From f67cbf0705c57d4ee6816e5c80979d03aca14871 Mon Sep 17 00:00:00 2001 From: Gerardo Marset Date: Thu, 30 Jun 2016 04:53:23 -0300 Subject: [PATCH] Better follow the project's coding standards. --- Assets/Fungus/Narrative/Scripts/MenuDialog.cs | 26 ++++++++--------- Assets/Fungus/UI/Scripts/SelectOnEnable.cs | 29 +++++++++---------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Assets/Fungus/Narrative/Scripts/MenuDialog.cs b/Assets/Fungus/Narrative/Scripts/MenuDialog.cs index ba14c5da..72c90ebe 100644 --- a/Assets/Fungus/Narrative/Scripts/MenuDialog.cs +++ b/Assets/Fungus/Narrative/Scripts/MenuDialog.cs @@ -20,14 +20,14 @@ namespace Fungus // Currently active Menu Dialog used to display Menu options public static MenuDialog activeMenuDialog; - [Tooltip("Automatically select the first interactable button when the menu is shown.")] - public bool autoSelectFirstButton = false; + [Tooltip("Automatically select the first interactable button when the menu is shown.")] + public bool autoSelectFirstButton = false; - [NonSerialized] + [NonSerialized] public Button[] cachedButtons; - [NonSerialized] - public Slider cachedSlider; + [NonSerialized] + public Slider cachedSlider; public static MenuDialog GetMenuDialog() { @@ -73,10 +73,10 @@ namespace Fungus } public virtual void OnEnable() - { + { // The canvas may fail to update if the menu dialog is enabled in the first game frame. // To fix this we just need to force a canvas update when the object is enabled. - Canvas.ForceUpdateCanvases(); + Canvas.ForceUpdateCanvases(); } public virtual void Clear() @@ -115,10 +115,10 @@ namespace Fungus button.interactable = interactable; - if (interactable && autoSelectFirstButton && !cachedButtons.Select((x) => x.gameObject).Contains(EventSystem.current.currentSelectedGameObject)) - { - EventSystem.current.SetSelectedGameObject(button.gameObject); - } + if (interactable && autoSelectFirstButton && !cachedButtons.Select((x) => x.gameObject).Contains(EventSystem.current.currentSelectedGameObject)) + { + EventSystem.current.SetSelectedGameObject(button.gameObject); + } Text textComponent = button.GetComponentInChildren(); if (textComponent != null) @@ -130,7 +130,7 @@ namespace Fungus button.onClick.AddListener(delegate { - EventSystem.current.SetSelectedGameObject(null); + EventSystem.current.SetSelectedGameObject(null); StopAllCoroutines(); // Stop timeout Clear(); @@ -173,7 +173,7 @@ namespace Fungus if (cachedSlider != null) { cachedSlider.gameObject.SetActive(true); - gameObject.SetActive(true); + gameObject.SetActive(true); StopAllCoroutines(); StartCoroutine(WaitForTimeout(duration, targetBlock)); } diff --git a/Assets/Fungus/UI/Scripts/SelectOnEnable.cs b/Assets/Fungus/UI/Scripts/SelectOnEnable.cs index 36038f86..c2ee08fb 100644 --- a/Assets/Fungus/UI/Scripts/SelectOnEnable.cs +++ b/Assets/Fungus/UI/Scripts/SelectOnEnable.cs @@ -1,22 +1,21 @@ -using System; -using UnityEngine; +using UnityEngine; using UnityEngine.UI; namespace Fungus { [RequireComponent(typeof(Selectable))] - public class SelectOnEnable : MonoBehaviour - { - private Selectable selectable; + public class SelectOnEnable : MonoBehaviour + { + private Selectable selectable; - private void Awake() - { - selectable = GetComponent(); - } + private void Awake() + { + selectable = GetComponent(); + } - private void OnEnable() - { - selectable.Select(); - } - } -} \ No newline at end of file + private void OnEnable() + { + selectable.Select(); + } + } +}