Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11206


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

merged campain menu

Location:
code/branches/presentationFS16
Files:
11 edited
4 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentationFS16

  • code/branches/presentationFS16/data/gui/layouts/CampaignMenu.layout

    r11052 r11206  
    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" />
    1213            <Property Name="Visible" Value="False"/>
    1314            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    14             <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.1,0},{0.65,0},{0.15,0}}" />
     15            <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.34,0},{0.3,0},{0.39,0}}" />
    1516            <Event Name="Clicked" Function="CampaignMenu.Mission1Button_clicked"/>
    1617        </Window>
     18
    1719        <Window Type="MenuWidgets/Button" Name="orxonox/Mission2Button" >
    1820            <Property Name="Text" Value="Fight in our Back" />
    1921            <Property Name="Visible" Value="False"/>
    2022            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    21             <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.18,0},{0.65,0},{0.23,0}}" />
    22             <Property Name="Disabled" Value="True" />
     23            <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.26,0},{0.4,0},{0.31,0}}" />
     24            <Property Name="Disabled" Value="True"/>
    2325            <Event Name="Clicked" Function="CampaignMenu.Mission2Button_clicked"/>
    2426        </Window>
     27
    2528        <Window Type="MenuWidgets/Button" Name="orxonox/Mission3Button" >
    2629            <Property Name="Text" Value="Pirate Attack" />
    2730            <Property Name="Visible" Value="False"/>
    2831            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    29             <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.26,0},{0.65,0},{0.31,0}}" />
     32            <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.42,0},{0.4,0},{0.47,0}}" />
    3033            <Property Name="Disabled" Value="True" />
    3134            <Event Name="Clicked" Function="CampaignMenu.Mission3Button_clicked"/>
    3235        </Window>
     36
    3337        <Window Type="MenuWidgets/Button" Name="orxonox/Mission4Button" >
    3438            <Property Name="Text" Value="Trip to Area 51" />
    3539            <Property Name="Visible" Value="False"/>
    3640            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    37             <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.34,0},{0.65,0},{0.39,0}}" />
     41            <Property Name="UnifiedAreaRect" Value="{{0.41,0},{0.26,0},{0.71,0},{0.31,0}}" />
    3842            <Property Name="Disabled" Value="True" />
    3943            <Event Name="Clicked" Function="CampaignMenu.Mission4Button_clicked"/>
    4044        </Window>
     45
    4146        <Window Type="MenuWidgets/Button" Name="orxonox/Mission5Button" >
    4247            <Property Name="Text" Value="Area 51 under Fire" />
    4348            <Property Name="Visible" Value="False"/>
    4449            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    45             <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.42,0},{0.65,0},{0.47,0}}" />
     50            <Property Name="UnifiedAreaRect" Value="{{0.41,0},{0.42,0},{0.71,0},{0.47,0}}" />
    4651            <Property Name="Disabled" Value="True" />
    4752            <Event Name="Clicked" Function="CampaignMenu.Mission5Button_clicked"/>
    4853        </Window>
     54
    4955        <Window Type="MenuWidgets/Button" Name="orxonox/Mission6Button" >
    5056            <Property Name="Text" Value="Escape the Bastards" />
    5157            <Property Name="Visible" Value="False"/>
    5258            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    53             <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.50,0},{0.65,0},{0.55,0}}" />
     59            <Property Name="UnifiedAreaRect" Value="{{0.72,0},{0.10,0},{0.99,0},{0.15,0}}" />
    5460            <Property Name="Disabled" Value="True" />
    5561            <Event Name="Clicked" Function="CampaignMenu.Mission6Button_clicked"/>
    5662        </Window>
     63
    5764        <Window Type="MenuWidgets/Button" Name="orxonox/Mission7Button" >
    5865            <Property Name="Text" Value="Expedition to Sector 5C" />
    5966            <Property Name="Visible" Value="False"/>
    6067            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    61             <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.58,0},{0.65,0},{0.63,0}}" />
     68            <Property Name="UnifiedAreaRect" Value="{{0.72,0},{0.18,0},{0.99,0},{0.23,0}}" />
    6269            <Property Name="Disabled" Value="True" />
    6370            <Event Name="Clicked" Function="CampaignMenu.Mission7Button_clicked"/>
    6471        </Window>
     72
    6573        <Window Type="MenuWidgets/Button" Name="orxonox/Mission8Button" >
    6674            <Property Name="Text" Value="Shuttle under Attack" />
    6775            <Property Name="Visible" Value="False"/>
    6876            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    69             <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.66,0},{0.65,0},{0.71,0}}" />
     77            <Property Name="UnifiedAreaRect" Value="{{0.72,0},{0.50,0},{0.99,0},{0.55,0}}" />
    7078            <Property Name="Disabled" Value="True" />
    7179            <Event Name="Clicked" Function="CampaignMenu.Mission8Button_clicked"/>
    7280        </Window>
     81
    7382        <Window Type="MenuWidgets/Button" Name="orxonox/Mission9Button" >
    7483            <Property Name="Text" Value="Retaliation" />
    7584            <Property Name="Visible" Value="False"/>
    7685            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    77             <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.74,0},{0.65,0},{0.79,0}}" />
     86            <Property Name="UnifiedAreaRect" Value="{{0.72,0},{0.58,0},{0.99,0},{0.63,0}}" />
    7887            <Property Name="Disabled" Value="True" />
    7988            <Event Name="Clicked" Function="CampaignMenu.Mission9Button_clicked"/>
    8089        </Window>
    8190
    82 
    8391        <Window Type="MenuWidgets/Button" Name="orxonox/CampaignMenuBackButton" >
    8492            <Property Name="Text" Value="Back" />
     93            <Property Name="Visible" Value="False"/>
    8594            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    8695            <Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.85,0},{0.65,0},{0.9,0}}" />
     96            <Property Name="Visible" Value="True"/>
     97            <Property Name="Disabled" Value="False"/>
    8798            <Event Name="Clicked" Function="CampaignMenu.CampaignMenuBackButton_clicked"/>
    8899        </Window>
     100
    89101        <Window Type="MenuWidgets/StaticText" Name="orxonox/CampaignMenuCongratulation" >
    90102            <Property Name="Text" Value="Campaign Completed!!!" />
  • 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
  • code/branches/presentationFS16/src/orxonox/CMakeLists.txt

    r11080 r11206  
    2626  Level.cc
    2727  LevelInfo.cc
     28  LevelStatus.cc
    2829  LevelManager.cc
    2930  Main.cc
     
    5859  TOLUA_FILES
    5960    chat/ChatInputHandler.h
     61    overlays/CampaignMenu.h
    6062    LevelInfo.h
    6163    LevelManager.h
     
    6567    sound/SoundManager.h
    6668    controllers/ScriptController.h
     69    overlays/CampaignMenu.h
    6770  PCH_FILE
    6871    OrxonoxPrecompiledHeaders.h
  • code/branches/presentationFS16/src/orxonox/LevelManager.cc

    r11071 r11206  
    2424 *   Co-authors:
    2525 *      Damian 'Mozork' Frick
     26 *      Matthias Binder
    2627 *
    2728 */
     
    3334
    3435#include "LevelManager.h"
     36#include "LevelStatus.h"
    3537
    3638#include <map>
     
    4749#include "PlayerManager.h"
    4850
     51
    4952namespace orxonox
    5053{
     54
     55
     56
     57
    5158    SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)");
    5259
     
    6370        RegisterObject(LevelManager);
    6471        this->setConfigValues();
     72
     73
    6574
    6675        // check override
     
    7382        this->nextIndex_ = 0;
    7483        this->nextLevel_ = this->availableLevels_.begin();
    75     }
     84
     85        buildallLevelStatus();
     86    }
     87
    7688
    7789    LevelManager::~LevelManager()
     
    8092        for (LevelInfoItem* info : availableLevels_)
    8193            info->destroy();
     94        for(unsigned int i = 0; i<allLevelStatus_.size();++i)
     95        {
     96            allLevelStatus_[i]->destroy();
     97        }
    8298    }
    8399
     
    88104    void LevelManager::setConfigValues()
    89105    {
     106
    90107        SetConfigValue(defaultLevelName_, "missionOne.oxw")
    91108            .description("Sets the pre selection of the level in the main menu.");
    92         SetConfigValue(lastFinishedCampaignMission_,  "")
     109        SetConfigValue(lastWonMission_,  "")
    93110            .description("The last finished mission of a campaign");
    94111        SetConfigValue(campaignMissions_,  std::vector<std::string>())
     
    96113    }
    97114
    98     /**
    99      * @brief Stores the argument in the corresponding config value.
    100      */
    101     void LevelManager::setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission)
    102     {
    103         ModifyConfigValue(lastFinishedCampaignMission_, set, lastFinishedCampaignMission);
    104     }
    105115
    106116    /**
     
    169179    void LevelManager::activateNextLevel()
    170180    {
     181
    171182        if (this->levels_.size() > 0)
    172183        {
     
    317328        //TODO: Implement some kind of update?
    318329    }
     330
     331
     332
     333    /**
     334    @brief
     335        first updates allLevelStatus and then check if the level with index i is activated
     336    */
     337    int LevelManager::missionactivate(int index)
     338    {
     339        updateAllLevelStatus();
     340        int activated = allLevelStatus_[index]->activated;
     341        return activated;
     342    }
     343    /**
     344    @brief
     345        update the last won mission to won=true
     346    */
     347
     348    void LevelManager::updatewon(int lastwon)
     349    {
     350        allLevelStatus_[lastwon]->won=true;
     351
     352    }
     353
     354    /**
     355    @brief
     356        checks if a level is won
     357        if a level is won, the other levels should be shown as saved in 'nextLevels' of the won level
     358        therefore 'activated' of all other levels will be updated to the correct value
     359        if more than one level is won, the level with the highes index decides which other levels will be shown, activated or not activated
     360    */
     361
     362    void LevelManager::updateAllLevelStatus()
     363    {
     364        for(unsigned int i =0;i<allLevelStatus_.size();i++)
     365        {
     366            if(allLevelStatus_[i]->won)
     367            {
     368                allLevelStatus_[i]->activated=1;
     369                std::vector<int> nextLevels=allLevelStatus_[i]->nextLevels;
     370                for(unsigned int j=0;j<allLevelStatus_.size();j++)
     371                {
     372                    allLevelStatus_[j]->activated=nextLevels[j];
     373                }
     374            }
     375        }
     376    }
     377
     378    /**
     379    @brief
     380        the name of the last won mission is saved in the config file
     381    */
     382
     383    void LevelManager::setLevelStatus(const std::string& LevelWon)
     384    {
     385       
     386           
     387        ModifyConfigValue(lastWonMission_, set, LevelWon);
     388
     389        /**
     390        TODO: save allLevelWon_ into the config file
     391        */
     392    }
     393
     394
     395    /**
     396    @brief
     397        build up allLevelStatus_
     398        has to be done once per game (not per level)
     399        all connections between the levels are saved in the allLevelStatus_
     400        also the won variable of the LevelStatus have to be set to the corresponding allLevelWon_ values
     401    */
     402    void LevelManager::buildallLevelStatus()
     403    {
     404        for(unsigned int i =0;i<campaignMissions_.size();++i)
     405        {
     406            LevelStatus* level= new LevelStatus(this->getContext());
     407            allLevelStatus_.push_back(level);
     408        }
     409
     410        /**
     411        TODO: allLevelWon_ should be loaded into the allLevelSatus_ such that the progress of the campaign can be saved
     412        */
     413
     414        allLevelStatus_[0]->activated=1;
     415
     416
     417        std::vector<int> v={1,1,1,0,0,0,0,0,0};
     418        allLevelStatus_[0]->nextLevels=v;
     419
     420        v={1,1,2,1,0,0,0,0,0};
     421        allLevelStatus_[1]->nextLevels=v;
     422
     423        v={1,2,1,0,1,0,0,0,0};
     424        allLevelStatus_[2]->nextLevels=v;
     425
     426        v={1,1,2,1,0,1,1,0,0};
     427        allLevelStatus_[3]->nextLevels=v;
     428
     429        v={1,2,1,0,1,0,0,1,1};
     430        allLevelStatus_[4]->nextLevels=v;
     431
     432        v={1,1,2,1,0,1,2,0,0};
     433        allLevelStatus_[5]->nextLevels=v;
     434
     435        v={1,1,2,1,0,2,1,0,0};
     436        allLevelStatus_[6]->nextLevels=v;
     437
     438        v={1,2,1,0,1,0,0,1,2};
     439        allLevelStatus_[7]->nextLevels=v;
     440
     441        v={1,2,1,0,1,0,0,2,1};
     442        allLevelStatus_[8]->nextLevels=v;
     443
     444    }
    319445}
  • code/branches/presentationFS16/src/orxonox/LevelManager.h

    r11071 r11206  
    2424 *   Co-authors:
    2525 *      Damian 'Mozork' Frick
     26 *      Matthias Binder
    2627 *
    2728 */
     
    4748#include "util/Singleton.h"
    4849#include "core/config/Configurable.h"
     50#include "LevelStatus.h"
     51
    4952
    5053// tolua_begin
     
    6366        Damian 'Mozork' Frick
    6467
    65     @ingroup Orxonox
     68
     69    @ingroup Orxonox1
    6670    */
     71
     72
     73
     74
    6775    class _OrxonoxExport LevelManager
    6876    // tolua_end
     
    7482            virtual ~LevelManager();
    7583
     84            void buildallLevelStatus();
     85            void updateAllLevelStatus();
     86            void setLevelStatus(const std::string& LevelWon);
     87
     88
    7689            void setConfigValues(); //!< Set the config values for this object.
    7790
    7891            void requestActivity(Level* level); //!< Request activity for the input Level.
    7992            void releaseActivity(Level* level); //!< Release activity for the input Level.
     93
    8094            Level* getActiveLevel(); //!< Get the currently active Level.
    8195
    8296            // tolua_begin
     97            void updatewon(int lastwon);
     98            int missionactivate(int index);
    8399            void setDefaultLevel(const std::string& levelName); //!< Set the default Level.
    84100            /**
     
    91107            LevelInfoItem* getAvailableLevelListItem(unsigned int index); //!< Get the LevelInfoItem at the given index in the list of available Levels.
    92108
    93             void setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission);
    94             inline const std::string& getLastFinishedCampaignMission() const
    95                 { return this->lastFinishedCampaignMission_; }
     109            inline const std::string& getLastWonMission() const
     110                { return this->lastWonMission_; }
    96111
    97112            inline unsigned int getNumberOfCampaignMissions()
    98113                { return this->campaignMissions_.size(); }
     114
    99115            inline const std::string& getCampaignMission(unsigned int index)
    100116                { return this->campaignMissions_[index]; }
     117
    101118
    102119            /**
     
    127144            // config values
    128145            std::string defaultLevelName_;
    129             std::string lastFinishedCampaignMission_;
     146            std::string lastWonMission_;
    130147            std::vector<std::string> campaignMissions_;
     148            std::vector<int> allLevelWon_;                  //level i is won if allLevelWon_[i]=1
     149            std::vector<LevelStatus*> allLevelStatus_;
     150
     151
    131152
    132153            static LevelManager* singletonPtr_s;
  • code/branches/presentationFS16/src/orxonox/gametypes/Mission.cc

    r11071 r11206  
    9191            this->gtinfo_->sendAnnounceMessage("Mission accomplished!");
    9292
    93             LevelManager::getInstance().setLastFinishedCampaignMission(this->getFilename());
     93            //LevelManager::getInstance().setLastFinishedCampaignMission(this->getFilename());
     94
     95            //gibt index von bestandenem level weiter
     96            LevelManager::getInstance().setLevelStatus(this->getFilename());
    9497        }
    9598        else if (!this->gtinfo_->hasEnded())
  • code/branches/presentationFS16/src/orxonox/gametypes/Mission.h

    r11071 r11206  
    4545
    4646            virtual void start() override;
    47             virtual void end() override;
     47            virtual void end() override;  //checks if the mission was accomplished and sends the name of the won mission to the LevelManager
    4848            virtual void setTeams();
    4949            virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
  • code/branches/presentationFS16/src/orxonox/overlays/CMakeLists.txt

    r7163 r11206  
    33  OrxonoxOverlay.cc
    44  OverlayGroup.cc
     5  CampaignMenu.cc
    56
    67#COMPILATION_BEGIN OverlayCompilation.cc
  • code/branches/presentationFS16/src/orxonox/overlays/GUISheet.cc

    r9667 r11206  
    3333#include "core/XMLPort.h"
    3434#include "core/GameMode.h"
     35#include "core/command/ConsoleCommandIncludes.h"
    3536
    3637namespace orxonox
    3738{
     39
     40
    3841    RegisterClass(GUISheet);
     42
    3943
    4044    GUISheet::GUISheet(Context* context)
     
    9599        // Note: This call has no effect when already showing!
    96100    }
     101
    97102}
Note: See TracChangeset for help on using the changeset viewer.