WIP added an event to become a server. changed xml file.

This commit is contained in:
stiffly
2016-03-10 14:12:08 +01:00
parent 28de31d84d
commit d7f166b8ae
7 changed files with 6188 additions and 6027 deletions
+14
View File
@@ -0,0 +1,14 @@
#ifndef Events_BecomeServer_h__
#define Events_BecomeServer_h__
#include "Core/EventBroker.h"
namespace Events
{
struct BecomeServer : public Event { };
}
#endif
+2
View File
@@ -70,6 +70,8 @@ private:
bool m_IsServer = false; bool m_IsServer = false;
int parseArgs(int argc, char* argv[]); int parseArgs(int argc, char* argv[]);
EventRelay<Game, Events::BecomeServer> m_EBecomeServer;
bool OnBecomeServer(const Events::BecomeServer& e);
}; };
#endif #endif
+1
View File
@@ -14,6 +14,7 @@
#include "Input/EInputCommand.h" #include "Input/EInputCommand.h"
#include "Network/ESearchForServers.h" #include "Network/ESearchForServers.h"
#include "Network/EConnectRequest.h" #include "Network/EConnectRequest.h"
#include "Network/EBecomeServer.h"
class MainMenuSystem : public ImpureSystem class MainMenuSystem : public ImpureSystem
+65 -8
View File
@@ -319,26 +319,83 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
</Children> <Entity name="ButtonPos_5">
</Entity>
<Entity name="Popup_Origin">
<Components> <Components>
<c:Transform> <c:Transform>
<Position X="-0.103822395" Y="0" Z="0"/> <Position X="0" Y="-0.280000001" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
<Entity name="PlaySpawner"> <Entity name="Button_5">
<Components>
<c:Button/>
<c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<BlurBackground>true</BlurBackground>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
<Color A="0.392156869" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
<Scale X="0.200000003" Y="0.0500000007" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Text">
<Components>
<c:Text>
<Content>Host</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>
<Right/>
</Alignment>
</c:Text>
<c:Transform>
<Position X="0.0920000002" Y="-0.0150000006" Z="0.00499999989"/>
<Scale X="0.0199999996" Y="0.0199999996" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ButtonCorner_Origin">
<Components> <Components>
<c:Spawner>
<EntityFile>Schema/Entities/ServerList.xml</EntityFile>
</c:Spawner>
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children>
<Entity name="TopRight">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/HUD/ButtonCorner_16.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0.0970000029" Y="0.0220000017" Z="0.00499999989"/>
<Scale X="0.00499999989" Y="0.00499999989" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="BottomRight">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/HUD/ButtonCorner_16.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0.0970000029" Y="-0.0219999999" Z="0.00499999989"/>
<Orientation X="0" Y="0" Z="4.71199989"/>
<Scale X="0.00499999989" Y="0.00499999989" Z="1"/>
</c:Transform>
</Components>
<Children/> <Children/>
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
</Children> </Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity> </Entity>
File diff suppressed because it is too large Load Diff
+5
View File
@@ -284,3 +284,8 @@ int Game::parseArgs(int argc, char* argv[])
return 0; return 0;
} }
bool Game::OnBecomeServer(const Events::BecomeServer& e)
{
}
+3
View File
@@ -44,6 +44,9 @@ bool MainMenuSystem::OnButtonPress(const Events::ButtonPressed& e)
bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e) bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e)
{ {
if (e.Command == "Host" && e.Value == 1) {
m_EventBroker->Publish(Events::BecomeServer());
}
if (e.Command == "Play" && e.Value == 1) { if (e.Command == "Play" && e.Value == 1) {
auto menus = m_World->GetComponents("Menu"); auto menus = m_World->GetComponents("Menu");
if (menus == nullptr) { if (menus == nullptr) {