//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Tuesday, October 17, 2017
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
|
public class TeamFrameWin : Window
|
{
|
[SerializeField] FunctionButtonGroup m_FunctionGroup;
|
[SerializeField] FunctionButton m_TeamList;
|
[SerializeField] FunctionButton m_MyTeam;
|
|
TeamModel model { get { return ModelCenter.Instance.GetModel<TeamModel>(); } }
|
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
m_TeamList.AddListener(ShowTeamList);
|
m_MyTeam.AddListener(ShowMyTeam);
|
}
|
|
protected override void OnPreOpen()
|
{
|
model.createTeamEvent += OnCreateTeam;
|
model.matchingStateChangeEvent += OnMatchStateChange;
|
}
|
|
protected override void OnAfterOpen()
|
{
|
|
}
|
|
protected override void OnPreClose()
|
{
|
model.createTeamEvent -= OnCreateTeam;
|
model.matchingStateChangeEvent -= OnMatchStateChange;
|
|
if (WindowCenter.Instance.IsOpen<MyTeamWin>())
|
{
|
WindowCenter.Instance.Close<MyTeamWin>();
|
}
|
|
if (WindowCenter.Instance.IsOpen<TeamListWin>())
|
{
|
WindowCenter.Instance.Close<TeamListWin>();
|
}
|
}
|
|
protected override void OnAfterClose()
|
{
|
if (!WindowJumpMgr.Instance.IsJumpState)
|
{
|
WindowCenter.Instance.Open<MainInterfaceWin>();
|
}
|
}
|
|
protected override void OnActived()
|
{
|
base.OnActived();
|
|
if (functionOrder == 0)
|
{
|
if (model.myTeam.inTeam)
|
{
|
m_FunctionGroup.TriggerByOrder(m_MyTeam.order);
|
}
|
else
|
{
|
m_FunctionGroup.TriggerByOrder(m_TeamList.order);
|
}
|
}
|
else
|
{
|
m_FunctionGroup.TriggerByOrder(functionOrder);
|
}
|
|
}
|
|
#endregion
|
|
private void ShowTeamList()
|
{
|
if (WindowCenter.Instance.IsOpen<MyTeamWin>())
|
{
|
WindowCenter.Instance.Close<MyTeamWin>();
|
}
|
|
WindowCenter.Instance.Open<TeamListWin>(true);
|
functionOrder = m_TeamList.order;
|
}
|
|
private void ShowMyTeam()
|
{
|
if (WindowCenter.Instance.IsOpen<TeamListWin>())
|
{
|
WindowCenter.Instance.Close<TeamListWin>();
|
}
|
|
WindowCenter.Instance.Open<MyTeamWin>(true);
|
functionOrder = m_MyTeam.order;
|
}
|
|
private void OnCreateTeam()
|
{
|
m_FunctionGroup.TriggerByOrder(m_MyTeam.order);
|
}
|
|
private void OnMatchStateChange()
|
{
|
if (model.isMatching)
|
{
|
m_FunctionGroup.TriggerByOrder(m_MyTeam.order);
|
}
|
}
|
|
}
|
|
}
|