finish new profile screens
This commit is contained in:
@@ -0,0 +1,197 @@
|
|||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
#include "ScreenOptionsEditProfile.h"
|
||||||
|
#include "ScreenMiniMenu.h"
|
||||||
|
#include "ProfileManager.h"
|
||||||
|
#include "ScreenTextEntry.h"
|
||||||
|
#include "ScreenPrompt.h"
|
||||||
|
#include "RageUtil.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
#include "Profile.h"
|
||||||
|
#include "Character.h"
|
||||||
|
|
||||||
|
AutoScreenMessage( SM_BackFromEnterName )
|
||||||
|
AutoScreenMessage( SM_BackFromDelete )
|
||||||
|
|
||||||
|
enum EditProfileRow
|
||||||
|
{
|
||||||
|
ROW_NAME,
|
||||||
|
ROW_CHARACTER,
|
||||||
|
ROW_DELETE
|
||||||
|
};
|
||||||
|
|
||||||
|
REGISTER_SCREEN_CLASS( ScreenOptionsEditProfile );
|
||||||
|
ScreenOptionsEditProfile::ScreenOptionsEditProfile( CString sName ) :
|
||||||
|
ScreenOptions( sName )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsEditProfile::Init()
|
||||||
|
{
|
||||||
|
ScreenOptions::Init();
|
||||||
|
|
||||||
|
|
||||||
|
vector<OptionRowDefinition> vDefs;
|
||||||
|
vector<OptionRowHandler*> vHands;
|
||||||
|
|
||||||
|
OptionRowDefinition def;
|
||||||
|
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||||
|
def.m_bOneChoiceForAllPlayers = true;
|
||||||
|
def.m_bAllowThemeItems = false;
|
||||||
|
def.m_bAllowThemeTitles = false;
|
||||||
|
def.m_bAllowExplanation = false;
|
||||||
|
|
||||||
|
Profile &pro = PROFILEMAN->GetLocalProfile( GAMESTATE->m_sLastSelectedProfileID );
|
||||||
|
|
||||||
|
{
|
||||||
|
def.m_sName = "Name";
|
||||||
|
def.m_vsChoices.clear();
|
||||||
|
CString s = pro.m_sDisplayName;
|
||||||
|
def.m_vsChoices.push_back( s );
|
||||||
|
vDefs.push_back( def );
|
||||||
|
vHands.push_back( NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
def.m_sName = "Character";
|
||||||
|
def.m_vsChoices.clear();
|
||||||
|
vector<Character*> vpCharacters;
|
||||||
|
GAMESTATE->GetCharacters( vpCharacters );
|
||||||
|
FOREACH_CONST( Character*, vpCharacters, c )
|
||||||
|
def.m_vsChoices.push_back( (*c)->m_sName );
|
||||||
|
vDefs.push_back( def );
|
||||||
|
vHands.push_back( NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
def.m_sName = "Delete";
|
||||||
|
def.m_vsChoices.clear();
|
||||||
|
vDefs.push_back( def );
|
||||||
|
vHands.push_back( NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands );
|
||||||
|
}
|
||||||
|
|
||||||
|
ScreenOptionsEditProfile::~ScreenOptionsEditProfile()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsEditProfile::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||||
|
{
|
||||||
|
switch( iRow )
|
||||||
|
{
|
||||||
|
case ROW_CHARACTER:
|
||||||
|
Profile &pro = PROFILEMAN->GetLocalProfile( GAMESTATE->m_sLastSelectedProfileID );
|
||||||
|
OptionRow &row = *m_pRows[ROW_CHARACTER];
|
||||||
|
row.SetOneSharedSelectionIfPresent( pro.m_sCharacter );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsEditProfile::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsEditProfile::GoToNextScreen()
|
||||||
|
{
|
||||||
|
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsEditProfile::GoToPrevScreen()
|
||||||
|
{
|
||||||
|
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsEditProfile::HandleScreenMessage( const ScreenMessage SM )
|
||||||
|
{
|
||||||
|
if( SM == SM_BackFromEnterName )
|
||||||
|
{
|
||||||
|
if( !ScreenTextEntry::s_bCancelledLast )
|
||||||
|
{
|
||||||
|
ASSERT( ScreenTextEntry::s_sLastAnswer != "" ); // validate should have assured this
|
||||||
|
|
||||||
|
CString sNewName = ScreenTextEntry::s_sLastAnswer;
|
||||||
|
ASSERT( !GAMESTATE->m_sLastSelectedProfileID.empty() )
|
||||||
|
|
||||||
|
// rename
|
||||||
|
bool bResult = PROFILEMAN->RenameLocalProfile( GAMESTATE->m_sLastSelectedProfileID, sNewName );
|
||||||
|
if( bResult )
|
||||||
|
SCREENMAN->SetNewScreen( m_sName ); // reload
|
||||||
|
else
|
||||||
|
ScreenPrompt::Prompt( SM_None, ssprintf("Error renaming profile '%s'.", sNewName.c_str()) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( SM == SM_BackFromDelete )
|
||||||
|
{
|
||||||
|
if( ScreenPrompt::s_LastAnswer == ANSWER_YES )
|
||||||
|
{
|
||||||
|
PROFILEMAN->DeleteLocalProfile( GAMESTATE->m_sLastSelectedProfileID );
|
||||||
|
HandleScreenMessage( SM_GoToPrevScreen );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ScreenOptions::HandleScreenMessage( SM );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsEditProfile::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
|
||||||
|
{
|
||||||
|
int iRow = GetCurrentRow();;
|
||||||
|
OptionRow &row = *m_pRows[iRow];
|
||||||
|
|
||||||
|
switch( iRow )
|
||||||
|
{
|
||||||
|
case ROW_NAME:
|
||||||
|
{
|
||||||
|
CString sCurrentProfileName = PROFILEMAN->GetLocalProfile( GAMESTATE->m_sLastSelectedProfileID ).m_sDisplayName;
|
||||||
|
ScreenTextEntry::TextEntry( SM_BackFromEnterName, "Enter a name for a new profile.", sCurrentProfileName, PROFILE_MAX_DISPLAY_NAME_LENGTH, ProfileManager::ValidateLocalProfileName );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ROW_CHARACTER:
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
int iProfileIndex = iRow - 1;
|
||||||
|
int iThrowAway, iX, iY;
|
||||||
|
GetWidthXY( PLAYER_1, iRow, 0, iThrowAway, iX, iY );
|
||||||
|
ScreenMiniMenu::MiniMenu( &g_ProfileContextMenu, SM_BackFromProfileContextMenu, SM_BackFromProfileContextMenu, (float)iX, (float)iY );
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ROW_DELETE:
|
||||||
|
{
|
||||||
|
CString sCurrentProfileName = PROFILEMAN->GetLocalProfile( GAMESTATE->m_sLastSelectedProfileID ).m_sDisplayName;
|
||||||
|
CString sMessage = ssprintf( "Are you sure you want to delete the profile '%s'?", sCurrentProfileName.c_str() );
|
||||||
|
ScreenPrompt::Prompt( SM_BackFromDelete, sMessage, PROMPT_YES_NO );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2003-2004 Chris Danford
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||||
|
* whom the Software is furnished to do so, provided that the above
|
||||||
|
* copyright notice(s) and this permission notice appear in all copies of
|
||||||
|
* the Software and that both the above copyright notice(s) and this
|
||||||
|
* permission notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||||
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||||
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||||
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#ifndef ScreenOptionsEditProfile_H
|
||||||
|
#define ScreenOptionsEditProfile_H
|
||||||
|
|
||||||
|
#include "ScreenOptions.h"
|
||||||
|
|
||||||
|
class ScreenOptionsEditProfile : public ScreenOptions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScreenOptionsEditProfile( CString sName );
|
||||||
|
virtual void Init();
|
||||||
|
virtual ~ScreenOptionsEditProfile();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
private:
|
||||||
|
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
|
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
|
|
||||||
|
virtual void GoToNextScreen();
|
||||||
|
virtual void GoToPrevScreen();
|
||||||
|
|
||||||
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2003-2004 Chris Danford
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||||
|
* whom the Software is furnished to do so, provided that the above
|
||||||
|
* copyright notice(s) and this permission notice appear in all copies of
|
||||||
|
* the Software and that both the above copyright notice(s) and this
|
||||||
|
* permission notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||||
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||||
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||||
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
@@ -10,55 +10,13 @@
|
|||||||
#include "Profile.h"
|
#include "Profile.h"
|
||||||
|
|
||||||
AutoScreenMessage( SM_BackFromEnterName )
|
AutoScreenMessage( SM_BackFromEnterName )
|
||||||
AutoScreenMessage( SM_BackFromProfileContextMenu )
|
|
||||||
AutoScreenMessage( SM_BackFromDelete )
|
AutoScreenMessage( SM_BackFromDelete )
|
||||||
|
|
||||||
const int PROFILE_MAX_NAME_LENGTH = 64;
|
|
||||||
|
|
||||||
static CString GetLastSelectedProfileName()
|
|
||||||
{
|
|
||||||
Profile &pro = PROFILEMAN->GetLocalProfileEditableData( GAMESTATE->m_sLastSelectedProfileID );
|
|
||||||
return pro.m_sDisplayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool ValidateProfileName( const CString &sAnswer, CString &sErrorOut )
|
|
||||||
{
|
|
||||||
const CString &sCurrentProfileOldName = GetLastSelectedProfileName();
|
|
||||||
|
|
||||||
vector<CString> vsUsedNames;
|
|
||||||
PROFILEMAN->GetLocalProfileDisplayNames( vsUsedNames );
|
|
||||||
bool bAlreadyAProfileWithThisName = find( vsUsedNames.begin(), vsUsedNames.end(), sAnswer ) != vsUsedNames.end();
|
|
||||||
|
|
||||||
if( sAnswer == "" )
|
|
||||||
{
|
|
||||||
sErrorOut = "Profile name cannot be blank.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if( sAnswer == sCurrentProfileOldName )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if( bAlreadyAProfileWithThisName )
|
|
||||||
{
|
|
||||||
sErrorOut = "There is already another profile with this name. Please choose a different name.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ContextMenuAnswer
|
|
||||||
{
|
|
||||||
A_EDIT,
|
|
||||||
A_RENAME,
|
|
||||||
A_DELETE,
|
|
||||||
A_CANCEL,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
REGISTER_SCREEN_CLASS( ScreenSelectProfile );
|
REGISTER_SCREEN_CLASS( ScreenSelectProfile );
|
||||||
ScreenSelectProfile::ScreenSelectProfile( CString sName ) :
|
ScreenSelectProfile::ScreenSelectProfile( CString sName ) :
|
||||||
ScreenSelectMaster( sName )
|
ScreenSelectMaster( sName ),
|
||||||
|
NEXT_SCREEN( sName, "NextScreen" )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -67,22 +25,21 @@ void ScreenSelectProfile::Init()
|
|||||||
{
|
{
|
||||||
// Fill m_aGameCommands overriding whatever is in metrics
|
// Fill m_aGameCommands overriding whatever is in metrics
|
||||||
GameCommand gc;
|
GameCommand gc;
|
||||||
|
int iIndex = 0;
|
||||||
m_aGameCommands.clear();
|
m_aGameCommands.clear();
|
||||||
|
|
||||||
gc.m_sName = "create";
|
gc.Load( iIndex++, ParseCommands("name,create") );
|
||||||
m_aGameCommands.push_back( gc );
|
m_aGameCommands.push_back( gc );
|
||||||
|
|
||||||
vector<CString> vProfileIDs;
|
vector<CString> vProfileIDs;
|
||||||
PROFILEMAN->GetLocalProfileIDs( vProfileIDs );
|
PROFILEMAN->GetLocalProfileIDs( vProfileIDs );
|
||||||
FOREACH_CONST( CString, vProfileIDs, s )
|
FOREACH_CONST( CString, vProfileIDs, s )
|
||||||
{
|
{
|
||||||
gc.m_sName = "profile";
|
gc.Load( iIndex++, ParseCommands("name,profile;profileid," + *s + ";screen," + NEXT_SCREEN.GetValue()) );
|
||||||
gc.m_sProfileID = *s;
|
|
||||||
m_aGameCommands.push_back( gc );
|
m_aGameCommands.push_back( gc );
|
||||||
}
|
}
|
||||||
|
|
||||||
gc.m_sName = "exit";
|
gc.Load( iIndex++, ParseCommands("name,exit") );
|
||||||
gc.m_sProfileID = "";
|
|
||||||
m_aGameCommands.push_back( gc );
|
m_aGameCommands.push_back( gc );
|
||||||
|
|
||||||
|
|
||||||
@@ -94,6 +51,29 @@ ScreenSelectProfile::~ScreenSelectProfile()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScreenSelectProfile::ProcessMenuStart( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
int iChoice = m_iChoice[GetSharedPlayer()];
|
||||||
|
|
||||||
|
if( iChoice == 0 ) // "create"
|
||||||
|
{
|
||||||
|
vector<CString> vProfileIDs;
|
||||||
|
PROFILEMAN->GetLocalProfileIDs( vProfileIDs );
|
||||||
|
if( vProfileIDs.size() >= MAX_NUM_LOCAL_PROFILES )
|
||||||
|
{
|
||||||
|
CString sError = ssprintf( "You may only create up to %d profiles. You must delete an existing profile before creating a new one.", MAX_NUM_LOCAL_PROFILES );
|
||||||
|
ScreenPrompt::Prompt( SM_None, sError );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ScreenTextEntry::TextEntry( SM_BackFromEnterName, "Enter a name for a new profile.", PROFILEMAN->GetNewLocalProfileDefaultName(), PROFILE_MAX_DISPLAY_NAME_LENGTH, ProfileManager::ValidateLocalProfileName );
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenSelectProfile::HandleScreenMessage( const ScreenMessage SM )
|
void ScreenSelectProfile::HandleScreenMessage( const ScreenMessage SM )
|
||||||
{
|
{
|
||||||
if( SM == SM_BackFromEnterName )
|
if( SM == SM_BackFromEnterName )
|
||||||
@@ -103,8 +83,8 @@ void ScreenSelectProfile::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
ASSERT( ScreenTextEntry::s_sLastAnswer != "" ); // validate should have assured this
|
ASSERT( ScreenTextEntry::s_sLastAnswer != "" ); // validate should have assured this
|
||||||
|
|
||||||
CString sNewName = ScreenTextEntry::s_sLastAnswer;
|
CString sNewName = ScreenTextEntry::s_sLastAnswer;
|
||||||
if( GAMESTATE->m_sLastSelectedProfileID.empty() )
|
ASSERT( GAMESTATE->m_sLastSelectedProfileID.empty() )
|
||||||
{
|
|
||||||
// create
|
// create
|
||||||
bool bResult = PROFILEMAN->CreateLocalProfile( sNewName );
|
bool bResult = PROFILEMAN->CreateLocalProfile( sNewName );
|
||||||
if( bResult )
|
if( bResult )
|
||||||
@@ -112,86 +92,28 @@ void ScreenSelectProfile::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
else
|
else
|
||||||
ScreenPrompt::Prompt( SM_None, ssprintf("Error creating profile '%s'.", sNewName.c_str()) );
|
ScreenPrompt::Prompt( SM_None, ssprintf("Error creating profile '%s'.", sNewName.c_str()) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if( SM == SM_GoToNextScreen )
|
||||||
|
{
|
||||||
|
int iSelection = GetSelectionIndex( PLAYER_1 );
|
||||||
|
|
||||||
|
vector<CString> vsProfileID;
|
||||||
|
PROFILEMAN->GetLocalProfileIDs( vsProfileID );
|
||||||
|
if( iSelection == 0 || iSelection == vsProfileID.size()+1 )
|
||||||
|
{
|
||||||
|
GAMESTATE->m_sLastSelectedProfileID = "";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// rename
|
GAMESTATE->m_sLastSelectedProfileID = m_aGameCommands[iSelection].m_sProfileID;
|
||||||
bool bResult = PROFILEMAN->RenameLocalProfile( GAMESTATE->m_sLastSelectedProfileID, sNewName );
|
ASSERT( !GAMESTATE->m_sLastSelectedProfileID.empty() );
|
||||||
if( bResult )
|
|
||||||
SCREENMAN->SetNewScreen( m_sName ); // reload
|
|
||||||
else
|
|
||||||
ScreenPrompt::Prompt( SM_None, ssprintf("Error renaming profile '%s'.", sNewName.c_str()) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( SM == SM_BackFromProfileContextMenu )
|
|
||||||
{
|
|
||||||
if( !ScreenMiniMenu::s_bCancelled )
|
|
||||||
{
|
|
||||||
switch( ScreenMiniMenu::s_iLastRowCode )
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
ASSERT(0);
|
|
||||||
case A_EDIT:
|
|
||||||
SCREENMAN->SetNewScreen( "ScreenOptionsEditProfile" );
|
|
||||||
break;
|
|
||||||
case A_RENAME:
|
|
||||||
{
|
|
||||||
ScreenTextEntry::TextEntry( SM_BackFromEnterName, "Enter a name for a new profile.", GetLastSelectedProfileName(), PROFILE_MAX_NAME_LENGTH, ValidateProfileName );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case A_DELETE:
|
|
||||||
{
|
|
||||||
CString sMessage = ssprintf( "Are you sure you want to delete the profile '%s'?", GetLastSelectedProfileName().c_str() );
|
|
||||||
ScreenPrompt::Prompt( SM_BackFromDelete, sMessage, PROMPT_YES_NO );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case A_CANCEL:
|
|
||||||
SCREENMAN->PlayInvalidSound();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( SM == SM_BackFromDelete )
|
|
||||||
{
|
|
||||||
if( ScreenPrompt::s_LastAnswer == ANSWER_YES )
|
|
||||||
{
|
|
||||||
PROFILEMAN->DeleteLocalProfile( GAMESTATE->m_sLastSelectedProfileID );
|
|
||||||
SCREENMAN->SetNewScreen( m_sName ); // reload
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ScreenSelectMaster::HandleScreenMessage( SM );
|
ScreenSelectMaster::HandleScreenMessage( SM );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void ScreenSelectProfile::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
|
|
||||||
{
|
|
||||||
int iRow = GetCurrentRow();;
|
|
||||||
OptionRow &row = *m_pRows[iRow];
|
|
||||||
|
|
||||||
if( iRow == 0 ) // "create new"
|
|
||||||
{
|
|
||||||
s_sLastSelectedProfileID = "";
|
|
||||||
ScreenTextEntry::TextEntry( SM_BackFromEnterName, "Enter a name for a new profile.", PROFILEMAN->GetNewProfileDefaultName(), PROFILE_MAX_NAME_LENGTH, ValidateProfileName );
|
|
||||||
}
|
|
||||||
else if( row.GetRowType() == OptionRow::ROW_EXIT )
|
|
||||||
{
|
|
||||||
s_sLastSelectedProfileID = "";
|
|
||||||
ScreenOptions::ProcessMenuStart( pn, type );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int iProfileIndex = iRow - 1;
|
|
||||||
vector<CString> vsProfileIDs;
|
|
||||||
PROFILEMAN->GetLocalProfileIDs( vsProfileIDs );
|
|
||||||
s_sLastSelectedProfileID = vsProfileIDs[ iProfileIndex ];
|
|
||||||
int iThrowAway, iX, iY;
|
|
||||||
GetWidthXY( PLAYER_1, iRow, 0, iThrowAway, iX, iY );
|
|
||||||
ScreenMiniMenu::MiniMenu( &g_ProfileContextMenu, SM_BackFromProfileContextMenu, SM_BackFromProfileContextMenu, (float)iX, (float)iY );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003-2004 Chris Danford
|
* (c) 2003-2004 Chris Danford
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
virtual bool ProcessMenuStart( PlayerNumber pn );
|
||||||
|
|
||||||
|
ThemeMetric<CString> NEXT_SCREEN;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user