示例#1
0
void PercentageDisplay::Load( const PlayerState *pPlayerState, const PlayerStageStats *pPlayerStageStats, const RString &sMetricsGroup, bool bAutoRefresh )
{
	m_pPlayerState = pPlayerState;
	m_pPlayerStageStats = pPlayerStageStats;
	m_bAutoRefresh = bAutoRefresh;

	m_iDancePointsDigits = THEME->GetMetricI( sMetricsGroup, "DancePointsDigits" );
	m_bUseRemainder = THEME->GetMetricB( sMetricsGroup, "PercentUseRemainder" );
	m_FormatPercentScore = THEME->GetMetricR( sMetricsGroup, "Format" );

	m_sPercentFormat = THEME->GetMetric( sMetricsGroup, "PercentFormat" );
	m_sRemainderFormat = THEME->GetMetric( sMetricsGroup, "RemainderFormat" );

	if(m_FormatPercentScore.GetLuaType() != LUA_TFUNCTION)
	{
		// Not reported as an error because _fallback and default provided bad
		// examples in their [LifeMeterBattery Percent]:Format metric and nobody
		// realized it was supposed to be set to a function. -Kyz
		LOG->Trace("Format metric is not a function in [%s]. Defaulting to 'FormatPercentScore'.", sMetricsGroup.c_str());
		m_FormatPercentScore.SetFromExpression( "FormatPercentScore" );
	}

	if( ShowDancePointsNotPercentage() )
		m_textPercent.SetName( "DancePoints" + PlayerNumberToString(m_pPlayerState->m_PlayerNumber) );
	else
		m_textPercent.SetName( "Percent" + PlayerNumberToString(m_pPlayerState->m_PlayerNumber) );

	m_textPercent.LoadFromFont( THEME->GetPathF(sMetricsGroup,"text") );
	ActorUtil::SetXY( m_textPercent, sMetricsGroup );
	ActorUtil::LoadAllCommands( m_textPercent, sMetricsGroup );
	this->AddChild( &m_textPercent );

	if( !ShowDancePointsNotPercentage() && m_bUseRemainder )
	{
		m_textPercentRemainder.SetName( "PercentRemainder" + PlayerNumberToString(m_pPlayerState->m_PlayerNumber) );
		m_textPercentRemainder.LoadFromFont( THEME->GetPathF(sMetricsGroup,"remainder") );
		ActorUtil::SetXY( m_textPercentRemainder, sMetricsGroup );
		ActorUtil::LoadAllCommands( m_textPercentRemainder, sMetricsGroup );
		ASSERT( m_textPercentRemainder.HasCommand("Off") );
		m_textPercentRemainder.SetText( "456" );
		this->AddChild( &m_textPercentRemainder );
	}

	Refresh();
}
示例#2
0
void ScreenTestLights::Update( float fDeltaTime )
{
    Screen::Update( fDeltaTime );


    if( m_timerBackToAutoCycle.Ago() > 20 )
    {
        m_timerBackToAutoCycle.Touch();
        LIGHTSMAN->SetLightsMode( LIGHTSMODE_TEST_AUTO_CYCLE );
    }


    CabinetLight cl = LIGHTSMAN->GetFirstLitCabinetLight();
    GameInput gi = LIGHTSMAN->GetFirstLitGameButtonLight();

    RString s;

    switch( LIGHTSMAN->GetLightsMode() )
    {
    case LIGHTSMODE_TEST_AUTO_CYCLE:
        s += AUTO_CYCLE.GetValue()+"\n";
        break;
    case LIGHTSMODE_TEST_MANUAL_CYCLE:
        s += MANUAL_CYCLE.GetValue()+"\n";
        break;
    default:
        break;
    }

    if( cl == CabinetLight_Invalid )
        s += CABINET_LIGHT.GetValue()+": -----\n";
    else
        s += ssprintf( "%s: %d %s\n", CABINET_LIGHT.GetValue().c_str(), cl, CabinetLightToString(cl).c_str() );

    if( !gi.IsValid() )
    {
        s += CONTROLLER_LIGHT.GetValue()+": -----\n";
    }
    else
    {
        RString sGameButton = GameButtonToLocalizedString( INPUTMAPPER->GetInputScheme(), gi.button );
        PlayerNumber pn = (PlayerNumber)(gi.controller);
        s += ssprintf( "%s: %s %d %s\n", CONTROLLER_LIGHT.GetValue().c_str(), PlayerNumberToString(pn).c_str(), gi.button, sGameButton.c_str() );
    }

    m_textInputs.SetText( s );
}
示例#3
0
void ScreenOptions::Init()
{
	NUM_ROWS_SHOWN.Load( m_sName, "NumRowsShown" );
	ROW_INIT_COMMAND.Load( m_sName, "RowInitCommand" );
	ROW_ON_COMMAND.Load( m_sName, "RowOnCommand" );
	ROW_OFF_COMMAND.Load( m_sName, "RowOffCommand" );
	SHOW_SCROLL_BAR.Load( m_sName, "ShowScrollBar" );
	SCROLL_BAR_HEIGHT.Load( m_sName, "ScrollBarHeight" );
	SCROLL_BAR_TIME.Load( m_sName, "ScrollBarTime" );
	LINE_HIGHLIGHT_X.Load( m_sName, "LineHighlightX" );
	SHOW_EXIT_ROW.Load( m_sName, "ShowExitRow" );
	SEPARATE_EXIT_ROW.Load( m_sName, "SeparateExitRow" );
	SEPARATE_EXIT_ROW_Y.Load( m_sName, "SeparateExitRowY" );
	SHOW_EXPLANATIONS.Load( m_sName, "ShowExplanations" );
	ALLOW_REPEATING_CHANGE_VALUE_INPUT.Load( m_sName, "AllowRepeatingChangeValueInput" );
	CURSOR_TWEEN_SECONDS.Load( m_sName, "CursorTweenSeconds" );
	WRAP_VALUE_IN_ROW.Load( m_sName, "WrapValueInRow" );
	OPTION_ROW_NORMAL_METRICS_GROUP.Load( m_sName, "OptionRowNormalMetricsGroup" );
	OPTION_ROW_EXIT_METRICS_GROUP.Load( m_sName, "OptionRowExitMetricsGroup" );

	m_exprRowPositionTransformFunction.SetFromReference( THEME->GetMetricR(m_sName,"RowPositionTransformFunction") );

	ScreenWithMenuElements::Init();

	m_SoundChangeCol.Load( THEME->GetPathS(m_sName,"change"), true );
	m_SoundNextRow.Load( THEME->GetPathS(m_sName,"next"), true );
	m_SoundPrevRow.Load( THEME->GetPathS(m_sName,"prev"), true );
	m_SoundToggleOn.Load( THEME->GetPathS(m_sName,"toggle on"), true );
	m_SoundToggleOff.Load( THEME->GetPathS(m_sName,"toggle off"), true );
	m_SoundStart.Load( THEME->GetPathS(m_sName,"start"), true );

	// add everything to m_frameContainer so we can animate everything at once
	m_frameContainer.SetName( "Container" );
	LOAD_ALL_COMMANDS( m_frameContainer );
	this->AddChild( &m_frameContainer );

	m_sprPage.Load( THEME->GetPathG(m_sName,"page") );
	m_sprPage->SetName( "Page" );
	LOAD_ALL_COMMANDS_AND_SET_XY( m_sprPage );
	m_frameContainer.AddChild( m_sprPage );

	// init line highlights
	FOREACH_PlayerNumber( p )
	{
		m_sprLineHighlight[p].Load( THEME->GetPathG(m_sName, ssprintf("LineHighlight P%d",p+1)) );
		m_sprLineHighlight[p]->SetName( ssprintf("LineHighlightP%d",p+1) );
		m_sprLineHighlight[p]->SetX( LINE_HIGHLIGHT_X );
		LOAD_ALL_COMMANDS( m_sprLineHighlight[p] );
		m_frameContainer.AddChild( m_sprLineHighlight[p] );
	}

	// init cursors
	FOREACH_PlayerNumber( p )
	{
		m_Cursor[p].Load( "OptionsCursor" + PlayerNumberToString(p), true );
		m_Cursor[p].SetName( "Cursor" );
		LOAD_ALL_COMMANDS( m_Cursor[p] );
		m_frameContainer.AddChild( &m_Cursor[p] );
	}

	switch( m_InputMode )
	{
	case INPUTMODE_INDIVIDUAL:
		FOREACH_PlayerNumber( p )
		{
			m_textExplanation[p].LoadFromFont( THEME->GetPathF(m_sName,"explanation") );
			m_textExplanation[p].SetDrawOrder( 2 );
			m_textExplanation[p].SetName( "Explanation" + PlayerNumberToString(p) );
			LOAD_ALL_COMMANDS_AND_SET_XY( m_textExplanation[p] );
			m_frameContainer.AddChild( &m_textExplanation[p] );

		}
		break;
	case INPUTMODE_SHARE_CURSOR:
		m_textExplanationTogether.LoadFromFont( THEME->GetPathF(m_sName,"explanation") );
		m_textExplanationTogether.SetDrawOrder( 2 );
		m_textExplanationTogether.SetName( "ExplanationTogether" );
		LOAD_ALL_COMMANDS_AND_SET_XY( m_textExplanationTogether );
		m_frameContainer.AddChild( &m_textExplanationTogether );
		break;
	default:
		FAIL_M(ssprintf("Invalid InputMode: %i", m_InputMode));
	}

	if( SHOW_SCROLL_BAR )
	{
		m_ScrollBar.SetName( "ScrollBar" );
		m_ScrollBar.SetBarHeight( SCROLL_BAR_HEIGHT );
		m_ScrollBar.SetBarTime( SCROLL_BAR_TIME );
		m_ScrollBar.Load( "DualScrollBar" );
		FOREACH_PlayerNumber( p )
			m_ScrollBar.EnablePlayer( p, GAMESTATE->IsHumanPlayer(p) );
		LOAD_ALL_COMMANDS_AND_SET_XY( m_ScrollBar );
		m_ScrollBar.SetDrawOrder( 2 );
		m_frameContainer.AddChild( &m_ScrollBar );
	}

	m_sprMore.Load( THEME->GetPathG( m_sName,"more") );
	m_sprMore->SetName( "More" );
	LOAD_ALL_COMMANDS_AND_SET_XY( m_sprMore );
	m_sprMore->SetDrawOrder( 2 );
	m_sprMore->PlayCommand( "LoseFocus" );
	m_frameContainer.AddChild( m_sprMore );

	m_OptionRowTypeNormal.Load( OPTION_ROW_NORMAL_METRICS_GROUP, this );
	m_OptionRowTypeExit.Load( OPTION_ROW_EXIT_METRICS_GROUP, this );
}