TH1/Unity/Assets/Scripts/TH1_UI/Controller/Outside/UIOutsideModController.cs
2026-05-10 11:52:37 +08:00

68 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using TH1_Core.Events;
using TH1_Core.Managers;
using TH1_UI.Controller.Base;
using TH1_UI.View.Outside;
using UnityEngine;
namespace TH1_UI.Controller.Outside
{
/// <summary>
/// Mod 管理界面 - Controller 层空架子
/// 由 ShowUIOutsideMod 事件触发打开典型来源UIOutsideMenuSettingPanel 的 ManageButton
/// </summary>
public class UIOutsideModController : ViewController<UIOutsideModView>
{
public UIOutsideModController() { }
private ShowUIOutsideMod _evt;
protected override void RegisterEventCallback()
{
base.RegisterEventCallback();
if (WindowScript != null)
{
WindowScript.OnBtnCloseClick += _OnBtnCloseClick;
}
}
protected override void UnregisterEventCallback()
{
if (WindowScript != null)
{
WindowScript.OnBtnCloseClick -= _OnBtnCloseClick;
}
base.UnregisterEventCallback();
}
protected override void OnOpen()
{
base.OnOpen();
if (_openParameter is ShowUIOutsideMod evt)
{
_evt = evt;
if (WindowScript != null)
{
WindowScript.SetContent(evt);
}
}
else
{
Debug.LogWarning("[UIOutsideModController] Opened without valid parameters.");
}
}
void _OnBtnCloseClick()
{
// 关闭 Mod 面板后回到主菜单
EventManager.Publish(new ShowUIOutsideMenu());
Close();
}
public override bool Close()
{
WindowScript?.OnCloseView();
return base.Close();
}
}
}