Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11173 for code


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

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

Location:
code/branches/bindermFS16
Files:
9 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
  • code/branches/bindermFS16/src/orxonox/CMakeLists.txt

    r11162 r11173  
    5858  TOLUA_FILES
    5959    chat/ChatInputHandler.h
     60    overlays/CampaignMenu.h
    6061    LevelInfo.h
    6162    LevelManager.h
  • code/branches/bindermFS16/src/orxonox/LevelManager.cc

    r11071 r11173  
    4949namespace orxonox
    5050{
     51
     52    LevelStatus::LevelStatus()
     53    {
     54        this->won = true;
     55    }
     56
     57    LevelStatus::~LevelStatus()
     58    {}
     59
     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    }
     70
     71
    5172    SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)");
    5273
     
    6384        RegisterObject(LevelManager);
    6485        this->setConfigValues();
     86
     87
    6588
    6689        // check override
     
    7396        this->nextIndex_ = 0;
    7497        this->nextLevel_ = this->availableLevels_.begin();
    75     }
     98
     99        allLevelStatus_.reserve(1);
     100    }
     101
    76102
    77103    LevelManager::~LevelManager()
     
    103129        ModifyConfigValue(lastFinishedCampaignMission_, set, lastFinishedCampaignMission);
    104130    }
     131
     132
    105133
    106134    /**
  • code/branches/bindermFS16/src/orxonox/LevelManager.h

    r11071 r11173  
    4848#include "core/config/Configurable.h"
    4949
     50
     51namespace orxonox
     52{
     53
     54    class LevelStatus
     55    {
     56    public:
     57        LevelStatus();
     58        virtual ~LevelStatus();
     59       
     60
     61    private:
     62        bool won;
     63        std::vector<int> nextLevels;
     64
     65    };
     66}
     67
    5068// tolua_begin
    5169namespace orxonox
     
    6381        Damian 'Mozork' Frick
    6482
    65     @ingroup Orxonox
     83
     84    @ingroup Orxonox1
    6685    */
     86
     87
     88
     89
    6790    class _OrxonoxExport LevelManager
    6891    // tolua_end
     
    7497            virtual ~LevelManager();
    7598
     99            void setLevelStatus(int integer);
     100
     101
    76102            void setConfigValues(); //!< Set the config values for this object.
    77103
    78104            void requestActivity(Level* level); //!< Request activity for the input Level.
    79105            void releaseActivity(Level* level); //!< Release activity for the input Level.
     106
    80107            Level* getActiveLevel(); //!< Get the currently active Level.
    81108
    82109            // tolua_begin
     110            bool missionactivate(int index);
    83111            void setDefaultLevel(const std::string& levelName); //!< Set the default Level.
    84112            /**
     
    97125            inline unsigned int getNumberOfCampaignMissions()
    98126                { return this->campaignMissions_.size(); }
     127
    99128            inline const std::string& getCampaignMission(unsigned int index)
    100129                { return this->campaignMissions_[index]; }
     130
    101131
    102132            /**
     
    129159            std::string lastFinishedCampaignMission_;
    130160            std::vector<std::string> campaignMissions_;
     161            std::vector<LevelStatus> allLevelStatus_;
     162
     163
    131164
    132165            static LevelManager* singletonPtr_s;
  • code/branches/bindermFS16/src/orxonox/gametypes/Mission.cc

    r11071 r11173  
    9292
    9393            LevelManager::getInstance().setLastFinishedCampaignMission(this->getFilename());
     94            //LevelManager::getInstance().setLevelStatus(7);
    9495        }
    9596        else if (!this->gtinfo_->hasEnded())
  • code/branches/bindermFS16/src/orxonox/overlays/CampaignMenu.cc

    r11162 r11173  
    3333#include "core/GameMode.h"
    3434
     35
    3536namespace orxonox
    3637{
     38
     39   
    3740    RegisterClass(CampaignMenu);
    3841
     
    5255    }
    5356
    54     //loads the campaign menu
    55     void CampaignMenu::loadNewMenu()
     57
     58    //loads the new campaign menu
     59    void CampaignMenu::loadnewmenu()
    5660    {
    5761       
  • code/branches/bindermFS16/src/orxonox/overlays/CampaignMenu.h

    r11162 r11173  
    3232#include <string>
    3333#include "core/BaseObject.h"
     34#include "util/Singleton.h"
    3435
    35 
    36 namespace orxonox // tolua_export
    37 { // tolua_export
    38 
    39         class _OrxonoxExport CampaignMenu // tolua_export
    40          : public BaseObject
    41     { // tolua_export
     36//tolua_begin
     37namespace orxonox
     38{
     39//tolua_end
     40class _OrxonoxExport CampaignMenu : public BaseObject //tolua_export
     41    { //tolua_export
    4242    public:
    4343        CampaignMenu(Context* context);
    4444        ~CampaignMenu();
    45         static void test(); // tolua_export
    46         void loadNewMenu();
    47     };// tolua_export
    48 } // tolua_export
     45        static void test(); //tolua_export
     46        void loadnewmenu();
     47    }; //tolua_export
     48
     49
     50
     51} //tolua_export
    4952
    5053#endif /* _CampaignMenu_H__ */
Note: See TracChangeset for help on using the changeset viewer.