Changeset 8079 for code/trunk/data/gui/scripts/SheetManager.lua
- Timestamp:
- Mar 15, 2011, 9:47:11 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/data/gui/scripts/SheetManager.lua
r7689 r8079 8 8 local mainMenuLoaded = false 9 9 orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed") 10 11 ----------------------- 12 --- Local functions --- 13 ----------------------- 14 15 local function hideCursor() 16 if cursor:isVisible() then 17 cursor:hide() 18 end 19 end 20 21 local function showCursor() 22 if not cursor:isVisible() and inputMgr:isMouseExclusive() then 23 cursor:show() 24 end 25 end 26 10 orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "Sized", "windowResized") 27 11 28 12 ------------------------ 29 13 --- Global functions --- 30 14 ------------------------ 15 16 function hideCursor() 17 if cursor:isVisible() then 18 cursor:hide() 19 end 20 end 21 22 function showCursor() 23 if not cursor:isVisible() and inputMgr:isMouseExclusive() then 24 cursor:show() 25 end 26 end 31 27 32 28 -- Loads the GUI with the specified name … … 93 89 ["sheet"] = menuSheet, 94 90 ["bHidePrevious"] = bHidePrevious, 95 ["bNoInput"] = bNoInput 91 ["bNoInput"] = bNoInput, 92 ["name"] = name 96 93 } 97 94 table.insert(activeMenuSheets, sheetTuple) -- indexed array access … … 121 118 122 119 -- Hide all previous sheets if necessary 120 local previous 123 121 if bHidePrevious then 124 122 for i = 1, activeMenuSheets.size - 1 do 125 activeMenuSheets[i].sheet:hide() 126 end 127 end 128 123 previous = activeMenuSheets[i].sheet 124 previous:hide() 125 end 126 end 127 129 128 menuSheet:show() 130 129 menuSheetsRoot:activate() 130 131 -- select first button if the menu was opened with the keyboard 132 if previous and previous.pressedEnter and menuSheet:hasSelection() == false then 133 menuSheet:setSelectionNear(1, 1) 134 end 131 135 132 136 return menuSheet … … 179 183 inputMgr:leaveState(sheetTuple.sheet.inputState) 180 184 end 181 185 182 186 -- CURSOR SHOWING 183 187 local i = activeMenuSheets.size … … 200 204 end 201 205 202 sheetTuple.sheet: afterHide()206 sheetTuple.sheet:quit() 203 207 end 204 208 … … 242 246 keyESC() 243 247 elseif code == "0"then 244 orxonox.CommandExecutor:execute("openConsole") 245 end 246 end 247 sheet.sheet:onKeyPressed() 248 orxonox.CommandExecutor:execute("InGameConsole openConsole") 249 end 250 end 251 sheet.sheet:keyPressed() 252 end 253 254 function windowResized(e) 255 for name, sheet in pairs(loadedSheets) do 256 if orxonox.GraphicsManager:getInstance():isFullScreen() or sheet.tShowCursor == TriBool.False then 257 inputMgr:setMouseExclusive(sheet.inputState, TriBool.True) 258 else 259 inputMgr:setMouseExclusive(sheet.inputState, TriBool.False) 260 end 261 end 262 local sheetTuple = activeMenuSheets[activeMenuSheets.size] 263 if sheetTuple then 264 if orxonox.GraphicsManager:getInstance():isFullScreen() and sheetTuple.sheet.tShowCursor ~= TriBool.False then 265 showCursor() 266 else 267 hideCursor() 268 end 269 sheetTuple.sheet:windowResized() 270 end 248 271 end 249 272 … … 276 299 end 277 300 301 function getGUIFirstActive(name, bHidePrevious, bNoInput) 302 local sheet = activeMenuSheets.topSheetTuple 303 -- If the topmost gui sheet has the input name 304 if sheet ~= nil and sheet.name == name then 305 guiMgr:toggleGUIHelper(name, bHidePrevious, bNoInput, false); 306 else 307 guiMgr:toggleGUIHelper(name, bHidePrevious, bNoInput, true); 308 end 309 end 310 278 311 ---------------------- 279 312 --- Initialisation ---
Note: See TracChangeset
for help on using the changeset viewer.