Changeset 11245
- Timestamp:
- Oct 24, 2016, 4:04:51 PM (8 years ago)
- 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 13 13 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 14 14 <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> 16 22 <Window Type="MenuWidgets/StaticText" Name="orxonox/HighscoreMenuWrapper" > 17 23 <Property Name="InheritsAlpha" Value="False" /> … … 36 42 <Property Name="Text" Value="Back" /> 37 43 <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}}" /> 39 45 <Event Name="Clicked" Function="HighscoreMenu.HighscoreBackButton_clicked"/> 40 46 </Window> -
code/branches/Highscore_HS16/data/gui/scripts/HighscoreMenu.lua
r11235 r11245 30 30 P.sampleWindow:setText("SampleText") 31 31 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 32 45 local size = getMinTextSize(P.sampleWindow) 33 46 P.lineHeight = size[1] … … 67 80 --description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(0.0, height))) 68 81 end 69 function P.createLine(k) 82 function 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 101 end 102 103 function 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 116 end 117 118 function 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 --]] 142 end 143 144 function P.createLine(k,tag) 145 146 local tabName = k 147 148 if tag ~= nil then 149 tabName = tabName..tag 150 end 151 70 152 -- 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) 72 154 line:setHeight(CEGUI.UDim(0, P.lineHeight)) 73 155 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1)))) … … 77 159 local offset = half * 0.01 78 160 -- 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") 80 162 player:setText(P.nameList[k]) 81 163 player:setSize(CEGUI.UVector2(CEGUI.UDim(0, half-offset), CEGUI.UDim(1, 0))) … … 86 168 -- config value (editable) 87 169 88 local playerValue = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/HighscoreMenuPane/Score" .. k.. "/Value")170 local playerValue = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/HighscoreMenuPane/Score" .. tabName .. "/Value") 89 171 --playerValue:setProperty("ReadOnly", "set:False") 90 172 --local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[k])SS … … 107 189 108 190 for k,v in pairs(P.scoreList) do 109 local line = P.createLine(k )191 local line = P.createLine(k,nil) 110 192 table.insert(P.linesList, line) 111 193 window:addChildWindow(line)
Note: See TracChangeset
for help on using the changeset viewer.