diff --git a/include/Game/Systems/MainMenuSystem.h b/include/Game/Systems/MainMenuSystem.h index 341bc7cd..7a51f4f0 100644 --- a/include/Game/Systems/MainMenuSystem.h +++ b/include/Game/Systems/MainMenuSystem.h @@ -23,8 +23,6 @@ public: private: IRenderer* m_Renderer; - void OnPlay(const Events::InputCommand& e); - void OnOptions(const Events::InputCommand& e); void OpenSubMenu(const Events::InputCommand& e); EventRelay m_EClicked; diff --git a/resources/Schema/Entities/OptionMenu.xml b/resources/Schema/Entities/OptionMenu.xml index c1c4b517..600dc49b 100644 --- a/resources/Schema/Entities/OptionMenu.xml +++ b/resources/Schema/Entities/OptionMenu.xml @@ -1,5 +1,5 @@ - + diff --git a/resources/Schema/Entities/ServerList.xml b/resources/Schema/Entities/ServerList.xml index f9a601f5..79f50c09 100644 --- a/resources/Schema/Entities/ServerList.xml +++ b/resources/Schema/Entities/ServerList.xml @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ - + @@ -33,9 +33,10 @@ + Models/Core/UnitQuad.mesh + Textures/Core/White.png true - @@ -48,9 +49,10 @@ + Models/Core/UnitQuad.mesh + Textures/Core/White.png true - @@ -66,8 +68,9 @@ - Textures/Icons/rotate.png + Models/Core/UnitQuad.mesh + Textures/Icons/rotate.png @@ -79,6 +82,43 @@ + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + + + + + + + + + + + + Servers + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + diff --git a/src/Game/Systems/MainMenuSystem.cpp b/src/Game/Systems/MainMenuSystem.cpp index 1f0d3cf6..ff2e2981 100644 --- a/src/Game/Systems/MainMenuSystem.cpp +++ b/src/Game/Systems/MainMenuSystem.cpp @@ -16,7 +16,7 @@ void MainMenuSystem::Update(double dt) } -void MainMenuSystem::OnPlay(const Events::InputCommand& e) +void MainMenuSystem::OpenSubMenu(const Events::InputCommand& e) { auto menus = m_World->GetComponents("Menu"); if (menus == nullptr) { @@ -37,7 +37,7 @@ void MainMenuSystem::OnPlay(const Events::InputCommand& e) break; } - } else if (!m_OpenSubMenu.HasComponent("ServerList")) { + } else if (m_OpenSubMenu.Name().compare(e.Command) != 0) { //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; @@ -60,21 +60,10 @@ void MainMenuSystem::OnPlay(const Events::InputCommand& e) } } - -void MainMenuSystem::OnOptions(const Events::InputCommand& e) -{ - -} - -void MainMenuSystem::OpenSubMenu(const Events::InputCommand& e) -{ - -} - bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e) { - if (e.EntityName == "ServerIdentityConnect") { - EntityWrapper entity = e.Entity; + EntityWrapper entity = e.Entity; + if (entity.Name() == "ServerIdentityConnect") { EntityWrapper serverIdentityEntity = entity.FirstParentWithComponent("ServerIdentity"); if(serverIdentityEntity.Valid()) { Events::ConnectRequest event; @@ -83,6 +72,9 @@ bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e) printf("\n ----Request Server Connect----\nIP: %s\nPort: %i\n ------------------------------", event.IP, event.Port); m_EventBroker->Publish(event); } + } else if (entity.HasComponent("ConfigBtnResolution")) { + + m_Renderer->SetResolution(Rectangle((int)entity["ConfigBtnResolution"]["Width"], (int)entity["ConfigBtnResolution"]["Height"])); } return true; } @@ -100,12 +92,12 @@ bool MainMenuSystem::OnButtonPress(const Events::ButtonPressed& e) bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e) { if(e.Command == "Play" && e.Value == 1) { - OnPlay(e); + OpenSubMenu(e); } else if (e.Command == "RefreshServerList" && e.Value == 1){ Events::SearchForServers event; m_EventBroker->Publish(event); } else if (e.Command == "Options" && e.Value == 1) { - OnOptions(e); + OpenSubMenu(e); } return true; } \ No newline at end of file