Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 24, 2018, 1:05:32 AM (6 years ago)
Author:
landauf
Message:

updated Settings.lua and all sub-menus to cegui 0.8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cegui0.8_ogre1.9/data/gui/scripts/MiscConfigMenu.lua

    r11356 r11800  
    1818
    1919    P.commandList = {}
    20     table.insert(P.commandList, "Highscore playerName_")
    2120    table.insert(P.commandList, "KeyBinder mouseSensitivity_")
    2221    table.insert(P.commandList, "KeyBinder mouseSensitivityDerived_")
     
    2423    table.insert(P.commandList, "KeyBinder mouseWheelStepSize_")
    2524    table.insert(P.commandList, "Shell maxHistoryLength_")
    26     table.insert(P.commandList, "Core bStartIOConsole_")
    27     table.insert(P.commandList, "Game fpsLimit_")
     25    table.insert(P.commandList, "CoreConfig bStartIOConsole_")
     26    table.insert(P.commandList, "GraphicsSettings fpsLimit")
    2827    table.insert(P.commandList, "Spectator speed_")
    2928    table.insert(P.commandList, "SpaceShip bInvertYAxis_")
     
    3433    table.insert(P.commandList, "Gametype numberOfBots_")
    3534    table.insert(P.commandList, "UnderAttack gameTime_")
    36     table.insert(P.commandList, "TeamDeathmatch teams_")
     35    table.insert(P.commandList, "TeamGametype teams_")
    3736    table.insert(P.commandList, "TeamDeathmatch maxScore_")
    3837    table.insert(P.commandList, "HumanPlayer nick_")
    3938    table.insert(P.commandList, "ChatOverlay displayTime_")
    40     table.insert(P.commandList, "Core bDevMode_")
     39    table.insert(P.commandList, "CoreConfig bDevMode_")
    4140    table.insert(P.commandList, "HUDNavigation MarkerLimit_")
    42     table.insert(P.commandList, "HUDNavigation showDistance")
     41    table.insert(P.commandList, "HUDNavigation showDistance_")
    4342    table.insert(P.commandList, "HUDRadar RadarMode_")
    4443
    4544    P.nameList = {}
    46     table.insert(P.nameList, "Playername")
    4745    table.insert(P.nameList, "Mouse sensitivity")
    4846    table.insert(P.nameList, "Mouse acceleration")
     
    6058    table.insert(P.nameList, "Number of Bots")
    6159    table.insert(P.nameList, "UnderAttack: game time")
    62     table.insert(P.nameList, "TeamDeathmatch: Number of teams")
     60    table.insert(P.nameList, "TeamGametype: Number of teams")
    6361    table.insert(P.nameList, "TeamDeathmatch: Score needed to end the game")
    6462    table.insert(P.nameList, "Playername")
     
    7270
    7371    --Calculate design parameters:
    74     P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/MiscConfigMenu/MiscConfigPane/SampleWindow")
     72    P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "MiscConfigMenu/MiscConfigPane/SampleWindow")
    7573    P.sampleWindow:setText("SampleText")
    7674
     
    9391    P.spaceWidth = 10
    9492   
    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")
    9694    size = pane:getViewableArea()
    9795    P.editboxWidth = size:getWidth() - P.commandWidth - P.resetWidth - 5*P.spaceWidth
     
    10098
    10199    P:setButton(1, 1, {
    102             ["button"] = winMgr:getWindow("orxonox/MiscConfigMenu/CancelButton"),
     100            ["button"] = P.window:getChild("CancelButton"),
    103101            ["callback"]  = P.MiscConfigCancelButton_clicked
    104102    })
    105103   
    106104    P:setButton(1, 2, {
    107             ["button"] = winMgr:getWindow("orxonox/MiscConfigMenu/OKButton"),
     105            ["button"] = P.window:getChild("OKButton"),
    108106            ["callback"]  = P.MiscConfigOKButton_clicked
    109107    })
     
    113111    local offset = 0
    114112    -- 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)
    116114    line:setHeight(CEGUI.UDim(0, P.lineHeight))
    117115    line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1))))
    118116
    119117    -- config name
    120     local command = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Command")
     118    local command = winMgr:createWindow("MenuWidgets/StaticText", "Command")
    121119    command:setText(P.nameList[k])
    122     command:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0)))
     120    command:setSize(CEGUI.USize(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0)))
    123121    command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0)))
    124     line:addChildWindow(command)
     122    line:addChild(command)
    125123    offset = offset + P.commandWidth + P.spaceWidth
    126124
    127125    -- config value (editable)
    128     local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
     126    local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "Configvalue")
    129127    configvalue:setProperty("ReadOnly", "set:False")
    130128    local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[k])
    131129    configvalue:setText(value)
    132     configvalue:setSize(CEGUI.UVector2(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)))
    133131    configvalue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
    134132    -- enable the reset button if the value changed
    135133    orxonox.GUIManager:subscribeEventHelper(configvalue, "TextAccepted", P.name .. ".MiscConfigEditbox_textAccepted")
    136     line:addChildWindow(configvalue)
     134    line:addChild(configvalue)
    137135    offset = offset + P.editboxWidth + P.spaceWidth
    138136
    139137    -- reset button (only available when value changed)
    140     local reset = winMgr:createWindow("MenuWidgets/Button", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
    141     reset:setSize(CEGUI.UVector2(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)))
    142140    reset:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
    143141    reset:setText("reset")
    144142    orxonox.GUIManager:subscribeEventHelper(reset, "Clicked", P.name .. ".MiscConfigResetButton_clicked")
    145     line:addChildWindow(reset)
     143    line:addChild(reset)
    146144    reset:setEnabled(false)
    147145    offset = offset + P.resetWidth + P.spaceWidth
     
    153151
    154152function P.createLines()
    155     local window = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane")
     153    local window = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane")
    156154
    157155    for k,v in pairs(P.commandList) do
    158156        local line = P.createLine(k)
    159157        table.insert(P.linesList, line)
    160         window:addChildWindow(line)
     158        window:addChild(line)
    161159    end
    162160
     
    168166    for k,v in pairs(P.commandList) do
    169167        -- 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")
    171169        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")
    173171        resetButton:setEnabled(false)
    174172    end
     
    183181function P.MiscConfigEditbox_textAccepted(e)
    184182    local we = CEGUI.toWindowEventArgs(e)
    185     local name = we.window:getName()
     183    local name = we.window:getNamePath()
    186184
    187185    local match = string.gmatch(name, "%d+")
    188186    local commandNr = tonumber(match())
    189187
    190     local resetButton = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset")
     188    local resetButton = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset")
    191189    resetButton:setEnabled(true)
    192190end
     
    194192function P.MiscConfigResetButton_clicked(e)
    195193    local we = CEGUI.toWindowEventArgs(e)
    196     local name = we.window:getName()
     194    local name = we.window:getNamePath()
    197195
    198196    local match = string.gmatch(name, "%d+")
     
    200198
    201199    -- 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")
    203201    local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[commandNr])
    204202    editbox:setText(value)
Note: See TracChangeset for help on using the changeset viewer.