[Orxonox-commit 3045] r7741 - code/branches/presentation/data/gui/scripts

dafrick at orxonox.net dafrick at orxonox.net
Wed Dec 8 16:54:58 CET 2010


Author: dafrick
Date: 2010-12-08 16:54:58 +0100 (Wed, 08 Dec 2010)
New Revision: 7741

Modified:
   code/branches/presentation/data/gui/scripts/MultiplayerMenu.lua
Log:
Server discovery just once insetad of (redundantly) twice.


Modified: code/branches/presentation/data/gui/scripts/MultiplayerMenu.lua
===================================================================
--- code/branches/presentation/data/gui/scripts/MultiplayerMenu.lua	2010-12-08 15:39:04 UTC (rev 7740)
+++ code/branches/presentation/data/gui/scripts/MultiplayerMenu.lua	2010-12-08 15:54:58 UTC (rev 7741)
@@ -5,8 +5,8 @@
 P.buttonList = {}
 
 --joinMode is 1 for choice "LAN" and 2 for "Internet"
---initial status 0
-P.joinMode = 0
+--initial status 1
+P.joinMode = 1
 
 function P.onLoad()
     P.multiplayerMode = "startClient" 
@@ -32,21 +32,40 @@
 end
 
 function P.onShow()
-    P.showServerList()
+    --P.showServerList()
 
     --indices to iterate through buttonlist
     P.oldindex = -2
     P.index = -1
+    
+    if P.joinMode == 1 then
+        local window = winMgr:getWindow("orxonox/MultiplayerLanButton")
+        local button = tolua.cast(window,"CEGUI::RadioButton")
+        button:setSelected(true)
+    end
+    if P.joinMode == 2 then
+        local window = winMgr:getWindow("orxonox/MultiplayerInternetButton")
+        local button = tolua.cast(window,"CEGUI::RadioButton")
+        button:setSelected(true)
+    end
 end
 
 function P.LanButton_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local button = tolua.cast(we.window,"CEGUI::RadioButton")
     P.joinMode = 1
-	P.showServerList()
+    if button:isSelected() == true then
+	    P.showServerList()
+    end
 end
 
 function P.InternetButton_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local button = tolua.cast(we.window,"CEGUI::RadioButton")
     P.joinMode = 2
-	P.showServerList()
+    if button:isSelected() == true then
+	    P.showServerList()
+	end
 end
 
 function P.MultiplayerHostButton_clicked(e)




More information about the Orxonox-commit mailing list