2025-03-04 18:40:14 +08:00
|
|
|
|
#if ODIN_INSPECTOR && UNITY_EDITOR
|
|
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
2025-01-24 16:21:00 +08:00
|
|
|
|
|
2025-03-04 18:40:14 +08:00
|
|
|
|
namespace AlicizaX.UI.Runtime
|
2025-01-24 16:21:00 +08:00
|
|
|
|
{
|
2025-03-04 18:40:14 +08:00
|
|
|
|
[DisallowMultipleComponent]
|
|
|
|
|
|
#if ODIN_INSPECTOR && UNITY_EDITOR
|
|
|
|
|
|
[HideMonoScript]
|
|
|
|
|
|
#endif
|
|
|
|
|
|
public abstract class UIHolderObjectBase : UnityEngine.MonoBehaviour
|
2025-01-24 16:21:00 +08:00
|
|
|
|
{
|
2025-03-04 18:40:14 +08:00
|
|
|
|
[SerializeField] [HideInInspector] private string Location = string.Empty;
|
2025-01-24 16:21:00 +08:00
|
|
|
|
|
2025-03-04 18:40:14 +08:00
|
|
|
|
private GameObject _target;
|
2025-01-24 16:21:00 +08:00
|
|
|
|
|
2025-03-04 18:40:14 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// UI实例资源对象。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public GameObject Target => _target ??= gameObject;
|
2025-01-24 16:21:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-03-04 18:40:14 +08:00
|
|
|
|
private RectTransform _rectTransform;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 窗口矩阵位置组件。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public RectTransform RectTransform => _rectTransform ??= _target.transform as RectTransform;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 可见性
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool Visible => Target.activeSelf;
|
|
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
_target = gameObject;
|
|
|
|
|
|
}
|
2025-01-24 16:21:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|