[Orxonox-commit 1458] r6176 - code/branches/presentation2/data/gui/scripts
dafrick at orxonox.net
dafrick at orxonox.net
Sun Nov 29 13:36:13 CET 2009
Author: dafrick
Date: 2009-11-29 13:36:12 +0100 (Sun, 29 Nov 2009)
New Revision: 6176
Modified:
code/branches/presentation2/data/gui/scripts/InitialiseGUI.lua
code/branches/presentation2/data/gui/scripts/NewMultiplayerMenu.lua
code/branches/presentation2/data/gui/scripts/NewSingleplayerMenu.lua
Log:
Made NewMultiplayerMenu and NewSingleplayerMenu work. Also added hideALLGUIs functionality in InitialiseGUI
Modified: code/branches/presentation2/data/gui/scripts/InitialiseGUI.lua
===================================================================
--- code/branches/presentation2/data/gui/scripts/InitialiseGUI.lua 2009-11-28 22:28:51 UTC (rev 6175)
+++ code/branches/presentation2/data/gui/scripts/InitialiseGUI.lua 2009-11-29 12:36:12 UTC (rev 6176)
@@ -160,6 +160,12 @@
end
end
+function hideAllGUIs()
+ while nrOfActiveSheets ~= 0 do
+ hideGUI(activeSheets[nrOfActiveSheets])
+ end
+end
+
function keyESC()
if nrOfActiveSheets > 0 then
orxonox.CommandExecutor:execute("hideGUI "..activeSheets[nrOfActiveSheets])
Modified: code/branches/presentation2/data/gui/scripts/NewMultiplayerMenu.lua
===================================================================
--- code/branches/presentation2/data/gui/scripts/NewMultiplayerMenu.lua 2009-11-28 22:28:51 UTC (rev 6175)
+++ code/branches/presentation2/data/gui/scripts/NewMultiplayerMenu.lua 2009-11-29 12:36:12 UTC (rev 6176)
@@ -19,12 +19,12 @@
local index = 0
local level = ""
while true do
- level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
- if level == "" then
- break
- end
- table.insert(levelList, level)
- index = index + 1
+ level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
+ if level == "" then
+ break
+ end
+ table.insert(levelList, level)
+ index = index + 1
end
table.sort(levelList)
for k,v in pairs(levelList) do
@@ -37,18 +37,18 @@
end
local multiplayerMode = "startClient"
if multiplayerMode == "startClient" then
- window = winMgr:getWindow("orxonox/MultiplayerJoinButton")
- button = tolua.cast(window,"CEGUI::RadioButton")
+ window = winMgr:getWindow("orxonox/MultiplayerJoinButton")
+ button = tolua.cast(window,"CEGUI::RadioButton")
button:setSelected(true)
end
if multiplayerMode == "startServer" then
- window = winMgr:getWindow("orxonox/MultiplayerHostButton")
- button = tolua.cast(window,"CEGUI::RadioButton")
+ window = winMgr:getWindow("orxonox/MultiplayerHostButton")
+ button = tolua.cast(window,"CEGUI::RadioButton")
button:setSelected(true)
end
if multiplayerMode == "startDedicated" then
- window = winMgr:getWindow("orxonox/MultiplayerDedicatedButton")
- button = tolua.cast(window,"CEGUI::RadioButton")
+ window = winMgr:getWindow("orxonox/MultiplayerDedicatedButton")
+ button = tolua.cast(window,"CEGUI::RadioButton")
button:setSelected(true)
end
end
@@ -69,8 +69,13 @@
end
function P.MultiplayerStartButton_clicked(e)
- orxonox.CommandExecutor:execute(multiplayerMode)
- debug("event: start")
+ local choice = winMgr:getWindow("orxonox/MultiplayerLevelListbox"):getFirstSelectedItem()
+ if choice then
+ orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+ orxonox.CommandExecutor:execute(multiplayerMode)
+ hideAllGUIs()
+ debug("event: start")
+ end
end
function P.MultiplayerBackButton_clicked(e)
Modified: code/branches/presentation2/data/gui/scripts/NewSingleplayerMenu.lua
===================================================================
--- code/branches/presentation2/data/gui/scripts/NewSingleplayerMenu.lua 2009-11-28 22:28:51 UTC (rev 6175)
+++ code/branches/presentation2/data/gui/scripts/NewSingleplayerMenu.lua 2009-11-29 12:36:12 UTC (rev 6176)
@@ -38,8 +38,13 @@
end
function P.SingleplayerStartButton_clicked(e)
- -- start game
- debug("event: start")
+ choice = winMgr:getWindow("orxonox/SingleplayerLevelListbox"):getFirstSelectedItem()
+ if choice then
+ orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+ orxonox.CommandExecutor:execute("startGame")
+ hideAllGUIs()
+ debug("event: start")
+ end
end
function P.SingleplayerBackButton_clicked(e)
More information about the Orxonox-commit
mailing list