using System; using System.Collections.Generic; using UnityEngine; public class OnaholeNodeButton : MonoBehaviour, IOnaholeNodeButton { public string text { get { return this.textLabel.text; } set { this.textLabel.text = ((!string.IsNullOrEmpty(value)) ? value : string.Empty); } } public bool visibleNextMarker { get { return this.nextMarker.activeSelf; } set { this.nextMarker.SetActive(value); this.textLabel.rightAnchor.absolute = ((!value) ? 0 : -30); UIRect.AnchorUpdate updateAnchors = this.textLabel.updateAnchors; this.textLabel.updateAnchors = UIRect.AnchorUpdate.OnUpdate; this.textLabel.UpdateAnchors(); this.textLabel.updateAnchors = updateAnchors; } } public bool sizeModeBig { set { this.bg.width = ((!value) ? 250 : 380); List list = new List(); list.Add(this.textLabel); if (this.nextMarker.GetComponent() != null) { list.Add(this.nextMarker.GetComponent()); } foreach (UIRect uirect in list) { UIRect.AnchorUpdate updateAnchors = uirect.updateAnchors; uirect.updateAnchors = UIRect.AnchorUpdate.OnUpdate; uirect.UpdateAnchors(); uirect.updateAnchors = updateAnchors; } } } public string uniqueName { get; set; } public OnaholeNodeButton.SelectType selectType { get { return this.selectType_; } set { this.selectType_ = value; if (value == OnaholeNodeButton.SelectType.None) { this.bg.alpha = this.defaultBGAlpha; this.textLabel.color = Color.white; } else if (value == OnaholeNodeButton.SelectType.Focus) { this.bg.alpha = 1f; this.textLabel.color = Color.white; } else if (value == OnaholeNodeButton.SelectType.Select) { this.bg.alpha = 1f; this.textLabel.color = Color.yellow; } else if (value == OnaholeNodeButton.SelectType.Disable) { this.bg.alpha = 0.2f; this.textLabel.color = Color.gray; } } } public void Awake() { this.defaultBGAlpha = this.bg.alpha; this.selectType = OnaholeNodeButton.SelectType.None; this.sizeModeBig = false; } GameObject IOnaholeNodeButton.get_gameObject() { return base.gameObject; } [SerializeField] private UIWidget bg; [SerializeField] private UILabel textLabel; [SerializeField] private GameObject nextMarker; private float defaultBGAlpha; private OnaholeNodeButton.SelectType selectType_; public enum SelectType { None, Focus, Select, Disable } }