add ranking manual scroll sound
fix weird scrolling if num songs < num lines shown
This commit is contained in:
@@ -201,6 +201,16 @@ float ScreenRanking::SetPage( const PageToShow &pts )
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ScreenRankingScroller::DoScroll( int iDir )
|
||||
{
|
||||
if( m_ListScoreRowItems.Scroll(iDir) )
|
||||
m_soundChange.Play();
|
||||
else
|
||||
SCREENMAN->PlayInvalidSound();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
|
||||
ScoreScroller::ScoreScroller()
|
||||
{
|
||||
this->DeleteChildrenWhenDone();
|
||||
@@ -221,17 +231,25 @@ void ScoreScroller::SetStepsType( StepsType st, RageColor color )
|
||||
ShiftSubActors( INT_MAX );
|
||||
}
|
||||
|
||||
void ScoreScroller::Scroll( int iDir )
|
||||
bool ScoreScroller::Scroll( int iDir )
|
||||
{
|
||||
if( m_vScoreRowItemData.size() <= m_metricSongScoreRowsToDraw )
|
||||
return false;
|
||||
|
||||
float fDest = GetDestinationItem();
|
||||
float fOldDest = fDest;
|
||||
fDest += iDir;
|
||||
CLAMP( fDest, (m_metricSongScoreRowsToDraw-1)/2.0f, m_vScoreRowItemData.size()-(m_metricSongScoreRowsToDraw-1)/2.0f-1 );
|
||||
float fLowClamp = (m_metricSongScoreRowsToDraw-1)/2.0f;
|
||||
float fHighClamp = m_vScoreRowItemData.size()-(m_metricSongScoreRowsToDraw-1)/2.0f-1;
|
||||
CLAMP( fDest, fLowClamp, fHighClamp );
|
||||
if( fOldDest != fDest )
|
||||
{
|
||||
// TODO: play sound
|
||||
SetDestinationItem( fDest );
|
||||
SetDestinationItem( fDest );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,6 +443,8 @@ void ScreenRankingScroller::Init()
|
||||
pts.st = STEPS_TYPES_TO_SHOW.GetValue()[i];
|
||||
m_vPagesToShow.push_back( pts );
|
||||
}
|
||||
|
||||
m_soundChange.Load( THEME->GetPathS(m_sName,"change") );
|
||||
}
|
||||
|
||||
void ScreenRankingScroller::BeginScreen()
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "Difficulty.h"
|
||||
#include "ThemeMetric.h"
|
||||
#include "CommonMetrics.h"
|
||||
#include "RageSound.h"
|
||||
|
||||
class Course;
|
||||
class Song;
|
||||
@@ -98,7 +99,7 @@ public:
|
||||
const vector<Difficulty> &DifficultiesToShow,
|
||||
float fItemHeight );
|
||||
void SetStepsType( StepsType st, RageColor color );
|
||||
void Scroll( int iDir );
|
||||
bool Scroll( int iDir );
|
||||
void ScrollTop();
|
||||
|
||||
protected:
|
||||
@@ -140,12 +141,13 @@ public:
|
||||
virtual void Init();
|
||||
virtual void BeginScreen();
|
||||
|
||||
virtual void MenuLeft( const InputEventPlus &input ) { m_ListScoreRowItems.Scroll(-1); }
|
||||
virtual void MenuRight( const InputEventPlus &input ) { m_ListScoreRowItems.Scroll(+1); }
|
||||
virtual void MenuUp( const InputEventPlus &input ) { m_ListScoreRowItems.Scroll(-1); }
|
||||
virtual void MenuDown( const InputEventPlus &input ) { m_ListScoreRowItems.Scroll(+1); }
|
||||
virtual void MenuLeft( const InputEventPlus &input ) { DoScroll(-1); }
|
||||
virtual void MenuRight( const InputEventPlus &input ) { DoScroll(+1); }
|
||||
virtual void MenuUp( const InputEventPlus &input ) { DoScroll(-1); }
|
||||
virtual void MenuDown( const InputEventPlus &input ) { DoScroll(+1); }
|
||||
|
||||
private:
|
||||
void DoScroll( int iDir );
|
||||
virtual float SetPage( const PageToShow &pts );
|
||||
|
||||
ScoreScroller m_ListScoreRowItems;
|
||||
@@ -159,6 +161,8 @@ private:
|
||||
ThemeMetric<float> DIFFICULTY_START_X;
|
||||
ThemeMetric<float> DIFFICULTY_Y;
|
||||
ThemeMetric<int> NUM_MOST_RECENT_SCORES_TO_SHOW;
|
||||
|
||||
RageSound m_soundChange;
|
||||
};
|
||||
|
||||
static const int NUM_RANKING_LINES = 5;
|
||||
|
||||
Reference in New Issue
Block a user