AesirBasePanel¶
- 种类:
abstract class - 命名空间:
Runestone.AesirModules - 程序集:
Runestone.AesirModules
继承链: System.Object → UnityEngine.Object → UnityEngine.Component → UnityEngine.Behaviour → UnityEngine.MonoBehaviour → Sirenix.OdinInspector.SerializedMonoBehaviour → Runestone.AesirArchitecture.AesirMonoBehaviour → AesirBasePanel
实现接口: Sirenix.Serialization.ISupportsPrefabSerialization,UnityEngine.ISerializationCallbackReceiver,Runestone.AesirModules.IUIPanel
声明¶
public abstract class AesirBasePanel : Runestone.AesirArchitecture.AesirMonoBehaviour,
Sirenix.Serialization.ISupportsPrefabSerialization,
UnityEngine.ISerializationCallbackReceiver,
Runestone.AesirModules.IUIPanel
UI 面板基类。子类覆写生命周期虚方法,通过 Context 访问 Model/Service。
属性¶
声明的属性
| 名称 | 描述 |
|---|---|
Layer |
面板所在的 UI 层级。 |
DestroyOnHide |
隐藏时是否销毁并回收实例。 |
IsOpen |
当前是否处于显示状态。由 UIModule 驱动。 |
继承的属性
| 名称 | 描述 | 声明类型 |
|---|---|---|
destroyCancellationToken |
— | MonoBehaviour |
gameObject |
— | Component |
hideFlags |
— | Object |
transform |
— | Component |
enabled |
— | Behaviour |
isActiveAndEnabled |
— | Behaviour |
runInEditMode |
— | MonoBehaviour |
useGUILayout |
— | MonoBehaviour |
name |
— | Object |
tag |
— | Component |
animation |
— | Component |
audio |
— | Component |
camera |
— | Component |
collider |
— | Component |
collider2D |
— | Component |
constantForce |
— | Component |
hingeJoint |
— | Component |
light |
— | Component |
networkView |
— | Component |
particleSystem |
— | Component |
renderer |
— | Component |
rigidbody |
— | Component |
rigidbody2D |
— | Component |
Layer¶
面板所在的 UI 层级。
DestroyOnHide¶
隐藏时是否销毁并回收实例。
IsOpen¶
当前是否处于显示状态。由 UIModule 驱动。
方法¶
声明的方法
| 名称 | 描述 |
|---|---|
OnClose() |
面板经 HidePanel 受控销毁前调用(DestroyOnHide 为 true 的关闭路径)。 子类可覆写释放资源、解绑事件等。 |
OnDestroy() |
实例被销毁时的反清理回调(向 UIModule 注销注册表条目)。 |
OnHide() |
面板被隐藏时调用(默认不销毁实例)。子类可覆写清理显示状态。 |
OnInit() |
面板首次实例化后调用一次。子类可覆写进行一次性初始化。 |
OnShow(object) |
每次显示时调用(含首次)。默认实现为 gameObject.SetActive(true)。 |
HideSelf() |
便捷关闭自身,等价于 UIModule.Instance.HidePanel(GetType())。 走非创建式获取:面板销毁/场景卸载阶段 UIModule 可能已随之消失,此时"关闭自己"无对象可关, 静默返回即可——若走 Instance 会重建 DDOL 宿主(详见 TryGetExisting 的说明)。 |
继承的方法
| 名称 | 描述 | 声明类型 |
|---|---|---|
GetComponent(Type) |
— | Component |
GetComponent(string) |
— | Component |
GetComponentInChildren(Type) |
— | Component |
GetComponentInChildren(Type, bool) |
— | Component |
GetComponentInParent(Type) |
— | Component |
GetComponentInParent(Type, bool) |
— | Component |
GetComponents(Type) |
— | Component |
GetComponentsInChildren(Type) |
— | Component |
GetComponentsInChildren(Type, bool) |
— | Component |
GetComponentsInParent(Type) |
— | Component |
GetComponentsInParent(Type, bool) |
— | Component |
StartCoroutine(IEnumerator) |
— | MonoBehaviour |
StartCoroutine(string) |
— | MonoBehaviour |
StartCoroutine(string, object) |
— | MonoBehaviour |
GetComponent() |
— | Component |
GetComponentInChildren() |
— | Component |
GetComponentInChildren(bool) |
— | Component |
GetComponentInParent() |
— | Component |
GetComponentInParent(bool) |
— | Component |
GetComponents() |
— | Component |
GetComponentsInChildren() |
— | Component |
GetComponentsInChildren(bool) |
— | Component |
GetComponentsInParent() |
— | Component |
GetComponentsInParent(bool) |
— | Component |
GetType() |
— | object |
CompareTag(string) |
— | Component |
IsInvoking() |
— | MonoBehaviour |
IsInvoking(string) |
— | MonoBehaviour |
TryGetComponent(Type, ref Component) |
— | Component |
TryGetComponent(ref T) |
— | Component |
GetComponentIndex() |
— | Component |
GetInstanceID() |
— | Object |
Equals(object) |
— | Object |
GetHashCode() |
— | Object |
ToString() |
— | Object |
BroadcastMessage(string) |
— | Component |
BroadcastMessage(string, SendMessageOptions) |
— | Component |
BroadcastMessage(string, object) |
— | Component |
BroadcastMessage(string, object, SendMessageOptions) |
— | Component |
CancelInvoke() |
— | MonoBehaviour |
CancelInvoke(string) |
— | MonoBehaviour |
GetComponents(Type, List<Component>) |
— | Component |
GetComponents(List<T>) |
— | Component |
GetComponentsInChildren(List<T>) |
— | Component |
GetComponentsInChildren(bool, List<T>) |
— | Component |
GetComponentsInParent(bool, List<T>) |
— | Component |
Invoke(string, float) |
— | MonoBehaviour |
InvokeRepeating(string, float, float) |
— | MonoBehaviour |
SendMessage(string) |
— | Component |
SendMessage(string, SendMessageOptions) |
— | Component |
SendMessage(string, object) |
— | Component |
SendMessage(string, object, SendMessageOptions) |
— | Component |
SendMessageUpwards(string) |
— | Component |
SendMessageUpwards(string, SendMessageOptions) |
— | Component |
SendMessageUpwards(string, object) |
— | Component |
SendMessageUpwards(string, object, SendMessageOptions) |
— | Component |
StopAllCoroutines() |
— | MonoBehaviour |
StopCoroutine(Coroutine) |
— | MonoBehaviour |
StopCoroutine(IEnumerator) |
— | MonoBehaviour |
StopCoroutine(string) |
— | MonoBehaviour |
MemberwiseClone() |
— | object |
Finalize() |
— | object |
OnAfterDeserialize() |
— | SerializedMonoBehaviour |
OnBeforeSerialize() |
— | SerializedMonoBehaviour |
StartCoroutine_Auto(IEnumerator) |
— | MonoBehaviour |
OnClose()¶
面板经 HidePanel 受控销毁前调用(DestroyOnHide 为 true 的关闭路径)。 子类可覆写释放资源、解绑事件等。
备注
仅受控销毁路径调用本方法;场景卸载、外部 Destroy 等非受控销毁只触发 OnDestroy。 因此事件解绑、订阅释放等必须放在 OnDestroy 中(或两处都写), 仅写在本方法会在场景卸载时泄漏。
OnDestroy()¶
实例被销毁时的反清理回调(向 UIModule 注销注册表条目)。
备注
子类覆写本方法时必须调用 base.OnDestroy():Unity 的消息派发只调用最派生类型的声明, 不调用 base 会使注册表残留已销毁实例。注册表另有自愈兜底 (命中已销毁条目时按未注册处理并重建),但仍应保留 base 调用以维持时序与开销。
OnHide()¶
面板被隐藏时调用(默认不销毁实例)。子类可覆写清理显示状态。
OnInit()¶
面板首次实例化后调用一次。子类可覆写进行一次性初始化。
OnShow(object)¶
每次显示时调用(含首次)。默认实现为 gameObject.SetActive(true)。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
payload |
object |
外部传入的数据。 |
HideSelf()¶
便捷关闭自身,等价于 UIModule.Instance.HidePanel(GetType())。 走非创建式获取:面板销毁/场景卸载阶段 UIModule 可能已随之消失,此时"关闭自己"无对象可关, 静默返回即可——若走 Instance 会重建 DDOL 宿主(详见 TryGetExisting 的说明)。
Additional Notes¶
首个
## Additional Notes是增量生成文档标识符,请勿修改标题级别和内容!本文档由Script Doc Generator辅助生成。