using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace MoreMountains.Tools { /// /// A class used to handle the display of a tab in a MMDebugMenu /// public class MMDebugMenuTab : MonoBehaviour { /// the tab's title public Text TabText; /// the tab's background image public Image TabBackground; /// the color to use for the background when the tab is selected public Color SelectedBackgroundColor; /// the color to use for the background when the tab is not selected public Color DeselectedBackgroundColor; /// the color to use for the text when the tab is selected public Color SelectedTextColor; /// the color to use for the text when the tab is not selected public Color DeselectedTextColor; /// the index of that tab, auto setup by the manager public int Index; /// the manager for this tab, auto setup public MMDebugMenuTabManager Manager; /// if this is true, scale will be forced to one on init public bool ForceScaleOne = true; /// /// On Start we initialize this tab item /// protected virtual void Start() { Initialization(); } /// /// On init we force the scale to one /// protected virtual void Initialization() { if (ForceScaleOne) { this.gameObject.GetComponent().localScale = Vector3.one; } } /// /// Selects this tab /// public virtual void Select() { Manager.Select(Index); TabText.color = SelectedTextColor; TabBackground.color = SelectedBackgroundColor; } /// /// Deselects this tab /// public virtual void Deselect() { TabText.color = DeselectedTextColor; TabBackground.color = DeselectedBackgroundColor; } } }