using TH1_Core.Events;
using TH1_UI.Controller.Base;
using TH1_UI.View.Outside;
using UnityEngine;
namespace TH1_UI.Controller.Outside
{
///
/// 剧情选择界面的控制器
///
public class UIOutsideStoryController : ViewController
{
public UIOutsideStoryController() { }
private ShowUIOutsideStory _evt;
protected override void RegisterEventCallback()
{
base.RegisterEventCallback();
if (WindowScript != null)
{
WindowScript.OnBtnCloseClick += _OnBtnCloseClick;
}
}
protected override void UnregisterEventCallback()
{
if (WindowScript != null)
{
WindowScript.OnBtnCloseClick = null;
}
base.UnregisterEventCallback();
}
protected override void OnOpen()
{
base.OnOpen();
if (_openParameter is ShowUIOutsideStory evt)
{
_evt = evt;
if (WindowScript != null)
{
WindowScript.SetContent(evt);
}
}
else
{
Debug.LogWarning("[UIOutsideStoryController] Opened without valid parameters.");
}
}
public override bool Close()
{
WindowScript?.CloseView();
return base.Close();
}
void _OnBtnCloseClick()
{
Close();
}
}
}