using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Events;

namespace Stary.Evo
{
    /// <summary>
    /// 热更基类,应该继承的基类
    /// </summary>
    public class DomainBase : MonoBehaviour
    {
        /// <summary>
        /// 触发Domain时，调用该方法
        /// </summary>
        /// <param name="param"></param>
        public virtual void OnEnter(string param)
        {
        }

        /// <summary>
        /// Domain被关闭时，会调该方法
        /// </summary>
        /// <param name="param"></param>
        public virtual void OnExit()
        {
        }

        /// <summary>
        /// 如果Domain主动退出，请触发此Action
        /// </summary>
        public UnityAction RequestExit;

        public virtual async Task OnEnterAsync(string param)
        {
            await Task.Delay(1);
        }

        public virtual async Task OnExitAsync()
        {
            await Task.Delay(1);
        }
    }
}

