34 lines
857 B
C#
34 lines
857 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using BITKit;
|
|
using UnityEngine.Events;
|
|
namespace BITKit.UX
|
|
{
|
|
/// <summary>
|
|
/// 基于<see cref="IUXPanel"/>的面板事件
|
|
/// </summary>
|
|
public class UXPanelEvent : MonoBehaviour
|
|
{
|
|
public UnityEvent<bool> onEntryOrExit = new();
|
|
public UnityEvent onEntry = new();
|
|
public UnityEvent onExit = new();
|
|
private void Awake()
|
|
{
|
|
var panel = GetComponent<IUXPanel>();
|
|
panel.OnEntry += OnEntry;
|
|
panel.OnExit += OnExit;
|
|
}
|
|
private void OnExit()
|
|
{
|
|
onEntryOrExit.Invoke(false);
|
|
onExit.Invoke();
|
|
}
|
|
private void OnEntry()
|
|
{
|
|
onEntryOrExit.Invoke(true);
|
|
onEntry.Invoke();
|
|
}
|
|
}
|
|
} |