[Orxonox-commit 3030] r7726 - code/trunk/data/gui/scripts

konrad at orxonox.net konrad at orxonox.net
Wed Dec 8 13:27:51 CET 2010


Author: konrad
Date: 2010-12-08 13:27:51 +0100 (Wed, 08 Dec 2010)
New Revision: 7726

Modified:
   code/trunk/data/gui/scripts/DecisionPopup.lua
   code/trunk/data/gui/scripts/GUITools.lua
   code/trunk/data/gui/scripts/InGameMenu.lua
Log:

decision popup in ingame menu has been changed


Modified: code/trunk/data/gui/scripts/DecisionPopup.lua
===================================================================
--- code/trunk/data/gui/scripts/DecisionPopup.lua	2010-12-06 20:14:27 UTC (rev 7725)
+++ code/trunk/data/gui/scripts/DecisionPopup.lua	2010-12-08 12:27:51 UTC (rev 7726)
@@ -2,6 +2,31 @@
 
 local P = createMenuSheet("DecisionPopup")
 
+P.buttonList = {}
+
+function P.onShow()
+    --indices to iterate through buttonlist
+    P.oldindex = -2
+    P.index = -1
+end
+
+function P.onLoad()
+
+    --button are arranged in a 1x2 matrix
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/DecisionPopup_button_yes"),
+            ["function"]  = P.button_yes
+    }
+    P.buttonList[1] = item
+
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/DecisionPopup_button_no"),
+            ["function"]  = P.button_no
+    }
+    P.buttonList[2] = item
+
+end
+
 function P.setCallback(functionPtr)
     P.functionPtr = functionPtr
 end
@@ -25,5 +50,9 @@
     hideMenuSheet("DecisionPopup")
 end
 
+function P.onKeyPressed() 
+    buttonIteratorHelper(P.buttonList, code, P, 1, 2)
+end
+
 return P
 

Modified: code/trunk/data/gui/scripts/GUITools.lua
===================================================================
--- code/trunk/data/gui/scripts/GUITools.lua	2010-12-06 20:14:27 UTC (rev 7725)
+++ code/trunk/data/gui/scripts/GUITools.lua	2010-12-08 12:27:51 UTC (rev 7726)
@@ -171,10 +171,11 @@
         local window = winMgr:getWindow("orxonox/MainMenuBackground")
 
         local item = list[P.index+1]
-        local child = item["button"] 
+        local child = item["button"]
+        local s = child:getProperty("NormalImageRightEdge") 
 
         --teste ob der Button nicht schon gehighlightet ist
-        if child:getProperty("NormalImageRightEdge") == "set:TaharezGreenLook image:ButtonRightHighlight" then
+        if string.sub(s,string.len(s)-8,string.len(s)) == "Highlight" then
             --nop
         else
             child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-7) .. "Highlight")
@@ -200,7 +201,8 @@
                 if list[i] ~= nil then 
                 local item = list[i]
                 local child = item["button"]
-                    if child:getProperty("NormalImageRightEdge") == "set:TaharezGreenLook image:ButtonRightHighlight" then
+                local s = child:getProperty("NormalImageRightEdge")
+                    if string.sub(s,string.len(s)-8,string.len(s)) == "Highlight" then
                         child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-10) .. "Normal")
                         child:setProperty("NormalImageLeftEdge", string.sub(child:getProperty("NormalImageLeftEdge"),1,-10) .. "Normal")
                         child:setProperty("NormalImageBackground", string.sub(child:getProperty("NormalImageBackground"),1,-10) .. "Normal")
@@ -209,10 +211,10 @@
             end
                 i=i+1
         end
-    end
-    
+    end  
+
     --enter
-    if code == "28" and P.index >= 0 then
+    if code == "28" then
         local item = list[P.index+1]
         local child = item["button"] 
         child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-10) .. "Normal")

Modified: code/trunk/data/gui/scripts/InGameMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/InGameMenu.lua	2010-12-06 20:14:27 UTC (rev 7725)
+++ code/trunk/data/gui/scripts/InGameMenu.lua	2010-12-08 12:27:51 UTC (rev 7726)
@@ -3,6 +3,44 @@
 local P = createMenuSheet("InGameMenu")
 P.loadAlong = { "DecisionPopup" }
 
+P.buttonList = {}
+
+function P.onLoad()
+    P.multiplayerMode = "startClient" 
+
+    --button are arranged in a 4x1 matrix, the left lower item is nil
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/InGameMenu_ReturnButton"),
+            ["function"]  = P.button_settings_clicked
+    }
+    P.buttonList[1] = item
+
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/InGameMenu_MainMenuButton"),
+            ["function"]  = P.button_mainmenu_clicked
+    }
+    P.buttonList[2] = item
+
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/InGameMenu_SettingsButton"),
+            ["function"]  = P.button_settings_clicked
+    }
+    P.buttonList[3] = item
+
+    local item = {
+            ["button"] = winMgr:getWindow("orxonox/InGameMenu_QuitButton"),
+            ["function"]  = P.button_quit_clicked
+    }
+    P.buttonList[4] = item
+
+end
+
+function P.onShow()
+    --indices to iterate through buttonlist
+    P.oldindex = -2
+    P.index = -1
+end
+
 -- events for ingamemenu
 function P.button_quit_clicked(e)
     openDecisionPopup( "Do you really want to quit the game?", InGameMenu.callback )
@@ -26,8 +64,14 @@
     if doExit then
         hideMenuSheet("InGameMenu")
         orxonox.execute("exit")
+    else 
+        P.onShow()
     end
 end
 
+function P.onKeyPressed() 
+    buttonIteratorHelper(P.buttonList, code, P, 4, 1)
+end
+
 return P
 




More information about the Orxonox-commit mailing list