Changeset 6024 for code/branches/menu/data/gui/scripts
- Timestamp:
- Nov 4, 2009, 2:14:53 PM (15 years ago)
- Location:
- code/branches/menu
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/menu
- Property svn:mergeinfo changed
/code/branches/ingamemenu (added) merged: 6003,6018-6020,6022-6023
- Property svn:mergeinfo changed
-
code/branches/menu/data/gui/scripts/InitialiseGUI.lua
r5781 r6024 14 14 15 15 loadedGUIs = {} 16 cursorVisibility = {} 17 activeSheets = {} 18 nrOfActiveSheets = 0 19 root = nil 20 bShowsCursor = false 16 21 17 22 -- loads the GUI with the specified filename … … 35 40 end 36 41 37 function showGUI(filename, ptr)38 gui = showGUI(filename )42 function showGUI(filename, bCursorVisible, ptr) 43 gui = showGUI(filename, bCursorVisible) 39 44 gui.overlay = ptr 40 45 end … … 42 47 -- shows the specified and loads it if not loaded already 43 48 -- be sure to set the global variable "filename" before calling this function 44 function showGUI(filename) 45 if current == nil or current.filename ~= filename then 46 current = loadedGUIs[filename] 47 if current == nil then 48 current = loadGUI(filename) 49 end 50 system:setGUISheet(current.window) 49 function showGUI(filename, bCursorVisible) 50 -- bCursorVisibile=false 51 if bCursorVisible == nil then 52 cursorVisibility= true 51 53 end 52 current:show() 54 55 if root == nil then 56 root = winMgr:createWindow("TaharezLook/StaticImage", "AbsoluteRootWindow") 57 root:setProperty("Alpha", "0.0") 58 root:setSize(CEGUI.UVector2(CEGUI.UDim(1.0,0),CEGUI.UDim(1.0,0))) 59 system:setGUISheet(root) 60 end 61 62 local currentGUI = loadedGUIs[filename] 63 if(currentGUI == nil) then 64 currentGUI = loadGUI(filename) 65 end 66 67 if(root:isChild(currentGUI.window)) then 68 root:removeChildWindow(currentGUI.window) 69 end 70 root:addChildWindow(currentGUI.window) 71 72 if bCursorVisible then 73 showCursor() 74 else 75 hideCursor() 76 end 77 cursorVisibility[filename]=bCursorVisible 78 79 nrOfActiveSheets = nrOfActiveSheets + 1 80 table.insert(activeSheets, filename) 81 activeSheets[nrOfActiveSheets] = filename 82 83 currentGUI:show() 53 84 showing = true 54 return current 55 end 56 57 function toggleGUI() 58 if showing == true then 59 current:hide() 60 cursor:hide() 61 showing = false 62 else 63 current:show() 64 cursor:show() 65 showing = true 66 end 67 return showing 85 return currentGUI 68 86 end 69 87 70 88 function hideCursor() 71 cursor:hide() 89 if bShowsCursor==true then 90 bShowsCursor=false 91 cursor:hide() 92 end 72 93 end 73 94 74 95 function showCursor() 75 cursor:show() 96 if bShowsCursor==false then 97 bShowsCursor=true 98 cursor:show() 99 end 76 100 end 77 101 78 102 function hideGUI(filename) 79 current = loadedGUIs[filename] 80 if current ~= nil then 81 current:hide() 82 showing = false 103 local currentGUI = loadedGUIs[filename] 104 if currentGUI == nil then 105 return 83 106 end 107 currentGUI:hide() 108 root:removeChildWindow(currentGUI.window) 109 showing = false 110 i=1 111 while activeSheets[i] do 112 if activeSheets[i+1] == nil then 113 if activeSheets[i-1] ~= nil then 114 if cursorVisibility[ activeSheets[i-1] ] == true then 115 showCursor() 116 else 117 hideCursor() 118 end 119 else 120 hideCursor() 121 end 122 end 123 if activeSheets[i] == filename then 124 table.remove( activeSheets, i ) 125 nrOfActiveSheets = nrOfActiveSheets-1 126 else 127 i = i+1 128 end 129 end 130 cursorVisibility[filename] = nil -- remove the cursor visibility of the current gui from the table 84 131 end -
code/branches/menu/data/gui/scripts/MainMenu.lua
r5781 r6024 50 50 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 51 51 orxonox.CommandExecutor:execute("startGame") 52 toggleGUI()52 hideGUI(P.filename) 53 53 end 54 54 end … … 59 59 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 60 60 orxonox.CommandExecutor:execute("startServer") 61 toggleGUI()61 hideGUI(P.filename) 62 62 end 63 63 end … … 68 68 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 69 69 orxonox.CommandExecutor:execute("startDedicated") 70 toggleGUI()70 hideGUI(P.filename) 71 71 end 72 72 end … … 77 77 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 78 78 orxonox.CommandExecutor:execute("startClient") 79 toggleGUI() 79 hideGUI(P.filename) 80 80 81 end 81 82 end
Note: See TracChangeset
for help on using the changeset viewer.