Moved buttons and fixed so you can't spawn with no class.

This commit is contained in:
William Moberg
2016-03-04 07:01:47 +01:00
parent 2ecc53ecca
commit 03843774d7
3 changed files with 1481 additions and 1240 deletions
File diff suppressed because it is too large Load Diff
+244 -128
View File
@@ -20,6 +20,136 @@
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
<Entity name="PickTeamCamera">
<Components>
<c:Camera/>
<c:Transform/>
</Components>
<Children>
<Entity name="PickTeamHUD">
<Components>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
</c:Transform>
</Components>
<Children>
<Entity name="SpectatorPick">
<Components>
<c:Button/>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="1" B="0" G="1" R="0.509803951"/>
</c:Sprite>
<c:InputCmdButton>
<Command>PickTeam</Command>
<PressValue>1</PressValue>
</c:InputCmdButton>
<c:Transform>
<Position X="0" Y="-0.0500000007" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/>
</c:Transform>
</Components>
<Children>
<Entity name="SpectatorText">
<Components>
<c:Text>
<Content>Spectator</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
</c:Text>
<c:Transform>
<Position X="0" Y="-0.0450000018" Z="0.00200000009"/>
<Scale X="0.200000003" Y="0.200000003" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="TeamRedPick">
<Components>
<c:Button/>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="1" B="0" G="0.294117659" R="0.980392158"/>
</c:Sprite>
<c:InputCmdButton>
<Command>PickTeam</Command>
<PressValue>2</PressValue>
</c:InputCmdButton>
<c:Transform>
<Position X="0.150000006" Y="-0.0500000007" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Text>
<Content>Red</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
</c:Text>
<c:Transform>
<Position X="0" Y="-0.0850000009" Z="0.00249999994"/>
<Scale X="0.310000002" Y="0.310000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="TeamBluePick">
<Components>
<c:Button/>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="1" B="0.980392158" G="0.294117659" R="0"/>
</c:Sprite>
<c:InputCmdButton>
<Command>PickTeam</Command>
<PressValue>3</PressValue>
</c:InputCmdButton>
<c:Transform>
<Position X="-0.150000006" Y="-0.0500000007" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/>
</c:Transform>
</Components>
<Children>
<Entity name="BlueText">
<Components>
<c:Text>
<Content>Blue</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
</c:Text>
<c:Transform>
<Position X="0" Y="-0.0850000009" Z="0.00200000009"/>
<Scale X="0.310000002" Y="0.310000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="TeamPickText">
<Components>
<c:Text>
<Content>Pick Team</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="0" G="1" R="0.784313738"/>
</c:Text>
<c:Transform>
<Position X="0" Y="0.0799999982" Z="0"/>
<Scale X="0.0250000004" Y="0.0250000004" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="SpectatorCamera"> <Entity name="SpectatorCamera">
<Components> <Components>
<c:Camera/> <c:Camera/>
@@ -46,10 +176,10 @@
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap> <GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/> <Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0.919596612" Z="0"/> <Position X="1.62788737" Y="0.919596612" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -59,7 +189,7 @@
<Color A="0.699999988" B="1" G="0.200000003" R="0"/> <Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill> </c:Fill>
<c:CapturePointHUD> <c:CapturePointHUD>
<CapturePointNumber>2</CapturePointNumber> <CapturePointNumber>4</CapturePointNumber>
</c:CapturePointHUD> </c:CapturePointHUD>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
@@ -114,10 +244,10 @@
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap> <GlowMap></GlowMap>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/> <Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="1.62788737" Y="0.919596612" Z="0"/> <Position X="0" Y="0.919596612" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -127,7 +257,7 @@
<Color A="0.699999988" B="1" G="0.200000003" R="0"/> <Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill> </c:Fill>
<c:CapturePointHUD> <c:CapturePointHUD>
<CapturePointNumber>4</CapturePointNumber> <CapturePointNumber>2</CapturePointNumber>
</c:CapturePointHUD> </c:CapturePointHUD>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
@@ -143,6 +273,38 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="0" G="0" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:CapturePointHUD/>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BackgroundHexagon"> <Entity name="BackgroundHexagon">
<Components> <Components>
<c:Sprite> <c:Sprite>
@@ -178,38 +340,6 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="0" G="0" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:CapturePointHUD/>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="RespawnTimer"> <Entity name="RespawnTimer">
@@ -239,28 +369,10 @@
<Entity name="PickClassHUD"> <Entity name="PickClassHUD">
<Components> <Components>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="-0.5"/> <Position X="0" Y="-0" Z="-0.5"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
<Entity name="DefenderClassPick">
<Components>
<c:Button/>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:InputCmdButton>
<Command>PickClass</Command>
<PressValue>2</PressValue>
</c:InputCmdButton>
<c:Transform>
<Position X="0.349999994" Y="0.0500000007" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AssaultClassPick"> <Entity name="AssaultClassPick">
<Components> <Components>
<c:Button/> <c:Button/>
@@ -273,11 +385,59 @@
<PressValue>1</PressValue> <PressValue>1</PressValue>
</c:InputCmdButton> </c:InputCmdButton>
<c:Transform> <c:Transform>
<Position X="0.349999994" Y="0.149504215" Z="0"/> <Position X="-0.150000006" Y="-0.0500000007" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/> <Scale X="0.0799999982" Y="0.0799999982" Z="1"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children/> <Children>
<Entity name="AssaultText">
<Components>
<c:Text>
<Content>Assault</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="0" G="1" R="0.784313738"/>
</c:Text>
<c:Transform>
<Position X="0" Y="0.800000012" Z="0"/>
<Scale X="0.310000002" Y="0.310000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="DefenderClassPick">
<Components>
<c:Button/>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:InputCmdButton>
<Command>PickClass</Command>
<PressValue>2</PressValue>
</c:InputCmdButton>
<c:Transform>
<Position X="0" Y="-0.0500000007" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/>
</c:Transform>
</Components>
<Children>
<Entity name="DefenderText">
<Components>
<c:Text>
<Content>Defender</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="0" G="1" R="0.784313738"/>
</c:Text>
<c:Transform>
<Position X="0" Y="0.800000012" Z="0"/>
<Scale X="0.310000002" Y="0.310000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity> </Entity>
<Entity name="SniperClassPick"> <Entity name="SniperClassPick">
<Components> <Components>
@@ -291,81 +451,37 @@
<PressValue>3</PressValue> <PressValue>3</PressValue>
</c:InputCmdButton> </c:InputCmdButton>
<c:Transform> <c:Transform>
<Position X="0.349999994" Y="-0.0500000007" Z="0"/> <Position X="0.150000006" Y="-0.0500000007" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/> <Scale X="0.0799999982" Y="0.0799999982" Z="1"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children/> <Children>
<Entity name="SniperText">
<Components>
<c:Text>
<Content>Sniper</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="0" G="1" R="0.784313738"/>
</c:Text>
<c:Transform>
<Position X="0" Y="0.800000012" Z="0"/>
<Scale X="0.310000002" Y="0.310000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity> </Entity>
</Children> <Entity name="ClassPickText">
</Entity>
</Children>
</Entity>
<Entity name="PickTeamCamera">
<Components>
<c:Camera/>
<c:Transform/>
</Components>
<Children>
<Entity name="PickTeamHUD">
<Components>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
</c:Transform>
</Components>
<Children>
<Entity name="TeamRedPick">
<Components> <Components>
<c:Button/> <c:Text>
<c:Sprite> <Content>Pick Class</Content>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture> <Resource>Fonts/DroidSans.ttf,64</Resource>
<GlowMap></GlowMap> <Color A="1" B="0" G="1" R="0.784313738"/>
<Color A="1" B="0" G="0.294117659" R="0.980392158"/> </c:Text>
</c:Sprite>
<c:InputCmdButton>
<Command>PickTeam</Command>
<PressValue>2</PressValue>
</c:InputCmdButton>
<c:Transform> <c:Transform>
<Position X="0.349999994" Y="0.0500000007" Z="0"/> <Position X="0" Y="0.0799999982" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/> <Scale X="0.0250000004" Y="0.0250000004" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="TeamBluePick">
<Components>
<c:Button/>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="1" B="0.980392158" G="0.294117659" R="0"/>
</c:Sprite>
<c:InputCmdButton>
<Command>PickTeam</Command>
<PressValue>3</PressValue>
</c:InputCmdButton>
<c:Transform>
<Position X="0.349999994" Y="0.149504215" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="SpectatorPick">
<Components>
<c:Button/>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:InputCmdButton>
<Command>PickTeam</Command>
<PressValue>1</PressValue>
</c:InputCmdButton>
<c:Transform>
<Position X="0.349999994" Y="-0.0500000007" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children/> <Children/>
+13 -4
View File
@@ -60,6 +60,13 @@ void PlayerSpawnSystem::Update(double dt)
int numSpawnedPlayers = 0; int numSpawnedPlayers = 0;
for (auto it = m_SpawnRequests.begin(); it != m_SpawnRequests.end(); ++it) { for (auto it = m_SpawnRequests.begin(); it != m_SpawnRequests.end(); ++it) {
// TODO: -1 Signifies no class picked, enum here later?
// Increase num spawned players if they didn't pick class yet since it is valid
// but don't spawn anything, goto next spawnrequest.
if (it->Class == -1) {
++numSpawnedPlayers;
break;
}
for (auto& cPlayerSpawn : *playerSpawns) { for (auto& cPlayerSpawn : *playerSpawns) {
EntityWrapper spawner(m_World, cPlayerSpawn.EntityID); EntityWrapper spawner(m_World, cPlayerSpawn.EntityID);
if (!spawner.HasComponent("Spawner")) { if (!spawner.HasComponent("Spawner")) {
@@ -70,11 +77,9 @@ void PlayerSpawnSystem::Update(double dt)
if (spawner.HasComponent("Team")) { if (spawner.HasComponent("Team")) {
auto cSpawnerTeam = spawner["Team"]; auto cSpawnerTeam = spawner["Team"];
if ((int)cSpawnerTeam["Team"] != it->Team) { if ((int)cSpawnerTeam["Team"] != it->Team) {
// Increase num spawned players if someone picks spectator or didn't // Increase num spawned players if someone picks spectator since it is valid
// pick a class yet, since it is valid
// but don't spawn anything, goto next spawnrequest. // but don't spawn anything, goto next spawnrequest.
// TODO: -1 Signifies no class picked, enum here later? if (it->Team == (int)cSpawnerTeam["Team"].Enum("Spectator")) {
if (it->Class == -1 || it->Team == (int)cSpawnerTeam["Team"].Enum("Spectator")) {
++numSpawnedPlayers; ++numSpawnedPlayers;
break; break;
} }
@@ -149,8 +154,10 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
// If player is in queue to spawn, then change their team affiliation or class in the request. // If player is in queue to spawn, then change their team affiliation or class in the request.
if (e.Command == "PickTeam") { if (e.Command == "PickTeam") {
iter->Team = (ComponentInfo::EnumType)e.Value; iter->Team = (ComponentInfo::EnumType)e.Value;
LOG_INFO("old request swap Team");
} else { } else {
iter->Class = (ComponentInfo::EnumType)e.Value; iter->Class = (ComponentInfo::EnumType)e.Value;
LOG_INFO("old request swap Class");
} }
} else if (m_PlayerEntities.count(e.PlayerID) == 0 || !m_PlayerEntities[e.PlayerID].Valid()) { } else if (m_PlayerEntities.count(e.PlayerID) == 0 || !m_PlayerEntities[e.PlayerID].Valid()) {
// If player is not in queue to spawn, then create a spawn request, // If player is not in queue to spawn, then create a spawn request,
@@ -160,9 +167,11 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
if (e.Command == "PickTeam") { if (e.Command == "PickTeam") {
req.Team = (ComponentInfo::EnumType)e.Value; req.Team = (ComponentInfo::EnumType)e.Value;
req.Class = -1; // TODO: -1 Signifies no class picked, enum here later? req.Class = -1; // TODO: -1 Signifies no class picked, enum here later?
LOG_INFO("new request set Team");
} else { } else {
req.Team = 1; // TODO: 1 Signifies spectator, should probably have real enum here later. req.Team = 1; // TODO: 1 Signifies spectator, should probably have real enum here later.
req.Class = (ComponentInfo::EnumType)e.Value; req.Class = (ComponentInfo::EnumType)e.Value;
LOG_INFO("new request set Class");
} }
m_SpawnRequests.push_back(req); m_SpawnRequests.push_back(req);
} else { } else {