add profile switching on STitleMenu
This commit is contained in:
@@ -203,6 +203,12 @@ void FadingBanner::LoadFromCourse( const Course* pCourse )
|
|||||||
LoadFromCachedBanner( sPath );
|
LoadFromCachedBanner( sPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FadingBanner::LoadIconFromCharacter( Character* pCharacter )
|
||||||
|
{
|
||||||
|
BeforeChange();
|
||||||
|
m_Banner[m_iIndexLatest].LoadIconFromCharacter( pCharacter );
|
||||||
|
}
|
||||||
|
|
||||||
void FadingBanner::LoadRoulette()
|
void FadingBanner::LoadRoulette()
|
||||||
{
|
{
|
||||||
BeforeChange();
|
BeforeChange();
|
||||||
@@ -249,12 +255,19 @@ public:
|
|||||||
else { Course *pC = Luna<Course>::check(L,1); p->LoadFromCourse( pC ); }
|
else { Course *pC = Luna<Course>::check(L,1); p->LoadFromCourse( pC ); }
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
static int LoadIconFromCharacter( T* p, lua_State *L )
|
||||||
|
{
|
||||||
|
if( lua_isnil(L,1) ) { p->LoadIconFromCharacter( NULL ); }
|
||||||
|
else { Character *pC = Luna<Character>::check(L,1); p->LoadIconFromCharacter( pC ); }
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void Register(lua_State *L)
|
static void Register(lua_State *L)
|
||||||
{
|
{
|
||||||
ADD_METHOD( ScaleToClipped )
|
ADD_METHOD( ScaleToClipped )
|
||||||
ADD_METHOD( LoadFromSong )
|
ADD_METHOD( LoadFromSong )
|
||||||
ADD_METHOD( LoadFromCourse )
|
ADD_METHOD( LoadFromCourse )
|
||||||
|
ADD_METHOD( LoadIconFromCharacter )
|
||||||
Luna<T>::Register( L );
|
Luna<T>::Register( L );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public:
|
|||||||
void LoadMode();
|
void LoadMode();
|
||||||
void LoadFromSongGroup( CString sSongGroup );
|
void LoadFromSongGroup( CString sSongGroup );
|
||||||
void LoadFromCourse( const Course* pCourse );
|
void LoadFromCourse( const Course* pCourse );
|
||||||
|
void LoadIconFromCharacter( Character* pCharacter );
|
||||||
void LoadRoulette();
|
void LoadRoulette();
|
||||||
void LoadRandom();
|
void LoadRandom();
|
||||||
void LoadFallback();
|
void LoadFallback();
|
||||||
|
|||||||
@@ -14,9 +14,32 @@
|
|||||||
#include "RageTextureManager.h"
|
#include "RageTextureManager.h"
|
||||||
#include "LightsManager.h"
|
#include "LightsManager.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
#include "InputMapper.h"
|
||||||
|
#include "ProfileManager.h"
|
||||||
|
|
||||||
#define COIN_MODE_CHANGE_SCREEN THEME->GetMetric (m_sName,"CoinModeChangeScreen")
|
#define COIN_MODE_CHANGE_SCREEN THEME->GetMetric (m_sName,"CoinModeChangeScreen")
|
||||||
|
|
||||||
|
static void ChangeDefaultLocalProfile( PlayerNumber pn, int iDir )
|
||||||
|
{
|
||||||
|
CString sCurrent = PREFSMAN->GetDefaultLocalProfileID(pn);
|
||||||
|
vector<CString> vsProfileID;
|
||||||
|
PROFILEMAN->GetLocalProfileIDs( vsProfileID );
|
||||||
|
if( vsProfileID.empty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
int iIndex = 0;
|
||||||
|
vector<CString>::const_iterator iter = find( vsProfileID.begin(), vsProfileID.end(), sCurrent );
|
||||||
|
if( iter != vsProfileID.end() )
|
||||||
|
{
|
||||||
|
iIndex = iter - vsProfileID.begin();
|
||||||
|
iIndex += iDir;
|
||||||
|
wrap( iIndex, vsProfileID.size() );
|
||||||
|
}
|
||||||
|
|
||||||
|
sCurrent = vsProfileID[iIndex];
|
||||||
|
PREFSMAN->GetDefaultLocalProfileID(pn).Set( sCurrent );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
REGISTER_SCREEN_CLASS( ScreenTitleMenu );
|
REGISTER_SCREEN_CLASS( ScreenTitleMenu );
|
||||||
ScreenTitleMenu::ScreenTitleMenu( CString sScreenName ) :
|
ScreenTitleMenu::ScreenTitleMenu( CString sScreenName ) :
|
||||||
@@ -38,8 +61,12 @@ ScreenTitleMenu::ScreenTitleMenu( CString sScreenName ) :
|
|||||||
|
|
||||||
void ScreenTitleMenu::Init()
|
void ScreenTitleMenu::Init()
|
||||||
{
|
{
|
||||||
|
m_bSelectIsDown = false; // used by LoadHelpText which is called by ScreenWithMenuElements::Init()
|
||||||
|
|
||||||
ScreenSelectMaster::Init();
|
ScreenSelectMaster::Init();
|
||||||
|
|
||||||
|
m_soundSelectPressed.Load( THEME->GetPathS(m_sName,"select down"), true );
|
||||||
|
|
||||||
this->SortByDrawOrder();
|
this->SortByDrawOrder();
|
||||||
|
|
||||||
SOUND->PlayOnceFromAnnouncer( "title menu game name" );
|
SOUND->PlayOnceFromAnnouncer( "title menu game name" );
|
||||||
@@ -54,11 +81,11 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
{
|
{
|
||||||
LOG->Trace( "ScreenTitleMenu::Input( %d-%d )", DeviceI.device, DeviceI.button ); // debugging gameport joystick problem
|
LOG->Trace( "ScreenTitleMenu::Input( %d-%d )", DeviceI.device, DeviceI.button ); // debugging gameport joystick problem
|
||||||
|
|
||||||
|
if( m_In.IsTransitioning() || m_Cancel.IsTransitioning() ) /* not m_Out */
|
||||||
|
return;
|
||||||
|
|
||||||
if( type == IET_FIRST_PRESS )
|
if( type == IET_FIRST_PRESS )
|
||||||
{
|
{
|
||||||
if( m_In.IsTransitioning() || m_Cancel.IsTransitioning() ) /* not m_Out */
|
|
||||||
return;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// detect codes
|
// detect codes
|
||||||
//
|
//
|
||||||
@@ -105,6 +132,37 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( MenuI.IsValid() )
|
||||||
|
{
|
||||||
|
LoadHelpText();
|
||||||
|
|
||||||
|
PlayerNumber pn = MenuI.player;
|
||||||
|
|
||||||
|
bool bSelectIsDown = false;
|
||||||
|
FOREACH_PlayerNumber( p )
|
||||||
|
bSelectIsDown |= INPUTMAPPER->IsButtonDown( MenuInput(p, MENU_BUTTON_SELECT) );
|
||||||
|
if( bSelectIsDown )
|
||||||
|
{
|
||||||
|
if( type == IET_FIRST_PRESS )
|
||||||
|
{
|
||||||
|
switch( MenuI.button )
|
||||||
|
{
|
||||||
|
case MENU_BUTTON_LEFT:
|
||||||
|
ChangeDefaultLocalProfile( pn, -1 );
|
||||||
|
MESSAGEMAN->Broadcast( ssprintf("MenuLeftP%d",pn+1) );
|
||||||
|
break;
|
||||||
|
case MENU_BUTTON_RIGHT:
|
||||||
|
ChangeDefaultLocalProfile( pn, +1 );
|
||||||
|
MESSAGEMAN->Broadcast( ssprintf("MenuRightP%d",pn+1) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ScreenSelectMaster::Input( DeviceI, type, GameI, MenuI, StyleI );
|
ScreenSelectMaster::Input( DeviceI, type, GameI, MenuI, StyleI );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,6 +176,32 @@ void ScreenTitleMenu::HandleMessage( const CString& sMessage )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScreenTitleMenu::LoadHelpText()
|
||||||
|
{
|
||||||
|
ScreenWithMenuElements::LoadHelpText();
|
||||||
|
|
||||||
|
bool bSelectIsDown = false;
|
||||||
|
FOREACH_PlayerNumber( p )
|
||||||
|
bSelectIsDown |= INPUTMAPPER->IsButtonDown( MenuInput(p, MENU_BUTTON_SELECT) );
|
||||||
|
|
||||||
|
if( bSelectIsDown )
|
||||||
|
LOG->Trace( "bSelectIsDown" );
|
||||||
|
|
||||||
|
/* If m_soundSelectPressed isn't loaded yet, wait until it is before we do this. */
|
||||||
|
if( m_bSelectIsDown != bSelectIsDown && m_soundSelectPressed.IsLoaded() )
|
||||||
|
{
|
||||||
|
if( bSelectIsDown )
|
||||||
|
m_soundSelectPressed.Play();
|
||||||
|
|
||||||
|
m_bSelectIsDown = bSelectIsDown;
|
||||||
|
if( bSelectIsDown )
|
||||||
|
MESSAGEMAN->Broadcast( "SelectMenuOn" );
|
||||||
|
else
|
||||||
|
MESSAGEMAN->Broadcast( "SelectMenuOff" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2004 Chris Danford
|
* (c) 2001-2004 Chris Danford
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -15,6 +15,13 @@ public:
|
|||||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||||
|
|
||||||
virtual void HandleMessage( const CString& sMessage );
|
virtual void HandleMessage( const CString& sMessage );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void LoadHelpText();
|
||||||
|
|
||||||
|
RageSound m_soundSelectPressed;
|
||||||
|
|
||||||
|
bool m_bSelectIsDown;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ public:
|
|||||||
CString ToString() const;
|
CString ToString() const;
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
static void ClearCache();
|
static void ClearCache();
|
||||||
|
|
||||||
|
StepsType GetStepsType() const { return st; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user