Options menu started working on
This commit is contained in:
@@ -7,7 +7,6 @@
|
|||||||
#include "Core/Event.h"
|
#include "Core/Event.h"
|
||||||
#include "Systems/SpawnerSystem.h"
|
#include "Systems/SpawnerSystem.h"
|
||||||
|
|
||||||
|
|
||||||
#include "GUI/EButtonClicked.h"
|
#include "GUI/EButtonClicked.h"
|
||||||
#include "GUI/EButtonPressed.h"
|
#include "GUI/EButtonPressed.h"
|
||||||
#include "GUI/EButtonReleased.h"
|
#include "GUI/EButtonReleased.h"
|
||||||
@@ -24,6 +23,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
IRenderer* m_Renderer;
|
IRenderer* m_Renderer;
|
||||||
|
void OnPlay(const Events::InputCommand& e);
|
||||||
|
void OnOptions(const Events::InputCommand& e);
|
||||||
|
|
||||||
EventRelay<MainMenuSystem, Events::ButtonClicked> m_EClicked;
|
EventRelay<MainMenuSystem, Events::ButtonClicked> m_EClicked;
|
||||||
bool OnButtonClick(const Events::ButtonClicked& e);
|
bool OnButtonClick(const Events::ButtonClicked& e);
|
||||||
|
|||||||
@@ -68,4 +68,6 @@
|
|||||||
<xs:include schemaLocation="Components/NetworkComponent.xsd"/>
|
<xs:include schemaLocation="Components/NetworkComponent.xsd"/>
|
||||||
<xs:include schemaLocation="Components/ServerIdentity.xsd"/>
|
<xs:include schemaLocation="Components/ServerIdentity.xsd"/>
|
||||||
<xs:include schemaLocation="Components/ServerList.xsd"/>
|
<xs:include schemaLocation="Components/ServerList.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/ConfigBtnResolution.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/ConfigBtnFloat.xsd"/>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
@@ -6,47 +6,6 @@
|
|||||||
</Components>
|
</Components>
|
||||||
|
|
||||||
<Children>
|
<Children>
|
||||||
<Entity name="Buttons_anchor">
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0.168000013" Z="0.0199999996"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="Res1080">
|
|
||||||
<Components>
|
|
||||||
<c:Sprite>
|
|
||||||
<Model>Models/Core/UnitQuad.mesh</Model>
|
|
||||||
<GlowMap></GlowMap>
|
|
||||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
|
||||||
</c:Sprite>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-0.088000007" Y="0" Z="0"/>
|
|
||||||
<Scale X="0.0820000023" Y="0.0299999993" Z="1"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="Text">
|
|
||||||
<Components>
|
|
||||||
<c:Text>
|
|
||||||
<Content>1920x1080</Content>
|
|
||||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
|
||||||
<Color A="1" B="0" G="0" R="0"/>
|
|
||||||
<Alignment>
|
|
||||||
<Left/>
|
|
||||||
</Alignment>
|
|
||||||
</c:Text>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-0.387000024" Y="-0.472000033" Z="0.0199999996"/>
|
|
||||||
<Scale X="0.192000002" Y="0.396000028" Z="1"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="Background_Origin">
|
<Entity name="Background_Origin">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
@@ -72,6 +31,20 @@
|
|||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
|
<Entity name="UnderLine">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.00500000035" Y="0.198000014" Z="0.0199999996"/>
|
||||||
|
<Scale X="0.270000011" Y="0.00100000005" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
<Entity name="Text">
|
<Entity name="Text">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Text>
|
<c:Text>
|
||||||
@@ -88,16 +61,127 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="UnderLine">
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Buttons_anchor">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.168000013" Z="0.0199999996"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Res1080">
|
||||||
|
<Components>
|
||||||
|
<c:Button/>
|
||||||
|
<c:ConfigBtnResolution>
|
||||||
|
<Width>1920</Width>
|
||||||
|
<Height>1080</Height>
|
||||||
|
</c:ConfigBtnResolution>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||||
|
<BlurBackground>true</BlurBackground>
|
||||||
|
<Color A="0.392156869" B="1" G="1" R="1"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.088000007" Y="0" Z="0"/>
|
||||||
|
<Scale X="0.0820000023" Y="0.0299999993" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Text">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Text>
|
||||||
<Model>Models/Core/UnitQuad.mesh</Model>
|
<Content>1920x1080</Content>
|
||||||
<GlowMap></GlowMap>
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
<Color A="1" B="0" G="0" R="0"/>
|
||||||
</c:Sprite>
|
<Alignment>
|
||||||
|
<Left/>
|
||||||
|
</Alignment>
|
||||||
|
</c:Text>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.00500000035" Y="0.198000014" Z="0.0199999996"/>
|
<Position X="-0.361000031" Y="-0.562000036" Z="0.0199999996"/>
|
||||||
<Scale X="0.270000011" Y="0.00100000005" Z="1"/>
|
<Scale X="0.180000007" Y="0.469000012" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Res768">
|
||||||
|
<Components>
|
||||||
|
<c:Button/>
|
||||||
|
<c:ConfigBtnResolution>
|
||||||
|
<Width>1366</Width>
|
||||||
|
<Height>768</Height>
|
||||||
|
</c:ConfigBtnResolution>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||||
|
<BlurBackground>true</BlurBackground>
|
||||||
|
<Color A="0.392156869" B="1" G="1" R="1"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="0.0820000023" Y="0.0299999993" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Text">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>1366x768</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="0" G="0" R="0"/>
|
||||||
|
<Alignment>
|
||||||
|
<Left/>
|
||||||
|
</Alignment>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.380000025" Y="-0.561999977" Z="0.0199999996"/>
|
||||||
|
<Scale X="0.180000007" Y="0.469000012" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Res720">
|
||||||
|
<Components>
|
||||||
|
<c:Button/>
|
||||||
|
<c:ConfigBtnResolution>
|
||||||
|
<Width>1280</Width>
|
||||||
|
<Height>720</Height>
|
||||||
|
</c:ConfigBtnResolution>
|
||||||
|
<c:Sprite>
|
||||||
|
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||||
|
<BlurBackground>true</BlurBackground>
|
||||||
|
<Color A="0.392156869" B="1" G="1" R="1"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.088000007" Y="0" Z="0"/>
|
||||||
|
<Scale X="0.0820000023" Y="0.0299999993" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Text">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>1280x720</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="0" G="0" R="0"/>
|
||||||
|
<Alignment>
|
||||||
|
<Left/>
|
||||||
|
</Alignment>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.387000024" Y="-0.561999977" Z="0.0199999996"/>
|
||||||
|
<Scale X="0.180000007" Y="0.469000012" Z="1"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
|
|||||||
@@ -71,6 +71,8 @@
|
|||||||
<xs:element ref="c:NetworkComponent" minOccurs="0"/>
|
<xs:element ref="c:NetworkComponent" minOccurs="0"/>
|
||||||
<xs:element ref="c:ServerIdentity" minOccurs="0"/>
|
<xs:element ref="c:ServerIdentity" minOccurs="0"/>
|
||||||
<xs:element ref="c:ServerList" minOccurs="0"/>
|
<xs:element ref="c:ServerList" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:ConfigBtnResolution" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:ConfigBtnFloat" minOccurs="0"/>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -16,6 +16,57 @@ void MainMenuSystem::Update(double dt)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainMenuSystem::OnPlay(const Events::InputCommand& e)
|
||||||
|
{
|
||||||
|
auto menus = m_World->GetComponents("Menu");
|
||||||
|
if (menus == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_OpenSubMenu == EntityWrapper::Invalid) {
|
||||||
|
//No submenu is open, open one.
|
||||||
|
for (auto& menu : *menus) {
|
||||||
|
EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID);
|
||||||
|
auto serverListSpawner = menuEntity.FirstChildByName(e.Command + "Spawner");
|
||||||
|
if (!serverListSpawner.HasComponent("Spawner")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_OpenSubMenu = SpawnerSystem::Spawn(serverListSpawner, serverListSpawner);
|
||||||
|
Events::SearchForServers event;
|
||||||
|
m_EventBroker->Publish(event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (!m_OpenSubMenu.HasComponent("ServerList")) {
|
||||||
|
//Menu is open, but not the right one, delete the old one and open a new one.
|
||||||
|
m_World->DeleteEntity(m_OpenSubMenu.ID);
|
||||||
|
m_OpenSubMenu = EntityWrapper::Invalid;
|
||||||
|
|
||||||
|
for (auto& menu : *menus) {
|
||||||
|
EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID);
|
||||||
|
auto serverListSpawner = menuEntity.FirstChildByName(e.Command + "Spawner");
|
||||||
|
if (!serverListSpawner.HasComponent("Spawner")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_OpenSubMenu = SpawnerSystem::Spawn(serverListSpawner, serverListSpawner);
|
||||||
|
Events::SearchForServers event;
|
||||||
|
m_EventBroker->Publish(event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//Serverlist submenu is open, close it.
|
||||||
|
m_World->DeleteEntity(m_OpenSubMenu.ID);
|
||||||
|
m_OpenSubMenu = EntityWrapper::Invalid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainMenuSystem::OpenSubMenu(const Events::InputCommand& e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e)
|
bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e)
|
||||||
{
|
{
|
||||||
if (e.EntityName == "ServerIdentityConnect") {
|
if (e.EntityName == "ServerIdentityConnect") {
|
||||||
@@ -45,49 +96,12 @@ bool MainMenuSystem::OnButtonPress(const Events::ButtonPressed& e)
|
|||||||
bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e)
|
bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e)
|
||||||
{
|
{
|
||||||
if(e.Command == "Play" && e.Value == 1) {
|
if(e.Command == "Play" && e.Value == 1) {
|
||||||
auto menus = m_World->GetComponents("Menu");
|
OnPlay(e);
|
||||||
if (menus == nullptr) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_OpenSubMenu == EntityWrapper::Invalid) {
|
|
||||||
//No submenu is open, open one.
|
|
||||||
for (auto& menu : *menus) {
|
|
||||||
EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID);
|
|
||||||
auto serverListSpawner = menuEntity.FirstChildByName(e.Command + "Spawner");
|
|
||||||
if (!serverListSpawner.HasComponent("Spawner")) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
m_OpenSubMenu = SpawnerSystem::Spawn(serverListSpawner, serverListSpawner);
|
|
||||||
Events::SearchForServers event;
|
|
||||||
m_EventBroker->Publish(event);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if(!m_OpenSubMenu.HasComponent("ServerList")) {
|
|
||||||
//Menu is open, but not the right one, delete the old one and open a new one.
|
|
||||||
m_World->DeleteEntity(m_OpenSubMenu.ID);
|
|
||||||
m_OpenSubMenu = EntityWrapper::Invalid;
|
|
||||||
|
|
||||||
for (auto& menu : *menus) {
|
|
||||||
EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID);
|
|
||||||
auto serverListSpawner = menuEntity.FirstChildByName(e.Command + "Spawner");
|
|
||||||
if (!serverListSpawner.HasComponent("Spawner")) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
m_OpenSubMenu = SpawnerSystem::Spawn(serverListSpawner, serverListSpawner);
|
|
||||||
Events::SearchForServers event;
|
|
||||||
m_EventBroker->Publish(event);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//Serverlist submenu is open, close it.
|
|
||||||
m_World->DeleteEntity(m_OpenSubMenu.ID);
|
|
||||||
m_OpenSubMenu = EntityWrapper::Invalid;
|
|
||||||
}
|
|
||||||
} else if (e.Command == "RefreshServerList" && e.Value == 1){
|
} else if (e.Command == "RefreshServerList" && e.Value == 1){
|
||||||
Events::SearchForServers event;
|
Events::SearchForServers event;
|
||||||
m_EventBroker->Publish(event);
|
m_EventBroker->Publish(event);
|
||||||
|
} else if (e.Command == "Options" && e.Value == 1) {
|
||||||
|
OnOptions(e);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user