Browse Source

Fix API change for OnLevelWasLoaded() event

master
chrisgregan 9 years ago
parent
commit
3f9162eb13
  1. 16
      Assets/Fungus/Flowchart/Scripts/Flowchart.cs
  2. 14
      Assets/Fungus/Narrative/Scripts/Localization.cs
  3. 16
      Assets/Fungus/Thirdparty/LeanTween/LeanTween.cs

16
Assets/Fungus/Flowchart/Scripts/Flowchart.cs

@ -183,7 +183,21 @@ namespace Fungus
return maxId + 1;
}
protected virtual void OnLevelWasLoaded(int level)
#if UNITY_5_4_OR_NEWER
protected virtual void Awake()
{
UnityEngine.SceneManagement.SceneManager.activeSceneChanged += (A, B) => {
LevelWasLoaded();
};
}
#else
public virtual void OnLevelWasLoaded(int level)
{
LevelWasLoaded();
}
#endif
protected virtual void LevelWasLoaded()
{
// Reset the flag for checking for an event system as there may not be one in the newly loaded scene.
eventSystemPresent = false;

14
Assets/Fungus/Narrative/Scripts/Localization.cs

@ -59,7 +59,21 @@ namespace Fungus
protected bool initialized;
#if UNITY_5_4_OR_NEWER
protected virtual void Awake()
{
UnityEngine.SceneManagement.SceneManager.activeSceneChanged += (A, B) => {
LevelWasLoaded();
};
}
#else
public virtual void OnLevelWasLoaded(int level)
{
LevelWasLoaded();
}
#endif
protected virtual void LevelWasLoaded()
{
// Check if a language has been selected using the Set Language command in a previous scene.
if (SetLanguage.mostRecentLanguage != "")

16
Assets/Fungus/Thirdparty/LeanTween/LeanTween.cs vendored

@ -1346,7 +1346,21 @@ public void Update(){
LeanTween.update();
}
public void OnLevelWasLoaded( int lvl ){
#if UNITY_5_4_OR_NEWER
protected void Awake()
{
UnityEngine.SceneManagement.SceneManager.activeSceneChanged += (A, B) => {
LevelWasLoaded();
};
}
#else
protected void OnLevelWasLoaded(int level)
{
LevelWasLoaded();
}
#endif
public void LevelWasLoaded(){
// Debug.Log("reseting gui");
LTGUI.reset();
}

Loading…
Cancel
Save