Changeset 6746 for code/trunk/data/gui/scripts
- Timestamp:
- Apr 16, 2010, 2:50:16 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 1 deleted
- 20 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/data/gui/scripts/AudioMenu.lua
r6417 r6746 1 1 -- AudioMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 AudioMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 3 local P = createMenuSheet("AudioMenu") 10 4 11 P.filename = "AudioMenu" 12 P.layoutString = "AudioMenu.layout" 13 14 function P:init() 5 function P.onLoad() 15 6 soundMgr = orxonox.SoundManager:getInstance() 16 7 block = false … … 43 34 for k,v in pairs(themeList) do 44 35 item = CEGUI.createListboxTextItem(v) 45 item:setSelectionBrushImage( "TaharezLook", "MultiListSelectionBrush")36 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 46 37 CEGUI.toListbox(listboxwindow):addItem(item) 47 38 end … … 178 169 179 170 function P.AudioBackButton_clicked(e) 180 hide GUI(P.filename)171 hideMenuSheet(P.name) 181 172 end 182 173 -
code/trunk/data/gui/scripts/ControlsMenu.lua
r6417 r6746 1 1 -- ControlsMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 ControlsMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 10 11 P.filename = "ControlsMenu" 12 P.layoutString = "ControlsMenu.layout" 3 local P = createMenuSheet("ControlsMenu") 13 4 14 5 function P.ControlsMouseControlsButton_clicked(e) 15 show GUI("MouseControlsMenu", true)6 showMenuSheet("MouseControlsMenu", true) 16 7 end 17 8 18 9 function P.ControlsKeyboardControlsButton_clicked(e) 19 show GUI("KeyBindMenu", true)10 showMenuSheet("KeyBindMenu", true) 20 11 end 21 12 22 13 function P.ControlsBackButton_clicked(e) 23 hide GUI(P.filename)14 hideMenuSheet(P.name) 24 15 end 25 16 -
code/trunk/data/gui/scripts/CreditsMenu.lua
r6417 r6746 1 1 -- CreditsMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 CreditsMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 10 11 P.filename = "CreditsMenu" 12 P.layoutString = "CreditsMenu.layout" 3 local P = createMenuSheet("CreditsMenu") 13 4 14 5 function P.CreditsBackButton_clicked(e) 15 hide GUI(P.filename)6 hideMenuSheet(P.name) 16 7 end 17 8 -
code/trunk/data/gui/scripts/DecisionPopup.lua
r6417 r6746 1 1 -- DecisionPopup.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 DecisionPopup = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 10 11 P.filename = "DecisionPopup" 12 P.layoutString = "DecisionPopup.layout" 13 14 function P:init() 15 end 3 local P = createMenuSheet("DecisionPopup") 16 4 17 5 function P.setCallback(functionPtr) … … 28 16 P.functionPtr(true) 29 17 end 30 hide GUI("DecisionPopup")18 hideMenuSheet("DecisionPopup") 31 19 end 32 20 … … 35 23 P.functionPtr(false) 36 24 end 37 hide GUI("DecisionPopup")25 hideMenuSheet("DecisionPopup") 38 26 end 39 27 -
code/trunk/data/gui/scripts/GUITools.lua
r6417 r6746 1 -- Returns a new menu sheet 2 -- See MenuSheet.new for details about the parameters 3 function createMenuSheet(name, bHidePrevious, tShowCursor, tUseKeyboard, bBlockJoyStick) 4 local sheet = require("MenuSheet").new(name, bHidePrevious, tShowCursor, tUseKeyboard, bBlockJoyStick) 5 _G[sheet.name] = sheet -- Global access required because of the event handlers 6 return sheet 7 end 8 9 -- Returns a new HUD sheet 10 function createHUDSheet(name) 11 local sheet = require("HUDSheet").new(name) 12 _G[sheet.name] = sheet -- Global access required because of the event handlers 13 return sheet 14 end 15 1 16 function openDecisionPopup( text, callbackPtr ) 2 show GUI("DecisionPopup", false, true)17 showMenuSheet("DecisionPopup", false, true) 3 18 DecisionPopup.setCallback(callbackPtr) 4 19 DecisionPopup.setText(text) … … 6 21 7 22 function openInfoPopup(text, functionPtr, closeButton, arguments) 8 show GUI("InfoPopup", false, true)23 showMenuSheet("InfoPopup", false, true) 9 24 InfoPopup.execute(functionPtr, arguments) 10 25 InfoPopup.setText(text) -
code/trunk/data/gui/scripts/GameplayMenu.lua
r6417 r6746 1 1 -- GameplayMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 GameplayMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 3 local P = createMenuSheet("GameplayMenu") 10 4 11 P.filename = "GameplayMenu" 12 P.layoutString = "GameplayMenu.layout" 13 14 function P:init() 5 function P.onLoad() 15 6 dropdown = winMgr:getWindow("orxonox/ThemeCombobox") 16 7 local themeList = {} … … 20 11 for k,v in pairs(themeList) do 21 12 item = CEGUI.createListboxTextItem(v) 22 item:setSelectionBrushImage( "TaharezLook", "MultiListSelectionBrush")13 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 23 14 CEGUI.toCombobox(dropdown):addItem(item) 24 15 end … … 27 18 function P.GameplayThemeCombobox_changed(e) 28 19 -- theme 29 debug("event: theme")20 logMessage(0, "event: theme") 30 21 end 31 22 32 23 function P.GameplayDifficultyEasyButton_clicked(e) 33 24 -- difficulty easy 34 debug("event: easy")25 logMessage(0, "event: easy") 35 26 end 36 27 37 28 function P.GameplayDifficultyNormalButton_clicked(e) 38 29 -- difficulty normal 39 debug("event: normal")30 logMessage(0, "event: normal") 40 31 end 41 32 42 33 function P.GameplayDifficultyHardButton_clicked(e) 43 34 -- difficulty hard 44 debug("event: hard")35 logMessage(0, "event: hard") 45 36 end 46 37 47 38 function P.GameplayBackButton_clicked(e) 48 hide GUI(P.filename)39 hideMenuSheet(P.name) 49 40 end 50 41 -
code/trunk/data/gui/scripts/GraphicsMenu.lua
r6417 r6746 1 1 -- GraphicsMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 GraphicsMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 3 local P = createMenuSheet("GraphicsMenu") 10 4 11 P.filename = "GraphicsMenu" 12 P.layoutString = "GraphicsMenu.layout" 13 14 function P:init() 5 function P.onLoad() 15 6 block = true 16 7 file = orxonox.PathConfig:getConfigPathString() .. orxonox.getConfig("GraphicsManager", "ogreConfigFile_") … … 62 53 for k,v in pairs(resolutionList) do 63 54 item = CEGUI.createListboxTextItem(v) 64 item:setSelectionBrushImage( "TaharezLook", "MultiListSelectionBrush")55 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 65 56 CEGUI.toListbox(listboxwindow):addItem(item) 66 57 end … … 152 143 if scrollbar_active == false then 153 144 -- brightness 154 debug("event: brightness")145 logMessage(0, "event: brightness") 155 146 end 156 147 end … … 162 153 function P.GraphicsBrightnessScrollbar_ended(e) 163 154 -- brightness 164 debug("event: brightness")155 logMessage(0, "event: brightness") 165 156 scrollbar_active = false 166 157 end … … 201 192 202 193 function P.GraphicsBackButton_clicked(e) 203 hide GUI(P.filename)194 hideMenuSheet(P.name) 204 195 end 205 196 -
code/trunk/data/gui/scripts/InGameMenu.lua
r6417 r6746 1 1 -- InGameMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 InGameMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 10 11 P.filename = "InGameMenu" 12 P.layoutString = "InGameMenu.layout" 13 14 function P:init() 15 end 16 3 local P = createMenuSheet("InGameMenu") 17 4 18 5 -- events for ingamemenu … … 25 12 orxonox.Game:getInstance():popState() 26 13 orxonox.Game:getInstance():requestState("mainmenu") 27 hide GUI("InGameMenu")14 hideMenuSheet("InGameMenu") 28 15 end 29 16 30 17 function P.button_settings_clicked(e) 31 show GUI("SettingsMenu", true)18 showMenuSheet("SettingsMenu", true) 32 19 end 33 20 34 21 function P.button_return_clicked(e) 35 hide GUI("InGameMenu")22 hideMenuSheet("InGameMenu") 36 23 end 37 24 38 25 function P.callback(doExit) 39 26 if doExit then 40 hide GUI("InGameMenu")27 hideMenuSheet("InGameMenu") 41 28 orxonox.execute("exit") 42 29 end -
code/trunk/data/gui/scripts/InfoPopup.lua
r6417 r6746 1 1 -- InfoPopup.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 6 if _REQUIREDNAME == nil then 7 InfoPopup = P 8 else 9 _G[_REQUIREDNAME] = P 10 end 11 12 P.filename = "InfoPopup" 13 P.layoutString = "InfoPopup.layout" 14 15 function P:init() 16 end 3 local P = createMenuSheet("InfoPopup") 17 4 18 5 function P.execute(functionPtr, arguments) … … 26 13 end 27 14 28 function P.setText( text)15 function P.setText(text) 29 16 winMgr:getWindow("orxonox/InfoPopup_text"):setText( text ) 30 17 end … … 42 29 -- events for ingamemenu 43 30 function P.close(e) 44 hide GUI("InfoPopup")31 hideMenuSheet(P.name) 45 32 end 46 33 -
code/trunk/data/gui/scripts/InitialiseGUI.lua
r6711 r6746 1 local schemeMgr = CEGUI.SchemeManager:getSingleton() 2 winMgr = CEGUI.WindowManager:getSingleton()3 local logger = CEGUI.Logger:getSingleton()4 local system = CEGUI.System:getSingleton()5 local cursor = CEGUI.MouseCursor:getSingleton()1 -- Define some global shortcuts for common Managers 2 guiMgr = orxonox.GUIManager:getInstance() 3 inputMgr = orxonox.InputManager:getInstance() 4 schemeMgr = CEGUI.SchemeManager:getSingleton() 5 winMgr = CEGUI.WindowManager:getSingleton() 6 6 7 schemeMgr:loadScheme("TaharezLookSkin.scheme") 8 -- load scheme with our own images 7 -- Load all required skins 8 schemeMgr:loadScheme("TaharezGreenLook.scheme") 9 --schemeMgr:loadScheme("TaharezLook.scheme") 10 --schemeMgr:loadScheme("WindowsLook.scheme") 11 --schemeMgr:loadScheme("VanillaLook.scheme") 12 --schemeMgr:loadScheme("SleekSpaceLook.scheme") 13 14 -- Connect skin specific window types with our own window types 15 -- By loading a different file (if there is) you can change the skin 16 -- of the menus or the HUD independently 17 schemeMgr:loadScheme("TaharezGreenMenuWidgets.scheme") 18 menuImageSet = "TaharezGreenLook" 19 schemeMgr:loadScheme("TaharezGreenHUDWidgets.scheme") 20 hudImageSet = "TaharezGreenLook" 21 22 -- Just a remaining test hack 9 23 schemeMgr:loadScheme("OrxonoxGUIScheme.scheme") 10 24 11 system:setDefaultMouseCursor("TaharezLook", "MouseArrow") 25 local system = CEGUI.System:getSingleton() 26 system:setDefaultMouseCursor(menuImageSet, "MouseArrow") 12 27 system:setDefaultFont("BlueHighway-12") 13 system:setDefaultTooltip(" TaharezLook/Tooltip")28 system:setDefaultTooltip("MenuWidgets/Tooltip") 14 29 15 loadedGUIs = {} 16 cursorVisibility = {} 17 activeSheets = {} 18 nrOfActiveSheets = 0 19 root = nil 20 bShowsCursor = false 21 bHidePrevious = {} 22 23 -- Require all tools 30 -- Convenience function and additional tools 24 31 require("GUITools") 25 26 -- loads the GUI with the specified filename27 -- be sure to set the global variable "filename" before calling this function28 function loadGUI(filename)29 -- check if it already exists30 loadedGui = loadedGUIs[filename]31 if loadedGui == nil then32 loadedGuiNS = require(filename)33 if loadedGuiNS == nil then34 return35 end36 loadedGui = loadedGuiNS:load()37 loadedGUIs[filename] = loadedGui38 -- if there has no GUI been loaded yet, set new GUI as current39 if table.getn(loadedGUIs) == 1 then40 current = loadedGUIs[1]41 end42 -- hide new GUI as we do not want to show it accidentially43 loadedGui:hide()44 end45 return loadedGui46 end47 48 function showGUI(filename, hidePrevious, bCursorVisible, ptr)49 gui = showGUI(filename, hidePrevious, bCursorVisible)50 gui.overlay = ptr51 end52 53 -- shows the specified and loads it if not loaded already54 -- be sure to set the global variable "filename" before calling this function55 function showGUI(filename, hidePrevious, bCursorVisible)56 if bCursorVisible == nil then57 if nrOfActiveSheets > 0 then58 bCursorVisible = cursorVisibility[activeSheets[nrOfActiveSheets]]59 else60 bCursorVisible = true61 end62 end63 64 if root == nil then65 setBackground("")66 end67 68 local currentGUI = loadedGUIs[filename]69 if(currentGUI == nil) then70 currentGUI = loadGUI(filename)71 end72 73 if(root:isChild(currentGUI.window)) then74 root:removeChildWindow(currentGUI.window)75 end76 root:addChildWindow(currentGUI.window)77 78 if bCursorVisible then79 showCursor()80 else81 hideCursor()82 end83 84 if find( activeSheets, filename ) ~= nil then85 table.remove( activeSheets, find( activeSheets, filename ) )86 nrOfActiveSheets = nrOfActiveSheets - 187 else88 if nrOfActiveSheets == 0 then89 orxonox.InputManager:getInstance():enterState("guiMouseOnly")90 orxonox.HumanController:pauseControl()91 end92 end93 nrOfActiveSheets = nrOfActiveSheets + 194 table.insert(activeSheets, filename)95 activeSheets[nrOfActiveSheets] = filename96 bHidePrevious[filename]=hidePrevious97 cursorVisibility[filename] = bCursorVisible98 99 if hidePrevious == true then100 for i=1,nrOfActiveSheets-1 do101 loadedGUIs[ activeSheets[i] ]:hide()102 end103 end104 currentGUI:show()105 return currentGUI106 end107 108 function hideCursor()109 if bShowsCursor==true then110 bShowsCursor=false111 cursor:hide()112 end113 end114 115 function showCursor()116 if bShowsCursor==false then117 bShowsCursor=true118 cursor:show()119 end120 end121 122 function hideGUI(filename)123 local currentGUI = loadedGUIs[filename]124 if currentGUI == nil then125 return126 end127 currentGUI:hide()128 if bHidePrevious[filename] == true then129 local i = nrOfActiveSheets-1130 while i>0 do131 loadedGUIs[ activeSheets[i] ]:show()132 if bHidePrevious[filename]==true then133 break134 else135 i=i-1136 end137 end138 end139 root:removeChildWindow(currentGUI.window)140 local i=1141 while activeSheets[i] do142 if activeSheets[i+1] == nil then143 if activeSheets[i-1] ~= nil then144 if cursorVisibility[ activeSheets[i-1] ] == true then145 showCursor()146 else147 hideCursor()148 end149 else150 hideCursor()151 end152 end153 if activeSheets[i] == filename then154 table.remove( activeSheets, i )155 nrOfActiveSheets = nrOfActiveSheets-1156 else157 i = i+1158 end159 end160 cursorVisibility[filename] = nil -- remove the cursor visibility of the current gui from the table161 bHidePrevious[filename] = nil162 if nrOfActiveSheets == 0 then163 orxonox.InputManager:getInstance():leaveState("guiMouseOnly")164 orxonox.HumanController:resumeControl()165 hideCursor()166 end167 end168 169 function hideAllGUIs()170 while nrOfActiveSheets ~= 0 do171 hideGUI(activeSheets[nrOfActiveSheets])172 end173 end174 175 function keyESC()176 if nrOfActiveSheets == 1 and activeSheets[1] == "MainMenu" then177 orxonox.execute("exit")178 elseif nrOfActiveSheets > 0 then179 orxonox.execute("hideGUI "..activeSheets[nrOfActiveSheets])180 else181 showGUI("InGameMenu")182 end183 end184 185 function setBackground(filename)186 local newroot187 if root ~= nil then188 root:rename("oldRootWindow")189 end190 if filename ~= "" then191 newroot = winMgr:loadWindowLayout(filename .. ".layout")192 newroot:rename("AbsoluteRootWindow")193 system:setGUISheet(newroot)194 else195 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 end200 if root ~= nil then201 local child202 while root:getChildCount()~=0 do203 child = root:getChildAtIdx(0)204 root:removeChildWindow(child)205 newroot:addChildWindow(child)206 end207 winMgr:destroyWindow(root)208 end209 newroot:show()210 root = newroot211 end212 213 function find(table, value)214 local i=0215 while table[i] ~= nil do216 if table[i]==value then217 return i218 else219 i=i+1220 end221 end222 return nil223 end224 225 --TODO: Needed?226 function test(e)227 debug(0, "Blubb")228 end -
code/trunk/data/gui/scripts/KeyBindMenu.lua
r6549 r6746 1 1 -- KeyBindMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 6 if _REQUIREDNAME == nil then 7 KeyBindMenu = P 8 else 9 _G[_REQUIREDNAME] = P 10 end 11 12 P.filename = "KeyBindMenu" 13 P.layoutString = "KeyBindMenu.layout" 14 15 function P:init() 3 local P = createMenuSheet("KeyBindMenu") 4 5 function P.onLoad() 16 6 17 7 commandList = {} … … 68 58 69 59 --Calculate design parameters: 70 sampleWindow = winMgr:createWindow(" TaharezLook/StaticText", "orxonox/KeyBindPane/SampleWindow")60 sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/KeyBindPane/SampleWindow") 71 61 sampleWindow:setText("SampleText") 72 62 … … 125 115 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, lineHeight*(k-1)))) 126 116 127 local command = winMgr:createWindow(" TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")117 local command = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command") 128 118 command:setText(nameList[k]) 129 119 command:setSize(CEGUI.UVector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0))) … … 132 122 offset = offset + commandWidth + spaceWidth 133 123 134 local plus = winMgr:createWindow(" TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus")124 local plus = winMgr:createWindow("MenuWidgets/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus") 135 125 plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, addWidth), CEGUI.UDim(0.7, 0))) 136 126 plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 137 127 plus:setText("add") 138 orxonox.GUIManager:subscribeEventHelper(plus, "Clicked", P. filename .. ".KeyBindPlus_clicked")128 orxonox.GUIManager:subscribeEventHelper(plus, "Clicked", P.name .. ".KeyBindPlus_clicked") 139 129 line:addChildWindow(plus) 140 130 offset = offset + addWidth + spaceWidth … … 142 132 local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(commandList[k]); 143 133 for i=0,(numButtons-1) do 144 local button = winMgr:createWindow(" TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i)134 local button = winMgr:createWindow("MenuWidgets/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i) 145 135 local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i) 146 136 name = P.KeyNameNiceifier(name) … … 151 141 button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0))) 152 142 button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 153 orxonox.GUIManager:subscribeEventHelper(button, "Clicked", P. filename .. ".KeyBindButton_clicked")154 --button:subscribeScriptedEvent("EventClicked", P. filename .. ".KeyBindButton_clicked")143 orxonox.GUIManager:subscribeEventHelper(button, "Clicked", P.name .. ".KeyBindButton_clicked") 144 --button:subscribeScriptedEvent("EventClicked", P.name .. ".KeyBindButton_clicked") 155 145 line:addChildWindow(button) 156 146 offset = offset + buttonWidth 157 147 158 local clear = winMgr:createWindow(" TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i)148 local clear = winMgr:createWindow("MenuWidgets/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i) 159 149 clear:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0))) 160 150 clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0))) 161 151 clear:setText("X") 162 orxonox.GUIManager:subscribeEventHelper(clear, "Clicked", P. filename .. ".KeyBindClear_clicked")152 orxonox.GUIManager:subscribeEventHelper(clear, "Clicked", P.name .. ".KeyBindClear_clicked") 163 153 line:addChildWindow(clear) 164 154 offset = offset + clearWidth + spaceWidth … … 254 244 255 245 function P.KeyBindBackButton_clicked(e) 256 hide GUI("KeyBindMenu")246 hideMenuSheet("KeyBindMenu") 257 247 end 258 248 -
code/trunk/data/gui/scripts/MainMenu.lua
r6417 r6746 1 1 -- MainMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 MainMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 10 11 P.filename = "MainMenu" 12 P.layoutString = "MainMenu.layout" 3 local P = createMenuSheet("MainMenu") 13 4 14 5 -- events for MainMenu … … 18 9 19 10 function P.SingleplayerButton_clicked(e) 20 show GUI("SingleplayerMenu", true)11 showMenuSheet("SingleplayerMenu", true) 21 12 end 22 13 23 14 function P.MultiplayerButton_clicked(e) 24 show GUI("MultiplayerMenu", true)15 showMenuSheet("MultiplayerMenu", true) 25 16 end 26 17 27 18 function P.SettingsButton_clicked(e) 28 show GUI("SettingsMenu", true)19 showMenuSheet("SettingsMenu", true) 29 20 end 30 21 31 22 function P.CreditsButton_clicked(e) 32 show GUI("CreditsMenu", true)23 showMenuSheet("CreditsMenu", true) 33 24 end 34 25 -
code/trunk/data/gui/scripts/MouseControlsMenu.lua
r6417 r6746 1 1 -- MouseControlsMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 MouseControlsMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 3 local P = createMenuSheet("MouseControlsMenu") 10 4 11 P.filename = "MouseControlsMenu" 12 P.layoutString = "MouseControlsMenu.layout" 13 14 function P:init() 5 function P.onLoad() 15 6 block = false 16 7 mousenormalscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MouseNormalScrollbar"),"CEGUI::Scrollbar") … … 104 95 105 96 function P.MouseControlsBackButton_clicked(e) 106 hide GUI(P.filename)97 hideMenuSheet(P.name) 107 98 end 108 99 -
code/trunk/data/gui/scripts/MultiplayerMenu.lua
r6417 r6746 1 1 -- MultiplayerMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 MultiplayerMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 3 local P = createMenuSheet("MultiplayerMenu") 10 4 11 P.filename = "MultiplayerMenu" 12 P.layoutString = "MultiplayerMenu.layout" 13 14 function P:init() 5 function P.onLoad() 15 6 listbox = winMgr:getWindow("orxonox/MultiplayerLevelListbox") 16 7 preselect = orxonox.LevelManager:getInstance():getDefaultLevel() … … 30 21 for k,v in pairs(levelList) do 31 22 item = CEGUI.createListboxTextItem(v) 32 item:setSelectionBrushImage( "TaharezLook", "MultiListSelectionBrush")23 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 33 24 CEGUI.toListbox(listbox):addItem(item) 34 25 if v .. ".oxw" == preselect then … … 71 62 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 72 63 orxonox.execute(multiplayerMode) 73 hideAll GUIs()64 hideAllMenuSheets() 74 65 end 75 66 end 76 67 77 68 function P.MultiplayerBackButton_clicked(e) 78 hide GUI(P.filename)69 hideMenuSheet(P.name) 79 70 end 80 71 -
code/trunk/data/gui/scripts/MultiplayerOptionsMenu.lua
r6417 r6746 1 1 -- MultiplayerOptionsMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 MultiplayerOptionsMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 10 11 P.filename = "MultiplayerOptionsMenu" 12 P.layoutString = "MultiplayerOptionsMenu.layout" 3 local P = createMenuSheet("MultiplayerOptionsMenu") 13 4 14 5 function P.MultiplayerOptionsBackButton_clicked(e) 15 hide GUI(P.filename)6 hideMenuSheet(P.name) 16 7 end 17 8 -
code/trunk/data/gui/scripts/PickupInventory.lua
r6711 r6746 1 1 -- PickupInventory.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 6 if _REQUIREDNAME == nil then 7 PickupInventory = P 8 else 9 _G[_REQUIREDNAME] = P 10 end 11 12 P.filename = "PickupInventory" 13 P.layoutString = "PickupInventory.layout" 3 local P = createMenuSheet("PickupInventory") 14 4 15 5 P.carrierList = {} … … 17 7 P.detailsWindows = {} 18 8 19 function P. init()9 function P.onLoad() 20 10 carrierList = {} 21 11 end … … 23 13 function P.show() 24 14 P.window:show() -- TODO: Do this through parent... 25 P. visible = true15 P.bVisible = true 26 16 27 17 P.createInventory() … … 137 127 useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, textHeight))) 138 128 useButton:setText("use") 139 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P. filename .. ".InventoryUseButton_clicked")129 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseButton_clicked") 140 130 item:addChildWindow(useButton) 141 131 … … 144 134 dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, textHeight))) 145 135 dropButton:setText("drop") 146 orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P. filename .. ".InventoryDropButton_clicked")136 orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.name .. ".InventoryDropButton_clicked") 147 137 item:addChildWindow(dropButton) 148 138 … … 151 141 detailsButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, textHeight))) 152 142 detailsButton:setText("details") 153 orxonox.GUIManager:subscribeEventHelper(detailsButton, "Clicked", P. filename .. ".InventoryDetailsButton_clicked")143 orxonox.GUIManager:subscribeEventHelper(detailsButton, "Clicked", P.name .. ".InventoryDetailsButton_clicked") 154 144 item:addChildWindow(detailsButton) 155 145 end … … 201 191 local window = winMgr:createWindow("TaharezLook/FrameWindow", name) 202 192 window:setSize(CEGUI.UVector2(CEGUI.UDim(0.5,0),CEGUI.UDim(0.4,0))) 203 orxonox.GUIManager:subscribeEventHelper(window, "CloseClicked", P. filename .. ".closeDetailWindow")193 orxonox.GUIManager:subscribeEventHelper(window, "CloseClicked", P.name .. ".closeDetailWindow") 204 194 205 195 local root = winMgr:getWindow("orxonox/PickupInventory/Background") … … 240 230 useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, titleHeight))) 241 231 useButton:setText("use") 242 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P. filename .. ".InventoryUseButton_clicked")232 orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseButton_clicked") 243 233 wrapper:addChildWindow(useButton) 244 234 … … 247 237 dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0, titleHeight))) 248 238 dropButton:setText("drop") 249 orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P. filename .. ".InventoryDropButton_clicked")239 orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.name .. ".InventoryDropButton_clicked") 250 240 wrapper:addChildWindow(dropButton) 251 241 -
code/trunk/data/gui/scripts/QuestGUI.lua
r6711 r6746 1 gui = require("BasicGUI") 2 local P = BasicGUI:new() --inherit everything from the gui package 3 if _REQUIREDNAME == nil then 4 QuestGUI = P 5 else 6 _G[_REQUIREDNAME] = P 7 end 1 -- QuestGUI.lua 8 2 9 P.filename = "QuestGUI" 10 P.layoutString = "QuestGUI.layout" 3 local P = createMenuSheet("QuestGUI") 11 4 12 function P :show()13 self.window:show() -- TODO: Do this through parent...14 self.visible = true5 function P.show() 6 P.window:show() -- TODO: Do this through parent... 7 P.visible = true 15 8 16 9 local questManager = orxonox.QuestManager:getInstance() … … 18 11 local questsList = winMgr:getWindow("orxonox/QuestGUI/QuestsList") 19 12 20 local window = questManager:getQuestGUI(P. filename)13 local window = questManager:getQuestGUI(P.name) 21 14 22 15 questsList:addChildWindow(window) -
code/trunk/data/gui/scripts/SettingsMenu.lua
r6417 r6746 1 1 -- SettingsMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 SettingsMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 10 11 P.filename = "SettingsMenu" 12 P.layoutString = "SettingsMenu.layout" 3 local P = createMenuSheet("SettingsMenu") 13 4 14 5 function P.SettingsGameplayButton_clicked(e) 15 show GUI("GameplayMenu", true)6 showMenuSheet("GameplayMenu", true) 16 7 end 17 8 18 9 function P.SettingsMultiplayerOptionsButton_clicked(e) 19 show GUI("MultiplayerOptionsMenu", true)10 showMenuSheet("MultiplayerOptionsMenu", true) 20 11 end 21 12 22 13 function P.SettingsControlsButton_clicked(e) 23 show GUI("ControlsMenu", true)14 showMenuSheet("ControlsMenu", true) 24 15 end 25 16 26 17 function P.SettingsGraphicsButton_clicked(e) 27 show GUI("GraphicsMenu", true)18 showMenuSheet("GraphicsMenu", true) 28 19 end 29 20 30 21 function P.SettingsAudioButton_clicked(e) 31 show GUI("AudioMenu", true)22 showMenuSheet("AudioMenu", true) 32 23 end 33 24 34 25 function P.SettingsResetSettingsButton_clicked(e) 35 26 -- reset settings 36 debug("event: reset settings")27 logMessage(0, "event: reset settings") 37 28 end 38 29 39 30 function P.SettingsBackButton_clicked(e) 40 hide GUI(P.filename)31 hideMenuSheet(P.name) 41 32 end 42 33 -
code/trunk/data/gui/scripts/SingleplayerMenu.lua
r6417 r6746 1 1 -- SingleplayerMenu.lua 2 2 3 BasicGUI = require("BasicGUI") 4 local P = BasicGUI:new() --inherit everything from the gui package 5 if _REQUIREDNAME == nil then 6 SingleplayerMenu = P 7 else 8 _G[_REQUIREDNAME] = P 9 end 3 local P = createMenuSheet("SingleplayerMenu") 10 4 11 P.filename = "SingleplayerMenu" 12 P.layoutString = "SingleplayerMenu.layout" 13 14 function P:init() 5 function P.onLoad() 15 6 listbox = winMgr:getWindow("orxonox/SingleplayerLevelListbox") 16 7 preselect = orxonox.LevelManager:getInstance():getDefaultLevel() … … 30 21 for k,v in pairs(levelList) do 31 22 item = CEGUI.createListboxTextItem(v) 32 item:setSelectionBrushImage( "TaharezLook", "MultiListSelectionBrush")23 item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") 33 24 CEGUI.toListbox(listbox):addItem(item) 34 25 if v .. ".oxw" == preselect then … … 43 34 orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") 44 35 orxonox.execute("startGame") 45 hideAll GUIs()36 hideAllMenuSheets() 46 37 end 47 38 end 48 39 49 40 function P.SingleplayerBackButton_clicked(e) 50 hide GUI(P.filename)41 hideMenuSheet(P.name) 51 42 end 52 43
Note: See TracChangeset
for help on using the changeset viewer.