new profile/course screen polish

This commit is contained in:
Chris Danford
2005-08-05 10:07:49 +00:00
parent c885a38d9f
commit 1a9b738d8b
7 changed files with 90 additions and 19 deletions
+14 -2
View File
@@ -26,6 +26,7 @@ void ScreenOptionsEditProfile::Init()
{
ScreenOptions::Init();
m_Original = *GAMESTATE->GetEditLocalProfile();
vector<OptionRowDefinition> vDefs;
vector<OptionRowHandler*> vHands;
@@ -36,6 +37,7 @@ void ScreenOptionsEditProfile::Init()
def.m_bAllowThemeItems = false;
def.m_bAllowThemeTitles = false;
def.m_bAllowExplanation = false;
def.m_bExportOnChange = true;
Profile &pro = PROFILEMAN->GetLocalProfile( GAMESTATE->m_sEditLocalProfileID );
@@ -90,12 +92,10 @@ void ScreenOptionsEditProfile::ExportOptions( int iRow, const vector<PlayerNumbe
void ScreenOptionsEditProfile::GoToNextScreen()
{
SCREENMAN->SetNewScreen( "ScreenOptionsService" );
}
void ScreenOptionsEditProfile::GoToPrevScreen()
{
SCREENMAN->SetNewScreen( "ScreenOptionsService" );
}
void ScreenOptionsEditProfile::HandleScreenMessage( const ScreenMessage SM )
@@ -104,10 +104,22 @@ void ScreenOptionsEditProfile::HandleScreenMessage( const ScreenMessage SM )
{
PROFILEMAN->SaveLocalProfile( GAMESTATE->m_sEditLocalProfileID );
}
else if( SM == SM_GoToPrevScreen )
{
*GAMESTATE->GetEditLocalProfile() = m_Original;
}
ScreenOptions::HandleScreenMessage( SM );
}
void ScreenOptionsEditProfile::AfterChangeValueInRow( int iRow, PlayerNumber pn )
{
ScreenOptions::AfterChangeValueInRow( iRow, pn );
// cause the overlay to reload
GAMESTATE->m_sEditLocalProfileID.Set( GAMESTATE->m_sEditLocalProfileID );
}
void ScreenOptionsEditProfile::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
{
int iRow = GetCurrentRow();;
+6 -1
View File
@@ -2,14 +2,16 @@
#define ScreenOptionsEditProfile_H
#include "ScreenOptions.h"
#include "Profile.h"
class ScreenOptionsEditProfile : public ScreenOptions
{
public:
ScreenOptionsEditProfile( CString sName );
virtual void Init();
virtual ~ScreenOptionsEditProfile();
virtual void Init();
protected:
private:
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
@@ -19,7 +21,10 @@ private:
virtual void GoToPrevScreen();
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn );
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
Profile m_Original; // restore this on revert
};
#endif
+23 -5
View File
@@ -154,12 +154,17 @@ void ScreenOptionsManageCourses::Init()
OptionRowDefinition def;
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
int iIndex = 0;
def.m_sName = "";
def.m_vsChoices.clear();
def.m_vsChoices.push_back( "Create New" );
vDefs.push_back( def );
vHands.push_back( NULL );
{
def.m_sName = "";
def.m_vsChoices.clear();
def.m_vsChoices.push_back( "Create New" );
vDefs.push_back( def );
vHands.push_back( NULL );
iIndex++;
}
SONGMAN->GetAllCourses( m_vpCourses, false );
@@ -198,10 +203,13 @@ void ScreenOptionsManageCourses::Init()
break;
}
def.m_sName = ssprintf("%d",iIndex) + " " + def.m_sName;
def.m_vsChoices.clear();
def.m_vsChoices.push_back( (*c)->GetDisplayFullTitle() );
vDefs.push_back( def );
vHands.push_back( NULL );
iIndex++;
}
ScreenOptions::InitMenu( vDefs, vHands );
@@ -335,6 +343,16 @@ void ScreenOptionsManageCourses::ProcessMenuStart( PlayerNumber pn, const InputE
if( iCurRow == 0 ) // "create new"
{
if( SONGMAN->GetNumEditCourses(PROFILE_SLOT_MACHINE) >= MAX_EDIT_COURSES_PER_PROFILE )
{
CString s = ssprintf(
"You have %d course edits, the maximum number allowed.\n\n"
"You must delete an existing course edit before creating a new course edit.",
MAX_EDIT_COURSES_PER_PROFILE );
ScreenPrompt::Prompt( SM_None, s );
return;
}
CString sDefaultName;
CString sThrowAway;
for( int i=1; i<=9999; i++ )
+25 -1
View File
@@ -119,7 +119,6 @@ void ScreenOptionsManageProfiles::Init()
int iIndex = 0;
{
def.m_sName = "";
def.m_vsChoices.clear();
def.m_vsChoices.push_back( "Create New" );
vDefs.push_back( def );
@@ -137,6 +136,7 @@ void ScreenOptionsManageProfiles::Init()
{
Profile &profile = PROFILEMAN->GetLocalProfile( *s );
def.m_sName = ssprintf( "%d", iIndex );
def.m_vsChoices.clear();
def.m_vsChoices.push_back( profile.m_sDisplayName );
vDefs.push_back( def );
@@ -167,6 +167,11 @@ void ScreenOptionsManageProfiles::BeginScreen()
this->MoveRowAbsolute( PLAYER_1, 1 + iIndex, false );
}
}
else if( !m_vsLocalProfileID.empty() )
{
// select the first item below "create new"
this->MoveRowAbsolute( PLAYER_1, 1, false );
}
AfterChangeRow( PLAYER_1 );
}
@@ -215,7 +220,16 @@ void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM )
{
if( ScreenPrompt::s_LastAnswer == ANSWER_YES )
{
// Select the profile nearest to the one that was just deleted.
int iIndex = -1;
vector<CString>::const_iterator iter = find( m_vsLocalProfileID.begin(), m_vsLocalProfileID.end(), GAMESTATE->m_sEditLocalProfileID.Get() );
if( iter != m_vsLocalProfileID.end() )
iIndex = iter - m_vsLocalProfileID.begin();
CLAMP( iIndex, 0, m_vsLocalProfileID.size()-1 );
GAMESTATE->m_sEditLocalProfileID.Set( m_vsLocalProfileID[iIndex] );
PROFILEMAN->DeleteLocalProfile( GetLocalProfileIDWithFocus() );
SCREENMAN->SetNewScreen( this->m_sName ); // reload
}
}
@@ -271,6 +285,16 @@ void ScreenOptionsManageProfiles::ProcessMenuStart( PlayerNumber pn, const Input
if( iCurRow == 0 ) // "create new"
{
if( PROFILEMAN->GetNumLocalProfiles() >= MAX_NUM_LOCAL_PROFILES )
{
CString s = ssprintf(
"You have %d profiles, the maximum number allowed.\n\n"
"You must delete an existing profile before creating a new profile.",
MAX_NUM_LOCAL_PROFILES );
ScreenPrompt::Prompt( SM_None, s );
return;
}
vector<CString> vsUsedNames;
PROFILEMAN->GetLocalProfileDisplayNames( vsUsedNames );
+11 -3
View File
@@ -40,9 +40,6 @@ SongManager* SONGMAN = NULL; // global and accessable from anywhere in our progr
const CString SONGS_DIR = "Songs/";
const CString COURSES_DIR = "Courses/";
const int MAX_EDIT_STEPS_PER_PROFILE = 200;
const int MAX_EDIT_COURSES_PER_PROFILE = 20;
static const ThemeMetric<RageColor> BEGINNER_COLOR ("SongManager","BeginnerColor");
static const ThemeMetric<RageColor> EASY_COLOR ("SongManager","EasyColor");
static const ThemeMetric<RageColor> MEDIUM_COLOR ("SongManager","MediumColor");
@@ -486,6 +483,17 @@ int SongManager::GetNumCourseGroups() const
return m_mapCourseGroupToInfo.size();
}
int SongManager::GetNumEditCourses( ProfileSlot slot ) const
{
int iNum = 0;
FOREACH_CONST( Course*, m_pCourses, p )
{
if( (*p)->GetLoadedFromProfileSlot() == slot )
iNum++;
}
return iNum;
}
CString SongManager::ShortenGroupName( CString sLongGroupName )
{
sLongGroupName.Replace( "Dance Dance Revolution", "DDR" );
+5
View File
@@ -20,6 +20,9 @@ struct lua_State;
#include "ThemeMetric.h"
#include "RageTexturePreloader.h"
const int MAX_EDIT_STEPS_PER_PROFILE = 200;
const int MAX_EDIT_COURSES_PER_PROFILE = 20;
class SongManager
{
public:
@@ -48,6 +51,7 @@ public:
void AddCourse( Course *pCourse ); // transfers ownership of pCourse
void DeleteCourse( Course *pCourse ); // transfers ownership of pCourse
void InitAll( LoadingWindow *ld ); // songs, courses, groups - everything.
void Reload( LoadingWindow *ld=NULL ); // songs, courses, groups - everything.
void PreloadSongImages();
@@ -83,6 +87,7 @@ public:
int GetNumSongGroups() const;
int GetNumCourses() const;
int GetNumCourseGroups() const;
int GetNumEditCourses( ProfileSlot slot ) const;
Song* GetRandomSong();
Course* GetRandomCourse();