[Orxonox-commit 6532] r11173 - in code/branches/bindermFS16: data/defaultConfig data/gui/layouts data/gui/scripts src/orxonox src/orxonox/gametypes src/orxonox/overlays
binderm at orxonox.net
binderm at orxonox.net
Thu Apr 21 16:05:16 CEST 2016
Author: binderm
Date: 2016-04-21 16:05:15 +0200 (Thu, 21 Apr 2016)
New Revision: 11173
Modified:
code/branches/bindermFS16/data/defaultConfig/orxonox.ini
code/branches/bindermFS16/data/gui/layouts/CampaignMenu.layout
code/branches/bindermFS16/data/gui/scripts/CampaignMenu.lua
code/branches/bindermFS16/data/gui/scripts/SingleplayerMenu.lua
code/branches/bindermFS16/src/orxonox/CMakeLists.txt
code/branches/bindermFS16/src/orxonox/LevelManager.cc
code/branches/bindermFS16/src/orxonox/LevelManager.h
code/branches/bindermFS16/src/orxonox/gametypes/Mission.cc
code/branches/bindermFS16/src/orxonox/overlays/CampaignMenu.cc
code/branches/bindermFS16/src/orxonox/overlays/CampaignMenu.h
Log:
Campaignmenu improved, it's now possible to only show single levels and not all together.
Modified: code/branches/bindermFS16/data/defaultConfig/orxonox.ini
===================================================================
--- code/branches/bindermFS16/data/defaultConfig/orxonox.ini 2016-04-21 14:02:06 UTC (rev 11172)
+++ code/branches/bindermFS16/data/defaultConfig/orxonox.ini 2016-04-21 14:05:15 UTC (rev 11173)
@@ -7,4 +7,4 @@
campaignMissions_[5] = "iiiJohnVane_EscapeTheBastards.oxw"
campaignMissions_[6] = "expeditionSector.oxw"
campaignMissions_[7] = "shuttleAttack.oxw"
-campaignMissions_[8] = "shuttleRetaliation.oxw"
+campaignMissions_[8] = "shuttleRetaliation.oxw"
\ No newline at end of file
Modified: code/branches/bindermFS16/data/gui/layouts/CampaignMenu.layout
===================================================================
--- code/branches/bindermFS16/data/gui/layouts/CampaignMenu.layout 2016-04-21 14:02:06 UTC (rev 11172)
+++ code/branches/bindermFS16/data/gui/layouts/CampaignMenu.layout 2016-04-21 14:05:15 UTC (rev 11173)
@@ -7,13 +7,16 @@
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1.0,0},{1.0,0}}" />
<Property Name="BackgroundEnabled" Value="False" />
+
<Window Type="MenuWidgets/Button" Name="orxonox/Mission1Button" >
<Property Name="Text" Value="Mission One" />
<Property Name="Visible" Value="False"/>
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.1,0},{0.65,0},{0.15,0}}" />
+ <Property Name="Disabled" Value="False" />
<Event Name="Clicked" Function="CampaignMenu.Mission1Button_clicked"/>
</Window>
+
<Window Type="MenuWidgets/Button" Name="orxonox/Mission2Button" >
<Property Name="Text" Value="Fight in our Back" />
<Property Name="Visible" Value="False"/>
@@ -22,6 +25,7 @@
<Property Name="Disabled" Value="True" />
<Event Name="Clicked" Function="CampaignMenu.Mission2Button_clicked"/>
</Window>
+
<Window Type="MenuWidgets/Button" Name="orxonox/Mission3Button" >
<Property Name="Text" Value="Pirate Attack" />
<Property Name="Visible" Value="False"/>
@@ -30,6 +34,7 @@
<Property Name="Disabled" Value="True" />
<Event Name="Clicked" Function="CampaignMenu.Mission3Button_clicked"/>
</Window>
+
<Window Type="MenuWidgets/Button" Name="orxonox/Mission4Button" >
<Property Name="Text" Value="Trip to Area 51" />
<Property Name="Visible" Value="False"/>
@@ -38,6 +43,7 @@
<Property Name="Disabled" Value="True" />
<Event Name="Clicked" Function="CampaignMenu.Mission4Button_clicked"/>
</Window>
+
<Window Type="MenuWidgets/Button" Name="orxonox/Mission5Button" >
<Property Name="Text" Value="Area 51 under Fire" />
<Property Name="Visible" Value="False"/>
@@ -46,6 +52,7 @@
<Property Name="Disabled" Value="True" />
<Event Name="Clicked" Function="CampaignMenu.Mission5Button_clicked"/>
</Window>
+
<Window Type="MenuWidgets/Button" Name="orxonox/Mission6Button" >
<Property Name="Text" Value="Escape the Bastards" />
<Property Name="Visible" Value="False"/>
@@ -54,6 +61,7 @@
<Property Name="Disabled" Value="True" />
<Event Name="Clicked" Function="CampaignMenu.Mission6Button_clicked"/>
</Window>
+
<Window Type="MenuWidgets/Button" Name="orxonox/Mission7Button" >
<Property Name="Text" Value="Expedition to Sector 5C" />
<Property Name="Visible" Value="False"/>
@@ -62,6 +70,7 @@
<Property Name="Disabled" Value="True" />
<Event Name="Clicked" Function="CampaignMenu.Mission7Button_clicked"/>
</Window>
+
<Window Type="MenuWidgets/Button" Name="orxonox/Mission8Button" >
<Property Name="Text" Value="Shuttle under Attack" />
<Property Name="Visible" Value="False"/>
@@ -70,6 +79,7 @@
<Property Name="Disabled" Value="True" />
<Event Name="Clicked" Function="CampaignMenu.Mission8Button_clicked"/>
</Window>
+
<Window Type="MenuWidgets/Button" Name="orxonox/Mission9Button" >
<Property Name="Text" Value="Retaliation" />
<Property Name="Visible" Value="False"/>
@@ -79,13 +89,16 @@
<Event Name="Clicked" Function="CampaignMenu.Mission9Button_clicked"/>
</Window>
-
<Window Type="MenuWidgets/Button" Name="orxonox/CampaignMenuBackButton" >
<Property Name="Text" Value="Back" />
+ <Property Name="Visible" Value="False"/>
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedAreaRect" Value="{{0.35,0},{0.85,0},{0.65,0},{0.9,0}}" />
+ <Property Name="Visible" Value="True"/>
+ <Property Name="Disabled" Value="False"/>
<Event Name="Clicked" Function="CampaignMenu.CampaignMenuBackButton_clicked"/>
</Window>
+
<Window Type="MenuWidgets/StaticText" Name="orxonox/CampaignMenuCongratulation" >
<Property Name="Text" Value="Campaign Completed!!!" />
<Property Name="Visible" Value="False"/>
Modified: code/branches/bindermFS16/data/gui/scripts/CampaignMenu.lua
===================================================================
--- code/branches/bindermFS16/data/gui/scripts/CampaignMenu.lua 2016-04-21 14:02:06 UTC (rev 11172)
+++ code/branches/bindermFS16/data/gui/scripts/CampaignMenu.lua 2016-04-21 14:05:15 UTC (rev 11173)
@@ -18,46 +18,45 @@
P.updateButton(8, winMgr:getWindow("orxonox/Mission9Button"))
- if (P.getIndexOfLastFinishedMission() == orxonox.LevelManager:getInstance():getNumberOfCampaignMissions() - 1) then
- local label = winMgr:getWindow("orxonox/CampaignMenuCongratulation")
- label:setProperty("Visible","True")
- end
+-- if (P.getIndexOfLastFinishedMission() == orxonox.LevelManager:getInstance():getNumberOfCampaignMissions() - 1) then
+-- local label = winMgr:getWindow("orxonox/CampaignMenuCongratulation")
+-- label:setProperty("Visible","True")
+-- end
end
function P.updateButton(index, button)
- if (P.shouldDisplayButton(index)) then
+ if (orxonox.LevelManager:getInstance():missionactivate(index)) then
button:setProperty("Visible", "True")
-
- if (P.shouldEnableButton(index)) then
- button:setProperty("Disabled", "False")
- end
+ button:setProperty("Disabled", "False")
+ else
+ button:setProperty("Disabled", "True")
end
end
-function P.shouldDisplayButton(index)
- local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
- return index < size
-end
+--function P.shouldDisplayButton(index)
+-- local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
+-- return index < size
+--end
-function P.shouldEnableButton(index)
- return index <= P.getIndexOfLastFinishedMission() + 1
-end
+--function P.shouldActivateButton(index) --checks if button should be activated or not
+-- return index <= P.getIndexOfLastFinishedMission() + 1
+--end
-function P.getIndexOfLastFinishedMission()
- local lastMission = orxonox.LevelManager:getInstance():getLastFinishedCampaignMission()
- if (lastMission and lastMission ~= "") then
- local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
- local index = 0
- while index < size do
- local mission = orxonox.LevelManager:getInstance():getCampaignMission(index)
- if (mission == lastMission) then
- return index
- end
- index = index + 1
- end
- end
- return -1
-end
+--function P.getIndexOfLastFinishedMission()
+-- local lastMission = orxonox.LevelManager:getInstance():getLastFinishedCampaignMission()
+-- if (lastMission and lastMission ~= "") then
+-- local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
+-- local index = 0
+-- while index < size do
+-- local mission = orxonox.LevelManager:getInstance():getCampaignMission(index)
+-- if (mission == lastMission) then
+-- return index
+-- end
+-- index = index + 1
+-- end
+-- end
+-- return -1
+--end
function P.Mission1Button_clicked(e)
P.loadLevel(P.FindLevel(0))
Modified: code/branches/bindermFS16/data/gui/scripts/SingleplayerMenu.lua
===================================================================
--- code/branches/bindermFS16/data/gui/scripts/SingleplayerMenu.lua 2016-04-21 14:02:06 UTC (rev 11172)
+++ code/branches/bindermFS16/data/gui/scripts/SingleplayerMenu.lua 2016-04-21 14:05:15 UTC (rev 11173)
@@ -171,8 +171,12 @@
end
function P.CampaignButton_clicked(e)
- orxonox.CampaignMenu:test()
+-- P.test()
showMenuSheet("CampaignMenu", true)
end
-return P
\ No newline at end of file
+--function P.test()
+-- orxonox.CampaignMenu:test()
+--end
+
+return P
Modified: code/branches/bindermFS16/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/bindermFS16/src/orxonox/CMakeLists.txt 2016-04-21 14:02:06 UTC (rev 11172)
+++ code/branches/bindermFS16/src/orxonox/CMakeLists.txt 2016-04-21 14:05:15 UTC (rev 11173)
@@ -57,6 +57,7 @@
FIND_HEADER_FILES
TOLUA_FILES
chat/ChatInputHandler.h
+ overlays/CampaignMenu.h
LevelInfo.h
LevelManager.h
MoodManager.h
Modified: code/branches/bindermFS16/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/bindermFS16/src/orxonox/LevelManager.cc 2016-04-21 14:02:06 UTC (rev 11172)
+++ code/branches/bindermFS16/src/orxonox/LevelManager.cc 2016-04-21 14:05:15 UTC (rev 11173)
@@ -48,6 +48,27 @@
namespace orxonox
{
+
+ LevelStatus::LevelStatus()
+ {
+ this->won = true;
+ }
+
+ LevelStatus::~LevelStatus()
+ {}
+
+ bool LevelManager::missionactivate(int index)
+ {
+ //check for index level activate...
+ return index-5;
+ }
+
+ void LevelManager::setLevelStatus(int completedLevel)
+ {
+// allLevelStatus_[completedLevel]=new LevelStatus;
+ }
+
+
SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)");
ManageScopedSingleton(LevelManager, ScopeID::ROOT, false);
@@ -63,6 +84,8 @@
RegisterObject(LevelManager);
this->setConfigValues();
+
+
// check override
if (!CommandLineParser::getArgument("level")->hasDefaultValue())
{
@@ -72,8 +95,11 @@
this->compileAvailableLevelList();
this->nextIndex_ = 0;
this->nextLevel_ = this->availableLevels_.begin();
+
+ allLevelStatus_.reserve(1);
}
+
LevelManager::~LevelManager()
{
// Delete all the LevelInfoItem objects because the LevelManager created them
@@ -103,6 +129,8 @@
ModifyConfigValue(lastFinishedCampaignMission_, set, lastFinishedCampaignMission);
}
+
+
/**
@brief
Request activity for the input Level.
Modified: code/branches/bindermFS16/src/orxonox/LevelManager.h
===================================================================
--- code/branches/bindermFS16/src/orxonox/LevelManager.h 2016-04-21 14:02:06 UTC (rev 11172)
+++ code/branches/bindermFS16/src/orxonox/LevelManager.h 2016-04-21 14:05:15 UTC (rev 11173)
@@ -47,6 +47,24 @@
#include "util/Singleton.h"
#include "core/config/Configurable.h"
+
+namespace orxonox
+{
+
+ class LevelStatus
+ {
+ public:
+ LevelStatus();
+ virtual ~LevelStatus();
+
+
+ private:
+ bool won;
+ std::vector<int> nextLevels;
+
+ };
+}
+
// tolua_begin
namespace orxonox
{
@@ -62,8 +80,13 @@
@author
Damian 'Mozork' Frick
- @ingroup Orxonox
+
+ @ingroup Orxonox1
*/
+
+
+
+
class _OrxonoxExport LevelManager
// tolua_end
: public Singleton<LevelManager>, public Configurable
@@ -73,13 +96,18 @@
LevelManager();
virtual ~LevelManager();
+ void setLevelStatus(int integer);
+
+
void setConfigValues(); //!< Set the config values for this object.
void requestActivity(Level* level); //!< Request activity for the input Level.
void releaseActivity(Level* level); //!< Release activity for the input Level.
+
Level* getActiveLevel(); //!< Get the currently active Level.
// tolua_begin
+ bool missionactivate(int index);
void setDefaultLevel(const std::string& levelName); //!< Set the default Level.
/**
@brief Get the default level.
@@ -96,9 +124,11 @@
inline unsigned int getNumberOfCampaignMissions()
{ return this->campaignMissions_.size(); }
+
inline const std::string& getCampaignMission(unsigned int index)
{ return this->campaignMissions_[index]; }
+
/**
@brief Get the instance of the LevelManager.
@return Returns the instance of the LevelManager.
@@ -128,7 +158,10 @@
std::string defaultLevelName_;
std::string lastFinishedCampaignMission_;
std::vector<std::string> campaignMissions_;
+ std::vector<LevelStatus> allLevelStatus_;
+
+
static LevelManager* singletonPtr_s;
}; // tolua_export
} // tolua_export
Modified: code/branches/bindermFS16/src/orxonox/gametypes/Mission.cc
===================================================================
--- code/branches/bindermFS16/src/orxonox/gametypes/Mission.cc 2016-04-21 14:02:06 UTC (rev 11172)
+++ code/branches/bindermFS16/src/orxonox/gametypes/Mission.cc 2016-04-21 14:05:15 UTC (rev 11173)
@@ -91,6 +91,7 @@
this->gtinfo_->sendAnnounceMessage("Mission accomplished!");
LevelManager::getInstance().setLastFinishedCampaignMission(this->getFilename());
+ //LevelManager::getInstance().setLevelStatus(7);
}
else if (!this->gtinfo_->hasEnded())
this->gtinfo_->sendAnnounceMessage("Mission failed!");
Modified: code/branches/bindermFS16/src/orxonox/overlays/CampaignMenu.cc
===================================================================
--- code/branches/bindermFS16/src/orxonox/overlays/CampaignMenu.cc 2016-04-21 14:02:06 UTC (rev 11172)
+++ code/branches/bindermFS16/src/orxonox/overlays/CampaignMenu.cc 2016-04-21 14:05:15 UTC (rev 11173)
@@ -32,8 +32,11 @@
#include "core/XMLPort.h"
#include "core/GameMode.h"
+
namespace orxonox
{
+
+
RegisterClass(CampaignMenu);
CampaignMenu::CampaignMenu(Context* context)
@@ -51,8 +54,9 @@
orxout()<<"test"<< endl;
}
- //loads the campaign menu
- void CampaignMenu::loadNewMenu()
+
+ //loads the new campaign menu
+ void CampaignMenu::loadnewmenu()
{
}
Modified: code/branches/bindermFS16/src/orxonox/overlays/CampaignMenu.h
===================================================================
--- code/branches/bindermFS16/src/orxonox/overlays/CampaignMenu.h 2016-04-21 14:02:06 UTC (rev 11172)
+++ code/branches/bindermFS16/src/orxonox/overlays/CampaignMenu.h 2016-04-21 14:05:15 UTC (rev 11173)
@@ -31,20 +31,23 @@
#include <string>
#include "core/BaseObject.h"
+#include "util/Singleton.h"
-
-namespace orxonox // tolua_export
-{ // tolua_export
-
- class _OrxonoxExport CampaignMenu // tolua_export
- : public BaseObject
- { // tolua_export
+//tolua_begin
+namespace orxonox
+{
+//tolua_end
+class _OrxonoxExport CampaignMenu : public BaseObject //tolua_export
+ { //tolua_export
public:
CampaignMenu(Context* context);
~CampaignMenu();
- static void test(); // tolua_export
- void loadNewMenu();
- };// tolua_export
-} // tolua_export
+ static void test(); //tolua_export
+ void loadnewmenu();
+ }; //tolua_export
+
+
+} //tolua_export
+
#endif /* _CampaignMenu_H__ */
More information about the Orxonox-commit
mailing list