Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

migrated all ingame menus to cegui 0.8

File:
1 edited

Legend:

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

    r11795 r11806  
    4040-- selectQuest is a pointer to a quest that should be selected, if it is nil the first quest is selected.
    4141function P.loadQuestsList(selectQuest)
    42     local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
     42    local list = CEGUI.toListbox(P.window:getChild("MainWindow/LeftPanel/QuestsList"))
    4343    P.clearQuestList()
    4444
     
    124124        -- Load title and description
    125125        local description = P.questManager:getDescription(quest)
    126         local titleWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Title")
     126        local titleWindow = P.window:getChild("MainWindow/Title")
    127127        titleWindow:setText(description:getTitle())
    128         local descriptionWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Description")
     128        local descriptionWindow = P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/Description")
    129129        descriptionWindow:setText(description:getDescription())
    130         descriptionWindow:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0)))
     130        descriptionWindow:setSize(CEGUI.USize(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0)))
    131131        descriptionWindow:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, P.borderSize)))
    132132        local height = getStaticTextWindowHeight(descriptionWindow)
     
    135135
    136136        -- Load subquests
    137         local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))
     137        local list = CEGUI.toListbox(P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/SubquestsList"))
    138138        local numQuests = P.questManager:getNumSubQuests(quest, P.player)
    139139        local i = 0
     
    150150            height = height+P.frameHeigth
    151151        end
    152         list:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, height)))
     152        list:setSize(CEGUI.USize(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, height)))
    153153        list:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, offset)))
    154154        offset = offset + height + P.borderSize
    155155
    156156        -- Load hints
    157         local hintsWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Hints")
     157        local hintsWindow = P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/Hints")
    158158        hintsWindow:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, offset)))
    159         hintsWindow:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, 0)))
     159        hintsWindow:setSize(CEGUI.USize(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, 0)))
    160160        height = P.titleHeight
    161161        local numHints = P.questManager:getNumHints(quest, P.player)
     
    173173
    174174        -- Set the size of the wrapper
    175         local window = winMgr:getWindow("orxonox/QuestGUI/Quest/Wrapper")
    176         window:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize-P.scrollbarWidth), CEGUI.UDim(0,offset+P.borderSize)))
     175        local window = P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper")
     176        window:setSize(CEGUI.USize(CEGUI.UDim(1, -P.borderSize-P.scrollbarWidth), CEGUI.UDim(0,offset+P.borderSize)))
    177177    end
    178178end
     
    181181function P.clearQuest()
    182182    -- clear title
    183     local titleWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Title")
     183    local titleWindow = P.window:getChild("MainWindow/Title")
    184184    titleWindow:setText("no Quests")
    185185
    186186    -- clear description
    187     local descriptionWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Description")
     187    local descriptionWindow = P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/Description")
    188188    descriptionWindow:setText("There is currently no quest that can be displayed.")
    189189
    190190    -- clear list fo subquests
    191     local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))
     191    local list = CEGUI.toListbox(P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/SubquestsList"))
    192192    list:resetList()
    193193    list:setHeight(CEGUI.UDim(0, 0))
     
    195195
    196196    -- clear hints
    197     local hints = winMgr:getWindow("orxonox/QuestGUI/Quest/Hints")
     197    local hints = P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/Hints")
    198198    local numChildren = hints:getChildCount()-2 -- TODO: HACK
    199199    local i = 0
    200200    while i < numChildren do
    201         local hint = hints:getChild("orxonox/QuestGUI/Quest/Hints/" .. i)
     201        local hint = hints:getChild("" .. i)
    202202        if hint ~= nil then
    203             hints:removeChildWindow(hint)
     203            hints:removeChild(hint)
    204204            winMgr:destroyWindow(hint)
    205205        end
    206206        i = i+1
    207207    end
    208     hints:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.scrollbarWidth-P.borderSize), CEGUI.UDim(0, 0)))
     208    hints:setSize(CEGUI.USize(CEGUI.UDim(1, -P.scrollbarWidth-P.borderSize), CEGUI.UDim(0, 0)))
    209209end
    210210
    211211-- Clear the quests list
    212212function P.clearQuestList()
    213     local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
     213    local list = CEGUI.toListbox(P.window:getChild("MainWindow/LeftPanel/QuestsList"))
    214214    list:resetList()
    215215    P.quests = {}
     
    253253function P.insertHint(hintsWindow, hint, index, offset)
    254254    -- Create the window for the hint.
    255     local window = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/QuestGUI/Quest/Hints/" .. index)
     255    local window = winMgr:createWindow("MenuWidgets/StaticText", "" .. index)
    256256    window:setProperty("HorzFormatting", "WordWrapLeftAligned")
    257257    window:setProperty("VertFormatting", "TopAligned")
    258258    window:setProperty("FrameEnabled", "false")
    259259    window:setID(index)
    260     hintsWindow:addChildWindow(window)
     260    hintsWindow:addChild(window)
    261261    local description = P.questManager:getDescription(hint)
    262262    window:setText(description:getDescription())
    263     window:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0)))
     263    window:setSize(CEGUI.USize(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0)))
    264264    local height = getStaticTextWindowHeight(window)
    265265    window:setHeight(CEGUI.UDim(0, height))
     
    286286-- Change to a new quest.
    287287function P.changeQuest_clicked(e)
    288     local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
     288    local list = CEGUI.toListbox(P.window:getChild("MainWindow/LeftPanel/QuestsList"))
    289289    local choice = list:getFirstSelectedItem()
    290290    if choice ~= nil then
     
    299299-- Change to a new subquest.
    300300function P.changeToSubquest_clicked(e)
    301     local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))
    302     local questsList = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
     301    local list = CEGUI.toListbox(P.window:getChild("MainWindow/RightPanel/ScrollWrapper/Wrapper/SubquestsList"))
     302    local questsList = CEGUI.toListbox(P.window:getChild("MainWindow/LeftPanel/QuestsList"))
    303303    local choice = list:getFirstSelectedItem()
    304304    if choice ~= nil then
     
    328328
    329329    local questWindow = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/QuestGUI/Quests")
    330     questWindow:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0),CEGUI.UDim(1, 0)))
     330    questWindow:setSize(CEGUI.USize(CEGUI.UDim(1, 0),CEGUI.UDim(1, 0)))
    331331
    332332    -- Iterate through all root-quests.
     
    348348    node:setText(orxonox.QuestManager:getInstance():getDescription(parent):getTitle())
    349349    node:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.indentWidth*depth), CEGUI.UDim(0, P.buttonHeight*index)))
    350     node:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.indentWidth*depth-P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight)))
     350    node:setSize(CEGUI.USize(CEGUI.UDim(1, -P.indentWidth*depth-P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight)))
    351351    orxonox.GUIManager:subscribeEventHelper(node, "Clicked", P.name .. ".openDetails_clicked")
    352     root:addChildWindow(node)
     352    root:addChild(node)
    353353   
    354354    table.insert(P.quests, parent)
     
    389389    --Get some numbers from the window
    390390    local we = CEGUI.toWindowEventArgs(e)
    391     local name = we.window:getName()
     391    local name = we.window:getNamePath()
    392392    local match = string.gmatch(name, "%d+")
    393393    local questNr = tonumber(match())
     
    397397
    398398    local details = winMgr:createWindow("MenuWidgets/FrameWindow", name)
    399     details:setSize(CEGUI.UVector2(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0)))
     399    details:setSize(CEGUI.USize(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0)))
    400400    details:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0), CEGUI.UDim(0.1, 0)))
    401401    details:setText(orxonox.QuestManager:getInstance():getDescription(quest):getTitle())
     
    408408    name = name .. "/Scrollable"
    409409    local window = winMgr:createWindow("MenuWidgets/ScrollablePane", name)
    410     window:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight)))
     410    window:setSize(CEGUI.USize(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight)))
    411411    window:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderWidth), CEGUI.UDim(0, P.titleHeight)))
    412     details:addChildWindow(window)
     412    details:addChild(window)
    413413
    414414    local offset = 0
    415415
    416416    local status = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Status")
    417     window:addChildWindow(status)
     417    window:addChild(status)
    418418    status:setProperty("HorzFormatting", "WordWrapLeftAligned")
    419419    status:setProperty("VertFormatting", "TopAligned")
     
    426426    end
    427427    status:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
    428     status:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     428    status:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
    429429    local height = getStaticTextWindowHeight(status)
    430430    status:setHeight(CEGUI.UDim(0, height))
     
    432432
    433433    local descriptionTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description/Title")
    434     window:addChildWindow(descriptionTitle)
    435     descriptionTitle:setProperty("HorzFormatting", "HorzCentred")
     434    window:addChild(descriptionTitle)
     435    descriptionTitle:setProperty("HorzFormatting", "CentreAligned")
    436436    descriptionTitle:setProperty("VertFormatting", "TopAligned")
    437437    descriptionTitle:setText("Description:")
    438438    descriptionTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
    439     descriptionTitle:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     439    descriptionTitle:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
    440440    height = getStaticTextWindowHeight(descriptionTitle)
    441441    descriptionTitle:setHeight(CEGUI.UDim(0, height))
     
    443443
    444444    local description = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description")
    445     window:addChildWindow(description)
     445    window:addChild(description)
    446446    description:setProperty("HorzFormatting", "WordWrapLeftAligned")
    447447    description:setProperty("VertFormatting", "TopAligned")
    448448    description:setText(orxonox.QuestManager:getInstance():getDescription(quest):getDescription())
    449449    description:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
    450     description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     450    description:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
    451451    height = getStaticTextWindowHeight(description)
    452452    description:setHeight(CEGUI.UDim(0, height))
     
    457457    if numHints > 0 then
    458458        local hintsTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Hints/Title")
    459         window:addChildWindow(hintsTitle)
    460         hintsTitle:setProperty("HorzFormatting", "HorzCentred")
     459        window:addChild(hintsTitle)
     460        hintsTitle:setProperty("HorzFormatting", "CentreAligned")
    461461        hintsTitle:setProperty("VertFormatting", "TopAligned")
    462462        hintsTitle:setText("Hints:")
    463463        hintsTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
    464         hintsTitle:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     464        hintsTitle:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
    465465        height = getStaticTextWindowHeight(hintsTitle)
    466466        hintsTitle:setHeight(CEGUI.UDim(0, height))
     
    475475        node:setText(orxonox.QuestManager:getInstance():getDescription(hint):getTitle())
    476476        node:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
    477         node:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight)))
    478         window:addChildWindow(node)
     477        node:setSize(CEGUI.USize(CEGUI.UDim(1, -P.scrollbarWidth), CEGUI.UDim(0, P.buttonHeight)))
     478        window:addChild(node)
    479479        offset = offset + P.buttonHeight
    480480
     
    483483    end
    484484
    485     local window = winMgr:getWindow("orxonox/QuestGUI/Background")
    486     window:addChildWindow(details)
     485    local window = P.window:getChild("orxonox/QuestGUI/Background")
     486    window:addChild(details)
    487487end
    488488
     
    499499function P.closeDetails_clicked(e)
    500500    local we = CEGUI.toWindowEventArgs(e)
    501     local name = we.window:getName()
     501    local name = we.window:getNamePath()
    502502    local match = string.gmatch(name, "%d+")
    503503    match()
     
    511511    --Get some numbers from the window
    512512    local we = CEGUI.toWindowEventArgs(e)
    513     local name = we.window:getName()
     513    local name = we.window:getNamePath()
    514514    local match = string.gmatch(name, "%d+")
    515515    match()
     
    521521
    522522    local details = winMgr:createWindow("MenuWidgets/FrameWindow", name)
    523     details:setSize(CEGUI.UVector2(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0)))
     523    details:setSize(CEGUI.USize(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.7, 0)))
    524524    details:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0), CEGUI.UDim(0.1, 0)))
    525525    details:setText(orxonox.QuestManager:getInstance():getDescription(hint):getTitle())
     
    532532    name = name .. "/Scrollable"
    533533    local window = winMgr:createWindow("MenuWidgets/ScrollablePane", name)
    534     window:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight)))
     534    window:setSize(CEGUI.USize(CEGUI.UDim(1.0, -2*P.borderWidth),CEGUI.UDim(1.0, -P.titleHeight)))
    535535    window:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderWidth), CEGUI.UDim(0, P.titleHeight)))
    536     details:addChildWindow(window)
     536    details:addChild(window)
    537537
    538538    local offset = 0
    539539   
    540540    local descriptionTitle = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description/Title")
    541     window:addChildWindow(descriptionTitle)
    542     descriptionTitle:setProperty("HorzFormatting", "HorzCentred")
     541    window:addChild(descriptionTitle)
     542    descriptionTitle:setProperty("HorzFormatting", "CentreAligned")
    543543    descriptionTitle:setProperty("VertFormatting", "TopAligned")
    544544    descriptionTitle:setText("Description:")
    545545    descriptionTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
    546     descriptionTitle:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     546    descriptionTitle:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
    547547    height = getStaticTextWindowHeight(descriptionTitle)
    548548    descriptionTitle:setHeight(CEGUI.UDim(0, height))
     
    550550
    551551    local description = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description")
    552     window:addChildWindow(description)
     552    window:addChild(description)
    553553    description:setProperty("HorzFormatting", "WordWrapLeftAligned")
    554554    description:setProperty("VertFormatting", "TopAligned")
    555555    description:setText(orxonox.QuestManager:getInstance():getDescription(hint):getDescription())
    556556    description:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, offset)))
    557     description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     557    description:setSize(CEGUI.USize(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
    558558    height = getStaticTextWindowHeight(description)
    559559    description:setHeight(CEGUI.UDim(0, height))
    560560
    561     local window = winMgr:getWindow("orxonox/QuestGUI/Background")
    562     window:addChildWindow(details)
     561    local window = P.window:getChild("orxonox/QuestGUI/Background")
     562    window:addChild(details)
    563563end
    564564
    565565function P.closeHintDetails_clicked(e)
    566566    local we = CEGUI.toWindowEventArgs(e)
    567     local name = we.window:getName()
     567    local name = we.window:getNamePath()
    568568    local match = string.gmatch(name, "%d+")
    569569    match()
Note: See TracChangeset for help on using the changeset viewer.