using System; using UnityEngine; public class UIPanelBase : MonoBehaviour { private Transform m_Transform; private GameObject m_Go; private bool m_IsActive; public Transform CacheTransform { get { if (this.m_Transform == null) { this.m_Transform = base.transform; } return this.m_Transform; } } public GameObject CacheGameObject { get { if (this.m_Go == null) { this.m_Go = base.gameObject; } return this.m_Go; } } public bool IsActive { get { this.m_IsActive = this.m_Go.activeSelf; return this.m_IsActive; } } private void Awake() { this.OnAwake(); } private void Start() { this.OnStart(); } public void Show(object param = null) { m_IsActive = true; this.CacheGameObject.SetActive(true); this.OnShow(param); } protected virtual void OnAwake() { } protected virtual void OnStart() { } protected virtual void OnShow(object param) { } public virtual void Hide() { this.m_IsActive = false; CacheGameObject.SetActive(false); } public virtual void OnDestroy() { UnityEngine.Object.Destroy(base.gameObject); } }