Changeset 7670 for code/branches/menu
- Timestamp:
- Nov 24, 2010, 8:58:13 PM (14 years ago)
- Location:
- code/branches/menu/data/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/menu/data/gui/scripts/InGameMenu.lua
r6748 r7670 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/branches/menu/data/gui/scripts/SheetManager.lua
r7649 r7670 6 6 local menuSheetsRoot = guiMgr:getMenuRootWindow() 7 7 local bInGameConsoleClosed = false 8 local mainMenuLoaded = false 8 9 orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed") 9 10 … … 71 72 72 73 -- Count the number of sheets that don't need input till the first that does. 73 local counter = noInputSheet Counter()74 local counter = noInputSheetIndex() 74 75 -- Pause game control if this is the first menu to be displayed 75 76 -- HUGE HACK? … … 102 103 menuSheetsRoot:addChildWindow(menuSheet.window) 103 104 105 -- If sheet is the MainMenu 106 if name == "MainMenu" then 107 mainMenuLoaded = true 108 end 109 104 110 -- Handle input distribution 105 111 if bNoInput == false then … … 120 126 end 121 127 end 122 128 123 129 menuSheet:show() 124 130 menuSheetsRoot:activate() … … 164 170 activeMenuSheets.topSheetTuple = activeMenuSheets[activeMenuSheets.size] 165 171 172 -- If sheet is the MainMenu 173 if name == "MainMenu" then 174 mainMenuLoaded = false 175 end 176 166 177 -- Leave the input state 167 178 if not sheetTuple.bNoInput then … … 182 193 183 194 -- Count the number of sheets that don't need input till the first that does. 184 local counter = noInputSheet Counter()195 local counter = noInputSheetIndex() 185 196 -- Resume control if the last (non-noInput) menu is hidden 186 197 if counter == 0 then … … 204 215 -- If the InGameConsole is active, ignore the ESC command. 205 216 if bInGameConsoleClosed == true then 206 bInGameConsoleClosed = false s217 bInGameConsoleClosed = false 207 218 return 208 219 end 209 220 210 221 -- Count the number of sheets that don't need input till the first that does. 211 local counter = noInputSheet Counter()222 local counter = noInputSheetIndex() 212 223 213 224 -- If the first sheet that needs input is the MainMenu. 214 if counter == 1 and activeMenuSheets[1].sheet.name == "MainMenu" then225 if noInputSheetCounter() == 1 and activeMenuSheets[counter].sheet.name == "MainMenu" then 215 226 orxonox.execute("exit") 216 227 -- If there is at least one sheet that needs input. … … 226 237 local sheet = activeMenuSheets[activeMenuSheets.size] 227 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 228 247 sheet.sheet:onKeyPressed() 229 248 end … … 233 252 end 234 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 cout(0, activeMenuSheets[index].sheet.name) 259 index = index - 1 260 end 261 return index 262 end 263 235 264 function noInputSheetCounter() 236 -- Count the number of sheets that do n't need input till the first that does.265 -- Count the number of sheets that do need input. 237 266 local counter = activeMenuSheets.size 238 while counter > 0 and activeMenuSheets[counter].bNoInput do 239 counter = counter - 1 267 for i = 1,activeMenuSheets.size do 268 if activeMenuSheets[i].bNoInput then 269 counter = counter - 1 270 end 240 271 end 241 272 return counter
Note: See TracChangeset
for help on using the changeset viewer.