Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 10, 2016, 12:09:09 PM (9 years ago)
Author:
binderm
Message:

logic to show only certain levels and not all together, also not all shown levels have to be activated

Location:
code/branches/bindermFS16
Files:
5 edited

Legend:

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

    r11173 r11180  
    1313            <Property Name="Visible" Value="False"/>
    1414            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    15             <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.1,0},{0.65,0},{0.15,0}}" />
    16             <Property Name="Disabled" Value="False" />
     15            <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.01,0},{0.3,0},{0.06,0}}" />
    1716            <Event Name="Clicked" Function="CampaignMenu.Mission1Button_clicked"/>
    1817        </Window>
  • code/branches/bindermFS16/data/gui/scripts/CampaignMenu.lua

    r11173 r11180  
    2626
    2727function P.updateButton(index, button)
    28     if (orxonox.LevelManager:getInstance():missionactivate(index)) then
     28    local test =orxonox.LevelManager:getInstance():missionactivate(index)
     29    if (test==1) then
    2930        button:setProperty("Visible", "True")
    3031        button:setProperty("Disabled", "False")
     32    elseif (test==2) then
     33        button:setProperty("Visible", "True")
     34        button:setProperty("Disabled", "True")
    3135    else
     36        button:setProperty("Visible", "False")
    3237        button:setProperty("Disabled", "True")
    3338    end
  • code/branches/bindermFS16/src/orxonox/LevelManager.cc

    r11173 r11180  
    5252    LevelStatus::LevelStatus()
    5353    {
    54         this->won = true;
     54        this->won = false;
     55        this->nextLevels.insert(this->nextLevels.begin(),-1);
    5556    }
    5657
     
    5859    {}
    5960
    60     bool LevelManager::missionactivate(int index)
    61     {
    62         //check for index level activate...
    63         return index-5;
    64     }
    65 
    66     void LevelManager::setLevelStatus(int completedLevel)
    67     {
    68 //        allLevelStatus_[completedLevel]=new LevelStatus;
    69     }
     61
     62    //check if index level is activated...
     63    int LevelManager::missionactivate(int index)
     64    {
     65            return index+1;
     66
     67
     68        if (allLevelStatus_[index].won)
     69            return 1;
     70
     71        //check if level is activated
     72        for(unsigned int i=1;i<allLevelStatus_.size();i++)
     73        {
     74            std::vector<int> nextLevels=allLevelStatus_[i].nextLevels;
     75            bool won=allLevelStatus_[i].won;
     76            if(nextLevels[index]==1&&won)
     77                return 1;
     78        };
     79
     80        //check if level visible but not activated
     81        for(unsigned int i=1;i<allLevelStatus_.size();i++)
     82        {
     83            std::vector<int> nextLevels=allLevelStatus_[i].nextLevels;
     84            bool won=allLevelStatus_[i].won;
     85            if(nextLevels[index]==2&&won)
     86                return 2;
     87        };
     88        return false;
     89    }
     90
     91    //updates the won variable of the corresponding LevelStatus in allLevelStatus_
     92    void LevelManager::setLevelStatus(const int completedLevel)
     93    {
     94        allLevelStatus_[completedLevel].won=true;   
     95    }
     96
     97    //build up allLevelStatus
     98    //has to be done once per game (not per level)
     99    //all connections between the levels are saved in here
     100    void LevelManager::buildallLevelStatus()
     101    {
     102        LevelStatus level;
     103        allLevelStatus_.assign (10,level);
     104        allLevelStatus_[1].won=true;
     105
     106    }
     107
    70108
    71109
     
    97135        this->nextLevel_ = this->availableLevels_.begin();
    98136
    99         allLevelStatus_.reserve(1);
     137        buildallLevelStatus();
    100138    }
    101139
  • code/branches/bindermFS16/src/orxonox/LevelManager.h

    r11173 r11180  
    5858        virtual ~LevelStatus();
    5959       
    60 
    61     private:
    6260        bool won;
    6361        std::vector<int> nextLevels;
     
    9795            virtual ~LevelManager();
    9896
    99             void setLevelStatus(int integer);
     97            void setLevelStatus(const int integer);
     98            void buildallLevelStatus();
    10099
    101100
     
    108107
    109108            // tolua_begin
    110             bool missionactivate(int index);
     109            int missionactivate(int index);
    111110            void setDefaultLevel(const std::string& levelName); //!< Set the default Level.
    112111            /**
     
    159158            std::string lastFinishedCampaignMission_;
    160159            std::vector<std::string> campaignMissions_;
     160
    161161            std::vector<LevelStatus> allLevelStatus_;
    162162
  • code/branches/bindermFS16/src/orxonox/gametypes/Mission.cc

    r11173 r11180  
    9292
    9393            LevelManager::getInstance().setLastFinishedCampaignMission(this->getFilename());
    94             //LevelManager::getInstance().setLevelStatus(7);
     94
     95            //gibt index von bestandenem level weiter
     96            LevelManager::getInstance().setLevelStatus(7);
    9597        }
    9698        else if (!this->gtinfo_->hasEnded())
Note: See TracChangeset for help on using the changeset viewer.