PickClass used for class-picking, SwapToClassPick to swap camera.
This commit is contained in:
@@ -28,4 +28,4 @@ P=SwitchToPlayer
|
|||||||
K=TakeDamage,1500
|
K=TakeDamage,1500
|
||||||
F2=PerformanceTimingResetAllTimers
|
F2=PerformanceTimingResetAllTimers
|
||||||
F3=PerformanceTimingCreateExcelData
|
F3=PerformanceTimingCreateExcelData
|
||||||
F4=PickClass
|
F4=SwapToClassPick
|
||||||
@@ -45,6 +45,7 @@ bool ButtonSystem::OnMousePress(const Events::MousePress& e)
|
|||||||
EntityWrapper button = EntityWrapper(m_World, m_PickData.Entity);
|
EntityWrapper button = EntityWrapper(m_World, m_PickData.Entity);
|
||||||
eInputCmd.Command = (std::string)button["InputCmdButton"]["Command"];
|
eInputCmd.Command = (std::string)button["InputCmdButton"]["Command"];
|
||||||
eInputCmd.Value = (float)button["InputCmdButton"]["PressValue"];
|
eInputCmd.Value = (float)button["InputCmdButton"]["PressValue"];
|
||||||
|
m_EventBroker->Publish(eInputCmd);
|
||||||
} else {
|
} else {
|
||||||
Events::ButtonPressed ePressed;
|
Events::ButtonPressed ePressed;
|
||||||
ePressed.Entity = m_PickEntity;
|
ePressed.Entity = m_PickEntity;
|
||||||
@@ -72,6 +73,7 @@ bool ButtonSystem::OnMouseRelease(const Events::MouseRelease& e)
|
|||||||
EntityWrapper button = EntityWrapper(m_World, m_PickData.Entity);
|
EntityWrapper button = EntityWrapper(m_World, m_PickData.Entity);
|
||||||
eInputCmd.Command = (std::string)button["InputCmdButton"]["Command"];
|
eInputCmd.Command = (std::string)button["InputCmdButton"]["Command"];
|
||||||
eInputCmd.Value = 0;
|
eInputCmd.Value = 0;
|
||||||
|
m_EventBroker->Publish(eInputCmd);
|
||||||
} else {
|
} else {
|
||||||
Events::ButtonReleased eReleased;
|
Events::ButtonReleased eReleased;
|
||||||
eReleased.EntityName = m_PickEntity.Name();
|
eReleased.EntityName = m_PickEntity.Name();
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ void PlayerSpawnSystem::Update(double dt)
|
|||||||
|
|
||||||
bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
|
bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
|
||||||
{
|
{
|
||||||
if (e.Command != "PickTeam" && e.Command != "PickClass") {
|
if (e.Command != "PickTeam" && e.Command != "SwapToClassPick") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
|
|||||||
if (IsClient && !LocalPlayer.Valid()) {
|
if (IsClient && !LocalPlayer.Valid()) {
|
||||||
// Set the camera as active, if it exists.
|
// Set the camera as active, if it exists.
|
||||||
// Find the respawn camera or class pick camera.
|
// Find the respawn camera or class pick camera.
|
||||||
std::string camName = e.Command == "PickClass" ? "PickClassCamera" : "SpectatorCamera";
|
std::string camName = e.Command == "SwapToClassPick" ? "PickClassCamera" : "SpectatorCamera";
|
||||||
EntityWrapper spectatorCam = m_World->GetFirstEntityByName(camName);
|
EntityWrapper spectatorCam = m_World->GetFirstEntityByName(camName);
|
||||||
if (spectatorCam.Valid() && spectatorCam.HasComponent("Camera")) {
|
if (spectatorCam.Valid() && spectatorCam.HasComponent("Camera")) {
|
||||||
Events::SetCamera eSetCamera;
|
Events::SetCamera eSetCamera;
|
||||||
@@ -137,14 +137,14 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
|
|||||||
for (; iter != m_SpawnRequests.end(); ++iter) {
|
for (; iter != m_SpawnRequests.end(); ++iter) {
|
||||||
if (iter->PlayerID == e.PlayerID) {
|
if (iter->PlayerID == e.PlayerID) {
|
||||||
// If player wants to switch class, remove their spawn request.
|
// If player wants to switch class, remove their spawn request.
|
||||||
if (e.Command == "PickClass") {
|
if (e.Command == "SwapToClassPick") {
|
||||||
m_SpawnRequests.erase(iter);
|
m_SpawnRequests.erase(iter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Command == "PickClass") {
|
if (e.Command == "SwapToClassPick") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user