Changeset 9201
- Timestamp:
- May 18, 2012, 3:09:07 PM (13 years ago)
- Location:
- code/branches/shipSelection
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/shipSelection/data/gui/layouts/ShipSelectionMenu.layout
r9074 r9201 17 17 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 18 18 <Property Name="VertFormatting" Value="TopAligned" /> 19 <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.15,0},{0.8,0},{0.7,0}}" /> 19 <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.15,0},{0.8,0},{0.7,0}}" /> 20 20 <Window Type="MenuWidgets/TabControl" Name="orxonox/ShipSelectionTabControl" > 21 21 <Property Name="TabHeight" Value="{0,26.4388}" /> 22 22 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 23 23 <Property Name="TabPanePosition" Value="Top" /> 24 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" /> 24 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" /> 25 25 26 </Window> 26 <Window Type="MenuWidgets/StaticImage" Name="orxonox/ShipSelectionLevelImage" > 27 28 <!-- TODO: Ship Description and Image 29 <Window Type="MenuWidgets/StaticImage" Name="orxonox/ShipSelectionShipImage" > 27 30 <Property Name="AlwaysOnTop" Value="True" /> 28 31 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> … … 35 38 <Property Name="HorzScrollbar" Value="True" /> 36 39 <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.725,0},{0.9,0},{0.875,0}}" /> 37 </Window> 40 </Window>--> 38 41 39 42 </Window> … … 44 47 <Event Name="Clicked" Function="ShipSelectionMenu.ShipSelectionStartButton_clicked"/> 45 48 </Window> 46 <Window Type="MenuWidgets/Button" Name="orxonox/ShipSelectionConfigButton" > 49 <!-- TODO: set ship properties 50 <Window Type="MenuWidgets/Button" Name="orxonox/ShipSelectionConfigButton" > 47 51 <Property Name="Text" Value="Configure" /> 48 52 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> … … 50 54 <Property Name="Disabled" Value="True" /> 51 55 <Event Name="Clicked" Function="ShipSelectionMenu.ShipSelectionConfigButton_clicked"/> 52 </Window> 56 </Window> --> 53 57 <Window Type="MenuWidgets/Button" Name="orxonox/ShipSelectionBackButton" > 54 58 <Property Name="Text" Value="Back" /> -
code/branches/shipSelection/data/gui/scripts/ShipSelectionMenu.lua
r9157 r9201 6 6 P.shipList = {} 7 7 function P.onLoad() 8 --orxonox.execute("orxout user_warning Ships= " .. selectedlevel:hasShip("abcdef"))9 8 local dircmd = "ls ../levels/templates/ -l | awk '{print $9}' | grep \"spaceship\" | sed -e 's/\\.[a-zA-Z]*$//'" -- go to spaceships folder and generate a list of installed shipmodels. 10 9 os.execute(dircmd .. " > ../levels/templates/.shipmodels") --saves output in a textfile 11 --[[ Program a Windows Version here:10 --[[TODO: program a Windows Version / platform independent version here: 12 11 if string.sub(package.config,1,1) == '\\' then 13 12 -- Windows 14 13 dircmd = "dir /b/s" 15 14 end]] 15 P.createFilterTab("All Ships") 16 end 16 17 18 function P.createShipList() --generates list with tagged shipmodels 17 19 P.shipList = {} 18 for line in io.lines("../levels/templates/.shipmodels") do 20 for line in io.lines("../levels/templates/.shipmodels") do --checks if shipmodel is included in level file 19 21 if selectedlevel:hasShip(string.lower(line)) then 20 22 P.shipList[#P.shipList+1] = string.lower(line) 21 23 end 22 end 23 P.createFilterTab("Show All") 24 24 end 25 25 end 26 26 27 function P.createShipList() 28 29 30 end 31 32 33 34 function P.createFilterTab(name) 35 36 local tabName = "orxonox/ShipSelectionLevelTab" 37 -- create new tab window with desired name 38 local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName)) 39 listbox:setText(name) 40 listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}") 41 listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") 42 -- fill listbox with items 27 function P.update() --updates listbox with found models 28 P.createShipList() 43 29 listbox:resetList() 44 orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true) 45 local preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 30 --orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true) 46 31 local tabIndexes = {} 47 32 for k,v in pairs(P.shipList) do 48 -- only add level if it has desired tag33 --TODO: only add ship if is in the right filter tab 49 34 --if tag == nil or v:hasShip(tag) then 50 35 local item = CEGUI.createListboxTextItem(v) … … 52 37 listbox:addItem(item) 53 38 table.insert(tabIndexes, k) 54 --[[if v:getXMLFilename() == preselect then55 listbox:setItemSelectState(item, true)56 end--]]57 39 --orxonox.GUIManager:setTooltipTextHelper(item, v:getDescription()) 58 40 --end 59 41 end 60 42 table.insert(P.activeTabIndexes, tabIndexes) 43 end 44 45 function P.createFilterTab(name) -- generates filter tab and list box, sets handler for selection changes 46 tabName = "orxonox/ShipSelectionLevelTab" 47 -- create new tab window with desired name 48 listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName)) 49 listbox:setText(name) 50 listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}") 51 --[[TODO: smaller list if image and description is implemented. 52 listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") --]] 53 listbox:setProperty("UnifiedAreaRect", "{{0,0},{0,0},{1,0},{1,0}}") 54 -- fill listbox with items 55 P.update() 61 56 -- listen to selection changes 62 57 orxonox.GUIManager:subscribeEventHelper(listbox, "ItemSelectionChanged", P.name..".ShipSelectionSelectionChanged") … … 68 63 end 69 64 70 function P.ShipSelectionGetSelectedModel() 65 function P.ShipSelectionGetSelectedModel() --returns selected model, if available. 71 66 -- choose the active listbox 72 67 local tabControl = CEGUI.toTabControl(winMgr:getWindow("orxonox/ShipSelectionTabControl")) … … 84 79 85 80 function P.ShipSelectionSelectionChanged(e) 81 --[[ TODO: Get image and description from template file 86 82 local levelImage = winMgr:getWindow("orxonox/ShipSelectionLevelImage") 87 83 local levelDescription = winMgr:getWindow("orxonox/ShipSelectionLevelDescription") … … 104 100 levelImage:setProperty("Image", nil) 105 101 levelDescription:setText("") 106 configButton:setProperty("Disabled", "True")107 102 end 103 --]] 108 104 end 109 105 110 106 function P.ShipSelectionStartButton_clicked(e) 111 107 112 if selectedlevel ~= nilthen108 if (selectedlevel ~= nil and P.ShipSelectionGetSelectedModel() ~= nil) then 113 109 selectedlevel:selectShip(P.ShipSelectionGetSelectedModel()) 114 110 orxonox.execute("startGame " .. "_temp.oxw") 115 111 hideAllMenuSheets() 116 112 else 117 orxonox.execute("keyESC")113 orxonox.execute("orxout user_warning no ship model selected or no tagged shipmodel installed") 118 114 end 119 115 end 120 116 121 function P.ShipSelectionConfigButton_clicked(e)122 --[[ 117 --[[ TODO: function P.ShipSelectionConfigButton_clicked(e) 118 123 119 local level = P.ShipSelectionGetSelectedModel() 124 120 if level ~= nil then … … 126 122 configMenu:loadConfig(level) 127 123 end 124 end 128 125 --]] 129 end 126 130 127 131 128 function P.ShipSelectionBackButton_clicked(e) 132 --hideAllMenuSheets()133 129 orxonox.execute("keyESC") 134 130 end -
code/branches/shipSelection/data/gui/scripts/SingleplayerMenu.lua
r9127 r9201 147 147 if selectedlevel:hasTag("shipselection") then 148 148 local shipSelectionMenu = showMenuSheet("ShipSelectionMenu", true) 149 shipSelectionMenu: createShipList()149 shipSelectionMenu:update() 150 150 else 151 151 orxonox.execute("startGame " .. selectedlevel:getXMLFilename()) -
code/branches/shipSelection/data/levels/tutorial.oxw
r9185 r9201 4 4 tags = "tutorial, shipselection" 5 5 screenshot = "codingtutorial.png" 6 startingships = "spaceshipassff, spaceshipghost, spaceshipspacecruiser ,spaceshippirate"6 startingships = "spaceshipassff, spaceshipghost, spaceshipspacecruiser" 7 7 /> 8 8 … … 14 14 include("templates/spaceshipSpacecruiser.oxt") 15 15 include("templates/lodInformation.oxt") 16 include("templates/spaceshipPirate.oxt")17 16 ?> 18 17 … … 27 26 skybox = "Orxonox/skypanoramagen1" 28 27 > 29 30 31 32 33 28 <Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7"> 34 29 <attached> -
code/branches/shipSelection/src/orxonox/ShipManager.cc
r9157 r9201 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau 24 * Co-authors: 25 * Damian 'Mozork' Frick 26 * 23 * Matthias Hutter 24 * 27 25 */ 28 26 29 27 /** 30 @file LevelManager.cc 31 @brief Implementation of the LevelManager singleton. 28 @file ShipManager.cc 29 @brief Work-in Progress: Implementation of the ShipManager singleton. 30 Should make SpaceShip info available to lua handlers. 32 31 */ 33 32
Note: See TracChangeset
for help on using the changeset viewer.