using UnityEngine; using UnityEngine.EventSystems; namespace UnityEngine.UI { public class ZYButton : Button { private Color NomalColor = Color.white; private Text BtnText; protected override void Awake() { base.Awake(); BtnText = gameObject.GetComponentInChildren(); if (BtnText != null) NomalColor = BtnText.color; } public override void OnPointerClick(PointerEventData eventData) { if (eventData.button != PointerEventData.InputButton.Left) return; if (!IsActive()) return; onClick.Invoke(); } public override bool IsInteractable() { if(BtnText!=null) { BtnText.color = interactable ? NomalColor : GCGame.Utils.GetColorByString("515053"); } return base.IsInteractable(); } public string BtnName { get { return BtnText == null ? "" : BtnText.text; } set { if (BtnText != null) BtnText.text = value; } } } }