Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 21, 2016, 4:05:15 PM (9 years ago)
Author:
binderm
Message:

Campaignmenu improved, it's now possible to only show single levels and not all together.

Location:
code/branches/bindermFS16/data/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/bindermFS16/data/gui/layouts/CampaignMenu.layout

    r11052 r11173  
    88        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1.0,0},{1.0,0}}" />
    99        <Property Name="BackgroundEnabled" Value="False" />
     10
    1011        <Window Type="MenuWidgets/Button" Name="orxonox/Mission1Button" >
    1112            <Property Name="Text" Value="Mission One" />
     
    1314            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    1415            <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.1,0},{0.65,0},{0.15,0}}" />
     16            <Property Name="Disabled" Value="False" />
    1517            <Event Name="Clicked" Function="CampaignMenu.Mission1Button_clicked"/>
    1618        </Window>
     19
    1720        <Window Type="MenuWidgets/Button" Name="orxonox/Mission2Button" >
    1821            <Property Name="Text" Value="Fight in our Back" />
     
    2326            <Event Name="Clicked" Function="CampaignMenu.Mission2Button_clicked"/>
    2427        </Window>
     28
    2529        <Window Type="MenuWidgets/Button" Name="orxonox/Mission3Button" >
    2630            <Property Name="Text" Value="Pirate Attack" />
     
    3135            <Event Name="Clicked" Function="CampaignMenu.Mission3Button_clicked"/>
    3236        </Window>
     37
    3338        <Window Type="MenuWidgets/Button" Name="orxonox/Mission4Button" >
    3439            <Property Name="Text" Value="Trip to Area 51" />
     
    3944            <Event Name="Clicked" Function="CampaignMenu.Mission4Button_clicked"/>
    4045        </Window>
     46
    4147        <Window Type="MenuWidgets/Button" Name="orxonox/Mission5Button" >
    4248            <Property Name="Text" Value="Area 51 under Fire" />
     
    4753            <Event Name="Clicked" Function="CampaignMenu.Mission5Button_clicked"/>
    4854        </Window>
     55
    4956        <Window Type="MenuWidgets/Button" Name="orxonox/Mission6Button" >
    5057            <Property Name="Text" Value="Escape the Bastards" />
     
    5562            <Event Name="Clicked" Function="CampaignMenu.Mission6Button_clicked"/>
    5663        </Window>
     64
    5765        <Window Type="MenuWidgets/Button" Name="orxonox/Mission7Button" >
    5866            <Property Name="Text" Value="Expedition to Sector 5C" />
     
    6371            <Event Name="Clicked" Function="CampaignMenu.Mission7Button_clicked"/>
    6472        </Window>
     73
    6574        <Window Type="MenuWidgets/Button" Name="orxonox/Mission8Button" >
    6675            <Property Name="Text" Value="Shuttle under Attack" />
     
    7180            <Event Name="Clicked" Function="CampaignMenu.Mission8Button_clicked"/>
    7281        </Window>
     82
    7383        <Window Type="MenuWidgets/Button" Name="orxonox/Mission9Button" >
    7484            <Property Name="Text" Value="Retaliation" />
     
    8090        </Window>
    8191
    82 
    8392        <Window Type="MenuWidgets/Button" Name="orxonox/CampaignMenuBackButton" >
    8493            <Property Name="Text" Value="Back" />
     94            <Property Name="Visible" Value="False"/>
    8595            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    8696            <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.85,0},{0.65,0},{0.9,0}}" />
     97            <Property Name="Visible" Value="True"/>
     98            <Property Name="Disabled" Value="False"/>
    8799            <Event Name="Clicked" Function="CampaignMenu.CampaignMenuBackButton_clicked"/>
    88100        </Window>
     101
    89102        <Window Type="MenuWidgets/StaticText" Name="orxonox/CampaignMenuCongratulation" >
    90103            <Property Name="Text" Value="Campaign Completed!!!" />
  • code/branches/bindermFS16/data/gui/scripts/CampaignMenu.lua

    r11052 r11173  
    1919
    2020
    21     if (P.getIndexOfLastFinishedMission() == orxonox.LevelManager:getInstance():getNumberOfCampaignMissions() - 1) then
    22         local label = winMgr:getWindow("orxonox/CampaignMenuCongratulation")
    23         label:setProperty("Visible","True")
     21--    if (P.getIndexOfLastFinishedMission() == orxonox.LevelManager:getInstance():getNumberOfCampaignMissions() - 1) then
     22--        local label = winMgr:getWindow("orxonox/CampaignMenuCongratulation")
     23--        label:setProperty("Visible","True")
     24--    end
     25end
     26
     27function P.updateButton(index, button)
     28    if (orxonox.LevelManager:getInstance():missionactivate(index)) then
     29        button:setProperty("Visible", "True")
     30        button:setProperty("Disabled", "False")
     31    else
     32        button:setProperty("Disabled", "True")
    2433    end
    2534end
    2635
    27 function P.updateButton(index, button)
    28     if (P.shouldDisplayButton(index)) then
    29         button:setProperty("Visible", "True")
     36--function P.shouldDisplayButton(index)
     37--    local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
     38--    return index < size
     39--end
    3040
    31         if (P.shouldEnableButton(index)) then
    32             button:setProperty("Disabled", "False")
    33         end
    34     end
    35 end
     41--function P.shouldActivateButton(index) --checks if button should be activated or not
     42--    return index <= P.getIndexOfLastFinishedMission() + 1
     43--end
    3644
    37 function P.shouldDisplayButton(index)
    38     local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
    39     return index < size
    40 end
    41 
    42 function P.shouldEnableButton(index)
    43     return index <= P.getIndexOfLastFinishedMission() + 1
    44 end
    45 
    46 function P.getIndexOfLastFinishedMission()
    47     local lastMission = orxonox.LevelManager:getInstance():getLastFinishedCampaignMission()
    48     if (lastMission and lastMission ~= "") then
    49         local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
    50         local index = 0
    51         while index < size do
    52             local mission = orxonox.LevelManager:getInstance():getCampaignMission(index)
    53             if (mission == lastMission) then
    54                 return index
    55             end
    56             index = index + 1
    57         end
    58     end
    59     return -1
    60 end
     45--function P.getIndexOfLastFinishedMission()
     46--    local lastMission = orxonox.LevelManager:getInstance():getLastFinishedCampaignMission()
     47--    if (lastMission and lastMission ~= "") then
     48--        local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
     49--        local index = 0
     50--        while index < size do
     51--            local mission = orxonox.LevelManager:getInstance():getCampaignMission(index)
     52--            if (mission == lastMission) then
     53--                return index
     54--            end
     55--            index = index + 1
     56--        end
     57--    end
     58--    return -1
     59--end
    6160
    6261function P.Mission1Button_clicked(e)
  • code/branches/bindermFS16/data/gui/scripts/SingleplayerMenu.lua

    r11162 r11173  
    172172
    173173function P.CampaignButton_clicked(e)
    174     orxonox.CampaignMenu:test()
     174--    P.test()
    175175    showMenuSheet("CampaignMenu", true)
    176176end
    177177
     178--function P.test()
     179--    orxonox.CampaignMenu:test()
     180--end
     181
    178182return P
Note: See TracChangeset for help on using the changeset viewer.