Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
[KeeperManager] reset everything at every scene change
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanoCecere committed Mar 16, 2017
1 parent 1ef8026 commit c04d19a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions Assets/_app/_scripts/Managers/KeeperManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace EA4S.Core
public class KeeperManager : MonoBehaviour
{
public static KeeperManager I;
System.Action currentCallback;

void Start()
{
Expand Down Expand Up @@ -44,11 +45,11 @@ public void PlayDialog(Database.LocalizationData data, bool isKeeper = true, boo
{
if (autoClose) {
WidgetSubtitles.I.DisplaySentence(data, 2, isKeeper, null);
var callback = _callback;
currentCallback = _callback;
AudioManager.I.PlayDialogue(data, () => {
CloseDialog();
if (callback != null)
callback();
if (currentCallback != null)
currentCallback();
});
} else {
WidgetSubtitles.I.DisplaySentence(data, 2, true, null);
Expand All @@ -61,5 +62,11 @@ public void CloseDialog(bool _immediate = false)
WidgetSubtitles.I.Close(_immediate);
}

public void ResetKeeper()
{
currentCallback = null;
WidgetSubtitles.I.Close(true);
AudioManager.I.StopDialogue(true);
}
}
}
2 changes: 1 addition & 1 deletion Assets/_app/_scripts/Navigation/NavigationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private void GoToScene(AppScene newScene, Database.MiniGameData minigameData = n
NavData.CurrentScene = newScene;

// check to have closed any possibile Keeper Dialog
KeeperManager.I.CloseDialog(true);
KeeperManager.I.ResetKeeper();

GoToSceneByName(AppSceneHelper.GetSceneName(newScene, minigameData));
}
Expand Down

0 comments on commit c04d19a

Please sign in to comment.