TH1/Unity/Assets/Scripts/TH1_UI/Controller/Outside/UIOutsideQuestionnaireController.cs

56 lines
1.5 KiB
C#

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
{
public class UIOutsideQuestionnaireController : ViewController<UIOutsideQuestionnaireView>
{
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 ShowUIOutsideQuestionnaire evt)
{
WindowScript?.SetContent(evt);
}
else
{
Debug.LogWarning("[UIOutsideQuestionnaireController] Opened without valid parameters.");
WindowScript?.SetContent(new ShowUIOutsideQuestionnaire());
}
}
private void OnBtnCloseClick()
{
EventManager.Publish(new ShowUIOutsideMenu());
Close();
}
public override bool Close()
{
WindowScript?.OnCloseView();
return base.Close();
}
}
}