From 3f1900d0023f86795b0d750df1744317cd51e189 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 9 Dec 2016 14:28:57 +0000 Subject: [PATCH] Hide / show save menu --- .../Scripts/Components/SaveGameHelper.cs | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/Assets/Fungus/Scripts/Components/SaveGameHelper.cs b/Assets/Fungus/Scripts/Components/SaveGameHelper.cs index 74086e87..22d42de9 100644 --- a/Assets/Fungus/Scripts/Components/SaveGameHelper.cs +++ b/Assets/Fungus/Scripts/Components/SaveGameHelper.cs @@ -16,6 +16,8 @@ namespace Fungus [SerializeField] protected bool autoStartGame = true; + [SerializeField] protected bool saveMenuActive = false; + [SerializeField] protected bool restartDeletesSave = false; [SerializeField] protected CanvasGroup saveMenuGroup; @@ -34,6 +36,8 @@ namespace Fungus protected AudioSource clickAudioSource; + protected LTDescr fadeTween; + protected virtual void Awake() { clickAudioSource = GetComponent(); @@ -43,6 +47,11 @@ namespace Fungus { var saveManager = FungusManager.Instance.SaveManager; + if (!saveMenuActive) + { + saveMenuGroup.alpha = 0f; + } + if (autoStartGame && saveManager.NumSavePoints == 0) { @@ -70,8 +79,6 @@ namespace Fungus { rewindButton.interactable = saveManager.NumSavePoints > 1; } - - Debug.Log("Update"); } protected void CheckSavePointKeys() @@ -106,10 +113,6 @@ namespace Fungus } } - protected LTDescr fadeTween; - - protected bool saveMenuActive = true; - #region Public methods public SaveGameObjects SaveGameObjects { get { return saveGameObjects; } } @@ -124,22 +127,16 @@ namespace Fungus if (saveMenuActive) { - // Switch save menu off + // Switch menu off LeanTween.value(saveMenuGroup.gameObject, saveMenuGroup.alpha, 0f, 0.5f).setOnUpdate( (t) => { saveMenuGroup.alpha = t; - }).setOnComplete( () => { - //saveMenuGroup.interactable = false; - //saveMenuGroup.gameObject.SetActive(false); }); } else { - // Switch save menu on - //saveMenuGroup.gameObject.SetActive(true); - saveMenuGroup.interactable = false; + // Switch menu on LeanTween.value(saveMenuGroup.gameObject, saveMenuGroup.alpha, 1f, 0.5f).setOnUpdate( (t) => { saveMenuGroup.alpha = t; - }).setOnComplete( () => { }); }