AttackDisplay work
This commit is contained in:
@@ -13,8 +13,7 @@
|
|||||||
#include "AttackDisplay.h"
|
#include "AttackDisplay.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
|
#include "ActorUtil.h"
|
||||||
#define TEXT_ON_COMMAND( p ) THEME->GetMetric("AttackDisplay",ssprintf("TextP%dOnCommand",p+1))
|
|
||||||
|
|
||||||
|
|
||||||
AttackDisplay::AttackDisplay()
|
AttackDisplay::AttackDisplay()
|
||||||
@@ -23,11 +22,18 @@ AttackDisplay::AttackDisplay()
|
|||||||
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
|
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_textAttack.SetName( ssprintf("TextP%d",m_PlayerNumber+1) );
|
||||||
m_textAttack.LoadFromFont( THEME->GetPathToF("AttackDisplay") );
|
m_textAttack.LoadFromFont( THEME->GetPathToF("AttackDisplay") );
|
||||||
m_textAttack.SetDiffuseAlpha( 0 ); // invisible
|
m_textAttack.SetDiffuseAlpha( 0 ); // invisible
|
||||||
this->AddChild( &m_textAttack );
|
this->AddChild( &m_textAttack );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AttackDisplay::Init( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
m_PlayerNumber = pn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AttackDisplay::Update( float fDelta )
|
void AttackDisplay::Update( float fDelta )
|
||||||
{
|
{
|
||||||
ActorFrame::Update( fDelta );
|
ActorFrame::Update( fDelta );
|
||||||
@@ -52,13 +58,14 @@ void AttackDisplay::Update( float fDelta )
|
|||||||
if( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].IsBlank() )
|
if( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].IsBlank() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CString sText = GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].sModifier;
|
SetAttack( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].sModifier );
|
||||||
|
|
||||||
m_textAttack.SetDiffuseAlpha( 1 );
|
|
||||||
m_textAttack.SetText( sText );
|
|
||||||
m_textAttack.Command( TEXT_ON_COMMAND(m_PlayerNumber) );
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AttackDisplay::SetAttack( const CString &sText )
|
||||||
|
{
|
||||||
|
m_textAttack.SetDiffuseAlpha( 1 );
|
||||||
|
m_textAttack.SetText( sText );
|
||||||
|
UtilOnCommand( m_textAttack, "AttackDisplay" );
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ class AttackDisplay : public ActorFrame
|
|||||||
public:
|
public:
|
||||||
AttackDisplay();
|
AttackDisplay();
|
||||||
|
|
||||||
void Init( PlayerNumber pn ) { m_PlayerNumber = pn; }
|
void Init( PlayerNumber pn );
|
||||||
|
void SetAttack( const CString &mod );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user