Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11324 for code/branches


Ignore:
Timestamp:
Dec 8, 2016, 3:21:55 PM (8 years ago)
Author:
kappenh
Message:

Menu working: TODO add more minigames

File:
1 edited

Legend:

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

    r11315 r11324  
    55P.scrollbarWidth = 13
    66P.nameList = {}
    7 P.scoreList = {}
     7P.tabList = {}
    88P.linesList = {}
    99P.levelList = {}
     
    2121function P.onLoad()
    2222        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   
     31end
     32
     33function P.onShow()
     34       
    2335        P.nameList = {}
    24        
    25         P.scoreList = {}
     36        P.tabList = {}
     37        P.linesList = {}
    2638        test = orxonox.Highscore:getInstance():getNumberOfHighscores()
    2739
    2840        for i=0,orxonox.Highscore:getInstance():getNumberOfHighscores()-1 do
    2941                table.insert(P.nameList, orxonox.Highscore:getInstance():getHighscore(i))
    30                 table.insert(P.scoreList, i)
    3142       
    3243        end
    33 
    34         P.linesList = {}
    35 
    36 
    37     -- create tabs with desired tab as argument (nil for all)
    38    
     44       
    3945    for k,v in pairs(P.levelList) do
    4046        -- only add level if it has desired tag
     
    4652
    4753    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 end
    56 
    57 function P.onShow()
    58        
    59         P.scoreList = {}
    60         test = orxonox.Highscore:getInstance():getNumberOfHighscores()
    61 
    62         for i=0,orxonox.Highscore:getInstance():getNumberOfHighscores()-1 do
    63                 table.insert(P.scoreList, orxonox.Highscore:getInstance():getHighscore(i))
    64        
    65         end
    6654    --local description = winMgr:getWindow("orxonox/HighscoreText")
    6755
    6856    --height = getStaticTextWindowHeight(description)
    6957    --description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(0.0, height)))
     58end
     59function 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
    7069end
    7170function P.createLevelList()
     
    9796    end
    9897
    99    
     98    table.insert(P.tabList, tabName)
    10099    -- create new tab window with desired name
    101100        local default = (winMgr:createWindow("DefaultWindow", tabName))
     
    109108   
    110109    local offset = 2
    111     for k,v in pairs(P.scoreList) do
     110    for k,v in pairs(P.nameList) do
    112111       
    113112        local splitlist = P.Split(v,"./.")
    114 
    115         if(splitlist[1] ~= name)then  --TODO!!!!!!!
     113        if(splitlist[2] == name)then 
    116114                local line = P.createPickupEntry(tabName .. k,k,tag)
    117115                table.insert(P.linesList, line)
     
    135133   
    136134    local name = "orxonox/HiscoreEntry" .. parent
    137 
     135    local splitlist = P.Split(P.nameList[k],"./.")
    138136    local item = winMgr:createWindow("DefaultWindow", name)
    139137    item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(0, P.imageHeight)))
     
    141139
    142140    local player = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Player")
    143     player:setText(P.nameList[k].. tag)
     141    player:setText(splitlist[1])
    144142    player:setPosition(CEGUI.UVector2(CEGUI.UDim(0.005,0), CEGUI.UDim(0,0)))
    145143    player:setSize(CEGUI.UVector2(CEGUI.UDim(0.49, 0), CEGUI.UDim(0, P.imageHeight)))
     
    148146       
    149147    local score = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Score")
    150     score:setText(P.scoreList[k])
     148    score:setText(splitlist[3])
    151149    score:setPosition(CEGUI.UVector2(CEGUI.UDim(0.5,0), CEGUI.UDim(0,0)))
    152150    score:setSize(CEGUI.UVector2(CEGUI.UDim(0.495, 0), CEGUI.UDim(0, P.imageHeight)))
Note: See TracChangeset for help on using the changeset viewer.