Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 22, 2018, 1:03:44 AM (7 years ago)
Author:
landauf
Message:

updated CreditsMenu.lua and SingleplayerMenu.lua to cegui 0.8

File:
1 edited

Legend:

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

    r11795 r11797  
    2525    --buttons are arranged in a 2x3 matrix
    2626    P:setButton(1, 1, {
    27             ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"),
     27            ["button"] = P.window:getChild("SingleplayerStartButton"),
    2828            ["callback"]  = P.SingleplayerStartButton_clicked
    2929    })
    3030
    3131    P:setButton(1, 2, {
    32             ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigButton"),
     32            ["button"] = P.window:getChild("SingleplayerConfigButton"),
    3333            ["callback"]  = P.SingleplayerConfigButton_clicked
    3434    })
    3535
    3636    P:setButton(1, 3, {
    37             ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"),
     37            ["button"] = P.window:getChild("SingleplayerBackButton"),
    3838            ["callback"]  = P.SingleplayerBackButton_clicked
    3939    })
    4040
    4141    P:setButton(2, 2,{
    42             ["button"] = winMgr:getWindow("orxonox/CampaignButton"),
     42            ["button"] = P.window:getChild("CampaignButton"),
    4343            ["callback"] = P.CampaignButton_clicked
    4444    })
     
    5757            local imageName = level:getScreenshot()
    5858            if imageName ~= "" then
    59                 CEGUI.ImagesetManager:getSingleton():createFromImageFile(levelXMLFilename..imageName, imageName)
     59                CEGUI.ImageManager:getSingleton():addFromImageFile(levelXMLFilename..imageName, imageName)
    6060            else
    61                 CEGUI.ImagesetManager:getSingleton():createFromImageFile(levelXMLFilename..imageName, "noscreenshot.png")
     61                CEGUI.ImageManager:getSingleton():addFromImageFile(levelXMLFilename..imageName, "noscreenshot.png")
    6262            end
    6363            table.insert(P.levelList, level)
     
    6969function P.createFilterTab(name, tag)
    7070    -- create unique tab window name
    71     local tabName = "orxonox/SingleplayerLevelTab"
     71    local tabName = "SingleplayerLevelTab"
    7272    if tag ~= nil then
    7373        tabName = tabName..tag
     
    7676    local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName))
    7777    listbox:setText(name)
    78     listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
    79     listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}")
     78    listbox:setProperty("MaxSize", "{{1,0},{1,0}}")
     79    listbox:setProperty("Area", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}")
    8080    -- fill listbox with items
    8181    listbox:resetList()
     
    9898    table.insert(P.activeTabIndexes, tabIndexes)
    9999    -- listen to selection changes
    100     orxonox.GUIManager:subscribeEventHelper(listbox, "ItemSelectionChanged", P.name..".SingleplayerSelectionChanged")
    101     local tabControl = winMgr:getWindow("orxonox/SingleplayerTabControl")
    102     orxonox.GUIManager:subscribeEventHelper(tabControl, "TabSelectionChanged", P.name..".SingleplayerSelectionChanged")
     100    orxonox.GUIManager:subscribeEventHelper(listbox, "SelectionChanged", P.name..".SingleplayerSelectionChanged")
     101    local tabControl = P.window:getChild("SingleplayerWindow/SingleplayerTabControl")
     102    orxonox.GUIManager:subscribeEventHelper(tabControl, "SelectionChanged", P.name..".SingleplayerSelectionChanged")
    103103    if listbox:getItemCount() > 0 then
    104         tabControl:addChildWindow(tabName)
     104        tabControl:addChild(listbox)
    105105    end
    106106end
     
    108108function P.SingleplayerGetSelectedLevel()
    109109    -- choose the active listbox
    110     local tabControl = CEGUI.toTabControl(winMgr:getWindow("orxonox/SingleplayerTabControl"))
     110    local tabControl = CEGUI.toTabControl(P.window:getChild("SingleplayerWindow/SingleplayerTabControl"))
    111111    local listbox = CEGUI.toListbox(tabControl:getTabContentsAtIndex(tabControl:getSelectedTabIndex()))
    112112    local choice = listbox:getFirstSelectedItem()
     
    122122
    123123function P.SingleplayerSelectionChanged(e)
    124     local levelImage = winMgr:getWindow("orxonox/SingleplayerLevelImage")
    125     local levelDescription = winMgr:getWindow("orxonox/SingleplayerLevelDescription")
    126     local configButton = winMgr:getWindow("orxonox/SingleplayerConfigButton")
     124    local levelImage = P.window:getChild("SingleplayerWindow/SingleplayerLevelImage")
     125    local levelDescription = P.window:getChild("SingleplayerWindow/SingleplayerLevelDescription")
     126    local configButton = P.window:getChild("SingleplayerConfigButton")
    127127    local level = P.SingleplayerGetSelectedLevel()
    128128    if level ~= nil then
     
    130130        local imageName = level:getScreenshot()
    131131        -- set the screenshot and the description for the selected level
    132         levelImage:setProperty("Image", levelXMLFilename..imageName.."/full_image")
     132        levelImage:setProperty("Image", levelXMLFilename..imageName)
    133133        levelDescription:setText(level:getDescription())
    134134        -- only enable config button for "gametype" levels
Note: See TracChangeset for help on using the changeset viewer.