using Sirenix.OdinInspector; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; namespace Ether { public class ToggleEx : MonoBehaviour, IPointerClickHandler { [LabelText("选择状态显示")] public GameObject checkRoot; [LabelText("非选择状态显示")] public GameObject uncheckRoot; [LabelText("选择状态")] public bool isOn { set { SetIsOnState(); } get => isOn; } public void OnPointerClick(PointerEventData eventData) { isOn = !isOn; SetIsOnState(); } private void SetIsOnState() { checkRoot.SetActive(isOn); uncheckRoot.SetActive(!isOn); } } }