Menu should now show the correct server IP instead of default.
Start of a StartMenu entity that will show when the game is started.
This commit is contained in:
@@ -0,0 +1,87 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="StartMenu_Origin" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="Background_Map_Origin">
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Background_Spawner">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/CP_Rocky.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Spectator_Camera_Origin">
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Rotation_Anchor">
|
||||||
|
<Components>
|
||||||
|
<c:RaptorCopter>
|
||||||
|
<Speed>0.10000000149011612</Speed>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
</c:RaptorCopter>
|
||||||
|
<c:Transform>
|
||||||
|
<Orientation X="0" Y="65.3543472" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="RotationAnchor_Small">
|
||||||
|
<Components>
|
||||||
|
<c:RaptorCopter>
|
||||||
|
<Speed>0.20000000298023224</Speed>
|
||||||
|
<Axis X="0" Y="-1" Z="0"/>
|
||||||
|
</c:RaptorCopter>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="26" Z="40"/>
|
||||||
|
<Orientation X="0" Y="-47.6068382" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Camera">
|
||||||
|
<Components>
|
||||||
|
<c:Camera/>
|
||||||
|
<c:Transform>
|
||||||
|
<Orientation X="5.78618526" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Menu_Origin">
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Menu_Spawner">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/MainMenu.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -23,8 +23,8 @@ bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e)
|
|||||||
EntityWrapper serverIdentityEntity = entity.FirstParentWithComponent("ServerIdentity");
|
EntityWrapper serverIdentityEntity = entity.FirstParentWithComponent("ServerIdentity");
|
||||||
if(serverIdentityEntity.Valid()) {
|
if(serverIdentityEntity.Valid()) {
|
||||||
Events::ConnectRequest event;
|
Events::ConnectRequest event;
|
||||||
event.IP = (std::string)entity["ServerIdentity"]["IP"];
|
event.IP = (std::string)serverIdentityEntity["ServerIdentity"]["IP"];
|
||||||
event.Port = (int)entity["ServerIdentity"]["Port"];
|
event.Port = (int)serverIdentityEntity["ServerIdentity"]["Port"];
|
||||||
printf("\n ----Request Server Connect----\nIP: %s\nPort: %i\n ------------------------------", event.IP, event.Port);
|
printf("\n ----Request Server Connect----\nIP: %s\nPort: %i\n ------------------------------", event.IP, event.Port);
|
||||||
m_EventBroker->Publish(event);
|
m_EventBroker->Publish(event);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,11 +37,12 @@ bool ServerListSystem::OnServerListRecieved(const Events::DisplayServerlist& e)
|
|||||||
for (int i = 0; i < e.Serverlist.size(); i++) {
|
for (int i = 0; i < e.Serverlist.size(); i++) {
|
||||||
//Create Identities for each server and place them on the right position.
|
//Create Identities for each server and place them on the right position.
|
||||||
EntityWrapper newIdentity = SpawnerSystem::Spawn(identitySpawner, identitySpawner);
|
EntityWrapper newIdentity = SpawnerSystem::Spawn(identitySpawner, identitySpawner);
|
||||||
|
EntityWrapper serverIdentityEntity = newIdentity.FirstChildByName("ServerIdentity");
|
||||||
|
|
||||||
glm::vec3 offset = (glm::vec3)serverListEntity["ServerList"]["Offset"];
|
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["IP"] = e.Serverlist[i].Address;
|
||||||
(std::string&)cIdentity["ServerName"] = e.Serverlist[i].Name;
|
(std::string&)cIdentity["ServerName"] = e.Serverlist[i].Name;
|
||||||
(int&)cIdentity["Port"] = e.Serverlist[i].Port;
|
(int&)cIdentity["Port"] = e.Serverlist[i].Port;
|
||||||
|
|||||||
Reference in New Issue
Block a user