Changeset 11324
- Timestamp:
- Dec 8, 2016, 3:21:55 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Highscore_HS16/data/gui/scripts/HighscoreMenu.lua
r11315 r11324 5 5 P.scrollbarWidth = 13 6 6 P.nameList = {} 7 P. scoreList = {}7 P.tabList = {} 8 8 P.linesList = {} 9 9 P.levelList = {} … … 21 21 function P.onLoad() 22 22 P.createLevelList() 23 24 --P.createFilterTab("Minigames", "minigame") 25 --P.createFilterTab("Showcases", "showcase") 26 --P.createFilterTab("Presentations", "presentation") 27 --P.createFilterTab("Tests", "test") 28 --P.createFilterTab("Show All", nil) 29 30 31 end 32 33 function P.onShow() 34 23 35 P.nameList = {} 24 25 P. scoreList = {}36 P.tabList = {} 37 P.linesList = {} 26 38 test = orxonox.Highscore:getInstance():getNumberOfHighscores() 27 39 28 40 for i=0,orxonox.Highscore:getInstance():getNumberOfHighscores()-1 do 29 41 table.insert(P.nameList, orxonox.Highscore:getInstance():getHighscore(i)) 30 table.insert(P.scoreList, i)31 42 32 43 end 33 34 P.linesList = {} 35 36 37 -- create tabs with desired tab as argument (nil for all) 38 44 39 45 for k,v in pairs(P.levelList) do 40 46 -- only add level if it has desired tag … … 46 52 47 53 end 48 --P.createFilterTab("Minigames", "minigame")49 --P.createFilterTab("Showcases", "showcase")50 --P.createFilterTab("Presentations", "presentation")51 --P.createFilterTab("Tests", "test")52 --P.createFilterTab("Show All", nil)53 54 55 end56 57 function P.onShow()58 59 P.scoreList = {}60 test = orxonox.Highscore:getInstance():getNumberOfHighscores()61 62 for i=0,orxonox.Highscore:getInstance():getNumberOfHighscores()-1 do63 table.insert(P.scoreList, orxonox.Highscore:getInstance():getHighscore(i))64 65 end66 54 --local description = winMgr:getWindow("orxonox/HighscoreText") 67 55 68 56 --height = getStaticTextWindowHeight(description) 69 57 --description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(0.0, height))) 58 end 59 function P.onHide() 60 local tabControl = winMgr:getWindow("orxonox/HighscoreTabControl") 61 for k,v in pairs(P.tabList) do 62 local default = winMgr:getWindow(v) 63 tabControl:removeChildWindow(default) 64 winMgr:destroyWindow(default) 65 --local highscores = v:getHighscores() 66 --orxonox.CommandExecutor:execute("log test:".. highscores) 67 68 end 70 69 end 71 70 function P.createLevelList() … … 97 96 end 98 97 99 98 table.insert(P.tabList, tabName) 100 99 -- create new tab window with desired name 101 100 local default = (winMgr:createWindow("DefaultWindow", tabName)) … … 109 108 110 109 local offset = 2 111 for k,v in pairs(P. scoreList) do110 for k,v in pairs(P.nameList) do 112 111 113 112 local splitlist = P.Split(v,"./.") 114 115 if(splitlist[1] ~= name)then --TODO!!!!!!! 113 if(splitlist[2] == name)then 116 114 local line = P.createPickupEntry(tabName .. k,k,tag) 117 115 table.insert(P.linesList, line) … … 135 133 136 134 local name = "orxonox/HiscoreEntry" .. parent 137 135 local splitlist = P.Split(P.nameList[k],"./.") 138 136 local item = winMgr:createWindow("DefaultWindow", name) 139 137 item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(0, P.imageHeight))) … … 141 139 142 140 local player = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Player") 143 player:setText( P.nameList[k].. tag)141 player:setText(splitlist[1]) 144 142 player:setPosition(CEGUI.UVector2(CEGUI.UDim(0.005,0), CEGUI.UDim(0,0))) 145 143 player:setSize(CEGUI.UVector2(CEGUI.UDim(0.49, 0), CEGUI.UDim(0, P.imageHeight))) … … 148 146 149 147 local score = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Score") 150 score:setText( P.scoreList[k])148 score:setText(splitlist[3]) 151 149 score:setPosition(CEGUI.UVector2(CEGUI.UDim(0.5,0), CEGUI.UDim(0,0))) 152 150 score:setSize(CEGUI.UVector2(CEGUI.UDim(0.495, 0), CEGUI.UDim(0, P.imageHeight)))
Note: See TracChangeset
for help on using the changeset viewer.