Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 24, 2016, 4:04:51 PM (7 years ago)
Author:
kappenh
Message:

Tabbar im HS Menu

Location:
code/branches/Highscore_HS16/data/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Highscore_HS16/data/gui/layouts/HighscoreMenu.layout

    r11235 r11245  
    1313            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    1414            <Property Name="VertFormatting" Value="TopAligned" />
    15             <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.2125,0},{0.85,0},{0.6375,0}}" />
     15            <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.1,0},{0.85,0},{0.85,0}}" />
     16            <Window Type="MenuWidgets/TabControl" Name="orxonox/HighscoreTabControl" >
     17                <Property Name="TabHeight" Value="{0,30}" />
     18                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     19                <Property Name="TabPanePosition" Value="Top" />
     20                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.105,0},{0.95,0},{0.99,0}}" />
     21            </Window>
    1622            <Window Type="MenuWidgets/StaticText" Name="orxonox/HighscoreMenuWrapper" >
    1723                <Property Name="InheritsAlpha" Value="False" />
     
    3642            <Property Name="Text" Value="Back" />
    3743            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    38             <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" />
     44            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.8625,0},{0.6,0},{0.9125,0}}" />
    3945            <Event Name="Clicked" Function="HighscoreMenu.HighscoreBackButton_clicked"/>
    4046        </Window>
  • code/branches/Highscore_HS16/data/gui/scripts/HighscoreMenu.lua

    r11235 r11245  
    3030    P.sampleWindow:setText("SampleText")
    3131
     32    -- create tabs with desired tab as argument (nil for all)
     33   
     34    P.createFilterTab("Gametypes", "gametype")
     35    P.createFilterTab("Missions", "mission")
     36    --P.createFilterTab("Minigames", "minigame")
     37    --P.createFilterTab("Showcases", "showcase")
     38    --P.createFilterTab("Presentations", "presentation")
     39    --P.createFilterTab("Tests", "test")
     40    --P.createFilterTab("Show All", nil)
     41
     42    -- update description and screenshot boxes
     43    --P.SingleplayerSelectionChanged()
     44
    3245    local size = getMinTextSize(P.sampleWindow)
    3346    P.lineHeight = size[1]
     
    6780    --description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(0.0, height)))
    6881end
    69 function P.createLine(k)
     82function P.createFilterTab(name, tag)
     83    -- create unique tab window name
     84    local tabName = "orxonox/HighscoreLevelTab"
     85    if tag ~= nil then
     86        tabName = tabName..tag
     87    end
     88
     89   
     90    -- create new tab window with desired name
     91        local default = CEGUI.toListbox(winMgr:createWindow("DefaultWindow", tabName))
     92    default:setText(name)
     93 
     94    local tabControl = winMgr:getWindow("orxonox/HighscoreTabControl")
     95    orxonox.GUIManager:subscribeEventHelper(tabControl, "TabSelectionChanged", P.name..".HighscoreSelectionChanged")
     96    --if listbox:getItemCount() > 0 then
     97        tabControl:addChildWindow(tabName)
     98    --end
     99
     100   
     101end
     102
     103function P.HighscoreGetSelectedLevel()
     104    -- choose the active listbox
     105    local tabControl = CEGUI.toTabControl(winMgr:getWindow("orxonox/HighscoreTabControl"))
     106    local listbox = CEGUI.toListbox(tabControl:getTabContentsAtIndex(tabControl:getSelectedTabIndex()))
     107    local choice = listbox:getFirstSelectedItem()
     108    if choice ~= nil then
     109        -- get the right tab and the right index
     110        local tabIndexes = P.activeTabIndexes[tabControl:getSelectedTabIndex()+1]
     111        local index = tabIndexes[listbox:getItemIndex(choice)+1]
     112        return P.levelList[index]
     113    else
     114        return nil
     115    end
     116end
     117
     118function P.HighscoreSelectionChanged(e)
     119        local pane = tolua.cast(winMgr:getWindow("orxonox/HighscoreMenuPane"), "CEGUI::ScrollablePane")
     120        pane:moveToFront()
     121    --[[local levelDescription = winMgr:getWindow("orxonox/SingleplayerLevelDescription")
     122    local configButton = winMgr:getWindow("orxonox/SingleplayerConfigButton")
     123    local level = P.HighscoreGetSelectedLevel()
     124    if level ~= nil then
     125        local levelXMLFilename = level:getXMLFilename()
     126        local imageName = level:getScreenshot()
     127        -- set the screenshot and the description for the selected level
     128        levelImage:setProperty("Image", "set:"..levelXMLFilename..imageName.." image:full_image")
     129        levelDescription:setText(level:getDescription())
     130        -- only enable config button for "gametype" levels
     131        if level:hasTag("gametype") then
     132            configButton:setProperty("Disabled", "False")
     133        else
     134            configButton:setProperty("Disabled", "True")
     135        end
     136    else
     137        -- also take care of "no level selected"
     138        levelImage:setProperty("Image", "")
     139        levelDescription:setText("")
     140        configButton:setProperty("Disabled", "True")
     141    end --]]
     142end
     143
     144function P.createLine(k,tag)
     145
     146        local tabName = k
     147
     148        if tag ~= nil then
     149        tabName = tabName..tag
     150    end
     151
    70152    -- content window for the entire line
    71     local line = winMgr:createWindow("DefaultWindow", "orxonox/HighscoreMenuPane/Score" .. k)
     153    local line = winMgr:createWindow("DefaultWindow", "orxonox/HighscoreMenuPane/Score" .. tabName)
    72154    line:setHeight(CEGUI.UDim(0, P.lineHeight))
    73155    line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1))))
     
    77159    local offset = half * 0.01
    78160    -- config name
    79     local player = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/HighscoreMenuPane/Score" .. k .. "/Player")
     161    local player = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/HighscoreMenuPane/Score" .. tabName .. "/Player")
    80162    player:setText(P.nameList[k])
    81163    player:setSize(CEGUI.UVector2(CEGUI.UDim(0, half-offset), CEGUI.UDim(1, 0)))
     
    86168    -- config value (editable)
    87169
    88     local playerValue = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/HighscoreMenuPane/Score" .. k .. "/Value")
     170    local playerValue = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/HighscoreMenuPane/Score" .. tabName .. "/Value")
    89171    --playerValue:setProperty("ReadOnly", "set:False")
    90172    --local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[k])SS
     
    107189
    108190    for k,v in pairs(P.scoreList) do
    109         local line = P.createLine(k)
     191        local line = P.createLine(k,nil)
    110192        table.insert(P.linesList, line)
    111193        window:addChildWindow(line)
Note: See TracChangeset for help on using the changeset viewer.