- Timestamp:
- Nov 6, 2010, 9:52:48 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/releasetodo/data/gui/scripts/MultiplayerMenu.lua
r7163 r7626 2 2 3 3 local P = createMenuSheet("MultiplayerMenu") 4 5 P.levelList = {} 6 P.itemList = {} 7 P.showAll = false 4 8 5 9 function P.onLoad() … … 69 73 70 74 function P.showLevelList() 71 local listbox = winMgr:getWindow("orxonox/MultiplayerListbox") 72 CEGUI.toListbox(listbox):resetList() 75 P.createLevelList() 76 end 77 78 function P.createLevelList() 79 P.levelList = {} 80 P.itemList = {} 81 local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/MultiplayerListbox")) 82 listbox:resetList() 73 83 local preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 74 orxonox.LevelManager:getInstance():compileAvailableLevelList() 75 local levelList = {} 84 local size = orxonox.LevelManager:getInstance():getNumberOfLevels() 76 85 local index = 0 77 local level = ""78 while true do86 local level = nil 87 while index < size do 79 88 level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index) 80 if level == "" then 81 break 89 if level ~= nil then 90 if P.showAll or not level:hasTag("test") then 91 table.insert(P.levelList, level) 92 end 82 93 end 83 table.insert(levelList, level)84 94 index = index + 1 85 95 end 86 table.sort(levelList)87 index = 188 for k,v in pairs( levelList) do89 local item = CEGUI.createListboxTextItem(v )96 --TODO: Reintroduce sorting, if needed. 97 --table.sort(levelList) 98 for k,v in pairs(P.levelList) do 99 local item = CEGUI.createListboxTextItem(v:getName()) 90 100 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 91 item:setID(index) 92 index = index + 1 93 CEGUI.toListbox(listbox):addItem(item) 94 if v .. ".oxw" == preselect then 101 listbox:addItem(item) 102 if v:getXMLFilename() == preselect then 95 103 listbox:setItemSelectState(item, true) 96 104 end 105 P.itemList[k] = listbox:getListboxItemFromIndex(k-1) 106 --TODO: The description as tooltip would be nice. 107 --local lItem = tolua.cast("CEGUI::ListboxItem", P.itemList[k]) 108 --lItem:setTooltipText(v:getDescription()) 97 109 end 98 99 110 end 111 100 112 function P.showServerList() 101 113 local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
Note: See TracChangeset
for help on using the changeset viewer.