add experimental GenreDisplay
This commit is contained in:
@@ -15,17 +15,21 @@ HelpDisplay::HelpDisplay()
|
|||||||
|
|
||||||
void HelpDisplay::Load()
|
void HelpDisplay::Load()
|
||||||
{
|
{
|
||||||
m_textTip.SetName( "Tip" );
|
RunCommands( THEME->GetMetricA(m_sName,"TipOnCommand") );
|
||||||
m_textTip.LoadFromFont( THEME->GetPathF(m_sName,"text") );
|
|
||||||
ON_COMMAND( m_textTip );
|
LoadFromFont( THEME->GetPathF(m_sName,"text") );
|
||||||
this->AddChild( &m_textTip );
|
|
||||||
|
|
||||||
m_fSecsUntilSwitch = TIP_SHOW_TIME;
|
m_fSecsUntilSwitch = TIP_SHOW_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HelpDisplay::LoadFromNode( const CString& sDir, const XNode* pNode )
|
||||||
|
{
|
||||||
|
BitmapText::LoadFromNode( sDir, pNode );
|
||||||
|
}
|
||||||
|
|
||||||
void HelpDisplay::SetName( const CString &sName, const CString &sID )
|
void HelpDisplay::SetName( const CString &sName, const CString &sID )
|
||||||
{
|
{
|
||||||
ActorFrame::SetName( sName, sID );
|
BitmapText::SetName( sName, sID );
|
||||||
|
|
||||||
TIP_SHOW_TIME.Load( m_sName, "TipShowTime" );
|
TIP_SHOW_TIME.Load( m_sName, "TipShowTime" );
|
||||||
}
|
}
|
||||||
@@ -37,7 +41,7 @@ void HelpDisplay::SetTips( const CStringArray &arrayTips, const CStringArray &ar
|
|||||||
if( arrayTips == m_arrayTips && arrayTipsAlt == m_arrayTipsAlt )
|
if( arrayTips == m_arrayTips && arrayTipsAlt == m_arrayTipsAlt )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_textTip.SetText( "" );
|
SetText( "" );
|
||||||
|
|
||||||
m_arrayTips = arrayTips;
|
m_arrayTips = arrayTips;
|
||||||
m_arrayTipsAlt = arrayTipsAlt;
|
m_arrayTipsAlt = arrayTipsAlt;
|
||||||
@@ -50,7 +54,7 @@ void HelpDisplay::SetTips( const CStringArray &arrayTips, const CStringArray &ar
|
|||||||
|
|
||||||
void HelpDisplay::Update( float fDeltaTime )
|
void HelpDisplay::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
ActorFrame::Update( fDeltaTime );
|
BitmapText::Update( fDeltaTime );
|
||||||
|
|
||||||
if( m_arrayTips.empty() )
|
if( m_arrayTips.empty() )
|
||||||
return;
|
return;
|
||||||
@@ -61,11 +65,78 @@ void HelpDisplay::Update( float fDeltaTime )
|
|||||||
|
|
||||||
// time to switch states
|
// time to switch states
|
||||||
m_fSecsUntilSwitch = TIP_SHOW_TIME;
|
m_fSecsUntilSwitch = TIP_SHOW_TIME;
|
||||||
m_textTip.SetText( m_arrayTips[m_iCurTipIndex], m_arrayTipsAlt[m_iCurTipIndex] );
|
SetText( m_arrayTips[m_iCurTipIndex], m_arrayTipsAlt[m_iCurTipIndex] );
|
||||||
m_iCurTipIndex++;
|
m_iCurTipIndex++;
|
||||||
m_iCurTipIndex = m_iCurTipIndex % m_arrayTips.size();
|
m_iCurTipIndex = m_iCurTipIndex % m_arrayTips.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "song.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
#include "Course.h"
|
||||||
|
#include "Style.h"
|
||||||
|
#include "Foreach.h"
|
||||||
|
|
||||||
|
REGISTER_ACTOR_CLASS( GenreDisplay );
|
||||||
|
|
||||||
|
GenreDisplay::GenreDisplay()
|
||||||
|
{
|
||||||
|
MESSAGEMAN->Subscribe( this, "OnSongChanged" );
|
||||||
|
MESSAGEMAN->Subscribe( this, "OnCourseChanged" );
|
||||||
|
}
|
||||||
|
|
||||||
|
GenreDisplay::~GenreDisplay()
|
||||||
|
{
|
||||||
|
MESSAGEMAN->Unsubscribe( this, "OnSongChanged" );
|
||||||
|
MESSAGEMAN->Unsubscribe( this, "OnCourseChanged" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void GenreDisplay::PlayCommand( const CString &sCommandName )
|
||||||
|
{
|
||||||
|
if( sCommandName == "OnSongChanged" )
|
||||||
|
{
|
||||||
|
vector<CString> m_Artists, m_AltArtists;
|
||||||
|
|
||||||
|
Song* pSong = GAMESTATE->m_pCurSong;
|
||||||
|
ASSERT( pSong );
|
||||||
|
|
||||||
|
m_Artists.push_back( pSong->GetDisplayArtist() );
|
||||||
|
m_AltArtists.push_back( pSong->GetTranslitArtist() );
|
||||||
|
|
||||||
|
SetTips( m_Artists, m_AltArtists );
|
||||||
|
}
|
||||||
|
else if( sCommandName == "OnCourseChanged" )
|
||||||
|
{
|
||||||
|
vector<CString> m_Artists, m_AltArtists;
|
||||||
|
|
||||||
|
Course* pCourse = GAMESTATE->m_pCurCourse;
|
||||||
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
||||||
|
Trail *pTrail = pCourse->GetTrail( st );
|
||||||
|
ASSERT( pTrail );
|
||||||
|
|
||||||
|
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
|
||||||
|
{
|
||||||
|
if( e->bMystery )
|
||||||
|
{
|
||||||
|
m_Artists.push_back( "???" );
|
||||||
|
m_AltArtists.push_back( "???" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_Artists.push_back( e->pSong->GetDisplayArtist() );
|
||||||
|
m_AltArtists.push_back( e->pSong->GetTranslitArtist() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTips( m_Artists, m_AltArtists );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Actor::PlayCommand( sCommandName );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2003 Chris Danford, Glenn Maynard
|
* (c) 2001-2003 Chris Danford, Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -3,16 +3,19 @@
|
|||||||
#ifndef HELP_DISPLAY_H
|
#ifndef HELP_DISPLAY_H
|
||||||
#define HELP_DISPLAY_H
|
#define HELP_DISPLAY_H
|
||||||
|
|
||||||
#include "ActorFrame.h"
|
|
||||||
#include "BitmapText.h"
|
#include "BitmapText.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
#include "MessageManager.h"
|
||||||
|
|
||||||
|
|
||||||
class HelpDisplay : public ActorFrame
|
class HelpDisplay : public BitmapText
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HelpDisplay();
|
HelpDisplay();
|
||||||
void Load();
|
void Load();
|
||||||
|
|
||||||
|
void LoadFromNode( const CString& sDir, const XNode* pNode );
|
||||||
|
|
||||||
void SetTips( const CStringArray &arrayTips ) { SetTips( arrayTips, arrayTips ); }
|
void SetTips( const CStringArray &arrayTips ) { SetTips( arrayTips, arrayTips ); }
|
||||||
void SetTips( const CStringArray &arrayTips, const CStringArray &arrayTipsAlt );
|
void SetTips( const CStringArray &arrayTips, const CStringArray &arrayTipsAlt );
|
||||||
|
|
||||||
@@ -22,14 +25,20 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
ThemeMetric<float> TIP_SHOW_TIME;
|
ThemeMetric<float> TIP_SHOW_TIME;
|
||||||
|
|
||||||
BitmapText m_textTip;
|
|
||||||
|
|
||||||
CStringArray m_arrayTips, m_arrayTipsAlt;
|
CStringArray m_arrayTips, m_arrayTipsAlt;
|
||||||
int m_iCurTipIndex;
|
int m_iCurTipIndex;
|
||||||
|
|
||||||
float m_fSecsUntilSwitch;
|
float m_fSecsUntilSwitch;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class GenreDisplay : public HelpDisplay
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GenreDisplay();
|
||||||
|
~GenreDisplay();
|
||||||
|
void PlayCommand( const CString &sCommandName );
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user