Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 12, 2016, 4:07:25 PM (8 years ago)
Author:
binderm
Message:

LevelStatus and levelmanager in two files, LevelStatus saves and changes the actual campaign progress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/bindermFS16/data/gui/scripts/CampaignMenu.lua

    r11180 r11186  
    2626
    2727function P.updateButton(index, button)
     28    local lastMission = orxonox.LevelManager:getInstance():getLastWonMission()
     29    if (lastMission == "") then
     30    else
     31        local lastwon =P.getIndexOfLastFinishedMission()
     32        orxonox.LevelManager:getInstance():updatewon(lastwon)
     33    end
     34
    2835    local test =orxonox.LevelManager:getInstance():missionactivate(index)
     36
    2937    if (test==1) then
    3038        button:setProperty("Visible", "True")
     
    4856--end
    4957
    50 --function P.getIndexOfLastFinishedMission()
    51 --    local lastMission = orxonox.LevelManager:getInstance():getLastFinishedCampaignMission()
    52 --    if (lastMission and lastMission ~= "") then
    53 --        local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
    54 --        local index = 0
    55 --        while index < size do
    56 --            local mission = orxonox.LevelManager:getInstance():getCampaignMission(index)
    57 --            if (mission == lastMission) then
    58 --                return index
    59 --            end
    60 --            index = index + 1
    61 --        end
    62 --    end
    63 --    return -1
    64 --end
     58function P.getIndexOfLastFinishedMission()
     59    local lastMission = orxonox.LevelManager:getInstance():getLastWonMission()
     60    if (lastMission and lastMission ~= "") then
     61        local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
     62        local index = 0
     63        while index < size do
     64            local mission = orxonox.LevelManager:getInstance():getCampaignMission(index)
     65            if (mission == lastMission) then
     66                return index
     67            end
     68            index = index + 1
     69        end
     70    end
     71    return -1
     72end
    6573
    6674function P.Mission1Button_clicked(e)
Note: See TracChangeset for help on using the changeset viewer.