Changeset 7663 for code/branches/menu/data/gui/scripts/MainMenu.lua
- Timestamp:
- Nov 24, 2010, 3:33:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/menu/data/gui/scripts/MainMenu.lua
r7608 r7663 4 4 P.loadAlong = { "SingleplayerMenu", "MultiplayerMenu", "SettingsMenu", "CreditsMenu" } 5 5 6 P.index = 0 6 P.buttonList = {} 7 8 P.testArray = {} 9 10 11 function P.onLoad() 12 local item = { 13 ["button"] = winMgr:getWindow("orxonox/QuickGameTestButton"), 14 ["function"] = P.QuickGameTestButton_clicked 15 } 16 table.insert(P.buttonList,item) 17 18 item = { 19 ["button"] = winMgr:getWindow("orxonox/SingleplayerButton"), 20 ["function"] = P.SingleplayerButton_clicked 21 } 22 table.insert(P.buttonList,item) 23 24 item = { 25 ["button"] = winMgr:getWindow("orxonox/MultiplayerButton"), 26 ["function"] = P.MultiplayerButton_clicked 27 } 28 table.insert(P.buttonList,item) 29 30 item = { 31 ["button"] = winMgr:getWindow("orxonox/SettingsButton"), 32 ["function"] = P.SettingsButton_clicked 33 } 34 table.insert(P.buttonList,item) 35 36 item = { 37 ["button"] = winMgr:getWindow("orxonox/CreditsButton"), 38 ["function"] = P.CreditsButton_clicked 39 } 40 table.insert(P.buttonList,item) 41 42 item = { 43 ["button"] = winMgr:getWindow("orxonox/ExitButton"), 44 ["function"] = P.ExitButton_clicked 45 } 46 table.insert(P.buttonList,item) 47 end 48 49 function P.onShow() 50 P.oldindex = -2 51 P.index = -1 52 end 7 53 8 54 -- events for MainMenu … … 10 56 hideAllMenuSheets() 11 57 orxonox.execute("startGame") 12 end13 14 function P.onShow()15 16 58 end 17 59 … … 36 78 end 37 79 38 function P.onKeyPressed() 39 --local we = tolua.cast(e, "CEGUI::KeyEventArgs") 40 cout(0, code) 41 if code == "15" then 42 P.index = P.index + 1 43 local window = winMgr:getWindow("orxonox/MainMenuBackground") 44 if P.index == window:getChildCount() then 45 P.index = 1 46 end 47 local child = window:getChildAtIdx(P.index-1) 48 child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-7) .. "Highlight") 49 child:setProperty("NormalImageLeftEdge", string.sub(child:getProperty("NormalImageLeftEdge"),1,-7) .. "Highlight") 50 child:setProperty("NormalImageBackground", string.sub(child:getProperty("NormalImageBackground"),1,-7) .. "Highlight") 51 elseif code == "28" and P.index ~= 0 then 52 if P.index == 1 then 53 P.QuickGameTestButton_clicked() 54 elseif P.index == 2 then 55 P.SingleplayerButton_clicked() 56 elseif P.index == 3 then 57 P.MultiplayerButton_clicked() 58 elseif P.index == 4 then 59 P.SettingsButton_clicked() 60 elseif P.index == 5 then 61 P.CreditsButton_clicked() 62 elseif P.index == 6 then 63 P.ExitButton_clicked() 64 end 80 81 --[[ 82 list = {} 83 local item = 84 { 85 ["button"] = buttonWindow, 86 ["function"] = buttonFunction, 87 } 88 table.insert(list, item) 89 item = list[i] 90 91 for i,item in pairs(list) do 92 button = item["button"] 93 end 94 95 --]] 96 --[[ 97 function createList() 98 list = {} 99 100 local j 101 while j < P.loadAlong 102 local item = 103 { 104 ["button"] = buttonWindow, 105 ["function"] = buttonFunction, 106 } 107 table.insert(list, item) 65 108 end 109 110 --]] 111 112 function P.onKeyPressed() 113 cout(0,code) 114 buttonIteratorHelper(P.buttonList, code, P, 6, 1) 115 --indexTester(P.buttonList,code,P,6,1) 66 116 end 67 117 68 118 return P 119
Note: See TracChangeset
for help on using the changeset viewer.