adjust return-to-title code
This commit is contained in:
parent
8439594b10
commit
d5ea812d7c
|
@ -40,7 +40,7 @@ namespace StardewModdingAPI.Framework
|
||||||
private int AfterLoadTimer = 5;
|
private int AfterLoadTimer = 5;
|
||||||
|
|
||||||
/// <summary>Whether the game is returning to the menu.</summary>
|
/// <summary>Whether the game is returning to the menu.</summary>
|
||||||
private bool IsExiting;
|
private bool IsExitingToTitle;
|
||||||
|
|
||||||
/// <summary>Whether the game is saving and SMAPI has already raised <see cref="SaveEvents.BeforeSave"/>.</summary>
|
/// <summary>Whether the game is saving and SMAPI has already raised <see cref="SaveEvents.BeforeSave"/>.</summary>
|
||||||
private bool IsBetweenSaveEvents;
|
private bool IsBetweenSaveEvents;
|
||||||
|
@ -337,17 +337,16 @@ namespace StardewModdingAPI.Framework
|
||||||
*********/
|
*********/
|
||||||
// before exit to title
|
// before exit to title
|
||||||
if (Game1.exitToTitle)
|
if (Game1.exitToTitle)
|
||||||
this.IsExiting = true;
|
this.IsExitingToTitle = true;
|
||||||
|
|
||||||
// after exit to title
|
// after exit to title
|
||||||
if (Context.IsWorldReady && this.IsExiting && Game1.activeClickableMenu is TitleMenu)
|
if (Context.IsWorldReady && this.IsExitingToTitle && Game1.activeClickableMenu is TitleMenu)
|
||||||
{
|
{
|
||||||
this.Monitor.Log("Context: returned to title", LogLevel.Trace);
|
this.Monitor.Log("Context: returned to title", LogLevel.Trace);
|
||||||
Context.IsWorldReady = false;
|
|
||||||
|
|
||||||
|
this.IsExitingToTitle = false;
|
||||||
|
this.CleanupAfterReturnToTitle();
|
||||||
SaveEvents.InvokeAfterReturnToTitle(this.Monitor);
|
SaveEvents.InvokeAfterReturnToTitle(this.Monitor);
|
||||||
this.AfterLoadTimer = 5;
|
|
||||||
this.IsExiting = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
|
@ -1290,6 +1289,14 @@ namespace StardewModdingAPI.Framework
|
||||||
/****
|
/****
|
||||||
** Methods
|
** Methods
|
||||||
****/
|
****/
|
||||||
|
/// <summary>Perform any cleanup needed when the player unloads a save and returns to the title screen.</summary>
|
||||||
|
private void CleanupAfterReturnToTitle()
|
||||||
|
{
|
||||||
|
Context.IsWorldReady = false;
|
||||||
|
this.AfterLoadTimer = 5;
|
||||||
|
this.PreviousSaveID = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Get the controller buttons which are currently pressed.</summary>
|
/// <summary>Get the controller buttons which are currently pressed.</summary>
|
||||||
/// <param name="index">The controller to check.</param>
|
/// <param name="index">The controller to check.</param>
|
||||||
private Buttons[] GetButtonsDown(PlayerIndex index)
|
private Buttons[] GetButtonsDown(PlayerIndex index)
|
||||||
|
|
Loading…
Reference in New Issue