Don't set two different names for an element. Instead, pass the metrics group name as a parameter to Load()
This commit is contained in:
@@ -110,7 +110,7 @@ void Actor::LoadFromNode( const CString& sDir, const XNode* pNode )
|
||||
sCmdName="on";
|
||||
else
|
||||
sCmdName = sKeyName.Left( sKeyName.size()-7 );
|
||||
m_mapNameToCommands[sCmdName] = apac;
|
||||
AddCommand( sCmdName, apac );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -989,6 +989,11 @@ void Actor::QueueCommand( const CString& sCommandName )
|
||||
DestTweenState().sCommandName = sCommandName;
|
||||
}
|
||||
|
||||
void Actor::AddCommand( const CString &sCmdName, apActorCommands apac )
|
||||
{
|
||||
m_mapNameToCommands[sCmdName] = apac;
|
||||
}
|
||||
|
||||
void Actor::PlayCommand( const CString &sCommandName )
|
||||
{
|
||||
CString sKey = sCommandName;
|
||||
|
||||
@@ -308,6 +308,7 @@ public:
|
||||
// Commands
|
||||
//
|
||||
virtual void PushSelf( lua_State *L );
|
||||
void AddCommand( const CString &sCmdName, apActorCommands apac );
|
||||
virtual void PlayCommand( const CString &sCommandName );
|
||||
virtual void RunCommands( const ActorCommands& cmds );
|
||||
void RunCommands( const apActorCommands& cmds ) { this->RunCommands( *cmds ); } // convenience
|
||||
|
||||
@@ -53,8 +53,7 @@ void LifeMeterBattery::Load( PlayerNumber pn )
|
||||
|
||||
if( bPlayerEnabled )
|
||||
{
|
||||
m_Percent.SetName( "LifeMeterBattery Percent" );
|
||||
m_Percent.Load( pn, &STATSMAN->m_CurStageStats.m_player[pn], true );
|
||||
m_Percent.Load( pn, &STATSMAN->m_CurStageStats.m_player[pn], "LifeMeterBattery Percent", true );
|
||||
this->AddChild( &m_Percent );
|
||||
}
|
||||
|
||||
|
||||
@@ -14,38 +14,35 @@ PercentageDisplay::PercentageDisplay()
|
||||
m_pSource = NULL;
|
||||
}
|
||||
|
||||
void PercentageDisplay::SetName( const CString &sName, const CString &sID )
|
||||
void PercentageDisplay::Load( PlayerNumber pn, PlayerStageStats* pSource, const CString &sMetricsGroup, bool bAutoRefresh )
|
||||
{
|
||||
ActorFrame::SetName( sName, sID );
|
||||
|
||||
DANCE_POINT_DIGITS.Load( m_sName, "DancePointsDigits" );
|
||||
PERCENT_DECIMAL_PLACES.Load( m_sName, "PercentDecimalPlaces" );
|
||||
PERCENT_TOTAL_SIZE.Load( m_sName, "PercentTotalSize" );
|
||||
PERCENT_USE_REMAINDER.Load( m_sName, "PercentUseRemainder" );
|
||||
}
|
||||
|
||||
void PercentageDisplay::Load( PlayerNumber pn, PlayerStageStats* pSource, bool bAutoRefresh )
|
||||
{
|
||||
ASSERT( m_sName != "" ); // set this!
|
||||
m_PlayerNumber = pn;
|
||||
m_pSource = pSource;
|
||||
m_bAutoRefresh = bAutoRefresh;
|
||||
m_Last = -1;
|
||||
|
||||
DANCE_POINT_DIGITS.Load( sMetricsGroup, "DancePointsDigits" );
|
||||
PERCENT_DECIMAL_PLACES.Load( sMetricsGroup, "PercentDecimalPlaces" );
|
||||
PERCENT_TOTAL_SIZE.Load( sMetricsGroup, "PercentTotalSize" );
|
||||
PERCENT_USE_REMAINDER.Load( sMetricsGroup, "PercentUseRemainder" );
|
||||
|
||||
|
||||
if( PREFSMAN->m_bDancePointsForOni )
|
||||
m_textPercent.SetName( ssprintf("DancePointsP%i", pn+1) );
|
||||
else
|
||||
m_textPercent.SetName( ssprintf("PercentP%i", pn+1) );
|
||||
|
||||
m_textPercent.LoadFromFont( THEME->GetPathF(m_sName,"text") );
|
||||
SET_XY_AND_ON_COMMAND( m_textPercent );
|
||||
m_textPercent.LoadFromFont( THEME->GetPathF(sMetricsGroup,"text") );
|
||||
ActorUtil::SetXYAndOnCommand( m_textPercent, sMetricsGroup );
|
||||
m_textPercent.AddCommand( "Off", THEME->GetMetricA(sMetricsGroup, m_textPercent.GetName()+"OffCommand") );
|
||||
this->AddChild( &m_textPercent );
|
||||
|
||||
if( !PREFSMAN->m_bDancePointsForOni && (bool)PERCENT_USE_REMAINDER )
|
||||
{
|
||||
m_textPercentRemainder.SetName( ssprintf("PercentRemainderP%d",pn+1) );
|
||||
m_textPercentRemainder.LoadFromFont( THEME->GetPathF(m_sName,"remainder") );
|
||||
SET_XY_AND_ON_COMMAND( m_textPercentRemainder );
|
||||
m_textPercentRemainder.LoadFromFont( THEME->GetPathF(sMetricsGroup,"remainder") );
|
||||
ActorUtil::SetXYAndOnCommand( m_textPercentRemainder, sMetricsGroup );
|
||||
m_textPercentRemainder.AddCommand( "Off", THEME->GetMetricA(sMetricsGroup, m_textPercentRemainder.GetName()+"OffCommand") );
|
||||
m_textPercentRemainder.SetText( "456" );
|
||||
this->AddChild( &m_textPercentRemainder );
|
||||
}
|
||||
@@ -55,9 +52,9 @@ void PercentageDisplay::Load( PlayerNumber pn, PlayerStageStats* pSource, bool b
|
||||
|
||||
void PercentageDisplay::TweenOffScreen()
|
||||
{
|
||||
OFF_COMMAND( m_textPercent );
|
||||
m_textPercent.PlayCommand( "Off" );
|
||||
if( !PREFSMAN->m_bDancePointsForOni && (bool)PERCENT_USE_REMAINDER )
|
||||
OFF_COMMAND( m_textPercentRemainder );
|
||||
m_textPercentRemainder.PlayCommand( "Off" );
|
||||
}
|
||||
|
||||
void PercentageDisplay::Update( float fDeltaTime )
|
||||
|
||||
@@ -13,9 +13,8 @@ class PercentageDisplay: public ActorFrame
|
||||
{
|
||||
public:
|
||||
PercentageDisplay();
|
||||
void Load( PlayerNumber pn, PlayerStageStats *pSource, bool bAutoRefresh );
|
||||
void Load( PlayerNumber pn, PlayerStageStats *pSource, const CString &sMetricsGroup, bool bAutoRefresh );
|
||||
void Update( float fDeltaTime );
|
||||
void SetName( const CString &sName, const CString &sID = "" );
|
||||
void TweenOffScreen();
|
||||
|
||||
private:
|
||||
|
||||
@@ -16,7 +16,11 @@ ScoreDisplayPercentage::ScoreDisplayPercentage()
|
||||
|
||||
void ScoreDisplayPercentage::Init( const PlayerState* pPlayerState )
|
||||
{
|
||||
m_Percent.Load( pPlayerState->m_PlayerNumber, &STATSMAN->m_CurStageStats.m_player[pPlayerState->m_PlayerNumber], true );
|
||||
m_Percent.Load(
|
||||
pPlayerState->m_PlayerNumber,
|
||||
&STATSMAN->m_CurStageStats.m_player[pPlayerState->m_PlayerNumber],
|
||||
"ScoreDisplayPercentage Percent",
|
||||
true );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -501,11 +501,9 @@ void ScreenEvaluation::Init()
|
||||
|
||||
/* Use "ScreenEvaluation Percent" for the [metric set], but position and
|
||||
* tween it with "PercentP1X", etc. */
|
||||
m_Percent[p].SetName( "ScreenEvaluation Percent" );
|
||||
m_Percent[p].Load( p, &STATSMAN->m_CurStageStats.m_player[p], true );
|
||||
m_Percent[p].SetXY( THEME->GetMetricF(m_sName, ssprintf("PercentP%dX",p+1)),
|
||||
THEME->GetMetricF(m_sName,ssprintf("PercentP%dY",p+1)) );
|
||||
m_Percent[p].RunCommands( THEME->GetMetricA(m_sName,ssprintf("PercentP%dOnCommand",p+1)) );
|
||||
m_Percent[p].SetName( ssprintf("PercentP%d",p+1) );
|
||||
m_Percent[p].Load( p, &STATSMAN->m_CurStageStats.m_player[p], "ScreenEvaluation Percent", true );
|
||||
SET_XY_AND_ON_COMMAND( m_Percent[p] );
|
||||
this->AddChild( &m_Percent[p] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,6 +355,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
|
||||
sBanner = pCourse->m_sBannerPath;
|
||||
else
|
||||
sBanner = pSong->GetBannerPath();
|
||||
|
||||
if( !sBanner.empty() )
|
||||
{
|
||||
display.m_sprBanner.SetName( ssprintf("BannerP%i",p+1) );
|
||||
@@ -381,8 +382,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
|
||||
SET_ON( display.m_Difficulty );
|
||||
this->AddChild( &display.m_Difficulty );
|
||||
|
||||
display.m_textScore.SetName( "ScreenNameEntryTraditional Percent" );
|
||||
display.m_textScore.Load( p, &ss.m_player[p], false );
|
||||
display.m_textScore.Load( p, &ss.m_player[p], "ScreenNameEntryTraditional Percent", false );
|
||||
display.m_textScore.SetName( ssprintf("ScoreP%i",p+1) );
|
||||
SET_ON( display.m_textScore );
|
||||
this->AddChild( &display.m_textScore );
|
||||
|
||||
Reference in New Issue
Block a user