Changeset 11718 for code/trunk/data/gui/scripts
- Timestamp:
- Jan 7, 2018, 10:34:30 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/data/gui/scripts/HighscoreMenu.lua
r11356 r11718 12 12 13 13 function P.onLoad() 14 14 P.createLevelList() 15 15 end 16 16 17 17 function P.onShow() 18 19 20 21 22 18 19 -- reset tables 20 P.highscoreList = {} 21 P.tabList = {} 22 P.linesList = {} 23 23 24 25 26 27 28 29 30 24 -- fetch save scores and write it into the list 25 for i=orxonox.Highscore:getInstance():getNumberOfHighscores()-1,0,-1 do 26 table.insert(P.highscoreList, orxonox.Highscore:getInstance():getHighscore(i)) 27 28 end 29 30 -- read minigames out of the levelList 31 31 for k,v in pairs(P.levelList) do 32 32 if(v:getName() ~= "Hover level" and v:getName() ~= "Pong") then -- hover and pong dont contain relevant scores … … 38 38 function P.onHide() 39 39 40 41 42 43 40 -- delete old windows to reload them on show 41 local tabControl = winMgr:getWindow("orxonox/HighscoreTabControl") 42 for k,v in pairs(P.tabList) do 43 local default = winMgr:getWindow(v) 44 44 tabControl:removeChildWindow(default) 45 45 winMgr:destroyWindow(default) 46 46 end 47 47 end … … 68 68 table.insert(P.tabList, tabName) 69 69 -- create new tab window with desired name 70 70 local default = (winMgr:createWindow("DefaultWindow", tabName)) 71 71 default:setText(name) 72 72 default:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}") … … 79 79 local offset = 2 80 80 for k,v in pairs(P.highscoreList) do 81 82 83 84 85 86 87 88 pane:addChildWindow(line)89 81 -- split the score ("Playername./.game./.score") 82 local splitlist = P.Split(v,"./.") 83 if(splitlist[2] == name)then 84 local line = P.createPickupEntry(tabName .. k,k,tag) 85 table.insert(P.linesList, line) 86 line:setYPosition(CEGUI.UDim(0,offset)) 87 offset = offset + line:getHeight():asAbsolute(1)+2 88 pane:addChildWindow(line) 89 end 90 90 91 91 end 92 92 93 94 93 local tabControl = winMgr:getWindow("orxonox/HighscoreTabControl") 94 tabControl:addChildWindow(default) 95 95 96 96 … … 111 111 112 112 item:addChildWindow(player) 113 113 114 114 local score = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Score") 115 115 score:setText(splitlist[3])
Note: See TracChangeset
for help on using the changeset viewer.