2025-10-14 12:39:53 +08:00
|
|
|
using System;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Core
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Base class for all UI components.
|
|
|
|
/// </summary>
|
|
|
|
public abstract class UIBase : MonoBehaviour
|
|
|
|
{
|
|
|
|
public bool IsOpenOnFirstLoad;
|
2025-10-19 19:42:55 +08:00
|
|
|
|
|
|
|
protected virtual void Awake()
|
|
|
|
{
|
|
|
|
if (!IsOpenOnFirstLoad) Hide();
|
|
|
|
}
|
|
|
|
|
2025-10-14 12:39:53 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Called when the UI is shown.
|
|
|
|
/// </summary>
|
|
|
|
public virtual void Show()
|
|
|
|
{
|
|
|
|
gameObject.SetActive(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Called when the UI is hidden.
|
|
|
|
/// </summary>
|
|
|
|
public virtual void Hide()
|
|
|
|
{
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Called when the UI is initialized.
|
|
|
|
/// </summary>
|
|
|
|
public virtual void Initialize()
|
|
|
|
{
|
|
|
|
// Override in derived classes for initialization logic.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|