simplify. Don't separate "next" and "cancel" as much: to cancel, set the next screen to PREV_SCREEN, and use SM_GoToNextScreen.
This commit is contained in:
@@ -72,7 +72,6 @@ void Screen::BeginScreen()
|
|||||||
/* Screens set these when they determine their next screen dynamically. Reset them
|
/* Screens set these when they determine their next screen dynamically. Reset them
|
||||||
* here, so a reused screen doesn't inherit these from the last time it was used. */
|
* here, so a reused screen doesn't inherit these from the last time it was used. */
|
||||||
m_sNextScreen = RString();
|
m_sNextScreen = RString();
|
||||||
m_sPrevScreen = RString();
|
|
||||||
|
|
||||||
this->RunCommands( THEME->GetMetricA(m_sName, "ScreenOnCommand") );
|
this->RunCommands( THEME->GetMetricA(m_sName, "ScreenOnCommand") );
|
||||||
}
|
}
|
||||||
@@ -213,20 +212,13 @@ void Screen::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
FOREACH_HumanPlayer(p)
|
FOREACH_HumanPlayer(p)
|
||||||
MenuStart( p );
|
MenuStart( p );
|
||||||
}
|
}
|
||||||
else if( SM == SM_GoToNextScreen )
|
else if( SM == SM_GoToNextScreen || SM == SM_GoToPrevScreen )
|
||||||
{
|
{
|
||||||
if( SCREENMAN->IsStackedScreen(this) )
|
if( SCREENMAN->IsStackedScreen(this) )
|
||||||
SCREENMAN->PopTopScreen( m_smSendOnPop );
|
SCREENMAN->PopTopScreen( m_smSendOnPop );
|
||||||
else
|
else
|
||||||
SCREENMAN->SetNewScreen( GetNextScreen() );
|
SCREENMAN->SetNewScreen( GetNextScreen() );
|
||||||
}
|
}
|
||||||
else if( SM == SM_GoToPrevScreen )
|
|
||||||
{
|
|
||||||
if( SCREENMAN->IsStackedScreen(this) )
|
|
||||||
SCREENMAN->PopTopScreen( m_smSendOnPop );
|
|
||||||
else
|
|
||||||
SCREENMAN->SetNewScreen( GetPrevScreen() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RString Screen::GetNextScreen() const
|
RString Screen::GetNextScreen() const
|
||||||
@@ -238,8 +230,6 @@ RString Screen::GetNextScreen() const
|
|||||||
|
|
||||||
RString Screen::GetPrevScreen() const
|
RString Screen::GetPrevScreen() const
|
||||||
{
|
{
|
||||||
if( !m_sPrevScreen.empty() )
|
|
||||||
return m_sPrevScreen;
|
|
||||||
return PREV_SCREEN;
|
return PREV_SCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ protected:
|
|||||||
RString GetNextScreen() const;
|
RString GetNextScreen() const;
|
||||||
RString GetPrevScreen() const;
|
RString GetPrevScreen() const;
|
||||||
|
|
||||||
// If these are left blank, the NextScreen and PrevScreen metrics will be used.
|
// If left blank, the NextScreen metric will be used.
|
||||||
RString m_sNextScreen, m_sPrevScreen;
|
RString m_sNextScreen;
|
||||||
ScreenMessage m_smSendOnPop;
|
ScreenMessage m_smSendOnPop;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -2500,6 +2500,8 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
|
|
||||||
GAMESTATE->CancelStage();
|
GAMESTATE->CancelStage();
|
||||||
|
|
||||||
|
m_sNextScreen = GetPrevScreen();
|
||||||
|
|
||||||
if( AdjustSync::IsSyncDataChanged() )
|
if( AdjustSync::IsSyncDataChanged() )
|
||||||
ScreenSaveSync::PromptSaveSync( SM_GoToPrevScreen );
|
ScreenSaveSync::PromptSaveSync( SM_GoToPrevScreen );
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ void ScreenStage::MenuBack( PlayerNumber pn )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
this->ClearMessageQueue();
|
this->ClearMessageQueue();
|
||||||
|
m_sNextScreen = GetPrevScreen();
|
||||||
m_Cancel.StartTransitioning( SM_GoToPrevScreen );
|
m_Cancel.StartTransitioning( SM_GoToPrevScreen );
|
||||||
|
|
||||||
/* If a Back is buffered while we're prepping the screen (very common), we'll
|
/* If a Back is buffered while we're prepping the screen (very common), we'll
|
||||||
|
|||||||
@@ -285,6 +285,8 @@ void ScreenWithMenuElements::TweenOffScreen()
|
|||||||
|
|
||||||
void ScreenWithMenuElements::Cancel( ScreenMessage smSendWhenDone )
|
void ScreenWithMenuElements::Cancel( ScreenMessage smSendWhenDone )
|
||||||
{
|
{
|
||||||
|
m_sNextScreen = GetPrevScreen();
|
||||||
|
|
||||||
if( CANCEL_TRANSITIONS_OUT )
|
if( CANCEL_TRANSITIONS_OUT )
|
||||||
{
|
{
|
||||||
SCREENMAN->PlayCancelSound();
|
SCREENMAN->PlayCancelSound();
|
||||||
|
|||||||
Reference in New Issue
Block a user