working on profile management screen
This commit is contained in:
@@ -53,6 +53,27 @@ const unsigned int DEFAULT_WEIGHT_POUNDS = 120;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
int Profile::HighScoresForASong::GetNumTimesPlayed() const
|
||||||
|
{
|
||||||
|
int iCount = 0;
|
||||||
|
FOREACHM_CONST( StepsID, HighScoresForASteps, m_StepsHighScores, i )
|
||||||
|
{
|
||||||
|
iCount += i->second.hsl.GetNumTimesPlayed();
|
||||||
|
}
|
||||||
|
return iCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Profile::HighScoresForACourse::GetNumTimesPlayed() const
|
||||||
|
{
|
||||||
|
int iCount = 0;
|
||||||
|
FOREACHM_CONST( TrailID, HighScoresForATrail, m_TrailHighScores, i )
|
||||||
|
{
|
||||||
|
iCount += i->second.hsl.GetNumTimesPlayed();
|
||||||
|
}
|
||||||
|
return iCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Profile::InitEditableData()
|
void Profile::InitEditableData()
|
||||||
{
|
{
|
||||||
m_sDisplayName = "";
|
m_sDisplayName = "";
|
||||||
@@ -517,6 +538,41 @@ bool Profile::IsCodeUnlocked( int iCode ) const
|
|||||||
return m_UnlockedSongs.find( iCode ) != m_UnlockedSongs.end();
|
return m_UnlockedSongs.find( iCode ) != m_UnlockedSongs.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Song *Profile::GetMostPopularSong() const
|
||||||
|
{
|
||||||
|
int iMaxNumTimesPlayed = 0;
|
||||||
|
SongID id;
|
||||||
|
FOREACHM_CONST( SongID, HighScoresForASong, m_SongHighScores, i )
|
||||||
|
{
|
||||||
|
int iNumTimesPlayed = i->second.GetNumTimesPlayed();
|
||||||
|
if( iNumTimesPlayed > iMaxNumTimesPlayed )
|
||||||
|
{
|
||||||
|
id = i->first;
|
||||||
|
iMaxNumTimesPlayed = iNumTimesPlayed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return id.ToSong();
|
||||||
|
}
|
||||||
|
|
||||||
|
Course *Profile::GetMostPopularCourse() const
|
||||||
|
{
|
||||||
|
int iMaxNumTimesPlayed = 0;
|
||||||
|
CourseID id;
|
||||||
|
FOREACHM_CONST( CourseID, HighScoresForACourse, m_CourseHighScores, i )
|
||||||
|
{
|
||||||
|
int iNumTimesPlayed = i->second.GetNumTimesPlayed();
|
||||||
|
if( iNumTimesPlayed > iMaxNumTimesPlayed )
|
||||||
|
{
|
||||||
|
id = i->first;
|
||||||
|
iMaxNumTimesPlayed = iNumTimesPlayed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return id.ToCourse();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Steps high scores
|
// Steps high scores
|
||||||
//
|
//
|
||||||
@@ -1875,6 +1931,25 @@ public:
|
|||||||
static int GetNumTotalSongsPlayed( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iNumTotalSongsPlayed ); return 1; }
|
static int GetNumTotalSongsPlayed( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iNumTotalSongsPlayed ); return 1; }
|
||||||
static int GetLastPlayedStepsType( T* p, lua_State *L ) { lua_pushnumber(L, p->GetLastPlayedStepsType() ); return 1; }
|
static int GetLastPlayedStepsType( T* p, lua_State *L ) { lua_pushnumber(L, p->GetLastPlayedStepsType() ); return 1; }
|
||||||
static int GetSongsAndCoursesPercentCompleteAllDifficulties( T* p, lua_State *L ) { lua_pushnumber(L, p->GetSongsAndCoursesPercentCompleteAllDifficulties((StepsType)IArg(1)) ); return 1; }
|
static int GetSongsAndCoursesPercentCompleteAllDifficulties( T* p, lua_State *L ) { lua_pushnumber(L, p->GetSongsAndCoursesPercentCompleteAllDifficulties((StepsType)IArg(1)) ); return 1; }
|
||||||
|
static int GetDisplayTotalCaloriesBurned( T* p, lua_State *L ) { lua_pushstring(L, p->GetDisplayTotalCaloriesBurned() ); return 1; }
|
||||||
|
static int GetMostPopularSong( T* p, lua_State *L )
|
||||||
|
{
|
||||||
|
Song *p2 = p->GetMostPopularSong();
|
||||||
|
if( p2 )
|
||||||
|
p2->PushSelf(L);
|
||||||
|
else
|
||||||
|
lua_pushnil( L );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
static int GetMostPopularCourse( T* p, lua_State *L )
|
||||||
|
{
|
||||||
|
Course *p2 = p->GetMostPopularCourse();
|
||||||
|
if( p2 )
|
||||||
|
p2->PushSelf(L);
|
||||||
|
else
|
||||||
|
lua_pushnil( L );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void Register(lua_State *L)
|
static void Register(lua_State *L)
|
||||||
{
|
{
|
||||||
@@ -1903,6 +1978,9 @@ public:
|
|||||||
ADD_METHOD( GetNumTotalSongsPlayed )
|
ADD_METHOD( GetNumTotalSongsPlayed )
|
||||||
ADD_METHOD( GetLastPlayedStepsType )
|
ADD_METHOD( GetLastPlayedStepsType )
|
||||||
ADD_METHOD( GetSongsAndCoursesPercentCompleteAllDifficulties )
|
ADD_METHOD( GetSongsAndCoursesPercentCompleteAllDifficulties )
|
||||||
|
ADD_METHOD( GetDisplayTotalCaloriesBurned )
|
||||||
|
ADD_METHOD( GetMostPopularSong )
|
||||||
|
ADD_METHOD( GetMostPopularCourse )
|
||||||
|
|
||||||
Luna<T>::Register( L );
|
Luna<T>::Register( L );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ public:
|
|||||||
bool GetDefaultModifiers( const Game* pGameType, CString &sModifiersOut ) const;
|
bool GetDefaultModifiers( const Game* pGameType, CString &sModifiersOut ) const;
|
||||||
void SetDefaultModifiers( const Game* pGameType, const CString &sModifiers );
|
void SetDefaultModifiers( const Game* pGameType, const CString &sModifiers );
|
||||||
bool IsCodeUnlocked( int iCode ) const;
|
bool IsCodeUnlocked( int iCode ) const;
|
||||||
|
Song *GetMostPopularSong() const;
|
||||||
|
Course *GetMostPopularCourse() const;
|
||||||
|
|
||||||
void AddStepTotals( int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumRolls, int iNumMines, int iNumHands, float fCaloriesBurned );
|
void AddStepTotals( int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumRolls, int iNumMines, int iNumHands, float fCaloriesBurned );
|
||||||
|
|
||||||
@@ -154,6 +156,7 @@ public:
|
|||||||
struct HighScoresForASong
|
struct HighScoresForASong
|
||||||
{
|
{
|
||||||
std::map<StepsID,HighScoresForASteps> m_StepsHighScores;
|
std::map<StepsID,HighScoresForASteps> m_StepsHighScores;
|
||||||
|
int GetNumTimesPlayed() const;
|
||||||
};
|
};
|
||||||
std::map<SongID,HighScoresForASong> m_SongHighScores;
|
std::map<SongID,HighScoresForASong> m_SongHighScores;
|
||||||
|
|
||||||
@@ -179,6 +182,7 @@ public:
|
|||||||
struct HighScoresForACourse
|
struct HighScoresForACourse
|
||||||
{
|
{
|
||||||
std::map<TrailID,HighScoresForATrail> m_TrailHighScores;
|
std::map<TrailID,HighScoresForATrail> m_TrailHighScores;
|
||||||
|
int GetNumTimesPlayed() const;
|
||||||
};
|
};
|
||||||
std::map<CourseID,HighScoresForACourse> m_CourseHighScores;
|
std::map<CourseID,HighScoresForACourse> m_CourseHighScores;
|
||||||
|
|
||||||
|
|||||||
@@ -269,6 +269,14 @@ bool ProfileManager::SaveProfile( PlayerNumber pn ) const
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ProfileManager::SaveLocalProfile( CString sProfileID )
|
||||||
|
{
|
||||||
|
Profile &profile = GetLocalProfile( sProfileID );
|
||||||
|
CString sDir = LocalProfileIdToDir( sProfileID );
|
||||||
|
bool b = profile.SaveAllToDir( sDir, PREFSMAN->m_bSignProfileData );
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
void ProfileManager::UnloadProfile( PlayerNumber pn )
|
void ProfileManager::UnloadProfile( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
m_sProfileDir[pn] = "";
|
m_sProfileDir[pn] = "";
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public:
|
|||||||
bool FastLoadProfileNameFromMemoryCard( CString sRootDir, CString &sName ) const;
|
bool FastLoadProfileNameFromMemoryCard( CString sRootDir, CString &sName ) const;
|
||||||
void SaveAllProfiles() const;
|
void SaveAllProfiles() const;
|
||||||
bool SaveProfile( PlayerNumber pn ) const;
|
bool SaveProfile( PlayerNumber pn ) const;
|
||||||
|
bool SaveLocalProfile( CString sProfileID );
|
||||||
void UnloadProfile( PlayerNumber pn );
|
void UnloadProfile( PlayerNumber pn );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -100,6 +100,11 @@ void ScreenOptionsEditProfile::GoToPrevScreen()
|
|||||||
|
|
||||||
void ScreenOptionsEditProfile::HandleScreenMessage( const ScreenMessage SM )
|
void ScreenOptionsEditProfile::HandleScreenMessage( const ScreenMessage SM )
|
||||||
{
|
{
|
||||||
|
if( SM == SM_GoToNextScreen )
|
||||||
|
{
|
||||||
|
PROFILEMAN->SaveLocalProfile( GAMESTATE->m_sEditLocalProfileID );
|
||||||
|
}
|
||||||
|
|
||||||
ScreenOptions::HandleScreenMessage( SM );
|
ScreenOptions::HandleScreenMessage( SM );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user