using UnityEngine;
|
|
namespace vnxbqy.UI
|
{
|
public class FairySiegeScheduleWin : Window
|
{
|
[SerializeField] ButtonEx btnClose;
|
[SerializeField] FunctionButton btnGroup;
|
[SerializeField] FunctionButton btnRank;
|
[SerializeField] FunctionButtonGroup buttonGroup;
|
FairySiegeActModel model { get { return ModelCenter.Instance.GetModel<FairySiegeActModel>(); } }
|
|
#region Build-in
|
|
protected override void AddListeners()
|
{
|
btnRank.SetListener(OnRank);
|
btnGroup.SetListener(OnGroup);
|
btnClose.SetListener(() =>
|
{
|
CloseChildWin();
|
CloseClick();
|
});
|
}
|
|
protected override void BindController()
|
{
|
}
|
|
protected override void OnPreOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
CloseChildWin();
|
}
|
|
private void OnPointClickLockFunc(string obj)
|
{
|
// 玩家所在仙盟没有参赛资格
|
if (!model.hasQualification())
|
{
|
SysNotifyMgr.Instance.ShowTip("FairySiege04");
|
}
|
}
|
|
protected override void OnAfterOpen()
|
{
|
btnGroup.OnPointClickLockFunc += OnPointClickLockFunc;
|
}
|
|
protected override void OnAfterClose()
|
{
|
btnGroup.OnPointClickLockFunc -= OnPointClickLockFunc;
|
}
|
|
protected override void OnActived()
|
{
|
base.OnActived();
|
buttonGroup.TriggerByOrder(functionOrder);
|
}
|
|
#endregion
|
|
private void UpdateButtonStates()
|
{
|
var isGroupButtonUnlocked = model.hasQualification();
|
btnGroup.state = isGroupButtonUnlocked ? TitleBtnState.Normal : TitleBtnState.Locked;
|
}
|
|
public void OnRank()
|
{
|
CloseChildWin();
|
WindowCenter.Instance.Open<FairySiegeScheduleRankWin>();
|
functionOrder = 0;
|
UpdateButtonStates();
|
}
|
|
public void OnGroup()
|
{
|
// 玩家所在仙盟没有参赛资格
|
if (!model.hasQualification())
|
{
|
SysNotifyMgr.Instance.ShowTip("FairySiege04");
|
return;
|
}
|
|
CloseChildWin();
|
WindowCenter.Instance.Open<FairySiegeScheduleGroupWin>();
|
functionOrder = 1;
|
UpdateButtonStates();
|
}
|
|
private void CloseChildWin()
|
{
|
var children = WindowConfig.GetChildWindows("FairySiegeScheduleWin");
|
foreach (var window in children)
|
{
|
WindowCenter.Instance.Close(window);
|
}
|
}
|
}
|
}
|