Changeset 6417 for code/trunk/data/gui
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 8 edited
- 30 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/data/gui/layouts/MainMenu.layout
r5781 r6417 1 <?xml version="1.0" ?>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 9 < Window Type="TaharezLook/Button" Name="orxonox/StandaloneButton">10 <Property Name="UnifiedPosition" Value="{{0.11,0},{0.3,0}}"/>11 <Property Name=" UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>12 <Property Name=" Text" Value="Standalone"/>13 <Property Name=" Disabled" Value="true"/>14 <Event Name="Clicked" Function="MainMenu. button_standalone_clicked"/>1 <?xml version="1.0" encoding="UTF-8"?> 2 3 <GUILayout > 4 <Window Type="TaharezLook/StaticImage" Name="orxonox/MainMenuBackground" > 5 <Property Name="FrameEnabled" Value="False" /> 6 <Property Name="InheritsAlpha" Value="False" /> 7 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 8 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1.02125,0},{1.02167,0}}" /> 9 <Property Name="BackgroundEnabled" Value="False" /> 10 <Window Type="TaharezLook/Button" Name="orxonox/QuickGameTestButton" > 11 <Property Name="Text" Value="Quickstart" /> 12 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 13 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.2875,0},{0.6,0},{0.3375,0}}" /> 14 <Event Name="Clicked" Function="MainMenu.QuickGameTestButton_clicked"/> 15 15 </Window> 16 17 <Window Type="TaharezLook/Listbox" Name="orxonox/LevelListbox"> 18 <Property Name="UnifiedPosition" Value="{{0.4,0},{0.3,0}}"/> 16 <Window Type="TaharezLook/Button" Name="orxonox/SingleplayerButton" > 17 <Property Name="Text" Value="Singleplayer" /> 19 18 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 20 <Property Name="UnifiedSize" Value="{{0.35,0},{0.33,0}}" /> 21 <Property Name="Tooltip" Value="Available Levels." /> 22 <Event Name="ItemSelectionChanged" Function="MainMenu.listbox_level_selectionchanged" /> 19 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.3625,0},{0.6,0},{0.4125,0}}" /> 20 <Event Name="Clicked" Function="MainMenu.SingleplayerButton_clicked"/> 23 21 </Window> 24 25 <Window Type="TaharezLook/Button" Name="orxonox/DedicatedButton"> 26 <Property Name="UnifiedPosition" Value="{{0.11,0},{0.376,0}}"/> 27 <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/> 28 <Property Name="Text" Value="Dedicated"/> 29 <Event Name="Clicked" Function="MainMenu.button_dedicated_clicked"/> 22 <Window Type="TaharezLook/Button" Name="orxonox/MultiplayerButton" > 23 <Property Name="Text" Value="Multiplayer" /> 24 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 25 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.4375,0},{0.6,0},{0.4875,0}}" /> 26 <Event Name="Clicked" Function="MainMenu.MultiplayerButton_clicked"/> 30 27 </Window> 31 32 <Window Type="TaharezLook/Button" Name="orxonox/ServerButton"> 33 <Property Name="UnifiedPosition" Value="{{0.11,0},{0.452,0}}"/> 34 <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/> 35 <Property Name="Text" Value="Server"/> 36 <Event Name="Clicked" Function="MainMenu.button_server_clicked"/> 28 <Window Type="TaharezLook/Button" Name="orxonox/SettingsButton" > 29 <Property Name="Text" Value="Settings" /> 30 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 31 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5125,0},{0.6,0},{0.5625,0}}" /> 32 <Event Name="Clicked" Function="MainMenu.SettingsButton_clicked"/> 37 33 </Window> 38 39 <Window Type="TaharezLook/Button" Name="orxonox/ClientButton"> 40 <Property Name="UnifiedPosition" Value="{{0.11,0},{0.528,0}}"/> 41 <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/> 42 <Property Name="Text" Value="Client"/> 43 <Event Name="Clicked" Function="MainMenu.button_client_clicked"/> 34 <Window Type="TaharezLook/Button" Name="orxonox/CreditsButton" > 35 <Property Name="Text" Value="Credits" /> 36 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 37 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5875,0},{0.6,0},{0.6375,0}}" /> 38 <Event Name="Clicked" Function="MainMenu.CreditsButton_clicked"/> 44 39 </Window> 45 46 <Window Type="TaharezLook/Button" Name="orxonox/QuitButton"> 47 <Property Name="UnifiedPosition" Value="{{0.11,0},{0.604,0}}"/> 48 <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/> 49 <Property Name="Text" Value="Quit"/> 50 <Event Name="Clicked" Function="MainMenu.button_quit_clicked"/> 40 <Window Type="TaharezLook/Button" Name="orxonox/ExitButton" > 41 <Property Name="Text" Value="Exit" /> 42 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 43 <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" /> 44 <Event Name="Clicked" Function="MainMenu.ExitButton_clicked"/> 51 45 </Window> 52 46 </Window> -
code/trunk/data/gui/layouts/PickupInventory.layout
r5781 r6417 15 15 <Property Name="TabPanePosition" Value="Bottom" /> 16 16 <Property Name="UnifiedAreaRect" Value="{{0,10},{0,30},{1,-10},{1,-10}}" /> 17 17 18 18 <Window Type="TaharezLook/ScrollablePane" Name="orxonox/Inventory/TabControl/TabEquipment"> 19 19 <Property Name="Text" Value="Equipment" /> -
code/trunk/data/gui/layouts/QuestGUI.layout
r5781 r6417 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/trunk/data/gui/scripts/InitialiseGUI.lua
r5781 r6417 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 if nrOfActiveSheets > 0 then 58 bCursorVisible = cursorVisibility[activeSheets[nrOfActiveSheets]] 59 else 60 bCursorVisible = true 61 end 62 end 63 64 if root == nil then 65 setBackground("") 66 end 67 68 local currentGUI = loadedGUIs[filename] 69 if(currentGUI == nil) then 70 currentGUI = loadGUI(filename) 71 end 72 73 if(root:isChild(currentGUI.window)) then 74 root:removeChildWindow(currentGUI.window) 75 end 76 root:addChildWindow(currentGUI.window) 77 78 if bCursorVisible then 79 showCursor() 80 else 81 hideCursor() 82 end 83 84 if find( activeSheets, filename ) ~= nil then 85 table.remove( activeSheets, find( activeSheets, filename ) ) 86 nrOfActiveSheets = nrOfActiveSheets - 1 87 else 88 if nrOfActiveSheets == 0 then 89 orxonox.InputManager:getInstance():enterState("guiMouseOnly") 90 orxonox.HumanController:pauseControl() 91 end 92 end 93 nrOfActiveSheets = nrOfActiveSheets + 1 94 table.insert(activeSheets, filename) 95 activeSheets[nrOfActiveSheets] = filename 96 bHidePrevious[filename]=hidePrevious 97 cursorVisibility[filename] = bCursorVisible 98 99 if hidePrevious == true then 100 for i=1,nrOfActiveSheets-1 do 101 loadedGUIs[ activeSheets[i] ]:hide() 102 end 103 end 104 currentGUI:show() 105 return currentGUI 106 end 107 108 function hideCursor() 109 if bShowsCursor==true then 110 bShowsCursor=false 60 111 cursor:hide() 61 showing = false 62 else 63 current:show() 112 end 113 end 114 115 function showCursor() 116 if bShowsCursor==false then 117 bShowsCursor=true 64 118 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() 119 end 76 120 end 77 121 78 122 function hideGUI(filename) 79 current = loadedGUIs[filename] 80 if current ~= nil then 81 current:hide() 82 showing = false 83 end 84 end 123 local currentGUI = loadedGUIs[filename] 124 if currentGUI == nil then 125 return 126 end 127 currentGUI:hide() 128 if bHidePrevious[filename] == true then 129 local i = nrOfActiveSheets-1 130 while i>0 do 131 loadedGUIs[ activeSheets[i] ]:show() 132 if bHidePrevious[filename]==true then 133 break 134 else 135 i=i-1 136 end 137 end 138 end 139 root:removeChildWindow(currentGUI.window) 140 local i=1 141 while activeSheets[i] do 142 if activeSheets[i+1] == nil then 143 if activeSheets[i-1] ~= nil then 144 if cursorVisibility[ activeSheets[i-1] ] == true then 145 showCursor() 146 else 147 hideCursor() 148 end 149 else 150 hideCursor() 151 end 152 end 153 if activeSheets[i] == filename then 154 table.remove( activeSheets, i ) 155 nrOfActiveSheets = nrOfActiveSheets-1 156 else 157 i = i+1 158 end 159 end 160 cursorVisibility[filename] = nil -- remove the cursor visibility of the current gui from the table 161 bHidePrevious[filename] = nil 162 if nrOfActiveSheets == 0 then 163 orxonox.InputManager:getInstance():leaveState("guiMouseOnly") 164 orxonox.HumanController:resumeControl() 165 hideCursor() 166 end 167 end 168 169 function hideAllGUIs() 170 while nrOfActiveSheets ~= 0 do 171 hideGUI(activeSheets[nrOfActiveSheets]) 172 end 173 end 174 175 function keyESC() 176 if nrOfActiveSheets == 1 and activeSheets[1] == "MainMenu" then 177 orxonox.execute("exit") 178 elseif nrOfActiveSheets > 0 then 179 orxonox.execute("hideGUI "..activeSheets[nrOfActiveSheets]) 180 else 181 showGUI("InGameMenu") 182 end 183 end 184 185 function setBackground(filename) 186 local newroot 187 if root ~= nil then 188 root:rename("oldRootWindow") 189 end 190 if filename ~= "" then 191 newroot = winMgr:loadWindowLayout(filename .. ".layout") 192 newroot:rename("AbsoluteRootWindow") 193 system:setGUISheet(newroot) 194 else 195 newroot = winMgr:createWindow("DefaultWindow", "AbsoluteRootWindow") 196 newroot:setProperty("Alpha", "0.0") 197 newroot:setSize(CEGUI.UVector2(CEGUI.UDim(1.0,0),CEGUI.UDim(1.0,0))) 198 system:setGUISheet(newroot) 199 end 200 if root ~= nil then 201 local child 202 while root:getChildCount()~=0 do 203 child = root:getChildAtIdx(0) 204 root:removeChildWindow(child) 205 newroot:addChildWindow(child) 206 end 207 winMgr:destroyWindow(root) 208 end 209 newroot:show() 210 root = newroot 211 end 212 213 function find(table, value) 214 local i=0 215 while table[i] ~= nil do 216 if table[i]==value then 217 return i 218 else 219 i=i+1 220 end 221 end 222 return nil 223 end 224 225 function test(e) 226 debug(0, "Blubb") 227 end -
code/trunk/data/gui/scripts/MainMenu.lua
r5781 r6417 12 12 P.layoutString = "MainMenu.layout" 13 13 14 function P:init() 15 listbox = winMgr:getWindow("orxonox/LevelListbox") 16 preselect = orxonox.LevelManager:getInstance():getDefaultLevel() 17 orxonox.LevelManager:getInstance():compileAvailableLevelList() 18 local levelList = {} 19 local index = 0 20 local level = "" 21 while true do 22 level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index) 23 if level == "" then 24 break 25 end 26 table.insert(levelList, level) 27 index = index + 1 28 end 29 table.sort(levelList) 30 for k,v in pairs(levelList) do 31 item = CEGUI.createListboxTextItem(v) 32 item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush") 33 CEGUI.toListbox(listbox):addItem(item) 34 if v .. ".oxw" == preselect then 35 listbox:setItemSelectState(item, true) 36 end 37 end 14 -- events for MainMenu 15 function P.QuickGameTestButton_clicked(e) 16 orxonox.execute("startGame") 38 17 end 39 18 40 41 -- events for mainmenu 42 function P.button_quit_clicked(e) 43 hideGUI() 44 orxonox.CommandExecutor:execute("exit") 19 function P.SingleplayerButton_clicked(e) 20 showGUI("SingleplayerMenu", true) 45 21 end 46 22 47 function P.button_standalone_clicked(e) 48 choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() 49 if choice then 50 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 51 orxonox.CommandExecutor:execute("startGame") 52 toggleGUI() 53 end 23 function P.MultiplayerButton_clicked(e) 24 showGUI("MultiplayerMenu", true) 54 25 end 55 26 56 function P.button_server_clicked(e) 57 choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() 58 if choice then 59 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 60 orxonox.CommandExecutor:execute("startServer") 61 toggleGUI() 62 end 27 function P.SettingsButton_clicked(e) 28 showGUI("SettingsMenu", true) 63 29 end 64 30 65 function P.button_dedicated_clicked(e) 66 choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() 67 if choice then 68 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 69 orxonox.CommandExecutor:execute("startDedicated") 70 toggleGUI() 71 end 31 function P.CreditsButton_clicked(e) 32 showGUI("CreditsMenu", true) 72 33 end 73 34 74 function P.button_client_clicked(e) 75 choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() 76 if choice then 77 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 78 orxonox.CommandExecutor:execute("startClient") 79 toggleGUI() 80 end 81 end 82 83 function P.listbox_level_selectionchanged(e) 84 if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then 85 winMgr:getWindow("orxonox/StandaloneButton"):enable() 86 else 87 winMgr:getWindow("orxonox/StandaloneButton"):disable() 88 end 35 function P.ExitButton_clicked(e) 36 orxonox.execute("exit") 89 37 end 90 38 -
code/trunk/data/gui/scripts/PickupInventory.lua
r5781 r6417 20 20 local equipCount = orxonox.PickupInventory:getEquipmentCount() 21 21 local usableCount = orxonox.PickupInventory:getUsableCount() 22 22 23 23 if equipCount ~= self.lastEquipmentCount_ or usableCount ~= self.lastUsableCount_ then 24 24 self:updateTabs() … … 39 39 local t = name:sub(25, 27) 40 40 local i = name:sub(29) 41 41 42 42 if t == "equ" then 43 43 44 44 end 45 45 46 46 if t == "use" then 47 47 if self.currentUsableID_ >= 0 then … … 60 60 orxonox.PickupInventory:getSingleton():clearInventory(winMgr, eqWin, usWin) 61 61 orxonox.PickupInventory:getSingleton():updateTabs(winMgr, eqWin, usWin) 62 62 63 63 self.currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex() 64 64 self.lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount() -
code/trunk/data/gui/scripts/QuestGUI.lua
r5781 r6417 15 15 16 16 local questManager = orxonox.QuestManager:getInstance() 17 17 18 18 local questsList = winMgr:getWindow("orxonox/QuestGUI/QuestsList") 19 19
Note: See TracChangeset
for help on using the changeset viewer.