NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Framework/UI/UIEventBridge.cs

66 lines
2.0 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using PhxhSDK;
namespace Framework
{
/// <summary>
/// 项目特定的 UI 事件桥接实现
/// 将 UI 系统的事件桥接到项目的 EventManager
///
/// 设计说明:
/// - 实现 IUIEventBridge 接口
/// - 将通用的 UI 事件转换为项目特定的 EventManager 事件
/// - 使得 UIManagerBase 可以跨项目复用,不依赖具体的事件系统
/// </summary>
public class UIEventBridge : IUIEventBridge
{
/// <summary>
/// 当 UI 窗口打开时触发
/// </summary>
public void OnUIOpen(string windowName)
{
EventManager.Instance.Send(EventManager.EventName.UIOpen, windowName);
}
/// <summary>
/// 当 UI 窗口隐藏时触发
/// </summary>
public void OnUIHide(string windowName)
{
EventManager.Instance.Send(EventManager.EventName.UIHide, windowName);
}
/// <summary>
/// 当 UI 窗口销毁时触发
/// </summary>
public void OnUIDestroy(string windowName)
{
EventManager.Instance.Send(EventManager.EventName.UIDestroy, windowName);
}
/// <summary>
/// 当 UI 打开动画完成时触发
/// </summary>
public void OnUIOpenAnimComplete(string windowName)
{
EventManager.Instance.Send(EventManager.EventName.UIOpenByAnimComplete, windowName);
}
/// <summary>
/// 注册返回键Android Back监听器
/// </summary>
public void RegisterBackKey(Action handler)
{
EventManager.Instance.Register(EventManager.EventName.Android_Click_Back, handler);
}
/// <summary>
/// 注销返回键监听器
/// </summary>
public void UnregisterBackKey(Action handler)
{
EventManager.Instance.Unregister(EventManager.EventName.Android_Click_Back, handler);
}
}
}