[Orxonox-commit 460] r2157 - media/gui/scripts

bknecht at orxonox.net bknecht at orxonox.net
Sun May 24 02:39:59 CEST 2009


Author: bknecht
Date: 2009-05-24 02:39:59 +0200 (Sun, 24 May 2009)
New Revision: 2157

Modified:
   media/gui/scripts/mainmenu_2.lua
Log:
lua code to upgrade the mainmenu

Modified: media/gui/scripts/mainmenu_2.lua
===================================================================
--- media/gui/scripts/mainmenu_2.lua	2009-05-23 15:22:46 UTC (rev 2156)
+++ media/gui/scripts/mainmenu_2.lua	2009-05-24 00:39:59 UTC (rev 2157)
@@ -9,11 +9,15 @@
 
 function P:init()
     listbox = winMgr:getWindow("orxonox/LevelListbox")
-    orxonox.GUIManager:getInstance():getLevelList()
+    preselect = orxonox.Game:getInstance():getLevel()
+    orxonox.GUIManager:getInstance():getLevelList() --levellist variable ist set now
     for k,v in pairs(levellist) do
-        item = CEGUI.createListboxTextItem(v)
+        item = CEGUI.createListboxTextItem(v)        
         item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
         CEGUI.toListbox(listbox):addItem(item)
+        if v .. ".oxw" == preselect then
+            listbox:setItemSelectState(item, true)
+        end
     end
 end
 
@@ -27,7 +31,7 @@
 function P.button_standalone_clicked(e)
     choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
     if choice then
-        orxonox.CommandExecutor:execute("setLevel " .. choice:getText() .. ".oxw")
+        orxonox.Game:getInstance():setLevel(choice:getText() .. ".oxw")
         orxonox.CommandExecutor:execute("startGame")
         toggleGUI()
     end




More information about the Orxonox-commit mailing list