Changeset 8977 for code/branches/presentation2011/data/gui
- Timestamp:
- Dec 14, 2011, 2:12:11 PM (13 years ago)
- Location:
- code/branches/presentation2011
- Files:
-
- 8 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2011
- Property svn:mergeinfo changed
/code/branches/menue (added) merged: 8884,8890,8894,8912,8914,8916,8927,8931,8938,8945,8958,8964,8975
- Property svn:mergeinfo changed
-
code/branches/presentation2011/data/gui/layouts/CreditsMenu.layout
r8888 r8977 7 7 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 8 8 <Window Type="MenuWidgets/StaticText" Name="orxonox/CreditsWindow" > 9 <Property Name="Text" Value=" Keybindings" />9 <Property Name="Text" Value="Credits" /> 10 10 <Property Name="Alpha" Value="0.8" /> 11 11 <Property Name="InheritsAlpha" Value="False" /> … … 15 15 <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.2125,0},{0.85,0},{0.6375,0}}" /> 16 16 <Window Type="MenuWidgets/StaticText" Name="orxonox/CreditsMenuWrapper" > 17 <Property Name="TextColours" Value="FF4444FF" />18 17 <Property Name="InheritsAlpha" Value="False" /> 19 18 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> … … 27 26 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 28 27 <Property Name="HorzOverlapSize" Value="0.01" /> 29 <Property Name="UnifiedAreaRect" Value="{{0 .005,0},{0.01,0},{0.995,0},{0.99,0}}" />28 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0.997,0},{0.997,0}}" /> 30 29 <Property Name="VertOverlapSize" Value="0.01" /> 31 30 <Property Name="HorzScrollPosition" Value="0" /> … … 38 37 <Property Name="VertFormatting" Value="TopAligned" /> 39 38 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 40 <Property Name="Text">wird sowieso nicht gelesen 41 Orxonox version 0.0.3 42 43 Programming Language: C++ - lua - tcl 44 Environment: OpenAL - Ogre - OIS - CEGUI - enet - ODE 45 Licence: GNU General Public Licence - Creative Commons 46 47 das ist mein text höhö 48 49 http://www.orxonox.net 39 <Property Name="Text">Orxonox version 0.0.3 40 41 Programming Language: C++ - lua - tcl 42 Environment: OpenAL - Ogre - OIS - CEGUI - enet - ODE 43 Licence: GNU General Public Licence - Creative Commons 44 45 http://www.orxonox.net 46 47 Credits: 50 48 </Property> 51 49 </Window> … … 61 59 </Window> 62 60 </GUILayout> 63 64 65 66 67 -
code/branches/presentation2011/data/gui/layouts/MiscConfigMenu.layout
r7888 r8977 2 2 3 3 <GUILayout > 4 <Window Type="DefaultWindow" Name="orxonox/MiscConfigMenu/Background" > 4 <Window Type="MenuWidgets/StaticImage" Name="orxonox/MiscConfigMenu/Background" > 5 <Property Name="FrameEnabled" Value="False" /> 5 6 <Property Name="InheritsAlpha" Value="False" /> 6 7 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 7 8 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 9 <Property Name="BackgroundEnabled" Value="False" /> 8 10 <Window Type="MenuWidgets/StaticText" Name="orxonox/MicsConfigMenu/ConfigWindow" > 9 11 <Property Name="Text" Value="Miscellaneous" /> … … 34 36 </Window> 35 37 </Window> 36 <Window Type="MenuWidgets/Button" Name="orxonox/MiscConfigMenu/ MiscConfigBackButton" >37 <Property Name="Text" Value=" Back" />38 <Window Type="MenuWidgets/Button" Name="orxonox/MiscConfigMenu/CancelButton" > 39 <Property Name="Text" Value="Cancel" /> 38 40 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 39 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" /> 40 <Event Name="Clicked" Function="MiscConfigMenu.MiscConfigBackButton_clicked"/> 41 <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.725,0},{0.4,0},{0.775,0}}" /> 42 <Event Name="Clicked" Function="MiscConfigMenu.MiscConfigCancelButton_clicked"/> 43 </Window> 44 <Window Type="MenuWidgets/Button" Name="orxonox/MiscConfigMenu/OKButton" > 45 <Property Name="Text" Value="OK" /> 46 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 47 <Property Name="UnifiedAreaRect" Value="{{0.6,0},{0.725,0},{0.75,0},{0.775,0}}" /> 48 <Event Name="Clicked" Function="MiscConfigMenu.MiscConfigOKButton_clicked"/> 41 49 </Window> 42 50 </Window> -
code/branches/presentation2011/data/gui/layouts/SingleplayerMenu.layout
r7648 r8977 15 15 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 16 16 <Property Name="VertFormatting" Value="TopAligned" /> 17 <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.7,0}}" /> 18 <Window Type="MenuWidgets/Listbox" Name="orxonox/SingleplayerLevelListbox" > 17 <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.15,0},{0.8,0},{0.7,0}}" /> 18 <Window Type="MenuWidgets/TabControl" Name="orxonox/SingleplayerTabControl" > 19 <Property Name="TabHeight" Value="{0,26.4388}" /> 19 20 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 20 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" /> 21 <Property Name="TabPanePosition" Value="Top" /> 22 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" /> 21 23 </Window> 22 <Window Type="MenuWidgets/ Checkbox" Name="orxonox/SingleplayerShowAllCheckbox" >23 <Property Name=" Text" Value="show all" />24 <Window Type="MenuWidgets/StaticImage" Name="orxonox/SingleplayerLevelImage" > 25 <Property Name="AlwaysOnTop" Value="True" /> 24 26 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 25 <Property Name="UnifiedAreaRect" Value="{{0.65,0},{0.87,0},{0.8,0},{.97,0}}" /> 26 <Event Name="CheckStateChanged" Function="SingleplayerMenu.SingleplayerShowAll_clicked"/> 27 <Property Name="UnifiedAreaRect" Value="{{0.55,0},{0.25,0},{0.9,0},{0.675,0}}" /> 28 </Window> 29 <Window Type="MenuWidgets/StaticText" Name="orxonox/SingleplayerLevelDescription" > 30 <Property Name="AlwaysOnTop" Value="True" /> 31 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 32 <Property Name="VertScrollbar" Value="True" /> 33 <Property Name="HorzScrollbar" Value="True" /> 34 <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.725,0},{0.9,0},{0.875,0}}" /> 27 35 </Window> 28 36 </Window> … … 30 38 <Property Name="Text" Value="Start" /> 31 39 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 32 <Property Name="UnifiedAreaRect" Value="{{0.2 875,0},{0.725,0},{0.4875,0},{0.775,0}}" />40 <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.725,0},{0.4,0},{0.775,0}}" /> 33 41 <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerStartButton_clicked"/> 42 </Window> 43 <Window Type="MenuWidgets/Button" Name="orxonox/SingleplayerConfigButton" > 44 <Property Name="Text" Value="Configure" /> 45 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 46 <Property Name="UnifiedAreaRect" Value="{{0.425,0},{0.725,0},{0.575,0},{0.775,0}}" /> 47 <Property Name="Disabled" Value="True" /> 48 <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerConfigButton_clicked"/> 34 49 </Window> 35 50 <Window Type="MenuWidgets/Button" Name="orxonox/SingleplayerBackButton" > 36 51 <Property Name="Text" Value="Back" /> 37 52 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 38 <Property Name="UnifiedAreaRect" Value="{{0. 5125,0},{0.725,0},{0.7125,0},{0.775,0}}" />53 <Property Name="UnifiedAreaRect" Value="{{0.6,0},{0.725,0},{0.75,0},{0.775,0}}" /> 39 54 <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerBackButton_clicked"/> 40 55 </Window> -
code/branches/presentation2011/data/gui/scripts/CreditsMenu.lua
r8888 r8977 14 14 function P.onShow() 15 15 local description = winMgr:getWindow("orxonox/CreditsText") 16 description:setProperty("HorzFormatting", "WordWrapLeftAligned")17 description:setProperty("VertFormatting", "TopAligned")18 description:setText(" Orxonox version 0.0.3 \n \19 Programming Language: C++ - lua - tcl \20 Environment: OpenAL - Ogre - OIS - CEGUI - enet - ODE \21 Licence: GNU General Public Licence - Creative Commons \n \22 http://www.orxonox.net \n \23 Credits:")24 16 25 description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))26 17 height = getStaticTextWindowHeight(description) 27 description:set Height(CEGUI.UDim(0, height))18 description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(0.0, height))) 28 19 end 29 20 -
code/branches/presentation2011/data/gui/scripts/InGameMenu.lua
r8079 r8977 43 43 -- events for ingamemenu 44 44 function P.button_quit_clicked(e) 45 openDecisionPopup( "Do you really want to quit the game?", InGameMenu. callback )45 openDecisionPopup( "Do you really want to quit the game?", InGameMenu.exitCallback ) 46 46 end 47 47 48 48 function P.button_mainmenu_clicked(e) 49 orxonox.execute("startMainMenu") 50 hideMenuSheet("InGameMenu") 49 openDecisionPopup( "Do you really want to return to the main menu?", InGameMenu.mainMenuCallback ) 51 50 end 52 51 … … 59 58 end 60 59 61 function P.callback(doExit) 60 function P.mainMenuCallback(doExit) 61 if doExit then 62 orxonox.execute("startMainMenu") 63 hideMenuSheet("InGameMenu") 64 else 65 P.onShow() 66 end 67 end 68 69 function P.exitCallback(doExit) 62 70 if doExit then 63 71 hideMenuSheet("InGameMenu") -
code/branches/presentation2011/data/gui/scripts/MiscConfigMenu.lua
r8729 r8977 11 11 P.lineHeight = 0 12 12 P.commandWidth = 0 13 P. configWidth = 013 P.editboxWidth = 0 14 14 P.resetWidth = 0 15 15 P.spaceWidth = 0 … … 75 75 end 76 76 77 P.sampleWindow:setText("configure")78 size = getMinTextSize(P.sampleWindow)79 P.configWidth = size[2]+2080 81 77 P.sampleWindow:setText("reset") 82 78 size = getMinTextSize(P.sampleWindow) 83 79 P.resetWidth = size[2]+20 84 80 85 P.spaceWidth = math.floor(1/8*P.configWidth) 81 P.spaceWidth = 10 82 83 local pane = tolua.cast(winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane"), "CEGUI::ScrollablePane") 84 size = pane:getViewableArea() 85 P.editboxWidth = size:getWidth() - P.commandWidth - P.resetWidth - 5*P.spaceWidth 86 86 87 87 P.createLines() 88 88 89 89 P:setButton(1, 1, { 90 ["button"] = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigBackButton"), 91 ["callback"] = P.MiscConfigBackButton_clicked 90 ["button"] = winMgr:getWindow("orxonox/MiscConfigMenu/CancelButton"), 91 ["callback"] = P.MiscConfigCancelButton_clicked 92 }) 93 94 P:setButton(1, 2, { 95 ["button"] = winMgr:getWindow("orxonox/MiscConfigMenu/OKButton"), 96 ["callback"] = P.MiscConfigOKButton_clicked 92 97 }) 93 98 end … … 95 100 function P.createLine(k) 96 101 local offset = 0 102 -- content window for the entire line 97 103 local line = winMgr:createWindow("DefaultWindow", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k) 98 104 line:setHeight(CEGUI.UDim(0, P.lineHeight)) 99 105 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1)))) 100 106 107 -- config name 101 108 local command = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Command") 102 109 command:setText(P.nameList[k]) … … 106 113 offset = offset + P.commandWidth + P.spaceWidth 107 114 115 -- config value (editable) 108 116 local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue") 109 117 configvalue:setProperty("ReadOnly", "set:False") 110 118 local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[k]) 111 119 configvalue:setText(value) 112 P.sampleWindow:setText(value) 113 local size = getMinTextSize(P.sampleWindow) 114 local configvalueWidth = 2*size[2] 115 configvalue:setSize(CEGUI.UVector2(CEGUI.UDim(0, configvalueWidth), CEGUI.UDim(0.9, 0))) 120 configvalue:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0))) 116 121 configvalue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0))) 122 -- enable the reset button if the value changed 123 orxonox.GUIManager:subscribeEventHelper(configvalue, "TextAccepted", P.name .. ".MiscConfigEditbox_textAccepted") 117 124 line:addChildWindow(configvalue) 118 offset = offset + configvalueWidth + P.spaceWidth125 offset = offset + P.editboxWidth + P.spaceWidth 119 126 120 local config = winMgr:createWindow("MenuWidgets/Button", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Config") 121 config:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.configWidth), CEGUI.UDim(0.9, 0))) 122 config:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0))) 123 config:setText("configure") 124 orxonox.GUIManager:subscribeEventHelper(config, "Clicked", P.name .. ".MiscConfigConfigure_clicked") 125 line:addChildWindow(config) 126 offset = offset + P.configWidth + P.spaceWidth 127 127 -- reset button (only available when value changed) 128 128 local reset = winMgr:createWindow("MenuWidgets/Button", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset") 129 129 reset:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0))) 130 130 reset:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0))) 131 131 reset:setText("reset") 132 orxonox.GUIManager:subscribeEventHelper(reset, "Clicked", P.name .. ".MiscConfigReset _clicked")132 orxonox.GUIManager:subscribeEventHelper(reset, "Clicked", P.name .. ".MiscConfigResetButton_clicked") 133 133 line:addChildWindow(reset) 134 134 reset:setEnabled(false) … … 153 153 end 154 154 155 function P.MiscConfigReset_clicked(e) 155 function P.MiscConfigOKButton_clicked(e) 156 for k,v in pairs(P.commandList) do 157 -- save the changes 158 local editbox = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue") 159 orxonox.CommandExecutor:execute("config " .. P.commandList[k] .. " " .. editbox:getText()) 160 local resetButton = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset") 161 resetButton:setEnabled(false) 162 end 163 164 hideMenuSheet("MiscConfigMenu") 165 end 166 167 function P.MiscConfigCancelButton_clicked(e) 168 hideMenuSheet("MiscConfigMenu") 169 end 170 171 function P.MiscConfigEditbox_textAccepted(e) 156 172 local we = CEGUI.toWindowEventArgs(e) 157 173 local name = we.window:getName() … … 160 176 local commandNr = tonumber(match()) 161 177 162 -- TODO: Implement reset. 178 local resetButton = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset") 179 resetButton:setEnabled(true) 163 180 end 164 181 165 function P.MiscConfig Configure_clicked(e)182 function P.MiscConfigResetButton_clicked(e) 166 183 local we = CEGUI.toWindowEventArgs(e) 167 184 local name = we.window:getName() … … 170 187 local commandNr = tonumber(match()) 171 188 172 local window = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue") 173 174 orxonox.CommandExecutor:execute("config " .. P.commandList[commandNr] .. " " .. window:getText()) 189 -- reload the old value 190 local editbox = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue") 175 191 local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[commandNr]) 176 window:setText(value) 177 end 178 179 function P.MiscConfigBackButton_clicked(e) 180 hideMenuSheet("MiscConfigMenu") 192 editbox:setText(value) 193 194 we.window:setEnabled(false) 181 195 end 182 196 -
code/branches/presentation2011/data/gui/scripts/SingleplayerMenu.lua
r8706 r8977 4 4 5 5 P.levelList = {} 6 P. itemList= {}7 P.s howAll = false6 P.activeTabIndexes = {} 7 P.scrollbarWidth = 13 8 8 9 9 function P.onLoad() 10 local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")11 local button = tolua.cast(window,"CEGUI::Checkbox")12 button:setSelected(false)13 10 P.createLevelList() 14 15 --buttons are arranged in a 1x2 matrix 11 12 -- create tabs with desired tab as argument (nil for all) 13 P.createFilterTab("Gametypes", "gametype") 14 P.createFilterTab("Missions", "mission") 15 P.createFilterTab("Minigames", "minigame") 16 P.createFilterTab("Showcases", "showcase") 17 P.createFilterTab("Presentations", "presentation") 18 P.createFilterTab("Tests", "test") 19 P.createFilterTab("Show All", nil) 20 21 -- update description and screenshot boxes 22 P.SingleplayerSelectionChanged() 23 24 --buttons are arranged in a 1x3 matrix 16 25 P:setButton(1, 1, { 17 26 ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"), … … 20 29 21 30 P:setButton(1, 2, { 31 ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigButton"), 32 ["callback"] = P.SingleplayerConfigButton_clicked 33 }) 34 35 P:setButton(1, 3, { 22 36 ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"), 23 37 ["callback"] = P.SingleplayerBackButton_clicked … … 25 39 end 26 40 27 function P.onShow()28 if P.showAll ~= orxonox.GUIManager:inDevMode() then29 local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")30 local button = tolua.cast(window,"CEGUI::Checkbox")31 P.showAll = not P.showAll32 button:setSelected(P.showAll)33 P.createLevelList()34 end35 end36 37 41 function P.createLevelList() 38 42 P.levelList = {} 39 P.itemList = {}40 local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/SingleplayerLevelListbox"))41 listbox:resetList()42 orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)43 local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()44 43 local size = orxonox.LevelManager:getInstance():getNumberOfLevels() 45 44 local index = 0 … … 48 47 level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index) 49 48 if level ~= nil then 50 if P.showAll or not level:hasTag("test") then 51 table.insert(P.levelList, level) 49 local levelXMLFilename = level:getXMLFilename() 50 -- create an imageset for each screenshot 51 local imageName = level:getScreenshot() 52 if imageName ~= "" then 53 CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile(levelXMLFilename..imageName, imageName) 54 else 55 CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile(levelXMLFilename..imageName, "noscreenshot.png") 52 56 end 57 table.insert(P.levelList, level) 53 58 end 54 59 index = index + 1 55 60 end 61 end 56 62 63 function P.createFilterTab(name, tag) 64 -- create unique tab window name 65 local tabName = "orxonox/SingleplayerLevelTab" 66 if tag ~= nil then 67 tabName = tabName..tag 68 end 69 -- create new tab window with desired name 70 local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName)) 71 listbox:setText(name) 72 listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}") 73 listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") 74 -- fill listbox with items 75 listbox:resetList() 76 orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true) 77 local preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 78 local tabIndexes = {} 57 79 for k,v in pairs(P.levelList) do 58 local item = CEGUI.createListboxTextItem(v:getName()) 59 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 60 listbox:addItem(item) 61 if v:getXMLFilename() == preselect then 62 listbox:setItemSelectState(item, true) 80 -- only add level if it has desired tag 81 if tag == nil or v:hasTag(tag) then 82 local item = CEGUI.createListboxTextItem(v:getName()) 83 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 84 listbox:addItem(item) 85 table.insert(tabIndexes, k) 86 if v:getXMLFilename() == preselect then 87 listbox:setItemSelectState(item, true) 88 end 89 orxonox.GUIManager:setTooltipTextHelper(item, v:getDescription()) 63 90 end 64 P.itemList[k] = listbox:getListboxItemFromIndex(k-1) 65 orxonox.GUIManager:setTooltipTextHelper(P.itemList[k], v:getDescription()) 91 end 92 table.insert(P.activeTabIndexes, tabIndexes) 93 -- listen to selection changes 94 orxonox.GUIManager:subscribeEventHelper(listbox, "ItemSelectionChanged", P.name..".SingleplayerSelectionChanged") 95 local tabControl = winMgr:getWindow("orxonox/SingleplayerTabControl") 96 orxonox.GUIManager:subscribeEventHelper(tabControl, "TabSelectionChanged", P.name..".SingleplayerSelectionChanged") 97 if listbox:getItemCount() > 0 then 98 tabControl:addChildWindow(tabName) 99 end 100 end 101 102 function P.SingleplayerGetSelectedLevel() 103 -- choose the active listbox 104 local tabControl = CEGUI.toTabControl(winMgr:getWindow("orxonox/SingleplayerTabControl")) 105 local listbox = CEGUI.toListbox(tabControl:getTabContentsAtIndex(tabControl:getSelectedTabIndex())) 106 local choice = listbox:getFirstSelectedItem() 107 if choice ~= nil then 108 -- get the right tab and the right index 109 local tabIndexes = P.activeTabIndexes[tabControl:getSelectedTabIndex()+1] 110 local index = tabIndexes[listbox:getItemIndex(choice)+1] 111 return P.levelList[index] 112 else 113 return nil 114 end 115 end 116 117 function P.SingleplayerSelectionChanged(e) 118 local levelImage = winMgr:getWindow("orxonox/SingleplayerLevelImage") 119 local levelDescription = winMgr:getWindow("orxonox/SingleplayerLevelDescription") 120 local configButton = winMgr:getWindow("orxonox/SingleplayerConfigButton") 121 local level = P.SingleplayerGetSelectedLevel() 122 if level ~= nil then 123 local levelXMLFilename = level:getXMLFilename() 124 local imageName = level:getScreenshot() 125 -- set the screenshot and the description for the selected level 126 levelImage:setProperty("Image", "set:"..levelXMLFilename..imageName.." image:full_image") 127 levelDescription:setText(level:getDescription()) 128 -- only enable config button for "gametype" levels 129 if level:hasTag("gametype") then 130 configButton:setProperty("Disabled", "False") 131 else 132 configButton:setProperty("Disabled", "True") 133 end 134 else 135 -- also take care of "no level selected" 136 levelImage:setProperty("Image", nil) 137 levelDescription:setText("") 138 configButton:setProperty("Disabled", "True") 66 139 end 67 140 end 68 141 69 142 function P.SingleplayerStartButton_clicked(e) 70 local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/SingleplayerLevelListbox")) 71 local choice = listbox:getFirstSelectedItem() 72 if choice ~= nil then 73 local index = listbox:getItemIndex(choice) 74 local level = P.levelList[index+1] 75 if level ~= nil then 76 orxonox.execute("startGame " .. level:getXMLFilename()) 77 hideAllMenuSheets() 78 end 143 local level = P.SingleplayerGetSelectedLevel() 144 if level ~= nil then 145 orxonox.execute("startGame " .. level:getXMLFilename()) 146 hideAllMenuSheets() 79 147 end 80 148 end 81 149 82 function P.SingleplayerShowAll_clicked(e) 83 local checkbox = tolua.cast(winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox"), "CEGUI::Checkbox") 84 local show = checkbox:isSelected() 85 if show ~= P.showAll then 86 P.showAll = show 87 P.createLevelList() 88 end 150 function P.SingleplayerConfigButton_clicked(e) 151 local level = P.SingleplayerGetSelectedLevel() 152 if level ~= nil then 153 local configMenu = showMenuSheet("SingleplayerConfigMenu") 154 configMenu:loadConfig(level) 155 end 89 156 end 90 157 … … 94 161 95 162 return P 96
Note: See TracChangeset
for help on using the changeset viewer.