Changeset 7689
- Timestamp:
- Dec 1, 2010, 3:00:19 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 18 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/menu merged: 7587-7588,7594,7607-7608,7649,7663,7670-7671,7687
- Property svn:mergeinfo changed
-
code/trunk/data/gui/layouts/HostMenu.layout
r7687 r7689 8 8 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 9 9 <Property Name="BackgroundEnabled" Value="False" /> 10 11 12 10 <Window Type="MenuWidgets/StaticText" Name="orxonox/HostMenuWindow" > 13 11 <Property Name="Text" Value="Multiplayer" /> … … 17 15 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 18 16 <Property Name="VertFormatting" Value="TopAligned" /> 19 <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0. 6375,0}}" />17 <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.7,0}}" /> 20 18 <Window Type="MenuWidgets/Listbox" Name="orxonox/HostMenuListbox" > 21 19 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 22 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.8 ,0}}" />20 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" /> 23 21 </Window> 24 25 26 22 <Window Type="MenuWidgets/RadioButton" Name="orxonox/HostMenuHostButton" > 27 23 <Property Name="Text" Value="Build Server"/> 28 24 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 29 <Property Name="UnifiedAreaRect" Value="{{0. 2,0},{0.85,0},{0.4,0},{0.95,0}}" />25 <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.87,0},{0.3,0},{0.97,0}}" /> 30 26 <Event Name="SelectStateChanged" Function="HostMenu.HostMenuBuildServerButton_clicked"/> 31 27 </Window> … … 33 29 <Property Name="Text" Value="Dedicated" /> 34 30 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 35 <Property Name="UnifiedAreaRect" Value="{{0. 7,0},{0.85,0},{0.9,0},{0.95,0}}" />31 <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.87,0},{0.7,0},{0.97,0}}" /> 36 32 <Event Name="SelectStateChanged" Function="HostMenu.HostMenuDedicatedButton_clicked"/> 37 33 </Window> 38 34 <Window Type="MenuWidgets/Checkbox" Name="orxonox/MultiplayerShowAllCheckbox" > 35 <Property Name="Text" Value="show all" /> 36 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 37 <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.87,0},{1,0},{.97,0}}" /> 38 <Event Name="CheckStateChanged" Function="HostMenu.MultiplayerShowAll_clicked"/> 39 </Window> 39 40 </Window> 40 41 41 <Window Type="MenuWidgets/Button" Name="orxonox/HostMenuStartButton" > 42 42 <Property Name="Text" Value="Start" /> 43 43 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 44 <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0. 6625,0},{0.4875,0},{0.7125,0}}" />44 <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.725,0},{0.4875,0},{0.775,0}}" /> 45 45 <Event Name="Clicked" Function="HostMenu.HostMenuStartButton_clicked"/> 46 46 </Window> 47 47 <Window Type="MenuWidgets/Button" Name="orxonox/HostMenuBackButton" > 48 <Property Name="Text" Value="Back" /> 49 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 50 <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.6625,0},{0.7125,0},{0.7125,0}}" /> 51 <Event Name="Clicked" Function="HostMenu.HostMenuBackButton_clicked"/> 52 </Window> 53 48 <Property Name="Text" Value="Back" /> 49 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 50 <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.725,0},{0.7125,0},{0.775,0}}" /> 51 <Event Name="Clicked" Function="HostMenu.HostMenuBackButton_clicked"/> 52 </Window> 54 53 </Window> 55 54 </GUILayout> -
code/trunk/data/gui/layouts/MainMenuBackground.layout
r6746 r7689 2 2 <GUILayout> 3 3 <Window Type="MenuWidgets/StaticImage" Name="orxonox/Background"> 4 <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/>5 <Property Name="Image" Value="set:MainMenuBackground image:Background"/>6 <Property Name="FrameEnabled" Value="set:true"/>7 <Property Name="BackgroundEnabled" Value="set:false"/>8 <Property Name="InheritsAlpha" Value="False" />4 <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/> 5 <Property Name="Image" Value="set:MainMenuBackground image:Background"/> 6 <Property Name="FrameEnabled" Value="set:true"/> 7 <Property Name="BackgroundEnabled" Value="set:false"/> 8 <Property Name="InheritsAlpha" Value="False" /> 9 9 </Window> 10 10 </GUILayout> -
code/trunk/data/gui/layouts/MultiplayerMenu.layout
r7648 r7689 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}}" />17 <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.6375,0}}" /> 18 18 <Window Type="MenuWidgets/Listbox" Name="orxonox/MultiplayerListbox" > 19 19 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 20 20 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.8,0}}" /> 21 21 </Window> 22 <Window Type="MenuWidgets/RadioButton" Name="orxonox/MultiplayerJoinButton" >23 <Property Name="Text" Value="Join" />24 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />25 <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.81,0},{0.3,0},{0.89,0}}" />26 <Event Name="SelectStateChanged" Function="MultiplayerMenu.MultiplayerJoinButton_clicked"/>27 </Window>28 <Window Type="MenuWidgets/RadioButton" Name="orxonox/MultiplayerHostButton" >29 <Property Name="Text" Value="Host" />30 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />31 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.81,0},{0.6,0},{0.89,0}}" />32 <Event Name="SelectStateChanged" Function="MultiplayerMenu.MultiplayerHostButton_clicked"/>33 </Window>34 <Window Type="MenuWidgets/RadioButton" Name="orxonox/MultiplayerDedicatedButton" >35 <Property Name="Text" Value="Dedicated" />36 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />37 <Property Name="UnifiedAreaRect" Value="{{0.7,0},{0.81,0},{0.9,0},{0.89,0}}" />38 <Event Name="SelectStateChanged" Function="MultiplayerMenu.MultiplayerDedicatedButton_clicked"/>39 </Window>40 <Window Type="MenuWidgets/Checkbox" Name="orxonox/MultiplayerShowAllCheckbox" >41 <Property Name="Text" Value="show all" />42 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />43 <Property Name="UnifiedAreaRect" Value="{{0.65,0},{0.89,0},{0.8,0},{0.99,0}}" />44 <Property Name="Disabled" Value="True" />45 <Event Name="CheckStateChanged" Function="MultiplayerMenu.MultiplayerShowAll_clicked"/>46 </Window>47 22 </Window> 48 <Window Type="MenuWidgets/Button" Name="orxonox/MultiplayerStartButton" > 49 <Property Name="Text" Value="Start" /> 50 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 51 <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.725,0},{0.4875,0},{0.775,0}}" /> 52 <Event Name="Clicked" Function="MultiplayerMenu.MultiplayerStartButton_clicked"/> 53 </Window> 54 <Window Type="MenuWidgets/Button" Name="orxonox/MultiplayerBackButton" > 23 <Window Type="MenuWidgets/Button" Name="orxonox/MultiplayerBackButton" > 55 24 <Property Name="Text" Value="Back" /> 56 25 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 57 <Property Name="UnifiedAreaRect" Value="{{0. 5125,0},{0.725,0},{0.7125,0},{0.775,0}}" />26 <Property Name="UnifiedAreaRect" Value="{{0.7125,0},{0.8625,0},{0.9125,0},{0.9125,0}}" /> 58 27 <Event Name="Clicked" Function="MultiplayerMenu.MultiplayerBackButton_clicked"/> 28 </Window> 29 <Window Type="MenuWidgets/Button" Name="orxonox/MultiplayerJoinButton" > 30 <Property Name="Text" Value="Join" /> 31 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 32 <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.6625,0},{0.4875,0},{0.7125,0}}" /> 33 <Event Name="Clicked" Function="MultiplayerMenu.MultiplayerJoinButton_clicked"/> 34 </Window> 35 <Window Type="MenuWidgets/Button" Name="orxonox/MultiplayerHostButton" > 36 <Property Name="Text" Value="Host" /> 37 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 38 <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.6625,0},{0.7125,0},{0.7125,0}}" /> 39 <Event Name="Clicked" Function="MultiplayerMenu.MultiplayerHostButton_clicked"/> 59 40 </Window> 60 41 </Window> 61 42 </GUILayout> 43 -
code/trunk/data/gui/scripts/AudioMenu.lua
r6746 r7689 2 2 3 3 local P = createMenuSheet("AudioMenu") 4 5 P.buttonList = {} 6 7 function P.onShow() 8 P.oldindex = -2 9 P.index = -1 10 end 4 11 5 12 function P.onLoad() … … 42 49 listboxwindow:setItemSelectState(0,true) 43 50 end 51 52 local item = { 53 ["button"] = winMgr:getWindow("orxonox/AudioBackButton"), 54 ["function"] = P.AudioBackButton_clicked 55 } 56 P.buttonList[1] = item 44 57 end 45 58 … … 172 185 end 173 186 187 function P.onKeyPressed() 188 buttonIteratorHelper(P.buttonList, code, P, 1, 1) 189 end 190 174 191 return P 175 192 -
code/trunk/data/gui/scripts/ControlsMenu.lua
r6748 r7689 2 2 3 3 local P = createMenuSheet("ControlsMenu") 4 P.buttonList = {} 4 5 P.loadAlong = { "MouseControlsMenu", "KeyBindMenu" } 6 7 function P.onLoad() 8 P.multiplayerMode = "startClient" 9 10 --buttons are arranged in a 3x1 matrix: 11 local item = { 12 ["button"] = winMgr:getWindow("orxonox/MouseControlsButton"), 13 ["function"] = P.ControlsMouseControlsButton_clicked 14 } 15 P.buttonList[1] = item 16 17 local item = { 18 ["button"] = winMgr:getWindow("orxonox/KeybindingsButton"), 19 ["function"] = P.ControlsKeyboardControlsButton_clicked 20 } 21 P.buttonList[2] = item 22 23 local item = { 24 ["button"] = winMgr:getWindow("orxonox/ControlsBackButton"), 25 ["function"] = P.ControlsBackButton_clicked 26 } 27 P.buttonList[3] = item 28 29 end 30 31 function P.onShow() 32 --indices to iterate through buttonlist 33 P.oldindex = -2 34 P.index = -1 35 end 5 36 6 37 function P.ControlsMouseControlsButton_clicked(e) … … 16 47 end 17 48 49 function P.onKeyPressed() 50 buttonIteratorHelper(P.buttonList, code, P, 3, 1) 51 end 52 18 53 return P 19 54 -
code/trunk/data/gui/scripts/CreditsMenu.lua
r6746 r7689 2 2 3 3 local P = createMenuSheet("CreditsMenu") 4 5 P.buttonList = {} 6 7 function P.onLoad() 8 local item = { 9 ["button"] = winMgr:getWindow("orxonox/CreditsBackButton"), 10 ["function"] = P.CreditsBackButton_clicked 11 } 12 P.buttonList[1] = item 13 end 14 15 function P.onShow() 16 --indices to iterate through buttonlist 17 P.oldindex = -2 18 P.index = -1 19 end 4 20 5 21 function P.CreditsBackButton_clicked(e) … … 7 23 end 8 24 25 function P.onKeyPressed() 26 buttonIteratorHelper(P.buttonList, code, P, 1, 1) 27 end 28 9 29 return P 10 30 -
code/trunk/data/gui/scripts/GUISheet.lua
r7403 r7689 64 64 end 65 65 66 function P:onKeyPressed(e) 67 end 68 66 69 return P -
code/trunk/data/gui/scripts/GUITools.lua
r7163 r7689 54 54 return height 55 55 end 56 57 --function to iterate through a menu sheet by using arrowkeys 58 59 --@arguments: 60 -- list: 2-dimensional table, arguments are items that contain a button and its function 61 -- !!note: each button can only be in the list once!! 62 -- code: code of any key on the keyboard 63 -- P: menusheet 64 -- n: number of rows of the buttontable 65 -- m: number of colums of the buttontable 66 67 function buttonIteratorHelper(list, code, P, n, m) 68 69 --after a key (down,up,left,right) is pressed the index of the current button has to be updated 70 71 --key down 72 if code == "208" then 73 if P.index < 0 then -- initial status 74 P.index = 0 75 P.oldindex = -1 76 else 77 P.oldindex = P.index 78 P.index = (P.index + m) % (m*n) --modulo operation works as a "wrap around" in the button menu 79 80 while list[P.index+1] == nil do 81 P.oldindex = P.index 82 P.index = (P.index + m) % (m*n) 83 end 84 end 85 86 --key up 87 elseif code == "200" then 88 if P.index < 0 then 89 P.index = 0 90 P.oldindex = -1 91 elseif(P.index == 0) then 92 P.oldindex = P.index 93 P.index = m*n-m 94 95 while list[P.index+1] == nil do 96 P.oldindex = P.index 97 P.index = (P.index-m)%(m*n) 98 end 99 else 100 P.oldindex = P.index 101 P.index = (P.index -m) % (m*n) 102 103 while list[P.index+1] == nil do 104 P.oldindex = P.index 105 P.index = (P.index-m)%(m*n) 106 end 107 end 108 109 --key right 110 elseif code == "205" then 111 if P.index < 0 then 112 P.index = 0 113 P.oldindex = -1 114 elseif (P.index+1) % m == 0 then -- we are at the right-end of a row 115 P.oldindex = P.index 116 P.index = P.index + 1 -m 117 118 while list[P.index+1] == nil do 119 P.oldindex = P.index 120 P.index = P.index + 1 121 end 122 else 123 P.oldindex = P.index 124 P.index = P.index + 1 125 126 while list[P.index+1] == nil do 127 if (P.index+1) % m == 0 then -- we are at the right-end of a row 128 P.oldindex = P.index 129 P.index = P.index + 1-m 130 131 else 132 P.oldindex = P.index 133 P.index = P.index + 1 134 end 135 end 136 end 137 138 --key left 139 elseif code == "203" then 140 if P.index < 0 then 141 P.index = 0 142 P.oldindex = -1 143 elseif P.index % m == 0 then -- we are at the left-end of a row 144 P.oldindex = P.index 145 P.index = P.index +m-1 146 147 while list[P.index+1] == nil do 148 P.oldindex = P.index 149 P.index = P.index -1 150 end 151 else 152 P.oldindex = P.index 153 P.index = P.index -1 154 155 while list[P.index+1] == nil do 156 if P.index % m == 0 then -- we are at the left-end of a row 157 P.oldindex = P.index 158 P.index = P.index -1 + m 159 else 160 P.oldindex = P.index 161 P.index = P.index -1 162 end 163 end 164 end 165 end 166 167 --to update the new current button 168 if (code == "208" or code == "200" or code == "203" or code == "205") and P.oldindex~= P.index then 169 170 local system = CEGUI.System:getSingleton() 171 local window = winMgr:getWindow("orxonox/MainMenuBackground") 172 173 local item = list[P.index+1] 174 local child = item["button"] 175 176 --teste ob der Button nicht schon gehighlightet ist 177 if child:getProperty("NormalImageRightEdge") == "set:TaharezGreenLook image:ButtonRightHighlight" then 178 --nop 179 else 180 child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-7) .. "Highlight") 181 child:setProperty("NormalImageLeftEdge", string.sub(child:getProperty("NormalImageLeftEdge"),1,-7) .. "Highlight") 182 child:setProperty("NormalImageBackground", string.sub(child:getProperty("NormalImageBackground"),1,-7) .. "Highlight") 183 if P.oldindex >= 0 then 184 if list[P.oldindex+1] ~= nil then 185 local item = list[P.oldindex+1] 186 local oldChild = item["button"] 187 oldChild:setProperty("NormalImageRightEdge", string.sub(oldChild:getProperty("NormalImageRightEdge"),1,-10) .. "Normal") 188 oldChild:setProperty("NormalImageLeftEdge", string.sub(oldChild:getProperty("NormalImageLeftEdge"),1,-10) .. "Normal") 189 oldChild:setProperty("NormalImageBackground", string.sub(oldChild:getProperty("NormalImageBackground"),1,-10) .. "Normal") 190 end 191 end 192 end 193 194 --for every highlighted button check if index is on its position. If not, set imageproperty on "normal" 195 local i = 1 196 while i < (n*m) do 197 if i == P.index +1 then 198 i = i+1 199 else 200 if list[i] ~= nil then 201 local item = list[i] 202 local child = item["button"] 203 if child:getProperty("NormalImageRightEdge") == "set:TaharezGreenLook image:ButtonRightHighlight" then 204 child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-10) .. "Normal") 205 child:setProperty("NormalImageLeftEdge", string.sub(child:getProperty("NormalImageLeftEdge"),1,-10) .. "Normal") 206 child:setProperty("NormalImageBackground", string.sub(child:getProperty("NormalImageBackground"),1,-10) .. "Normal") 207 end 208 end 209 end 210 i=i+1 211 end 212 end 213 214 --enter 215 if code == "28" then 216 local item = list[P.index+1] 217 local child = item["button"] 218 child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-10) .. "Normal") 219 child:setProperty("NormalImageLeftEdge", string.sub(child:getProperty("NormalImageLeftEdge"),1,-10) .. "Normal") 220 child:setProperty("NormalImageBackground", string.sub(child:getProperty("NormalImageBackground"),1,-10) .. "Normal") 221 222 local foo = item["function"] 223 foo() 224 end 225 226 end 227 228 --write index and oldindex on the console 229 --works like buttonIteratorHelper 230 function indexTester(list,code,P,n,m) 231 --key down 232 if code == "208" then 233 if P.index < 0 then -- initial status 234 P.index = 0 235 P.oldindex = -1 236 else 237 P.oldindex = P.index 238 P.index = (P.index + m) % (m*n) 239 240 while list[P.index+1] == nil do 241 P.oldindex = P.index 242 P.index = (P.index + m) % (m*n) 243 end 244 end 245 246 --key up 247 elseif code == "200" then 248 if P.index < 0 then 249 P.index = 0 250 P.oldindex = -1 251 elseif(P.index == 0) then 252 P.oldindex = P.index 253 P.index = m*n-m 254 255 while list[P.index+1] == nil do 256 P.oldindex = P.index 257 P.index = (P.index-m)%(m*n) 258 end 259 else 260 P.oldindex = P.index 261 P.index = (P.index -m) % (m*n) 262 263 while list[P.index+1] == nil do 264 P.oldindex = P.index 265 P.index = P.index -m 266 end 267 end 268 269 --key right 270 elseif code == "205" then 271 if P.index < 0 then 272 P.index = 0 273 P.oldindex = -1 274 elseif (P.index+1) % m == 0 then -- we are at the right-end of a row 275 P.oldindex = P.index 276 P.index = P.index + 1 -m 277 278 while list[P.index+1] == nil do 279 P.oldindex = P.index 280 P.index = P.index + 1 281 end 282 else 283 P.oldindex = P.index 284 P.index = P.index + 1 285 286 while list[P.index+1] == nil do 287 if (P.index+1) % m == 0 then -- we are at the right-end of a row 288 P.oldindex = P.index 289 P.index = P.index + 1-m 290 291 else 292 P.oldindex = P.index 293 P.index = P.index + 1 294 end 295 end 296 end 297 298 --key left 299 elseif code == "203" then 300 if P.index < 0 then 301 P.index = 0 302 P.oldindex = -1 303 elseif P.index % m == 0 then -- we are at the left-end of a row 304 P.oldindex = P.index 305 P.index = P.index +m-1 306 307 while list[P.index+1] == nil do 308 P.oldindex = P.index 309 P.index = P.index -1 310 end 311 else 312 P.oldindex = P.index 313 P.index = P.index -1 314 315 while list[P.index+1] == nil do 316 if P.index % m == 0 then -- we are at the left-end of a row 317 P.oldindex = P.index 318 P.index = P.index -1 + m 319 else 320 P.oldindex = P.index 321 P.index = P.index -1 322 end 323 end 324 end 325 end 326 327 cout(0, P.oldindex) 328 cout(0, P.index) 329 330 end 331 332 333 334 -
code/trunk/data/gui/scripts/GraphicsMenu.lua
r6746 r7689 2 2 3 3 local P = createMenuSheet("GraphicsMenu") 4 5 P.buttonList = {} 6 7 function P.onShow() 8 --indices to iterate through buttonlist (trivial in this menu sheet) 9 P.oldindex = -2 10 P.index = -1 11 end 4 12 5 13 function P.onLoad() … … 83 91 scrollbar_active = false 84 92 block = false 93 94 local item = { 95 ["button"] = winMgr:getWindow("orxonox/GraphicsBackButton"), 96 ["function"] = P.GraphicsBackButton_clicked 97 } 98 P.buttonList[1] = item 85 99 end 86 100 … … 195 209 end 196 210 211 function P.onKeyPressed() 212 buttonIteratorHelper(P.buttonList, code, P, 1, 1) 213 end 214 197 215 return P 198 216 -
code/trunk/data/gui/scripts/HostMenu.lua
r7687 r7689 6 6 7 7 P.buttonList = {} 8 P.levelList = {} 9 P.itemList = {} 10 P.showAll = false 8 11 9 12 function P.onLoad() 10 P.multiplayerMode = "startClient" 13 P.multiplayerMode = "startServer" 14 local window = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox") 15 local button = tolua.cast(window,"CEGUI::Checkbox") 16 button:setSelected(false) 17 P.createLevelList() 11 18 12 19 local item = { … … 28 35 local button = tolua.cast(window,"CEGUI::RadioButton") 29 36 button:setSelected(true) 30 P. showLevelList()37 P.createLevelList() 31 38 end 32 39 … … 35 42 local button = tolua.cast(window,"CEGUI::RadioButton") 36 43 button:setSelected(true) 37 P. showLevelList()44 P.createLevelList() 38 45 end 39 46 … … 43 50 end 44 51 52 function P.createLevelList() 53 P.levelList = {} 54 P.itemList = {} 55 local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/HostMenuListbox")) 56 listbox:resetList() 57 orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true) 58 local preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 59 local size = orxonox.LevelManager:getInstance():getNumberOfLevels() 60 local index = 0 61 local level = nil 62 while index < size do 63 level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index) 64 if level ~= nil then 65 if P.showAll or not level:hasTag("test") then 66 table.insert(P.levelList, level) 67 end 68 end 69 index = index + 1 70 end 71 --TODO: Reintroduce sorting, if needed. At the moment it's sorted by filename. 72 --table.sort(levelList) 73 for k,v in pairs(P.levelList) do 74 local item = CEGUI.createListboxTextItem(v:getName()) 75 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 76 listbox:addItem(item) 77 if v:getXMLFilename() == preselect then 78 listbox:setItemSelectState(item, true) 79 end 80 P.itemList[k] = listbox:getListboxItemFromIndex(k-1) 81 orxonox.GUIManager:setTooltipTextHelper(P.itemList[k], v:getDescription()) 82 end 83 end 84 45 85 function P.HostMenuBuildServerButton_clicked(e) 46 86 P.multiplayerMode = "startServer" 47 P. showLevelList()87 P.createLevelList() 48 88 end 49 89 50 90 function P.HostMenuDedicatedButton_clicked(e) 51 91 P.multiplayerMode = "startDedicated" 52 P. showLevelList()92 P.createLevelList() 53 93 end 54 94 … … 57 97 end 58 98 59 function P.HostMenuStartButton_clicked(e) 60 local choice = winMgr:getWindow("orxonox/HostMenuListbox"):getFirstSelectedItem() 61 if choice then 62 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 63 else 64 return 65 end 66 orxonox.execute(P.multiplayerMode) 67 hideAllMenuSheets() 68 end 69 70 71 72 function P.showLevelList() 73 local listbox = winMgr:getWindow("orxonox/HostMenuListbox") 74 CEGUI.toListbox(listbox):resetList() 75 local preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 76 orxonox.LevelManager:getInstance():compileAvailableLevelList() 77 local levelList = {} 78 local index = 0 79 local level = "" 80 while true do 81 level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index) 82 if level == "" then 83 break 84 end 85 table.insert(levelList, level) 86 index = index + 1 87 end 88 table.sort(levelList) 89 index = 1 90 for k,v in pairs(levelList) do 91 local item = CEGUI.createListboxTextItem(v) 92 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 93 item:setID(index) 94 index = index + 1 95 CEGUI.toListbox(listbox):addItem(item) 96 if v .. ".oxw" == preselect then 97 listbox:setItemSelectState(item, true) 99 function P.HostMenuStartButton_clicked(e) 100 local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/HostMenuListbox")) 101 local choice = listbox:getFirstSelectedItem() 102 if choice ~= nil then 103 local index = listbox:getItemIndex(choice) 104 local level = P.levelList[index+1] 105 if level ~= nil then 106 orxonox.LevelManager:getInstance():setDefaultLevel(level:getXMLFilename()) 107 orxonox.execute(P.multiplayerMode) 108 hideAllMenuSheets() 98 109 end 99 110 end 100 111 end 101 112 113 function P.MultiplayerShowAll_clicked(e) 114 local checkbox = tolua.cast(winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox"), "CEGUI::Checkbox") 115 local show = checkbox:isSelected() 116 if show ~= P.showAll then 117 P.showAll = show 118 P.createLevelList() 119 end 120 end 102 121 103 122 function P.onKeyPressed() … … 105 124 end 106 125 107 108 109 126 return P -
code/trunk/data/gui/scripts/InGameMenu.lua
r6748 r7689 12 12 orxonox.Game:getInstance():popState() 13 13 orxonox.Game:getInstance():popState() 14 orxonox.Game:getInstance():requestState("mainmenu")15 14 hideMenuSheet("InGameMenu") 16 15 end -
code/trunk/data/gui/scripts/MainMenu.lua
r7163 r7689 3 3 local P = createMenuSheet("MainMenu") 4 4 P.loadAlong = { "SingleplayerMenu", "MultiplayerMenu", "SettingsMenu", "CreditsMenu" } 5 6 P.buttonList = {} 7 8 function P.onLoad() 9 --buttons are arranged in a 6x1 Matrix (list) 10 local item = { 11 ["button"] = winMgr:getWindow("orxonox/QuickGameTestButton"), 12 ["function"] = P.QuickGameTestButton_clicked 13 } 14 table.insert(P.buttonList,item) 15 16 item = { 17 ["button"] = winMgr:getWindow("orxonox/SingleplayerButton"), 18 ["function"] = P.SingleplayerButton_clicked 19 } 20 table.insert(P.buttonList,item) 21 22 item = { 23 ["button"] = winMgr:getWindow("orxonox/MultiplayerButton"), 24 ["function"] = P.MultiplayerButton_clicked 25 } 26 table.insert(P.buttonList,item) 27 28 item = { 29 ["button"] = winMgr:getWindow("orxonox/SettingsButton"), 30 ["function"] = P.SettingsButton_clicked 31 } 32 table.insert(P.buttonList,item) 33 34 item = { 35 ["button"] = winMgr:getWindow("orxonox/CreditsButton"), 36 ["function"] = P.CreditsButton_clicked 37 } 38 table.insert(P.buttonList,item) 39 40 item = { 41 ["button"] = winMgr:getWindow("orxonox/ExitButton"), 42 ["function"] = P.ExitButton_clicked 43 } 44 table.insert(P.buttonList,item) 45 end 46 47 function P.onShow() 48 --indices to iterate through buttonlist 49 P.oldindex = -2 50 P.index = -1 51 end 5 52 6 53 -- events for MainMenu … … 30 77 end 31 78 79 function P.onKeyPressed() 80 buttonIteratorHelper(P.buttonList, code, P, 6, 1) 81 end 82 32 83 return P 33 84 -
code/trunk/data/gui/scripts/MenuSheet.lua
r7163 r7689 16 16 newSheet.bHidePrevious = handleDefArg(_bHidePrevious, true) 17 17 newSheet.tShowCursor = handleDefArg(_tShowCusor, TriBool.True) 18 newSheet.tUseKeyboard = handleDefArg(_tUseKeyboard, TriBool. Dontcare)18 newSheet.tUseKeyboard = handleDefArg(_tUseKeyboard, TriBool.True) 19 19 newSheet.bBlockJoyStick = handleDefArg(_bBlockJoyStick, false) 20 20 -
code/trunk/data/gui/scripts/MultiplayerMenu.lua
r7648 r7689 3 3 local P = createMenuSheet("MultiplayerMenu") 4 4 5 P.levelList = {} 6 P.itemList = {} 7 P.showAll = false 5 P.buttonList = {} 8 6 9 7 function P.onLoad() 10 P.multiplayerMode = "startClient" 8 P.multiplayerMode = "startClient" 9 10 --button are arranged in a 2x2 matrix, the left lower item is nil 11 local item = { 12 ["button"] = winMgr:getWindow("orxonox/MultiplayerJoinButton"), 13 ["function"] = P.MultiplayerJoinButton2_clicked 14 } 15 P.buttonList[1] = item 16 17 local item = { 18 ["button"] = winMgr:getWindow("orxonox/MultiplayerHostButton"), 19 ["function"] = P.MultiplayerHostButton2_clicked 20 } 21 P.buttonList[2] = item 22 23 local item = { 24 ["button"] = winMgr:getWindow("orxonox/MultiplayerBackButton"), 25 ["function"] = P.MultiplayerBackButton_clicked 26 } 27 P.buttonList[4] = item 28 11 29 end 12 30 13 31 function P.onShow() 14 if P.multiplayerMode == "startClient" then 15 local window = winMgr:getWindow("orxonox/MultiplayerJoinButton") 16 local button = tolua.cast(window,"CEGUI::RadioButton") 17 button:setSelected(true) 18 local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox") 19 checkbox:setProperty("Disabled", "True") 20 P.showServerList() 21 end 22 if P.multiplayerMode == "startServer" then 23 local window = winMgr:getWindow("orxonox/MultiplayerHostButton") 24 local button = tolua.cast(window,"CEGUI::RadioButton") 25 button:setSelected(true) 26 local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox") 27 checkbox:setProperty("Disabled", "False") 28 P.showLevelList() 29 end 30 if P.multiplayerMode == "startDedicated" then 31 local window = winMgr:getWindow("orxonox/MultiplayerDedicatedButton") 32 local button = tolua.cast(window,"CEGUI::RadioButton") 33 button:setSelected(true) 34 local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox") 35 checkbox:setProperty("Disabled", "True") 36 P.showLevelList() 37 end 38 end 32 P.showServerList() 39 33 40 function P.MultiplayerJoinButton_clicked(e) 41 P.multiplayerMode = "startClient" 42 local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox") 43 checkbox:setProperty("Disabled", "True") 44 P.showServerList() 34 --indices to iterate through buttonlist 35 P.oldindex = -2 36 P.index = -1 45 37 end 46 38 47 39 function P.MultiplayerHostButton_clicked(e) 48 P.multiplayerMode = "startServer" 49 local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox") 50 checkbox:setProperty("Disabled", "False") 51 P.showLevelList() 40 showMenuSheet("HostMenu", true) 52 41 end 53 42 54 function P.MultiplayerDedicatedButton_clicked(e)55 P.multiplayerMode = "startDedicated"56 local checkbox = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")57 checkbox:setProperty("Disabled", "True")58 P.showLevelList()59 end60 43 61 function P.MultiplayerShowAll_clicked(e) 62 local checkbox = tolua.cast(winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox"), "CEGUI::Checkbox") 63 local show = checkbox:isSelected() 64 if show ~= P.showAll then 65 P.showAll = show 66 P.createLevelList() 44 function P.MultiplayerJoinButton_clicked(e) 45 local choice = winMgr:getWindow("orxonox/MultiplayerListbox"):getFirstSelectedItem() 46 if choice then 47 local client = orxonox.Client:getInstance() 48 local index = tolua.cast(choice, "CEGUI::ListboxItem"):getID() 49 client:setDestination( P.serverList[index][2], 55556 ) 50 else 51 return 67 52 end 68 end 69 70 function P.MultiplayerStartButton_clicked(e) 71 local choice = winMgr:getWindow("orxonox/MultiplayerListbox"):getFirstSelectedItem() 72 if P.multiplayerMode == "startClient" then 73 if choice then 74 local client = orxonox.Client:getInstance() 75 local index = tolua.cast(choice, "CEGUI::ListboxItem"):getID() 76 client:setDestination( P.serverList[index][2], 55556 ) 77 else 78 return 79 end 80 else 81 if choice then 82 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 83 else 84 return 85 end 86 end 87 orxonox.execute(P.multiplayerMode) 53 orxonox.execute("startClient") 88 54 hideAllMenuSheets() 89 55 end … … 91 57 function P.MultiplayerBackButton_clicked(e) 92 58 hideMenuSheet(P.name) 93 end94 95 function P.showLevelList()96 P.createLevelList()97 end98 99 function P.createLevelList()100 P.levelList = {}101 P.itemList = {}102 local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/MultiplayerListbox"))103 listbox:resetList()104 orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)105 local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()106 local size = orxonox.LevelManager:getInstance():getNumberOfLevels()107 local index = 0108 local level = nil109 while index < size do110 level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)111 if level ~= nil then112 if P.showAll or not level:hasTag("test") then113 table.insert(P.levelList, level)114 end115 end116 index = index + 1117 end118 --TODO: Reintroduce sorting, if needed. At the moment it's sorted by filename.119 --table.sort(levelList)120 for k,v in pairs(P.levelList) do121 local item = CEGUI.createListboxTextItem(v:getName())122 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")123 listbox:addItem(item)124 if v:getXMLFilename() == preselect then125 listbox:setItemSelectState(item, true)126 end127 P.itemList[k] = listbox:getListboxItemFromIndex(k-1)128 orxonox.GUIManager:setTooltipTextHelper(P.itemList[k], v:getDescription())129 end130 59 end 131 60 … … 161 90 end 162 91 92 function P.onKeyPressed() 93 buttonIteratorHelper(P.buttonList, code, P, 2, 2) 94 end 95 163 96 return P 164 97 -
code/trunk/data/gui/scripts/SettingsMenu.lua
r7163 r7689 3 3 local P = createMenuSheet("SettingsMenu") 4 4 P.loadAlong = { "ControlsMenu", "AudioMenu", "GraphicsMenu" } 5 6 P.buttonList = {} 7 8 function P.onLoad() 9 --"Gameplay" and "Multiplayer Options" are not integrated in the list 10 --buttons are arranged in a 4x2 matrix. The lower-right element is not in the matrix! 11 local item = { 12 ["button"] = winMgr:getWindow("orxonox/SettingsMenu/GraphicsButton"), 13 ["function"] = P.SettingsGraphicsButton_clicked 14 } 15 P.buttonList[2] = item 16 17 local item = { 18 ["button"] = winMgr:getWindow("orxonox/SettingsMenu/AudioButton"), 19 ["function"] = P.SettingsAudioButton_clicked 20 } 21 P.buttonList[4] = item 22 23 24 local item = { 25 ["button"] = winMgr:getWindow("orxonox/SettingsMenu/ControlsButton"), 26 ["function"] = P.SettingsControlsButton_clicked 27 } 28 P.buttonList[5] = item 29 30 local item = { 31 ["button"] = winMgr:getWindow("orxonox/SettingsMenu/MiscellaneousButton"), 32 ["function"] = P.SettingsMiscellaneousButton_clicked 33 } 34 P.buttonList[6] = item 35 36 local item = { 37 ["button"] = winMgr:getWindow("orxonox/SettingsMenu/SettingsBackButton"), 38 ["function"] = P.SettingsBackButton_clicked 39 } 40 P.buttonList[7] = item 41 42 end 43 44 function P.onShow() 45 --indices to iterate through buttonlist 46 P.oldindex = 3 47 P.index = 2 48 end 5 49 6 50 function P.SettingsGameplayButton_clicked(e) … … 32 76 end 33 77 78 function P.onKeyPressed() 79 buttonIteratorHelper(P.buttonList, code, P, 4, 2) 80 end 81 34 82 return P 35 83 -
code/trunk/data/gui/scripts/SheetManager.lua
r7403 r7689 5 5 local activeMenuSheets = {size = 0, topSheetTuple = nil} 6 6 local menuSheetsRoot = guiMgr:getMenuRootWindow() 7 local bInGameConsoleClosed = false 8 local mainMenuLoaded = false 9 orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed") 7 10 8 11 ----------------------- … … 69 72 70 73 -- Count the number of sheets that don't need input till the first that does. 71 local counter = noInputSheet Counter()74 local counter = noInputSheetIndex() 72 75 -- Pause game control if this is the first menu to be displayed 73 76 -- HUGE HACK? … … 100 103 menuSheetsRoot:addChildWindow(menuSheet.window) 101 104 105 -- If sheet is the MainMenu 106 if name == "MainMenu" then 107 mainMenuLoaded = true 108 end 109 102 110 -- Handle input distribution 103 111 if bNoInput == false then … … 118 126 end 119 127 end 120 128 121 129 menuSheet:show() 130 menuSheetsRoot:activate() 122 131 123 132 return menuSheet … … 161 170 activeMenuSheets.topSheetTuple = activeMenuSheets[activeMenuSheets.size] 162 171 172 -- If sheet is the MainMenu 173 if name == "MainMenu" then 174 mainMenuLoaded = false 175 end 176 163 177 -- Leave the input state 164 178 if not sheetTuple.bNoInput then … … 179 193 180 194 -- Count the number of sheets that don't need input till the first that does. 181 local counter = noInputSheet Counter()195 local counter = noInputSheetIndex() 182 196 -- Resume control if the last (non-noInput) menu is hidden 183 197 if counter == 0 then … … 199 213 -- HUGE, very HUGE hacks! 200 214 201 -- Count the number of sheets that don't need input till the first that does. 202 local counter = noInputSheetCounter() 215 -- If the InGameConsole is active, ignore the ESC command. 216 if bInGameConsoleClosed == true then 217 bInGameConsoleClosed = false 218 return 219 end 220 221 -- Count the number of sheets that don't need input till the first that does. 222 local counter = noInputSheetIndex() 203 223 204 224 -- If the first sheet that needs input is the MainMenu. 205 if counter == 1 and activeMenuSheets[1].sheet.name == "MainMenu" then225 if noInputSheetCounter() == 1 and activeMenuSheets[counter].sheet.name == "MainMenu" then 206 226 orxonox.execute("exit") 207 227 -- If there is at least one sheet that needs input. … … 213 233 end 214 234 235 function keyPressed(e) 236 local we = tolua.cast(e, "CEGUI::KeyEventArgs") 237 local sheet = activeMenuSheets[activeMenuSheets.size] 238 code = tostring(we.scancode) 239 -- Some preprocessing 240 if not mainMenuLoaded and not sheet.bNoInput then 241 if code == "1" then 242 keyESC() 243 elseif code == "0"then 244 orxonox.CommandExecutor:execute("openConsole") 245 end 246 end 247 sheet.sheet:onKeyPressed() 248 end 249 215 250 function setBackgroundImage(imageSet, imageName) 216 251 guiMgr:setBackgroundImage(imageSet, imageName) 217 252 end 218 253 254 function noInputSheetIndex() 255 -- Count the number of sheets that don't need input till the first that does. 256 local index = activeMenuSheets.size 257 while index > 0 and activeMenuSheets[index].bNoInput do 258 index = index - 1 259 end 260 return index 261 end 262 219 263 function noInputSheetCounter() 220 -- Count the number of sheets that do n't need input till the first that does.264 -- Count the number of sheets that do need input. 221 265 local counter = activeMenuSheets.size 222 while counter > 0 and activeMenuSheets[counter].bNoInput do 223 counter = counter - 1 266 for i = 1,activeMenuSheets.size do 267 if activeMenuSheets[i].bNoInput then 268 counter = counter - 1 269 end 224 270 end 225 271 return counter 272 end 273 274 function inGameConsoleClosed() 275 bInGameConsoleClosed = not bInGameConsoleClosed; 226 276 end 227 277 -
code/trunk/data/gui/scripts/SingleplayerMenu.lua
r7648 r7689 3 3 local P = createMenuSheet("SingleplayerMenu") 4 4 5 P.buttonList = {} 5 6 P.levelList = {} 6 7 P.itemList = {} … … 12 13 button:setSelected(false) 13 14 P.createLevelList() 15 16 --buttons are arranged in a 1x2 matrix 17 local item = { 18 ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"), 19 ["function"] = P.SingleplayerStartButton_clicked 20 } 21 P.buttonList[1] = item 22 23 local item = { 24 ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"), 25 ["function"] = P.SingleplayerBackButton_clicked 26 } 27 P.buttonList[2] = item 14 28 end 15 29 … … 47 61 end 48 62 63 function P.onShow() 64 --indices to iterate through buttonlist 65 P.oldindex = -2 66 P.index = -1 67 end 68 49 69 function P.SingleplayerStartButton_clicked(e) 50 70 local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/SingleplayerLevelListbox")) … … 74 94 end 75 95 96 function P.onKeyPressed() 97 buttonIteratorHelper(P.buttonList, code, P, 1, 2) 98 end 99 76 100 return P 77 101 -
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r7284 r7689 67 67 RegisterRootObject(GSMainMenu); 68 68 69 InputManager::getInstance().createInputState("MainMenuHackery" )->setKeyHandler(KeyBinderManager::getInstance().getDefaultAsHandler());69 InputManager::getInstance().createInputState("MainMenuHackery", true, true)->setKeyHandler(KeyBinderManager::getInstance().getDefaultAsHandler()); 70 70 71 71 // create an empty Scene -
code/trunk/src/orxonox/overlays/InGameConsole.cc
r7401 r7689 49 49 #include "core/ConfigValueIncludes.h" 50 50 #include "core/command/ConsoleCommand.h" 51 #include "core/GUIManager.h" 51 52 #include "core/input/InputManager.h" 52 53 #include "core/input/InputState.h" 53 54 #include "core/input/InputBuffer.h" 55 #include "core/LuaState.h" 54 56 55 57 namespace orxonox … … 119 121 { 120 122 if (this->consoleOverlayTextAreas_[i]) 121 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->consoleOverlayTextAreas_[i]);123 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->consoleOverlayTextAreas_[i]); 122 124 this->consoleOverlayTextAreas_[i] = 0; 123 125 } … … 495 497 } 496 498 else 497 this->inputWindowStart_ = 0;499 this->inputWindowStart_ = 0; 498 500 this->displayedText_ = output; 499 501 this->consoleOverlayTextAreas_[index]->setCaption(multi_cast<Ogre::DisplayString>(output)); … … 532 534 { 533 535 this->bActive_ = false; 536 GUIManager::getInstance().getLuaState()->doString("inGameConsoleClosed()"); // Notify the SheetManager in lua, that the console has been closed. 534 537 InputManager::getInstance().leaveState("console"); 535 538 this->shell_->unregisterListener(this); … … 608 611 /*static*/ void InGameConsole::closeConsole() 609 612 { 613 GUIManager::getInstance().getLuaState()->doString("inGameConsoleClosed()"); // Notify the SheetManager in lua, that the console has been closed, but not by ESC. 610 614 InGameConsole::getInstance().deactivate(); 611 615 } 616 612 617 }
Note: See TracChangeset
for help on using the changeset viewer.