Browse Source

Hide / show save menu

master
Christopher 8 years ago
parent
commit
3f1900d002
  1. 25
      Assets/Fungus/Scripts/Components/SaveGameHelper.cs

25
Assets/Fungus/Scripts/Components/SaveGameHelper.cs

@ -16,6 +16,8 @@ namespace Fungus
[SerializeField] protected bool autoStartGame = true; [SerializeField] protected bool autoStartGame = true;
[SerializeField] protected bool saveMenuActive = false;
[SerializeField] protected bool restartDeletesSave = false; [SerializeField] protected bool restartDeletesSave = false;
[SerializeField] protected CanvasGroup saveMenuGroup; [SerializeField] protected CanvasGroup saveMenuGroup;
@ -34,6 +36,8 @@ namespace Fungus
protected AudioSource clickAudioSource; protected AudioSource clickAudioSource;
protected LTDescr fadeTween;
protected virtual void Awake() protected virtual void Awake()
{ {
clickAudioSource = GetComponent<AudioSource>(); clickAudioSource = GetComponent<AudioSource>();
@ -43,6 +47,11 @@ namespace Fungus
{ {
var saveManager = FungusManager.Instance.SaveManager; var saveManager = FungusManager.Instance.SaveManager;
if (!saveMenuActive)
{
saveMenuGroup.alpha = 0f;
}
if (autoStartGame && if (autoStartGame &&
saveManager.NumSavePoints == 0) saveManager.NumSavePoints == 0)
{ {
@ -70,8 +79,6 @@ namespace Fungus
{ {
rewindButton.interactable = saveManager.NumSavePoints > 1; rewindButton.interactable = saveManager.NumSavePoints > 1;
} }
Debug.Log("Update");
} }
protected void CheckSavePointKeys() protected void CheckSavePointKeys()
@ -106,10 +113,6 @@ namespace Fungus
} }
} }
protected LTDescr fadeTween;
protected bool saveMenuActive = true;
#region Public methods #region Public methods
public SaveGameObjects SaveGameObjects { get { return saveGameObjects; } } public SaveGameObjects SaveGameObjects { get { return saveGameObjects; } }
@ -124,22 +127,16 @@ namespace Fungus
if (saveMenuActive) if (saveMenuActive)
{ {
// Switch save menu off // Switch menu off
LeanTween.value(saveMenuGroup.gameObject, saveMenuGroup.alpha, 0f, 0.5f).setOnUpdate( (t) => { LeanTween.value(saveMenuGroup.gameObject, saveMenuGroup.alpha, 0f, 0.5f).setOnUpdate( (t) => {
saveMenuGroup.alpha = t; saveMenuGroup.alpha = t;
}).setOnComplete( () => {
//saveMenuGroup.interactable = false;
//saveMenuGroup.gameObject.SetActive(false);
}); });
} }
else else
{ {
// Switch save menu on // Switch menu on
//saveMenuGroup.gameObject.SetActive(true);
saveMenuGroup.interactable = false;
LeanTween.value(saveMenuGroup.gameObject, saveMenuGroup.alpha, 1f, 0.5f).setOnUpdate( (t) => { LeanTween.value(saveMenuGroup.gameObject, saveMenuGroup.alpha, 1f, 0.5f).setOnUpdate( (t) => {
saveMenuGroup.alpha = t; saveMenuGroup.alpha = t;
}).setOnComplete( () => {
}); });
} }

Loading…
Cancel
Save