- Fixing bug with last screen not exiting if it is a background screen

This commit is contained in:
nathan@daedalus 2012-03-21 00:12:11 -05:00
parent 0c2172e2b2
commit c11e02d10e
4 changed files with 17 additions and 7 deletions

View File

@ -41,6 +41,13 @@
*
* 1.0.0.9 - 3/16/2012
* - Changeing the complex objects alot - now they are more like "chained" objects
* - Adding checks for if objects are getting deleted too fast
*
* 1.0.1.0 - 3/20/2012
* - Taking out hard coded debug statements for the screen system
* - Adding field to allow/disallow automated mouse joints per object
* - Fixing bug with last screen not exiting if it is a background screen
*
*
*/

View File

@ -270,7 +270,7 @@ namespace FarseerPhysics.SamplesFramework
/// </summary>
public virtual void ExitScreen()
{
if (TransitionOffTime == TimeSpan.Zero)
if (TransitionOffTime == TimeSpan.Zero && this.TransitionPosition == 0 && this.TransitionAlpha == 1)
{
// If the screen has a zero transition time, remove it immediately.
ScreenManager.RemoveScreen(this);

View File

@ -189,11 +189,14 @@ namespace FarseerPhysics.SamplesFramework
}
else if (input.IsMenuCancel())
{
if (this.ScreenState == SamplesFramework.ScreenState.Active)
if (this.ScreenState == SamplesFramework.ScreenState.Active && this.TransitionPosition == 0 && this.TransitionAlpha == 1)
{
if (ScreenManager.GetScreens().Length == 2)
ScreenManager.Game.Exit();
else
//GameScreen[] screens = ScreenManager.GetScreens();
//if (screens[screens.Length - 1] is BackgroundScreen ||| screens.Length )
// ScreenManager.Game.Exit();
//if (ScreenManager.GetScreens().Length == 2)
// ScreenManager.Game.Exit();
//else
this.ExitScreen();
}
//ScreenManager.Game.Exit();

View File

@ -139,7 +139,7 @@ namespace FarseerPhysics.SamplesFramework
// the process of updating one screen adds or removes others.
_screensToUpdate.Clear();
if (_screens.Count == 0)
if (_screens.Count == 0 || (_screens.Count == 1 && _screens[0] is BackgroundScreen))
//I'm done, exit
this.Game.Exit();