Changeset 7687 for code/branches/menu/data/gui
- Timestamp:
- Dec 1, 2010, 2:04:54 PM (14 years ago)
- Location:
- code/branches/menu/data/gui/scripts
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/menu/data/gui/scripts/AudioMenu.lua
r6746 r7687 2 2 3 3 local P = createMenuSheet("AudioMenu") 4 5 P.buttonList = {} 6 7 function P.onShow() 8 P.oldindex = -2 9 P.index = -1 10 end 4 11 5 12 function P.onLoad() … … 42 49 listboxwindow:setItemSelectState(0,true) 43 50 end 51 52 local item = { 53 ["button"] = winMgr:getWindow("orxonox/AudioBackButton"), 54 ["function"] = P.AudioBackButton_clicked 55 } 56 P.buttonList[1] = item 44 57 end 45 58 … … 172 185 end 173 186 187 function P.onKeyPressed() 188 buttonIteratorHelper(P.buttonList, code, P, 1, 1) 189 end 190 174 191 return P 175 192 -
code/branches/menu/data/gui/scripts/ControlsMenu.lua
r6748 r7687 2 2 3 3 local P = createMenuSheet("ControlsMenu") 4 P.buttonList = {} 4 5 P.loadAlong = { "MouseControlsMenu", "KeyBindMenu" } 6 7 function P.onLoad() 8 P.multiplayerMode = "startClient" 9 10 --buttons are arranged in a 3x1 matrix: 11 local item = { 12 ["button"] = winMgr:getWindow("orxonox/MouseControlsButton"), 13 ["function"] = P.ControlsMouseControlsButton_clicked 14 } 15 P.buttonList[1] = item 16 17 local item = { 18 ["button"] = winMgr:getWindow("orxonox/KeybindingsButton"), 19 ["function"] = P.ControlsKeyboardControlsButton_clicked 20 } 21 P.buttonList[2] = item 22 23 local item = { 24 ["button"] = winMgr:getWindow("orxonox/ControlsBackButton"), 25 ["function"] = P.ControlsBackButton_clicked 26 } 27 P.buttonList[3] = item 28 29 end 30 31 function P.onShow() 32 --indices to iterate through buttonlist 33 P.oldindex = -2 34 P.index = -1 35 end 5 36 6 37 function P.ControlsMouseControlsButton_clicked(e) … … 16 47 end 17 48 49 function P.onKeyPressed() 50 buttonIteratorHelper(P.buttonList, code, P, 3, 1) 51 end 52 18 53 return P 19 54 -
code/branches/menu/data/gui/scripts/CreditsMenu.lua
r7663 r7687 14 14 15 15 function P.onShow() 16 --indices to iterate through buttonlist 16 17 P.oldindex = -2 17 18 P.index = -1 -
code/branches/menu/data/gui/scripts/GUITools.lua
r7663 r7687 55 55 end 56 56 57 --function to iterate through a menu sheet by using arrowkeys 57 58 58 59 --@arguments: 59 60 -- list: 2-dimensional table, arguments are items that contain a button and its function 61 -- !!note: each button can only be in the list once!! 60 62 -- code: code of any key on the keyboard 61 63 -- P: menusheet 62 -- n: number of rows 63 -- m: number of colums 64 -- n: number of rows of the buttontable 65 -- m: number of colums of the buttontable 64 66 65 67 function buttonIteratorHelper(list, code, P, n, m) 68 69 --after a key (down,up,left,right) is pressed the index of the current button has to be updated 66 70 67 71 --key down … … 72 76 else 73 77 P.oldindex = P.index 74 P.index = (P.index + m) % (m*n) 75 76 while list[P.index+1] == nil do 78 P.index = (P.index + m) % (m*n) --modulo operation works as a "wrap around" in the button menu 79 80 while list[P.index+1] == nil do 77 81 P.oldindex = P.index 78 82 P.index = (P.index + m) % (m*n) … … 98 102 99 103 while list[P.index+1] == nil do 100 cout(0,P.index)101 104 P.oldindex = P.index 102 105 P.index = (P.index-m)%(m*n) … … 162 165 end 163 166 167 --to update the new current button 164 168 if (code == "208" or code == "200" or code == "203" or code == "205") and P.oldindex~= P.index then 165 169 … … 171 175 172 176 --teste ob der Button nicht schon gehighlightet ist 173 cout(0,child:getProperty("NormalImageRightEdge"))174 177 if child:getProperty("NormalImageRightEdge") == "set:TaharezGreenLook image:ButtonRightHighlight" then 175 178 --nop … … 189 192 end 190 193 194 --for every highlighted button check if index is on its position. If not, set imageproperty on "normal" 191 195 local i = 1 192 196 while i < (n*m) do … … 220 224 end 221 225 222 cout(0, P.oldindex) 223 cout(0, P.index) 224 225 end 226 226 end 227 228 --write index and oldindex on the console 229 --works like buttonIteratorHelper 227 230 function indexTester(list,code,P,n,m) 228 231 --key down -
code/branches/menu/data/gui/scripts/GraphicsMenu.lua
r6746 r7687 2 2 3 3 local P = createMenuSheet("GraphicsMenu") 4 5 P.buttonList = {} 6 7 function P.onShow() 8 --indices to iterate through buttonlist (trivial in this menu sheet) 9 P.oldindex = -2 10 P.index = -1 11 end 4 12 5 13 function P.onLoad() … … 83 91 scrollbar_active = false 84 92 block = false 93 94 local item = { 95 ["button"] = winMgr:getWindow("orxonox/GraphicsBackButton"), 96 ["function"] = P.GraphicsBackButton_clicked 97 } 98 P.buttonList[1] = item 85 99 end 86 100 … … 195 209 end 196 210 211 function P.onKeyPressed() 212 buttonIteratorHelper(P.buttonList, code, P, 1, 1) 213 end 214 197 215 return P 198 216 -
code/branches/menu/data/gui/scripts/HostMenu.lua
r7587 r7687 4 4 5 5 P.multiplayerMode = "startServer" 6 7 P.buttonList = {} 8 9 function P.onLoad() 10 P.multiplayerMode = "startClient" 11 12 local item = { 13 ["button"] = winMgr:getWindow("orxonox/HostMenuStartButton"), 14 ["function"] = P.HostMenuStartButton_clicked 15 } 16 P.buttonList[1] = item 17 18 local item = { 19 ["button"] = winMgr:getWindow("orxonox/HostMenuBackButton"), 20 ["function"] = P.HostMenuBackButton_clicked 21 } 22 P.buttonList[2] = item 23 end 6 24 7 25 function P.onShow() … … 19 37 P.showLevelList() 20 38 end 39 40 P.oldindex = -2 41 P.index = -1 21 42 22 43 end … … 80 101 81 102 103 function P.onKeyPressed() 104 buttonIteratorHelper(P.buttonList, code, P, 1, 2) 105 end 106 107 82 108 83 109 return P -
code/branches/menu/data/gui/scripts/MainMenu.lua
r7663 r7687 6 6 P.buttonList = {} 7 7 8 P.testArray = {}9 10 11 8 function P.onLoad() 9 --buttons are arranged in a 6x1 Matrix (list) 12 10 local item = { 13 11 ["button"] = winMgr:getWindow("orxonox/QuickGameTestButton"), … … 48 46 49 47 function P.onShow() 48 --indices to iterate through buttonlist 50 49 P.oldindex = -2 51 50 P.index = -1 … … 78 77 end 79 78 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) do92 button = item["button"]93 end94 95 --]]96 --[[97 function createList()98 list = {}99 100 local j101 while j < P.loadAlong102 local item =103 {104 ["button"] = buttonWindow,105 ["function"] = buttonFunction,106 }107 table.insert(list, item)108 end109 110 --]]111 112 79 function P.onKeyPressed() 113 cout(0,code)114 80 buttonIteratorHelper(P.buttonList, code, P, 6, 1) 115 --indexTester(P.buttonList,code,P,6,1)116 81 end 117 82 -
code/branches/menu/data/gui/scripts/MultiplayerMenu.lua
r7663 r7687 8 8 P.multiplayerMode = "startClient" 9 9 10 --button are arranged in a 2x2 matrix, the left lower item is nil 10 11 local item = { 11 12 ["button"] = winMgr:getWindow("orxonox/MultiplayerJoinButton2"), 12 ["function"] = P.MultiplayerJoinButton _clicked13 ["function"] = P.MultiplayerJoinButton2_clicked 13 14 } 14 15 P.buttonList[1] = item … … 16 17 local item = { 17 18 ["button"] = winMgr:getWindow("orxonox/MultiplayerHostButton2"), 18 ["function"] = P.MultiplayerHostButton _clicked19 ["function"] = P.MultiplayerHostButton2_clicked 19 20 } 20 21 P.buttonList[2] = item … … 30 31 function P.onShow() 31 32 P.showServerList() 33 34 --indices to iterate through buttonlist 32 35 P.oldindex = -2 33 36 P.index = -1 … … 133 136 134 137 function P.onKeyPressed() 135 cout(0,code)136 138 buttonIteratorHelper(P.buttonList, code, P, 2, 2) 137 --indexTester(P.buttonList,code,P,2,3)138 139 end 139 140 -
code/branches/menu/data/gui/scripts/SettingsMenu.lua
r7663 r7687 8 8 function P.onLoad() 9 9 --"Gameplay" and "Multiplayer Options" are not integrated in the list 10 10 --buttons are arranged in a 4x2 matrix. The lower-right element is not in the matrix! 11 11 local item = { 12 12 ["button"] = winMgr:getWindow("orxonox/SettingsMenu/GraphicsButton"), … … 43 43 44 44 function P.onShow() 45 --indices to iterate through buttonlist 45 46 P.oldindex = 3 46 47 P.index = 2 … … 76 77 77 78 function P.onKeyPressed() 78 cout(0,code)79 79 buttonIteratorHelper(P.buttonList, code, P, 4, 2) 80 --indexTester(P.buttonList,code,P,4,2)81 80 end 82 81 -
code/branches/menu/data/gui/scripts/SingleplayerMenu.lua
r7163 r7687 2 2 3 3 local P = createMenuSheet("SingleplayerMenu") 4 5 P.buttonList = {} 4 6 5 7 function P.onLoad() … … 28 30 end 29 31 32 --buttons are arranged in a 1x2 matrix 33 local item = { 34 ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"), 35 ["function"] = P.SingleplayerStartButton_clicked 36 } 37 P.buttonList[1] = item 38 39 local item = { 40 ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"), 41 ["function"] = P.SingleplayerBackButton_clicked 42 } 43 P.buttonList[2] = item 44 45 end 46 47 function P.onShow() 48 --indices to iterate through buttonlist 49 P.oldindex = -2 50 P.index = -1 30 51 end 31 52 … … 43 64 end 44 65 66 function P.onKeyPressed() 67 buttonIteratorHelper(P.buttonList, code, P, 1, 2) 68 end 69 45 70 return P 46 71
Note: See TracChangeset
for help on using the changeset viewer.