#include "global.h" #include "ScreenSelectStyle.h" #include "GameManager.h" #include "GameSoundManager.h" #include "NetworkSyncManager.h" #include "ThemeManager.h" #include "PrefsManager.h" #include "ScreenManager.h" #include "GameState.h" #include "AnnouncerManager.h" #include "ActorUtil.h" #include "LightsManager.h" #include "CommonMetrics.h" #include "Command.h" #define ICON_GAIN_FOCUS_COMMAND THEME->GetMetricA(m_sName,"IconGainFocusCommand") #define ICON_LOSE_FOCUS_COMMAND THEME->GetMetricA(m_sName,"IconLoseFocusCommand") #define DISABLED_COLOR THEME->GetMetricC(m_sName,"DisabledColor") REGISTER_SCREEN_CLASS( ScreenSelectStyle ); ScreenSelectStyle::ScreenSelectStyle( CString sClassName ) : ScreenSelect( sClassName ) { LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU ); } void ScreenSelectStyle::Init() { ScreenSelect::Init(); m_iSelection = 0; for( unsigned i=0; iGetPathG(m_sName,ssprintf("icon%d",i+1)); m_textIcon[i].SetName( ssprintf("Icon%d",i+1) ); m_sprIcon[i].SetName( ssprintf("Icon%d",i+1) ); if( sIconPath.empty() ) // element doesn't exist { m_textIcon[i].LoadFromFont( THEME->GetPathF("Common","normal") ); m_textIcon[i].SetText( mc.m_sName ); m_textIcon[i].SetZoom(0.5f); this->AddChild( &m_textIcon[i] ); } else { m_sprIcon[i].Load( sIconPath ); this->AddChild( &m_sprIcon[i] ); } // // Load Picture // CString sPicturePath = THEME->GetPathG(m_sName, ssprintf("picture%d",i+1)); if( sPicturePath != "" ) { m_sprPicture[i].SetName( "Picture" ); m_sprPicture[i].Load( sPicturePath ); m_sprPicture[i].SetDiffuse( RageColor(1,1,1,0) ); this->AddChild( &m_sprPicture[i] ); } // // Load info // CString sInfoPath = THEME->GetPathG(m_sName,ssprintf("info%d",i+1)); if( sInfoPath != "" ) { m_sprInfo[i].SetName( "Info" ); m_sprInfo[i].Load( sInfoPath ); m_sprInfo[i].SetDiffuse( RageColor(1,1,1,0) ); this->AddChild( &m_sprInfo[i] ); } } m_sprWarning.SetName( "Warning" ); m_sprWarning.Load( THEME->GetPathG(m_sName,"warning") ); this->AddChild( &m_sprWarning ); m_sprExplanation.SetName( "Explanation" ); m_sprExplanation.Load( THEME->GetPathG(m_sName,"explanation") ); this->AddChild( &m_sprExplanation ); // fix Z ordering of Picture and Info so that they draw on top for( unsigned i=0; im_aGameCommands.size(); i++ ) this->MoveToTail( &m_sprPicture[i] ); for( unsigned i=0; im_aGameCommands.size(); i++ ) this->MoveToTail( &m_sprInfo[i] ); this->UpdateSelectableChoices(); m_sprPremium.SetName( "Premium" ); switch( GAMESTATE->GetPremium() ) { case PREMIUM_DOUBLE: m_sprPremium.Load( THEME->GetPathG(m_sName,"doubles premium") ); this->AddChild( &m_sprPremium ); break; case PREMIUM_JOINT: m_sprPremium.Load( THEME->GetPathG(m_sName,"joint premium") ); this->AddChild( &m_sprPremium ); break; } m_soundChange.Load( THEME->GetPathS(m_sName,"change"), true ); // // TweenOnScreen // for( unsigned i=0; iSortByDrawOrder(); } void ScreenSelectStyle::MenuLeft( PlayerNumber pn ) { int iSwitchToIndex = -1; // -1 means none found for( int i=m_iSelection-1; i>=0; i-- ) { if( m_aGameCommands[i].IsPlayable() ) { iSwitchToIndex = i; break; } } if( iSwitchToIndex == -1 ) return; BeforeChange(); m_iSelection = iSwitchToIndex; m_soundChange.Play(); AfterChange(); } void ScreenSelectStyle::MenuRight( PlayerNumber pn ) { int iSwitchToIndex = -1; // -1 means none found for( unsigned i=m_iSelection+1; iStopTweening(); SCREENMAN->PlayStartSound(); SCREENMAN->SendMessageToTopScreen( SM_AllDoneChoosing ); const GameCommand& mc = m_aGameCommands[GetSelectionIndex(pn)]; SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("%s comment %s",m_sName.c_str(),mc.m_sName.c_str())) ); // // TweenOffScreen // for( unsigned i=0; i