Changeset 6150 for code/branches/presentation2/data/gui
- Timestamp:
- Nov 25, 2009, 4:52:37 PM (15 years ago)
- Location:
- code/branches/presentation2
- Files:
-
- 5 edited
- 26 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2
- Property svn:mergeinfo changed
/code/branches/ingamemenu (added) merged: 6003,6018-6020,6022-6023 /code/branches/menu (added) merged: 5941,5944,5952,6024,6032,6036,6047-6049,6051,6145-6146,6148
- Property svn:mergeinfo changed
-
code/branches/presentation2/data/gui/layouts/MainMenu.layout
r5781 r6150 1 1 <?xml version="1.0" ?> 2 2 <GUILayout> 3 <Window Type="TaharezLook/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 3 <Window Type="DefaultWindow" Name="orxonox/MainMenuRootWindow"> 4 <Property Name="InheritsAlpha" Value="false"/> 9 5 <Window Type="TaharezLook/Button" Name="orxonox/StandaloneButton"> 10 6 <Property Name="UnifiedPosition" Value="{{0.11,0},{0.3,0}}"/> -
code/branches/presentation2/data/gui/layouts/QuestGUI.layout
r5781 r6150 6 6 <Property Name="FrameEnabled" Value="set:true"/> 7 7 <Property Name="BackgroundEnabled" Value="set:false"/> 8 <Property Name="InheritsAlpha" Value="False" /> 8 9 9 10 <Window Type="TaharezLook/Titlebar" Name="orxonox/QuestGUI/Title"> -
code/branches/presentation2/data/gui/scripts/InGameMenu.lua
r6146 r6150 25 25 orxonox.Game:getInstance():popState() 26 26 orxonox.Game:getInstance():requestState("mainmenu") 27 orxonox.CommandExecutor:execute("showGUI MainMenu")28 27 orxonox.CommandExecutor:execute("hideGUI InGameMenu") 29 28 end -
code/branches/presentation2/data/gui/scripts/InitialiseGUI.lua
r5781 r6150 14 14 15 15 loadedGUIs = {} 16 cursorVisibility = {} 17 activeSheets = {} 18 nrOfActiveSheets = 0 19 root = nil 20 bShowsCursor = false 21 bHidePrevious = {} 22 23 -- Require all tools 24 require("GUITools") 16 25 17 26 -- loads the GUI with the specified filename … … 22 31 if loadedGui == nil then 23 32 loadedGuiNS = require(filename) 33 if loadedGuiNS == nil then 34 return 35 end 24 36 loadedGui = loadedGuiNS:load() 25 37 loadedGUIs[filename] = loadedGui … … 27 39 if table.getn(loadedGUIs) == 1 then 28 40 current = loadedGUIs[1] 29 showing = false30 41 end 31 42 -- hide new GUI as we do not want to show it accidentially … … 35 46 end 36 47 37 function showGUI(filename, ptr)38 gui = showGUI(filename )48 function showGUI(filename, hidePrevious, bCursorVisible, ptr) 49 gui = showGUI(filename, hidePrevious, bCursorVisible) 39 50 gui.overlay = ptr 40 51 end … … 42 53 -- shows the specified and loads it if not loaded already 43 54 -- 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) 51 end 52 current:show() 53 showing = true 54 return current 55 end 56 57 function toggleGUI() 58 if showing == true then 59 current:hide() 55 function showGUI(filename, hidePrevious, bCursorVisible) 56 if bCursorVisible == nil then 57 bCursorVisible = true 58 end 59 60 if root == nil then 61 setBackground("") 62 end 63 64 local currentGUI = loadedGUIs[filename] 65 if(currentGUI == nil) then 66 currentGUI = loadGUI(filename) 67 end 68 69 if(root:isChild(currentGUI.window)) then 70 root:removeChildWindow(currentGUI.window) 71 end 72 root:addChildWindow(currentGUI.window) 73 74 if bCursorVisible then 75 showCursor() 76 else 77 hideCursor() 78 end 79 80 if find( activeSheets, filename ) ~= nil then 81 table.remove( activeSheets, find( activeSheets, filename ) ) 82 nrOfActiveSheets = nrOfActiveSheets - 1 83 else 84 if nrOfActiveSheets == 0 then 85 orxonox.InputManager:getInstance():enterState("guiMouseOnly") 86 end 87 end 88 nrOfActiveSheets = nrOfActiveSheets + 1 89 table.insert(activeSheets, filename) 90 activeSheets[nrOfActiveSheets] = filename 91 bHidePrevious[filename]=hidePrevious 92 cursorVisibility[filename] = bCursorVisible 93 94 if hidePrevious == true then 95 for i=1,nrOfActiveSheets-1 do 96 loadedGUIs[ activeSheets[i] ]:hide() 97 end 98 end 99 currentGUI:show() 100 return currentGUI 101 end 102 103 function hideCursor() 104 if bShowsCursor==true then 105 bShowsCursor=false 60 106 cursor:hide() 61 showing = false 62 else 63 current:show() 107 end 108 end 109 110 function showCursor() 111 if bShowsCursor==false then 112 bShowsCursor=true 64 113 cursor:show() 65 showing = true 66 end 67 return showing 68 end 69 70 function hideCursor() 71 cursor:hide() 72 end 73 74 function showCursor() 75 cursor:show() 114 end 76 115 end 77 116 78 117 function hideGUI(filename) 79 current = loadedGUIs[filename] 80 if current ~= nil then 81 current:hide() 82 showing = false 83 end 84 end 118 local currentGUI = loadedGUIs[filename] 119 if currentGUI == nil then 120 return 121 end 122 currentGUI:hide() 123 if bHidePrevious[filename] == true then 124 local i = nrOfActiveSheets-1 125 while i>0 do 126 loadedGUIs[ activeSheets[i] ]:show() 127 if bHidePrevious[filename]==true then 128 break 129 else 130 i=i-1 131 end 132 end 133 end 134 root:removeChildWindow(currentGUI.window) 135 local i=1 136 while activeSheets[i] do 137 if activeSheets[i+1] == nil then 138 if activeSheets[i-1] ~= nil then 139 if cursorVisibility[ activeSheets[i-1] ] == true then 140 showCursor() 141 else 142 hideCursor() 143 end 144 else 145 hideCursor() 146 end 147 end 148 if activeSheets[i] == filename then 149 table.remove( activeSheets, i ) 150 nrOfActiveSheets = nrOfActiveSheets-1 151 else 152 i = i+1 153 end 154 end 155 cursorVisibility[filename] = nil -- remove the cursor visibility of the current gui from the table 156 bHidePrevious[filename] = nil 157 if nrOfActiveSheets == 0 then 158 orxonox.InputManager:getInstance():leaveState("guiMouseOnly") 159 hideCursor() 160 end 161 end 162 163 function keyESC() 164 if nrOfActiveSheets > 0 then 165 orxonox.CommandExecutor:execute("hideGUI "..activeSheets[nrOfActiveSheets]) 166 else 167 showGUI("InGameMenu") 168 end 169 end 170 171 function setBackground(filename) 172 local newroot 173 if root ~= nil then 174 root:rename("oldRootWindow") 175 end 176 if filename ~= "" then 177 newroot = winMgr:loadWindowLayout(filename .. ".layout") 178 newroot:rename("AbsoluteRootWindow") 179 system:setGUISheet(newroot) 180 else 181 newroot = winMgr:createWindow("DefaultWindow", "AbsoluteRootWindow") 182 newroot:setProperty("Alpha", "0.0") 183 newroot:setSize(CEGUI.UVector2(CEGUI.UDim(1.0,0),CEGUI.UDim(1.0,0))) 184 system:setGUISheet(newroot) 185 end 186 if root ~= nil then 187 local child 188 while root:getChildCount()~=0 do 189 debug(root:getChildCount()) 190 child = root:getChildAtIdx(0) 191 root:removeChildWindow(child) 192 newroot:addChildWindow(child) 193 end 194 winMgr:destroyWindow(root) 195 end 196 newroot:show() 197 root = newroot 198 end 199 200 function find(table, value) 201 local i=0 202 while table[i] ~= nil do 203 if table[i]==value then 204 return i 205 else 206 i=i+1 207 end 208 end 209 return nil 210 end -
code/branches/presentation2/data/gui/scripts/MainMenu.lua
r5781 r6150 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.