- Timestamp:
- Feb 24, 2018, 1:05:32 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cegui0.8_ogre1.9/data/gui/scripts/MiscConfigMenu.lua
r11356 r11800 18 18 19 19 P.commandList = {} 20 table.insert(P.commandList, "Highscore playerName_")21 20 table.insert(P.commandList, "KeyBinder mouseSensitivity_") 22 21 table.insert(P.commandList, "KeyBinder mouseSensitivityDerived_") … … 24 23 table.insert(P.commandList, "KeyBinder mouseWheelStepSize_") 25 24 table.insert(P.commandList, "Shell maxHistoryLength_") 26 table.insert(P.commandList, "Core bStartIOConsole_")27 table.insert(P.commandList, "G ame fpsLimit_")25 table.insert(P.commandList, "CoreConfig bStartIOConsole_") 26 table.insert(P.commandList, "GraphicsSettings fpsLimit") 28 27 table.insert(P.commandList, "Spectator speed_") 29 28 table.insert(P.commandList, "SpaceShip bInvertYAxis_") … … 34 33 table.insert(P.commandList, "Gametype numberOfBots_") 35 34 table.insert(P.commandList, "UnderAttack gameTime_") 36 table.insert(P.commandList, "Team Deathmatchteams_")35 table.insert(P.commandList, "TeamGametype teams_") 37 36 table.insert(P.commandList, "TeamDeathmatch maxScore_") 38 37 table.insert(P.commandList, "HumanPlayer nick_") 39 38 table.insert(P.commandList, "ChatOverlay displayTime_") 40 table.insert(P.commandList, "Core bDevMode_")39 table.insert(P.commandList, "CoreConfig bDevMode_") 41 40 table.insert(P.commandList, "HUDNavigation MarkerLimit_") 42 table.insert(P.commandList, "HUDNavigation showDistance ")41 table.insert(P.commandList, "HUDNavigation showDistance_") 43 42 table.insert(P.commandList, "HUDRadar RadarMode_") 44 43 45 44 P.nameList = {} 46 table.insert(P.nameList, "Playername")47 45 table.insert(P.nameList, "Mouse sensitivity") 48 46 table.insert(P.nameList, "Mouse acceleration") … … 60 58 table.insert(P.nameList, "Number of Bots") 61 59 table.insert(P.nameList, "UnderAttack: game time") 62 table.insert(P.nameList, "Team Deathmatch: Number of teams")60 table.insert(P.nameList, "TeamGametype: Number of teams") 63 61 table.insert(P.nameList, "TeamDeathmatch: Score needed to end the game") 64 62 table.insert(P.nameList, "Playername") … … 72 70 73 71 --Calculate design parameters: 74 P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", " orxonox/MiscConfigMenu/MiscConfigPane/SampleWindow")72 P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "MiscConfigMenu/MiscConfigPane/SampleWindow") 75 73 P.sampleWindow:setText("SampleText") 76 74 … … 93 91 P.spaceWidth = 10 94 92 95 local pane = tolua.cast( winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane"), "CEGUI::ScrollablePane")93 local pane = tolua.cast(P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane"), "CEGUI::ScrollablePane") 96 94 size = pane:getViewableArea() 97 95 P.editboxWidth = size:getWidth() - P.commandWidth - P.resetWidth - 5*P.spaceWidth … … 100 98 101 99 P:setButton(1, 1, { 102 ["button"] = winMgr:getWindow("orxonox/MiscConfigMenu/CancelButton"),100 ["button"] = P.window:getChild("CancelButton"), 103 101 ["callback"] = P.MiscConfigCancelButton_clicked 104 102 }) 105 103 106 104 P:setButton(1, 2, { 107 ["button"] = winMgr:getWindow("orxonox/MiscConfigMenu/OKButton"),105 ["button"] = P.window:getChild("OKButton"), 108 106 ["callback"] = P.MiscConfigOKButton_clicked 109 107 }) … … 113 111 local offset = 0 114 112 -- content window for the entire line 115 local line = winMgr:createWindow("DefaultWindow", " orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k)113 local line = winMgr:createWindow("DefaultWindow", "ConfigCommand" .. k) 116 114 line:setHeight(CEGUI.UDim(0, P.lineHeight)) 117 115 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1)))) 118 116 119 117 -- config name 120 local command = winMgr:createWindow("MenuWidgets/StaticText", " orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Command")118 local command = winMgr:createWindow("MenuWidgets/StaticText", "Command") 121 119 command:setText(P.nameList[k]) 122 command:setSize(CEGUI.U Vector2(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0)))120 command:setSize(CEGUI.USize(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0))) 123 121 command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0))) 124 line:addChild Window(command)122 line:addChild(command) 125 123 offset = offset + P.commandWidth + P.spaceWidth 126 124 127 125 -- config value (editable) 128 local configvalue = winMgr:createWindow("MenuWidgets/Editbox", " orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")126 local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "Configvalue") 129 127 configvalue:setProperty("ReadOnly", "set:False") 130 128 local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[k]) 131 129 configvalue:setText(value) 132 configvalue:setSize(CEGUI.U Vector2(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0)))130 configvalue:setSize(CEGUI.USize(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0))) 133 131 configvalue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0))) 134 132 -- enable the reset button if the value changed 135 133 orxonox.GUIManager:subscribeEventHelper(configvalue, "TextAccepted", P.name .. ".MiscConfigEditbox_textAccepted") 136 line:addChild Window(configvalue)134 line:addChild(configvalue) 137 135 offset = offset + P.editboxWidth + P.spaceWidth 138 136 139 137 -- reset button (only available when value changed) 140 local reset = winMgr:createWindow("MenuWidgets/Button", " orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")141 reset:setSize(CEGUI.U Vector2(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0)))138 local reset = winMgr:createWindow("MenuWidgets/Button", "Reset") 139 reset:setSize(CEGUI.USize(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0))) 142 140 reset:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0))) 143 141 reset:setText("reset") 144 142 orxonox.GUIManager:subscribeEventHelper(reset, "Clicked", P.name .. ".MiscConfigResetButton_clicked") 145 line:addChild Window(reset)143 line:addChild(reset) 146 144 reset:setEnabled(false) 147 145 offset = offset + P.resetWidth + P.spaceWidth … … 153 151 154 152 function P.createLines() 155 local window = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane")153 local window = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane") 156 154 157 155 for k,v in pairs(P.commandList) do 158 156 local line = P.createLine(k) 159 157 table.insert(P.linesList, line) 160 window:addChild Window(line)158 window:addChild(line) 161 159 end 162 160 … … 168 166 for k,v in pairs(P.commandList) do 169 167 -- save the changes 170 local editbox = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")168 local editbox = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue") 171 169 orxonox.CommandExecutor:execute("config " .. P.commandList[k] .. " " .. editbox:getText()) 172 local resetButton = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")170 local resetButton = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. k .. "/Reset") 173 171 resetButton:setEnabled(false) 174 172 end … … 183 181 function P.MiscConfigEditbox_textAccepted(e) 184 182 local we = CEGUI.toWindowEventArgs(e) 185 local name = we.window:getName ()183 local name = we.window:getNamePath() 186 184 187 185 local match = string.gmatch(name, "%d+") 188 186 local commandNr = tonumber(match()) 189 187 190 local resetButton = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset")188 local resetButton = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset") 191 189 resetButton:setEnabled(true) 192 190 end … … 194 192 function P.MiscConfigResetButton_clicked(e) 195 193 local we = CEGUI.toWindowEventArgs(e) 196 local name = we.window:getName ()194 local name = we.window:getNamePath() 197 195 198 196 local match = string.gmatch(name, "%d+") … … 200 198 201 199 -- reload the old value 202 local editbox = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue")200 local editbox = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue") 203 201 local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[commandNr]) 204 202 editbox:setText(value)
Note: See TracChangeset
for help on using the changeset viewer.