I'm still slowly wrangling out just how Cancel should work.
Screens typically have two general simple models of transitioning; either the menu elements transition out, or we drop a fade on top of everything. The former leaves the background in place, the latter doesn't. Transitioning is usually used when we're going to a screen with the same background; fading is used otherwise. (There are combinations of these, and more complex modes, but these are the basics.) Traditionally, cancelling has always wiped. It usually goes back to the title menu, which rarely has the same background; and it's an uncommon path, so it's not worth setting up a full transition for. However, for cases where we don't go all the way back, this is incorrect; it looks very strange to press escape in the options submenu or the player options menu, and to have it wipe the screen. I've dealt with this in the past by setting up a "cancel" transition that simply runs "Off" and waits. That works, but it's a pain, since the wait duration needs to line up with the length of the transition. Instead, add a transition mode "CancelTransitionsOut" that causes Cancel to run the Out transition directly. (This also plays the start sound, due to a discrepency right now: with Out, it's the screen's job to play the sound, but with Cancel, it's the transition's job. Figure that out later ...) Ultimately, we should be able to have full CancelCommand transitions if we want, but the SWME TweenOnScreen/TweenOffScreen code transition needs to be completed first (replacing individual transitions with a single "On"/"Off" command).
This commit is contained in:
@@ -35,6 +35,7 @@ void ScreenWithMenuElements::Init()
|
||||
LOG->Trace( "ScreenWithMenuElements::Init()" );
|
||||
|
||||
PLAY_MUSIC.Load( m_sName, "PlayMusic" );
|
||||
CANCEL_TRANSITIONS_OUT.Load( m_sName, "CancelTransitionsOut" );
|
||||
TIMER_SECONDS.Load( m_sName, "TimerSeconds" );
|
||||
|
||||
Screen::Init();
|
||||
@@ -271,6 +272,13 @@ void ScreenWithMenuElements::TweenOffScreen()
|
||||
|
||||
void ScreenWithMenuElements::Cancel( ScreenMessage smSendWhenDone )
|
||||
{
|
||||
if( CANCEL_TRANSITIONS_OUT )
|
||||
{
|
||||
SCREENMAN->PlayStartSound();
|
||||
StartTransitioningScreen( smSendWhenDone );
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_Cancel.IsTransitioning() )
|
||||
return; // ignore
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ protected:
|
||||
Transition m_Cancel;
|
||||
|
||||
ThemeMetric<bool> PLAY_MUSIC;
|
||||
ThemeMetric<bool> CANCEL_TRANSITIONS_OUT;
|
||||
ThemeMetric<float> TIMER_SECONDS;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user