using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
namespace Snxxz.UI
|
{
|
|
//仙盟系统面板控制器
|
public class UnionPanel : Window
|
{
|
#region 界面
|
[SerializeField] GameObject funcPanel;
|
#endregion
|
|
[SerializeField] Button _CloseBtn;//关闭按钮
|
[SerializeField] Button _LeftBtn;//向左按钮
|
[SerializeField] Button _RightBtn;//向右按钮
|
|
|
[SerializeField] FunctionButton _FunctionsBtn;//基本功能
|
[SerializeField] FunctionButton _MemberListBtn;//成员列表
|
[SerializeField] FunctionButton _UnionLisBtn;//仙盟列表
|
[SerializeField] FunctionButton _UnionLeagueBtn;//仙盟联赛
|
[SerializeField] FunctionButton _KingTemperBtn;//王者圣殿
|
[SerializeField] FunctionButtonGroup buttonGroup;
|
|
private void OnRefreshFairyMine()
|
{
|
if (!PlayerDatas.Instance.fairyData.HasFairy)
|
{
|
InitFairyFunc();
|
buttonGroup.TriggerByOrder(3);
|
}
|
}
|
|
private void OnRefreshFariyInfo()
|
{
|
if (!_MemberListBtn.gameObject.activeInHierarchy)
|
{
|
InitFairyFunc();
|
buttonGroup.TriggerByOrder(2);
|
}
|
}
|
|
protected override void BindController()
|
{
|
|
}
|
|
protected override void AddListeners()
|
{
|
_FunctionsBtn.AddListener(OnBaseFunc);
|
_MemberListBtn.AddListener(OnMemberList);
|
_UnionLisBtn.AddListener(OnUnionList);
|
_UnionLeagueBtn.AddListener(OnUnionLeague);
|
_KingTemperBtn.AddListener(OnKingTemper);
|
_CloseBtn.onClick.AddListener(CloseClick);
|
_RightBtn.onClick.AddListener(buttonGroup.TriggerNext);
|
_LeftBtn.onClick.AddListener(buttonGroup.TriggerLast);
|
|
}
|
|
private void OnKingTemper()
|
{
|
CloseChildWin();
|
WindowCenter.Instance.Open<KingTempleWin>();
|
functionOrder = 5;
|
}
|
|
private void OnUnionLeague()
|
{
|
CloseChildWin();
|
WindowCenter.Instance.Open<FairyLeagueWin>();
|
functionOrder = 4;
|
}
|
|
private void OnUnionList()
|
{
|
CloseChildWin();
|
WindowCenter.Instance.Open<FairyApplyWin>();
|
functionOrder = 3;
|
}
|
|
private void OnMemberList()
|
{
|
CloseChildWin();
|
WindowCenter.Instance.Open<FairyMemberWin>();
|
functionOrder = 2;
|
}
|
|
private void OnBaseFunc()
|
{
|
CloseChildWin();
|
funcPanel.SetActive(true);
|
functionOrder = 1;
|
}
|
|
protected override void OnPreOpen()
|
{
|
PlayerDatas.Instance.fairyData.OnRefreshFairyInfo += OnRefreshFariyInfo;
|
PlayerDatas.Instance.fairyData.OnRefreshFairyMine += OnRefreshFairyMine;
|
|
InitFairyFunc();
|
}
|
|
protected override void OnActived()
|
{
|
base.OnActived();
|
buttonGroup.TriggerByOrder(functionOrder);
|
}
|
|
protected override void OnAfterOpen()
|
{
|
|
}
|
|
protected override void OnPreClose()
|
{
|
CloseChildWin();
|
}
|
|
protected override void OnAfterClose()
|
{
|
PlayerDatas.Instance.fairyData.OnRefreshFairyInfo -= OnRefreshFariyInfo;
|
PlayerDatas.Instance.fairyData.OnRefreshFairyMine -= OnRefreshFairyMine;
|
if (!WindowJumpMgr.Instance.IsJumpState)
|
{
|
WindowCenter.Instance.Open<MainInterfaceWin>();
|
}
|
}
|
|
|
void CloseChildWin()
|
{
|
funcPanel.SetActive(false);
|
var children = WindowConfig.Get().FindChildWindows("UnionPanel");
|
foreach (var window in children)
|
{
|
WindowCenter.Instance.Close(window);
|
}
|
}
|
|
void InitFairyFunc()
|
{
|
if (!PlayerDatas.Instance.fairyData.HasFairy)
|
{
|
_FunctionsBtn.gameObject.SetActive(false);
|
_MemberListBtn.gameObject.SetActive(false);
|
}
|
else
|
{
|
_FunctionsBtn.gameObject.SetActive(true);
|
_MemberListBtn.gameObject.SetActive(true);
|
}
|
}
|
}
|
}
|
|