simplify SystemMessage

This commit is contained in:
Glenn Maynard
2007-02-16 02:25:24 +00:00
parent 69f2604bb7
commit 0db3211c34
3 changed files with 13 additions and 18 deletions
@@ -23,17 +23,13 @@ local t = Def.ActorFrame {
OnCommand=cmd(maxwidth,750;finishtweening;horizalign,left;vertalign,top;x,SCREEN_LEFT+20;y,SCREEN_TOP+20;zoom,0.8;shadowlength,2;diffusealpha,1;addx,-SCREEN_WIDTH;linear,0.5;addx,SCREEN_WIDTH); OnCommand=cmd(maxwidth,750;finishtweening;horizalign,left;vertalign,top;x,SCREEN_LEFT+20;y,SCREEN_TOP+20;zoom,0.8;shadowlength,2;diffusealpha,1;addx,-SCREEN_WIDTH;linear,0.5;addx,SCREEN_WIDTH);
OffCommand=cmd(sleep,5;linear,0.5;diffusealpha,0); OffCommand=cmd(sleep,5;linear,0.5;diffusealpha,0);
SystemMessageMessageCommand = function(self) SystemMessageMessageCommand = function(self, params)
self:visible(true); self:visible(true);
self:settext( SCREENMAN:GetCurrentSystemMessage() ); self:settext( params.Message );
self:playcommand( "On" ); self:playcommand( "On" );
self:playcommand( "Off" ); if params.NoAnimate then
end; self:finishtweening();
SystemMessageNoAnimateMessageCommand = function(self) end
self:visible(true);
self:settext( SCREENMAN:GetCurrentSystemMessage() );
self:playcommand( "On" );
self:FinishTweening();
self:playcommand( "Off" ); self:playcommand( "Off" );
end; end;
HideSystemMessageMessageCommand = cmd(visible,false); HideSystemMessageMessageCommand = cmd(visible,false);
+8 -6
View File
@@ -750,16 +750,20 @@ void ScreenManager::SendMessageToTopScreen( ScreenMessage SM )
void ScreenManager::SystemMessage( const RString &sMessage ) void ScreenManager::SystemMessage( const RString &sMessage )
{ {
m_sSystemMessage = sMessage;
LOG->Trace( "%s", sMessage.c_str() ); LOG->Trace( "%s", sMessage.c_str() );
MESSAGEMAN->Broadcast( "SystemMessage" ); Message msg( "SystemMessage" );
msg.SetParam( "Message", sMessage );
msg.SetParam( "NoAnimate", false );
MESSAGEMAN->Broadcast( msg );
} }
void ScreenManager::SystemMessageNoAnimate( const RString &sMessage ) void ScreenManager::SystemMessageNoAnimate( const RString &sMessage )
{ {
// LOG->Trace( "%s", sMessage.c_str() ); // don't log because the caller is likely calling us every frame // LOG->Trace( "%s", sMessage.c_str() ); // don't log because the caller is likely calling us every frame
m_sSystemMessage = sMessage; Message msg( "SystemMessage" );
MESSAGEMAN->Broadcast( "SystemMessageNoAnimate" ); msg.SetParam( "Message", sMessage );
msg.SetParam( "NoAnimate", true );
MESSAGEMAN->Broadcast( msg );
} }
void ScreenManager::HideSystemMessage() void ScreenManager::HideSystemMessage()
@@ -847,7 +851,6 @@ public:
} }
static int SystemMessage( T* p, lua_State *L ) { p->SystemMessage( SArg(1) ); return 0; } static int SystemMessage( T* p, lua_State *L ) { p->SystemMessage( SArg(1) ); return 0; }
static int ScreenIsPrepped( T* p, lua_State *L ) { lua_pushboolean( L, ScreenManagerUtil::ScreenIsPrepped( SArg(1) ) ); return 1; } static int ScreenIsPrepped( T* p, lua_State *L ) { lua_pushboolean( L, ScreenManagerUtil::ScreenIsPrepped( SArg(1) ) ); return 1; }
static int GetCurrentSystemMessage( T* p, lua_State *L ){ LuaHelpers::Push( L, p->GetCurrentSystemMessage() ); return 1; }
LunaScreenManager() LunaScreenManager()
{ {
@@ -855,7 +858,6 @@ public:
ADD_METHOD( GetTopScreen ); ADD_METHOD( GetTopScreen );
ADD_METHOD( SystemMessage ); ADD_METHOD( SystemMessage );
ADD_METHOD( ScreenIsPrepped ); ADD_METHOD( ScreenIsPrepped );
ADD_METHOD( GetCurrentSystemMessage );
} }
}; };
-3
View File
@@ -40,7 +40,6 @@ public:
void SystemMessage( const RString &sMessage ); void SystemMessage( const RString &sMessage );
void SystemMessageNoAnimate( const RString &sMessage ); void SystemMessageNoAnimate( const RString &sMessage );
void HideSystemMessage(); void HideSystemMessage();
RString GetCurrentSystemMessage() const { return m_sSystemMessage; }
// Screen messages // Screen messages
void PostMessageToTopScreen( ScreenMessage SM, float fDelay ); void PostMessageToTopScreen( ScreenMessage SM, float fDelay );
@@ -63,8 +62,6 @@ public:
private: private:
Screen *m_pInputFocus; // NULL = top of m_ScreenStack Screen *m_pInputFocus; // NULL = top of m_ScreenStack
RString m_sSystemMessage;
// Screen loads, removals, and concurrent prepares are delayed until the next update. // Screen loads, removals, and concurrent prepares are delayed until the next update.
RString m_sDelayedScreen; RString m_sDelayedScreen;
RString m_sDelayedConcurrentPrepare; RString m_sDelayedConcurrentPrepare;