virtual ReloadChanged Reload() { m_Def.m_vsChoices.clear(); m_vpSteps.clear(); Song *pSong = GAMESTATE->m_pCurSong; if( pSong ) // playing a song { GetStepsForSong( pSong, m_vpSteps ); FOREACH_CONST( Steps*, m_vpSteps, steps ) { RString s; if( (*steps)->GetDifficulty() == Difficulty_Edit ) s = (*steps)->GetDescription(); else s = CustomDifficultyToLocalizedString( StepsToCustomDifficulty(*steps) ); s += ssprintf( " %d", (*steps)->GetMeter() ); m_Def.m_vsChoices.push_back( s ); } m_Def.m_vEnabledForPlayers.clear(); m_Def.m_vEnabledForPlayers.insert( PLAYER_1 ); }
void StepsDisplay::SetInternal( const SetParams ¶ms ) { this->SetVisible( true ); Message msg( "Set" ); RString sCustomDifficulty; if( params.pSteps ) sCustomDifficulty = StepsToCustomDifficulty(params.pSteps); else if( params.pTrail ) sCustomDifficulty = TrailToCustomDifficulty(params.pTrail); else sCustomDifficulty = GetCustomDifficulty( params.st, params.dc, params.ct ); msg.SetParam( "CustomDifficulty", sCustomDifficulty ); RString sDisplayDescription; if( params.pSteps && params.pSteps->IsAnEdit() ) sDisplayDescription = params.pSteps->GetDescription(); else if( sCustomDifficulty.empty() ) sDisplayDescription = RString(); else sDisplayDescription = CustomDifficultyToLocalizedString( sCustomDifficulty ); msg.SetParam( "DisplayDescription", sDisplayDescription ); RString sDisplayCredit; if( params.pSteps ) sDisplayCredit = params.pSteps->GetCredit(); if( params.pSteps ) msg.SetParam( "Steps", LuaReference::CreateFromPush(*(Steps*)params.pSteps) ); if( params.pTrail ) msg.SetParam( "Trail", LuaReference::CreateFromPush(*(Trail*)params.pTrail) ); msg.SetParam( "Meter", params.iMeter ); msg.SetParam( "StepsType", params.st ); m_sprFrame->HandleMessage( msg ); if( m_bShowTicks ) { // todo: let themers handle the logic of tick text. -aj char on = char('1'); char off = '0'; RString sNewText; int iNumOn = min( (int)m_iMaxTicks, params.iMeter ); sNewText.insert( sNewText.end(), iNumOn, on ); int iNumOff = max( 0, m_iNumTicks-iNumOn ); sNewText.insert( sNewText.end(), iNumOff, off ); m_textTicks.SetText( sNewText ); m_textTicks.HandleMessage( msg ); } if( m_bShowMeter ) { if( params.iMeter == 0 ) // Unset calls with this { m_textMeter.SetText( m_sZeroMeterString ); } else { const RString sMeter = ssprintf( m_sMeterFormatString.GetValue().c_str(), params.iMeter ); m_textMeter.SetText( sMeter ); m_textMeter.HandleMessage( msg ); } } if( m_bShowDescription ) { m_textDescription.SetText( sDisplayDescription ); m_textDescription.HandleMessage( msg ); } if( m_bShowCredit ) { m_textAuthor.SetText( sDisplayCredit ); m_textAuthor.HandleMessage( msg ); } if( m_bShowAutogen ) { bool b = params.pSteps && params.pSteps->IsAutogen(); m_sprAutogen->HandleMessage( msg ); m_sprAutogen->SetVisible( b ); } if( m_bShowStepsType ) { if( params.st != StepsType_Invalid ) { /* RString sStepsType = GAMEMAN->GetStepsTypeInfo(params.st).szName; m_sprStepsType.Load( THEME->GetPathG(m_sMetricsGroup,"StepsType "+sStepsType) ); */ m_sprStepsType->HandleMessage( msg ); } } this->HandleMessage( msg ); }