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/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.