custom formatting. Use 'Format=FormatPercentScore' to use the old behavior.
This commit is contained in:
@@ -22,6 +22,8 @@ PercentageDisplay::PercentageDisplay()
|
|||||||
|
|
||||||
m_Last = -1;
|
m_Last = -1;
|
||||||
m_LastMax = -1;
|
m_LastMax = -1;
|
||||||
|
|
||||||
|
m_Format.SetFromExpression( THEME->GetMetric("MultiplayerEvalScoreRow","NumberOnCommandFunction") );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PercentageDisplay::LoadFromNode( const RString& sDir, const XNode* pNode )
|
void PercentageDisplay::LoadFromNode( const RString& sDir, const XNode* pNode )
|
||||||
@@ -30,6 +32,9 @@ void PercentageDisplay::LoadFromNode( const RString& sDir, const XNode* pNode )
|
|||||||
pNode->GetAttrValue( "PercentUseRemainder", m_bUseRemainder );
|
pNode->GetAttrValue( "PercentUseRemainder", m_bUseRemainder );
|
||||||
pNode->GetAttrValue( "ApplyScoreDisplayOptions", m_bApplyScoreDisplayOptions );
|
pNode->GetAttrValue( "ApplyScoreDisplayOptions", m_bApplyScoreDisplayOptions );
|
||||||
pNode->GetAttrValue( "AutoRefresh", m_bAutoRefresh );
|
pNode->GetAttrValue( "AutoRefresh", m_bAutoRefresh );
|
||||||
|
RString sStr = "FormatPercentScore";
|
||||||
|
pNode->GetAttrValue( "Format", sStr );
|
||||||
|
m_Format.SetFromExpression( sStr );
|
||||||
|
|
||||||
const XNode *pChild = pNode->GetChild( "Percent" );
|
const XNode *pChild = pNode->GetChild( "Percent" );
|
||||||
if( pChild == NULL )
|
if( pChild == NULL )
|
||||||
@@ -67,6 +72,7 @@ void PercentageDisplay::Load( const PlayerState *pPlayerState, const PlayerStage
|
|||||||
m_iDancePointsDigits = THEME->GetMetricI( sMetricsGroup, "DancePointsDigits" );
|
m_iDancePointsDigits = THEME->GetMetricI( sMetricsGroup, "DancePointsDigits" );
|
||||||
m_bUseRemainder = THEME->GetMetricB( sMetricsGroup, "PercentUseRemainder" );
|
m_bUseRemainder = THEME->GetMetricB( sMetricsGroup, "PercentUseRemainder" );
|
||||||
m_bApplyScoreDisplayOptions = THEME->GetMetricB( sMetricsGroup, "ApplyScoreDisplayOptions" );
|
m_bApplyScoreDisplayOptions = THEME->GetMetricB( sMetricsGroup, "ApplyScoreDisplayOptions" );
|
||||||
|
m_Format.SetFromExpression( THEME->GetMetric(sMetricsGroup,"Format") );
|
||||||
|
|
||||||
|
|
||||||
if( PREFSMAN->m_bDancePointsForOni )
|
if( PREFSMAN->m_bDancePointsForOni )
|
||||||
@@ -153,7 +159,14 @@ void PercentageDisplay::Refresh()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sNumToDisplay = FormatPercentScore( fPercentDancePoints );
|
Lua *L = LUA->Get();
|
||||||
|
m_Format.PushSelf( L );
|
||||||
|
ASSERT( !lua_isnil(L, -1) );
|
||||||
|
LuaHelpers::Push( fPercentDancePoints, L );
|
||||||
|
lua_call( L, 1, 1 ); // 1 args, 1 result
|
||||||
|
sNumToDisplay = lua_tostring( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
LUA->Release(L);
|
||||||
|
|
||||||
// HACK: Use the last frame in the numbers texture as '-'
|
// HACK: Use the last frame in the numbers texture as '-'
|
||||||
sNumToDisplay.Replace('-','x');
|
sNumToDisplay.Replace('-','x');
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ private:
|
|||||||
int m_LastMax;
|
int m_LastMax;
|
||||||
BitmapText m_textPercent;
|
BitmapText m_textPercent;
|
||||||
BitmapText m_textPercentRemainder;
|
BitmapText m_textPercentRemainder;
|
||||||
|
|
||||||
|
LuaExpression m_Format;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user