actor messages for system messages

This commit is contained in:
Glenn Maynard
2005-02-28 05:10:08 +00:00
parent 7aef68aa7b
commit f9f5e0671c
4 changed files with 32 additions and 23 deletions
+9 -2
View File
@@ -521,14 +521,21 @@ void ScreenManager::SendMessageToTopScreen( ScreenMessage SM )
void ScreenManager::SystemMessage( const CString &sMessage )
{
m_sSystemMessage = sMessage;
LOG->Trace( "%s", sMessage.c_str() );
m_SystemLayer->SystemMessage( sMessage );
MESSAGEMAN->Broadcast( "SystemMessage" );
}
void ScreenManager::SystemMessageNoAnimate( const CString &sMessage )
{
// LOG->Trace( "%s", sMessage.c_str() ); // don't log because the caller is likely calling us every frame
m_SystemLayer->SystemMessageNoAnimate( sMessage );
m_sSystemMessage = sMessage;
MESSAGEMAN->Broadcast( "SystemMessageNoAnimate" );
}
CString ScreenManager::GetCurrentSystemMessage() const
{
return m_sSystemMessage;
}
void ScreenManager::RefreshCreditsMessages()
+3
View File
@@ -54,6 +54,8 @@ public:
void RefreshCreditsMessages();
void ThemeChanged();
CString GetCurrentSystemMessage() const;
Screen *GetTopScreen();
public:
@@ -68,6 +70,7 @@ private:
CString m_sLastLoadedBackgroundPath;
CString m_sDelayedScreen;
CString m_sSystemMessage;
ScreenMessage m_MessageSendOnPop;
vector<Screen*> m_vPreparedScreens;
vector<Screen*> m_vScreensToDelete;
+20 -19
View File
@@ -32,11 +32,15 @@
ScreenSystemLayer::ScreenSystemLayer() : Screen("ScreenSystemLayer")
{
MESSAGEMAN->Subscribe( this, "RefreshCreditText" );
MESSAGEMAN->Subscribe( this, "SystemMessage" );
MESSAGEMAN->Subscribe( this, "SystemMessageNoAnimate" );
}
ScreenSystemLayer::~ScreenSystemLayer()
{
MESSAGEMAN->Unsubscribe( this, "RefreshCreditText" );
MESSAGEMAN->Unsubscribe( this, "SystemMessage" );
MESSAGEMAN->Unsubscribe( this, "SystemMessageNoAnimate" );
}
void ScreenSystemLayer::Init()
@@ -109,24 +113,6 @@ void ScreenSystemLayer::ReloadCreditsText()
}
}
void ScreenSystemLayer::SystemMessage( const CString &sMessage )
{
m_textMessage.SetText( sMessage );
ActorCommands c = ActorCommands( "finishtweening;diffusealpha,1;addx,-640;linear,0.5;addx,+640;sleep,5;linear,0.5;diffusealpha,0" );
m_textMessage.RunCommands( c );
}
void ScreenSystemLayer::SystemMessageNoAnimate( const CString &sMessage )
{
m_textMessage.FinishTweening();
m_textMessage.SetText( sMessage );
m_textMessage.SetX( 4 );
m_textMessage.SetDiffuseAlpha( 1 );
m_textMessage.BeginTweening( 5 );
m_textMessage.BeginTweening( 0.5f );
m_textMessage.SetDiffuse( RageColor(1,1,1,0) );
}
CString ScreenSystemLayer::GetCreditsMessage( PlayerNumber pn ) const
{
if( CREDITS_JOIN_ONLY && !GAMESTATE->PlayersCanJoin() )
@@ -224,7 +210,22 @@ void ScreenSystemLayer::HandleMessage( const CString &sMessage )
FOREACH_PlayerNumber( pn )
m_textCredits[pn].SetText( GetCreditsMessage(pn) );
}
else if( sMessage == "SystemMessage" )
{
m_textMessage.SetText( SCREENMAN->GetCurrentSystemMessage() );
ActorCommands c = ActorCommands( "finishtweening;diffusealpha,1;addx,-640;linear,0.5;addx,+640;sleep,5;linear,0.5;diffusealpha,0" );
m_textMessage.RunCommands( c );
}
else if( sMessage == "SystemMessageNoAnimate" )
{
m_textMessage.FinishTweening();
m_textMessage.SetText( SCREENMAN->GetCurrentSystemMessage() );
m_textMessage.SetX( 4 );
m_textMessage.SetDiffuseAlpha( 1 );
m_textMessage.BeginTweening( 5 );
m_textMessage.BeginTweening( 0.5f );
m_textMessage.SetDiffuse( RageColor(1,1,1,0) );
}
Screen::HandleMessage( sMessage );
}
-2
View File
@@ -17,8 +17,6 @@ public:
virtual void Init();
void HandleMessage( const CString &sCommandName );
void SystemMessage( const CString &sMessage );
void SystemMessageNoAnimate( const CString &sMessage );
void ReloadCreditsText();
void Update( float fDeltaTime );