Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11265


Ignore:
Timestamp:
Nov 7, 2016, 2:01:23 PM (8 years ago)
Author:
kappenh
Message:

tab selection working

File:
1 edited

Legend:

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

    r11254 r11265  
    77P.scoreList = {}
    88P.linesList = {}
     9P.levelList = {}
    910
    1011P.sampleWindow = nil
     
    1920
    2021function P.onLoad()
     22        P.createLevelList()
    2123        P.nameList = {}
    2224        table.insert(P.nameList, "firsttestPlayer")
     
    3133    -- create tabs with desired tab as argument (nil for all)
    3234   
    33     P.createFilterTab("Game1", "game1")
    34     P.createFilterTab("Game2", "game2")
     35    for k,v in pairs(P.levelList) do
     36        -- only add level if it has desired tag
     37        if tag == nil or v:hasTag(tag) then
     38            P.createFilterTab(v:getName(), v:getName())
     39        end
     40    end
    3541    --P.createFilterTab("Minigames", "minigame")
    3642    --P.createFilterTab("Showcases", "showcase")
     
    4753    --height = getStaticTextWindowHeight(description)
    4854    --description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(0.0, height)))
     55end
     56function P.createLevelList()
     57    P.levelList = {}
     58    local size = orxonox.LevelManager:getInstance():getNumberOfLevels()
     59    local index = 0
     60    local level = nil
     61    while index < size do
     62        level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
     63        if (level ~= nil and level:getXMLFilename() ~= "_temp.oxw" and level:hasTag("minigame")) then
     64            local levelXMLFilename = level:getXMLFilename()
     65            -- create an imageset for each screenshot
     66            local imageName = level:getScreenshot()
     67            if imageName ~= "" then
     68                CEGUI.ImagesetManager:getSingleton():createFromImageFile(levelXMLFilename..imageName, imageName)
     69            else
     70                CEGUI.ImagesetManager:getSingleton():createFromImageFile(levelXMLFilename..imageName, "noscreenshot.png")
     71            end
     72            table.insert(P.levelList, level)
     73        end
     74        index = index + 1
     75    end
    4976end
    5077function P.createFilterTab(name, tag)
Note: See TracChangeset for help on using the changeset viewer.