- Timestamp:
- Mar 30, 2012, 4:28:52 PM (13 years ago)
- Location:
- code/branches/shipSelection/data/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/shipSelection/data/gui/layouts/ShipSelectionMenu.layout
r9045 r9074 18 18 <Property Name="VertFormatting" Value="TopAligned" /> 19 19 <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.15,0},{0.8,0},{0.7,0}}" /> 20 <!--21 20 <Window Type="MenuWidgets/TabControl" Name="orxonox/ShipSelectionTabControl" > 22 21 <Property Name="TabHeight" Value="{0,26.4388}" /> … … 24 23 <Property Name="TabPanePosition" Value="Top" /> 25 24 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" /> 26 </Window> 27 --> 25 </Window> 28 26 <Window Type="MenuWidgets/StaticImage" Name="orxonox/ShipSelectionLevelImage" > 29 27 <Property Name="AlwaysOnTop" Value="True" /> … … 40 38 41 39 </Window> 42 <!-- -->43 40 <Window Type="MenuWidgets/Button" Name="orxonox/ShipSelectionStartButton" > 44 41 <Property Name="Text" Value="Start" /> -
code/branches/shipSelection/data/gui/scripts/ShipSelectionMenu.lua
r9057 r9074 4 4 P.activeTabIndexes = {} 5 5 P.scrollbarWidth = 13 6 P.shipList = {} 7 function P.onLoad() 8 --orxonox.execute("orxout internal_warning Ships= " .. selectedlevel:hasShip("abcdef")) 9 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 os.execute(dircmd .. " > ../levels/templates/.shipmodels") --saves output in a textfile 11 --[[ Program a Windows Version here: 12 if string.sub(package.config,1,1) == '\\' then 13 -- Windows 14 dircmd = "dir /b/s" 15 end]] 6 16 7 function P.onLoad() 8 orxonox.execute("orxout internal_warning Ships= " .. selectedlevel.getShips()) 9 P.createLevelList(selectedlevel) 10 --[[ 11 -- create tabs with desired tab as argument (nil for all) 12 P.createFilterTab("Gametypes", "gametype") 13 P.createFilterTab("Missions", "mission") 14 P.createFilterTab("Minigames", "minigame") 15 P.createFilterTab("Showcases", "showcase") 16 P.createFilterTab("Presentations", "presentation") 17 P.createFilterTab("Tests", "test") 18 P.createFilterTab("Show All", nil) 19 20 -- update description and screenshot boxes 21 P.ShipSelectionSelectionChanged() 22 23 --buttons are arranged in a 1x3 matrix 24 P:setButton(1, 1, { 25 ["button"] = winMgr:getWindow("orxonox/ShipSelectionStartButton"), 26 ["callback"] = P.ShipSelectionStartButton_clicked 27 }) 28 29 P:setButton(1, 2, { 30 ["button"] = winMgr:getWindow("orxonox/ShipSelectionConfigButton"), 31 ["callback"] = P.ShipSelectionConfigButton_clicked 32 }) 33 34 P:setButton(1, 3, { 35 ["button"] = winMgr:getWindow("orxonox/ShipSelectionBackButton"), 36 ["callback"] = P.ShipSelectionBackButton_clicked 37 })--]] 17 P.shipList = {} 18 --[[for f in io.lines("../levels/templates/.shipmodels") do 19 if selectedlevel:hasShip(f) then 20 P.shipList[#P.shipList+1] = f 21 table.insert(P.shipList, f) 22 end 23 end--]] 24 P.shipList[1]="spaceshipAssff" 25 P.shipList[2]="spaceshipGhost" 26 P.shipList[3]="spaceshipPirate" 27 P.createFilterTab("Show All") 28 --[[list = winMgr:createWindow("MenuWidgets/Listbox", "listbox") 29 item = CEGUI.createListboxTextItem("Text") 30 CEGUI.toListbox(list):addItem(item) 31 list:enable()--]] 38 32 end 39 33 40 function P.createShipList(level) 34 function P.createShipList() 35 41 36 42 orxonox.execute("orxout internal_warning Ships= " .. selectedlevel:getShips())43 --local stream = selectedlevel:getShips()44 --local substr = stream45 --while substr.find(",")46 --[[47 local size = orxonox.LevelManager:getInstance():getNumberOfLevels()48 local index = 049 local level = nil50 while index < size do51 level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)52 if level ~= nil then53 local levelXMLFilename = level:getXMLFilename()54 -- create an imageset for each screenshot55 local imageName = level:getScreenshot()56 if imageName ~= "" then57 CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile(levelXMLFilename..imageName, imageName)58 else59 CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile(levelXMLFilename..imageName, "noscreenshot.png")60 end61 table.insert(P.levelList, level)62 end63 index = index + 164 end--]]65 37 end 66 38 67 39 68 40 69 function P.createFilterTab(name, tag) 41 function P.createFilterTab(name) 42 43 --[[-- create unique tab window name 44 orxonox.execute("orxout user_warning test") 45 local tabName = "orxonox/SchipSelectionLevelTab" 46 -- create new tab window with desired name 47 local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName)) 48 listbox:setText(name) 49 listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}") 50 listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") 51 -- fill listbox with items 52 listbox:resetList() 53 orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true) 54 local preselect = "spaceshipAssff" 55 local tabIndexes = {} 56 for k,v in pairs(P.shipList) do 57 --for i = 1 ,#P.shipList,1 do 58 -- only add level if it has desired tag 59 --if v:hasShip(Ship) then 60 local item = CEGUI.createListboxTextItem("asbsergse") 61 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 62 listbox:addItem(item) 63 table.insert(tabIndexes, k) 64 if v:getXMLFilename() == preselect then 65 listbox:setItemSelectState(item, true) 66 end 67 --orxonox.GUIManager:setTooltipTextHelper(item, v:getDescription()) 68 -- end 69 end 70 table.insert(P.activeTabIndexes, tabIndexes) 71 -- listen to selection changes 72 orxonox.GUIManager:subscribeEventHelper(listbox, "ItemSelectionChanged", P.name..".SingleplayerSelectionChanged") 73 local tabControl = winMgr:getWindow("orxonox/SingleplayerTabControl") 74 orxonox.GUIManager:subscribeEventHelper(tabControl, "TabSelectionChanged", P.name..".SingleplayerSelectionChanged") 75 if listbox:getItemCount() > 0 then 76 tabControl:addChildWindow(tabName) 77 end--]] 70 78 -- create unique tab window name 79 71 80 local tabName = "orxonox/ShipSelectionLevelTab" 72 if tag ~= nil then73 tabName = tabName..tag74 end75 81 -- create new tab window with desired name 76 82 local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName)) … … 83 89 local preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 84 90 local tabIndexes = {} 85 for k,v in pairs(P. levelList) do91 for k,v in pairs(P.shipList) do 86 92 -- only add level if it has desired tag 87 if tag == nil or v:hasTag(tag) then88 local item = CEGUI.createListboxTextItem(v :getName())93 --if tag == nil or v:hasShip(tag) then 94 local item = CEGUI.createListboxTextItem(v) 89 95 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 90 96 listbox:addItem(item) 91 97 table.insert(tabIndexes, k) 92 if v:getXMLFilename() == preselect then98 --[[if v:getXMLFilename() == preselect then 93 99 listbox:setItemSelectState(item, true) 94 end 95 orxonox.GUIManager:setTooltipTextHelper(item, v:getDescription())96 end100 end--]] 101 --orxonox.GUIManager:setTooltipTextHelper(item, v:getDescription()) 102 --end 97 103 end 98 104 table.insert(P.activeTabIndexes, tabIndexes) … … 148 154 function P.ShipSelectionStartButton_clicked(e) 149 155 150 if P.level ~= nil then151 orxonox.execute("startGame " .. level:getXMLFilename())156 if selectedlevel ~= nil then 157 orxonox.execute("startGame " .. selectedlevel:getXMLFilename()) 152 158 hideAllMenuSheets() 153 159 else … … 167 173 168 174 function P.ShipSelectionBackButton_clicked(e) 175 --hideAllMenuSheets() 169 176 orxonox.execute("keyESC") 170 177 end -
code/branches/shipSelection/data/gui/scripts/SingleplayerMenu.lua
r9057 r9074 146 146 if selectedlevel:hasTag("shipselection") then 147 147 local shipSelectionMenu = showMenuSheet("ShipSelectionMenu", true) 148 shipSelectionMenu:createShipList() 148 149 else 149 150 orxonox.execute("startGame " .. selectedlevel:getXMLFilename())
Note: See TracChangeset
for help on using the changeset viewer.