When pick class buttons are clicked they send an InputCommand, not an ButtonClicked event.
This commit is contained in:
@@ -59,4 +59,5 @@
|
|||||||
<xs:include schemaLocation="Components/CapturePointArrowHUD.xsd"/>
|
<xs:include schemaLocation="Components/CapturePointArrowHUD.xsd"/>
|
||||||
<xs:include schemaLocation="Components/FloatingEffect.xsd"/>
|
<xs:include schemaLocation="Components/FloatingEffect.xsd"/>
|
||||||
<xs:include schemaLocation="Components/BoostIconsHUD.xsd"/>
|
<xs:include schemaLocation="Components/BoostIconsHUD.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/InputCmdButton.xsd"/>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<InputCmdButton xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="InputCmdButton.xsd">
|
||||||
|
<Command></Command>
|
||||||
|
<PressValue>0.0</PressValue>
|
||||||
|
</InputCmdButton>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="InputCmdButton">
|
||||||
|
<xs:annotation><xs:documentation>Used with a Button component, the button will send an inputCommand event instead of ButtonPressed/Released event.</xs:documentation></xs:annotation>
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="Command" type="t:string" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>The command name for the inputCommand.</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="PressValue" type="t:float" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>The value in inputCommand.Value that will be sent on button press.</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -20,65 +20,6 @@
|
|||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
<Entity name="PickClassCamera">
|
|
||||||
<Components>
|
|
||||||
<c:Camera/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="PickClassHUD">
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0" Z="-0.5"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="AssaultClassPick">
|
|
||||||
<Components>
|
|
||||||
<c:Button/>
|
|
||||||
<c:Sprite>
|
|
||||||
<DiffuseTexture>Textures/Core/UnitRaptor.png</DiffuseTexture>
|
|
||||||
<GlowMap></GlowMap>
|
|
||||||
</c:Sprite>
|
|
||||||
<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="DefenderClassPick">
|
|
||||||
<Components>
|
|
||||||
<c:Button/>
|
|
||||||
<c:Sprite>
|
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
|
||||||
<GlowMap></GlowMap>
|
|
||||||
</c:Sprite>
|
|
||||||
<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="SniperClassPick">
|
|
||||||
<Components>
|
|
||||||
<c:Button/>
|
|
||||||
<c:Sprite>
|
|
||||||
<DiffuseTexture>Textures/Test/aM4ME4GR.png</DiffuseTexture>
|
|
||||||
<GlowMap></GlowMap>
|
|
||||||
</c:Sprite>
|
|
||||||
<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>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="SpectatorCamera">
|
<Entity name="SpectatorCamera">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Camera/>
|
<c:Camera/>
|
||||||
@@ -274,7 +215,7 @@
|
|||||||
<Entity name="RespawnTimer">
|
<Entity name="RespawnTimer">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Text>
|
<c:Text>
|
||||||
<Content>5</Content>
|
<Content>16</Content>
|
||||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
<Color A="1" B="0" G="1" R="0.784313738"/>
|
<Color A="1" B="0" G="1" R="0.784313738"/>
|
||||||
</c:Text>
|
</c:Text>
|
||||||
@@ -289,6 +230,77 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity name="PickClassCamera">
|
||||||
|
<Components>
|
||||||
|
<c:Camera/>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="PickClassHUD">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<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">
|
||||||
|
<Components>
|
||||||
|
<c:Button/>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitRaptor.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:InputCmdButton>
|
||||||
|
<Command>PickClass</Command>
|
||||||
|
<PressValue>1</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="SniperClassPick">
|
||||||
|
<Components>
|
||||||
|
<c:Button/>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Test/aM4ME4GR.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:InputCmdButton>
|
||||||
|
<Command>PickClass</Command>
|
||||||
|
<PressValue>3</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>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
<xs:element ref="c:DoubleJump" minOccurs="0"/>
|
<xs:element ref="c:DoubleJump" minOccurs="0"/>
|
||||||
<xs:element ref="c:HealthHUD" minOccurs="0"/>
|
<xs:element ref="c:HealthHUD" minOccurs="0"/>
|
||||||
<xs:element ref="c:SpriteIndicator" minOccurs="0"/>
|
<xs:element ref="c:SpriteIndicator" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:InputCmdButton" minOccurs="0"/>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "GUI/ButtonSystem.h"
|
#include "GUI/ButtonSystem.h"
|
||||||
|
#include "Input/EInputCommand.h"
|
||||||
|
|
||||||
ButtonSystem::ButtonSystem(SystemParams params, IRenderer* renderer)
|
ButtonSystem::ButtonSystem(SystemParams params, IRenderer* renderer)
|
||||||
: System(params)
|
: System(params)
|
||||||
@@ -37,10 +38,19 @@ bool ButtonSystem::OnMousePress(const Events::MousePress& e)
|
|||||||
m_PickEntity = EntityWrapper(m_World, m_PickData.Entity);
|
m_PickEntity = EntityWrapper(m_World, m_PickData.Entity);
|
||||||
|
|
||||||
//You have clicked on a button entity, send pressed event.
|
//You have clicked on a button entity, send pressed event.
|
||||||
Events::ButtonPressed ePressed;
|
if (m_World->HasComponent(m_PickData.Entity, "InputCmdButton")) {
|
||||||
ePressed.Entity = m_PickEntity;
|
Events::InputCommand eInputCmd;
|
||||||
ePressed.EntityName = m_PickEntity.Name();
|
eInputCmd.PlayerID = LocalPlayer.ID;
|
||||||
m_EventBroker->Publish(ePressed);
|
eInputCmd.Player = LocalPlayer;
|
||||||
|
EntityWrapper button = EntityWrapper(m_World, m_PickData.Entity);
|
||||||
|
eInputCmd.Command = (std::string)button["InputCmdButton"]["Command"];
|
||||||
|
eInputCmd.Value = (float)button["InputCmdButton"]["PressValue"];
|
||||||
|
} else {
|
||||||
|
Events::ButtonPressed ePressed;
|
||||||
|
ePressed.Entity = m_PickEntity;
|
||||||
|
ePressed.EntityName = m_PickEntity.Name();
|
||||||
|
m_EventBroker->Publish(ePressed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,10 +65,19 @@ bool ButtonSystem::OnMouseRelease(const Events::MouseRelease& e)
|
|||||||
if(m_PickData.Entity != EntityID_Invalid && m_PickData.World == m_World) {
|
if(m_PickData.Entity != EntityID_Invalid && m_PickData.World == m_World) {
|
||||||
EntityWrapper ent = EntityWrapper(m_World, m_PickData.Entity);
|
EntityWrapper ent = EntityWrapper(m_World, m_PickData.Entity);
|
||||||
|
|
||||||
Events::ButtonReleased eReleased;
|
if (m_World->HasComponent(m_PickData.Entity, "InputCmdButton")) {
|
||||||
eReleased.EntityName = m_PickEntity.Name();
|
Events::InputCommand eInputCmd;
|
||||||
eReleased.Entity = m_PickEntity;
|
eInputCmd.PlayerID = LocalPlayer.ID;
|
||||||
m_EventBroker->Publish(eReleased);
|
eInputCmd.Player = LocalPlayer;
|
||||||
|
EntityWrapper button = EntityWrapper(m_World, m_PickData.Entity);
|
||||||
|
eInputCmd.Command = (std::string)button["InputCmdButton"]["Command"];
|
||||||
|
eInputCmd.Value = 0;
|
||||||
|
} else {
|
||||||
|
Events::ButtonReleased eReleased;
|
||||||
|
eReleased.EntityName = m_PickEntity.Name();
|
||||||
|
eReleased.Entity = m_PickEntity;
|
||||||
|
m_EventBroker->Publish(eReleased);
|
||||||
|
}
|
||||||
|
|
||||||
if(m_World->HasComponent(m_PickData.Entity, "Button")) {
|
if(m_World->HasComponent(m_PickData.Entity, "Button")) {
|
||||||
if (ent == m_PickEntity) {
|
if (ent == m_PickEntity) {
|
||||||
|
|||||||
Reference in New Issue
Block a user