Merge remote-tracking branch 'origin/master' into Movement

This commit is contained in:
viktorljung
2016-03-09 18:27:36 +01:00
60 changed files with 10096 additions and 335 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ DamageIndicatorSystem::DamageIndicatorSystem(SystemParams params)
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &DamageIndicatorSystem::OnSetCamera);
//load texture to cache
auto texture = CommonFunctions::LoadTexture("Textures/DamageIndicator.png", false);
auto texture = CommonFunctions::TryLoadResource<Texture, false>("Textures/DamageIndicator.png");
auto entityFile = ResourceManager::Load<EntityXMLFile>("Schema/Entities/DamageIndicator.xml");
m_NetworkEnabled = ResourceManager::Load<ConfigFile>("Config.ini")->Get("Networking.StartNetwork", false);
}
+2 -3
View File
@@ -23,8 +23,8 @@ bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e)
EntityWrapper serverIdentityEntity = entity.FirstParentWithComponent("ServerIdentity");
if(serverIdentityEntity.Valid()) {
Events::ConnectRequest event;
event.IP = (std::string)entity["ServerIdentity"]["IP"];
event.Port = (int)entity["ServerIdentity"]["Port"];
event.IP = (std::string)serverIdentityEntity["ServerIdentity"]["IP"];
event.Port = (int)serverIdentityEntity["ServerIdentity"]["Port"];
printf("\n ----Request Server Connect----\nIP: %s\nPort: %i\n ------------------------------", event.IP, event.Port);
m_EventBroker->Publish(event);
}
@@ -82,7 +82,6 @@ bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e)
}
} else {
//Serverlist submenu is open, close it.
printf("\n\nMenuShit\n\n");
m_World->DeleteEntity(m_OpenSubMenu.ID);
m_OpenSubMenu = EntityWrapper::Invalid;
}
+3 -3
View File
@@ -37,17 +37,17 @@ bool ServerListSystem::OnServerListRecieved(const Events::DisplayServerlist& e)
for (int i = 0; i < e.Serverlist.size(); i++) {
//Create Identities for each server and place them on the right position.
EntityWrapper newIdentity = SpawnerSystem::Spawn(identitySpawner, identitySpawner);
EntityWrapper serverIdentityEntity = newIdentity.FirstChildByName("ServerIdentity");
glm::vec3 offset = (glm::vec3)serverListEntity["ServerList"]["Offset"];
(glm::vec3&)newIdentity["Transform"]["Position"] = offset * (float)i;
(glm::vec3&)serverIdentityEntity["Transform"]["Position"] = offset * (float)i;
auto& cIdentity = newIdentity["ServerIdentity"];
auto& cIdentity = serverIdentityEntity["ServerIdentity"];
(std::string&)cIdentity["IP"] = e.Serverlist[i].Address;
(std::string&)cIdentity["ServerName"] = e.Serverlist[i].Name;
(int&)cIdentity["Port"] = e.Serverlist[i].Port;
(int&)cIdentity["PlayersConnected"] = e.Serverlist[i].PlayersConnected;
}
}
return 1;
}
+33
View File
@@ -0,0 +1,33 @@
#include "../Game/Systems/StartSystem.h"
StartSystem::StartSystem(SystemParams params)
: System(params)
, ImpureSystem()
{
EVENT_SUBSCRIBE_MEMBER(m_ECameraActivated, &StartSystem::OnCameraActivated);
}
void StartSystem::Update(double dt)
{
auto cameras = m_World->GetComponents("Camera");
if(cameras == nullptr) {
return;
}
for(auto& cCamera: *cameras) {
EntityWrapper cameraEntity = EntityWrapper(m_World, cCamera.EntityID);
if(cameraEntity == m_ActiveCamera){
return;
}
if(cameraEntity.Name() == "Overview_Camera_Start_Menu") {
Events::SetCamera event;
event.CameraEntity = cameraEntity;
m_EventBroker->Publish(event);
}
}
}
bool StartSystem::OnCameraActivated(const Events::SetCamera& e)
{
m_ActiveCamera = e.CameraEntity;
return 1;
}