Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 7, 2018, 10:34:30 PM (6 years ago)
Author:
landauf
Message:

tabs → spaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/data/gui/scripts/HighscoreMenu.lua

    r11356 r11718  
    1212
    1313function P.onLoad()
    14         P.createLevelList()   
     14    P.createLevelList()   
    1515end
    1616
    1717function P.onShow()
    18        
    19         -- reset tables
    20         P.highscoreList = {}
    21         P.tabList = {}
    22         P.linesList = {}
     18   
     19    -- reset tables
     20    P.highscoreList = {}
     21    P.tabList = {}
     22    P.linesList = {}
    2323
    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
     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
    3131    for k,v in pairs(P.levelList) do
    3232        if(v:getName() ~= "Hover level" and v:getName() ~= "Pong") then   -- hover and pong dont contain relevant scores
     
    3838function P.onHide()
    3939
    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)
     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)
    4444            tabControl:removeChildWindow(default)
    45                 winMgr:destroyWindow(default)
     45            winMgr:destroyWindow(default)
    4646    end
    4747end
     
    6868    table.insert(P.tabList, tabName)
    6969    -- create new tab window with desired name
    70         local default = (winMgr:createWindow("DefaultWindow", tabName))
     70    local default = (winMgr:createWindow("DefaultWindow", tabName))
    7171    default:setText(name)
    7272    default:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
     
    7979    local offset = 2
    8080    for k,v in pairs(P.highscoreList) do
    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
     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
    9090       
    9191    end
    9292
    93         local tabControl = winMgr:getWindow("orxonox/HighscoreTabControl")
    94         tabControl:addChildWindow(default)
     93    local tabControl = winMgr:getWindow("orxonox/HighscoreTabControl")
     94    tabControl:addChildWindow(default)
    9595 
    9696
     
    111111   
    112112    item:addChildWindow(player)
    113        
     113       
    114114    local score = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Score")
    115115    score:setText(splitlist[3])
Note: See TracChangeset for help on using the changeset viewer.