- Timestamp:
- Dec 7, 2011, 3:22:46 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/menue/data/gui/scripts/SingleplayerConfigMenu.lua
r8945 r8964 28 28 ["callback"] = P.SingleplayerConfigOKButton_clicked 29 29 }) 30 end31 32 function P.onHide()33 34 30 end 35 31 … … 101 97 function P.createLine(k) 102 98 local offset = 0 99 -- destroy config line, if it already exists (otherwise would cause an error) 103 100 if winMgr:isWindowPresent("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k) then 104 101 winMgr:destroyWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k) 105 102 end 103 -- content window for the entire line 106 104 local line = winMgr:createWindow("DefaultWindow", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k) 107 105 line:setHeight(CEGUI.UDim(0, P.lineHeight)) 108 106 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1)))) 109 107 108 -- config name 110 109 local command = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Command") 111 110 command:setText(P.nameList[k]) … … 115 114 offset = offset + P.commandWidth + P.spaceWidth 116 115 116 -- config value (editable) 117 117 local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue") 118 118 configvalue:setProperty("ReadOnly", "set:False") … … 121 121 configvalue:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0))) 122 122 configvalue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0))) 123 -- enable the reset button if the value changed 123 124 orxonox.GUIManager:subscribeEventHelper(configvalue, "TextAccepted", P.name .. ".SingleplayerConfigEditbox_textAccepted") 124 125 line:addChildWindow(configvalue) 125 126 offset = offset + P.editboxWidth + P.spaceWidth 126 127 128 -- reset button (only available when value changed) 127 129 local reset = winMgr:createWindow("MenuWidgets/Button", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset") 128 130 reset:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0))) … … 154 156 function P.SingleplayerConfigOKButton_clicked(e) 155 157 for k,v in pairs(P.commandList) do 158 -- save the changes 156 159 local editbox = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue") 157 160 orxonox.CommandExecutor:execute("config " .. P.commandList[k] .. " " .. editbox:getText()) … … 185 188 local commandNr = tonumber(match()) 186 189 190 -- reload the old value 187 191 local editbox = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue") 188 192 local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[commandNr])
Note: See TracChangeset
for help on using the changeset viewer.