Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2016, 4:15:54 PM (8 years ago)
Author:
fvultier
Message:

merged campain menu

Location:
code/branches/presentationFS16
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationFS16

  • code/branches/presentationFS16/data/gui/scripts/CampaignMenu.lua

    r11052 r11206  
    1717    P.updateButton(7, winMgr:getWindow("orxonox/Mission8Button"))
    1818    P.updateButton(8, winMgr:getWindow("orxonox/Mission9Button"))
     19end
    1920
    2021
    21     if (P.getIndexOfLastFinishedMission() == orxonox.LevelManager:getInstance():getNumberOfCampaignMissions() - 1) then
    22         local label = winMgr:getWindow("orxonox/CampaignMenuCongratulation")
    23         label:setProperty("Visible","True")
     22function P.updateButton(index, button)
     23    local lastMission = orxonox.LevelManager:getInstance():getLastWonMission()
     24    if (lastMission == "") then
     25    else
     26        local lastwon =P.getIndexOfLastFinishedMission()
     27        orxonox.LevelManager:getInstance():updatewon(lastwon)
     28    end
     29
     30    local test =orxonox.LevelManager:getInstance():missionactivate(index)
     31
     32    if (test==1) then
     33        button:setProperty("Visible", "True")
     34        button:setProperty("Disabled", "False")
     35    elseif (test==2) then
     36        button:setProperty("Visible", "True")
     37        button:setProperty("Disabled", "True")
     38    else
     39        button:setProperty("Visible", "False")
     40        button:setProperty("Disabled", "True")
    2441    end
    2542end
    2643
    27 function P.updateButton(index, button)
    28     if (P.shouldDisplayButton(index)) then
    29         button:setProperty("Visible", "True")
    30 
    31         if (P.shouldEnableButton(index)) then
    32             button:setProperty("Disabled", "False")
    33         end
    34     end
    35 end
    36 
    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 
    4644function P.getIndexOfLastFinishedMission()
    47     local lastMission = orxonox.LevelManager:getInstance():getLastFinishedCampaignMission()
     45    local lastMission = orxonox.LevelManager:getInstance():getLastWonMission()
    4846    if (lastMission and lastMission ~= "") then
    4947        local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
  • code/branches/presentationFS16/data/gui/scripts/SingleplayerMenu.lua

    r10258 r11206  
    172172
    173173function P.CampaignButton_clicked(e)
     174--    P.test()
    174175    showMenuSheet("CampaignMenu", true)
    175176end
    176177
     178--function P.test()
     179--    orxonox.CampaignMenu:test()
     180--end
     181
    177182return P
Note: See TracChangeset for help on using the changeset viewer.