using UnityEngine;
|
|
namespace vnxbqy.UI
|
{
|
// ÏÉÔµ
|
public class FairyAffinityWin : Window
|
{
|
[SerializeField] FunctionButton btnZhanLing;
|
[SerializeField] FunctionButton btnFuLu;
|
[SerializeField] FunctionButton btnTask;
|
[SerializeField] FunctionButton btnGift;
|
[SerializeField] FunctionButtonGroup buttonGroup;
|
[SerializeField] ImageEx imgTitle;
|
[SerializeField] ImageEx imgInfo;
|
[SerializeField] ButtonEx btnClose;
|
[SerializeField] Transform tranBottomInfo;
|
[SerializeField] TextEx txtCheckInCnt;
|
[SerializeField] TextEx txtTaskResetTime1;
|
[SerializeField] TextEx txtTaskResetTime2;
|
FairyAffinityModel model { get { return ModelCenter.Instance.GetModel<FairyAffinityModel>(); } }
|
FairyAffinityLoginActModel fairyAffinityLoginActModel { get { return ModelCenter.Instance.GetModel<FairyAffinityLoginActModel>(); } }
|
|
#region Built-in
|
|
protected override void AddListeners()
|
{
|
btnZhanLing.SetListener(OnZhanLing);
|
btnFuLu.SetListener(OnFuLu);
|
btnTask.SetListener(OnTask);
|
btnGift.SetListener(OnGift);
|
btnClose.SetListener(CloseClick);
|
}
|
|
protected override void BindController()
|
{
|
}
|
|
protected override void OnPreOpen()
|
{
|
GlobalTimeEvent.Instance.secondEvent += secondEvent;
|
ChangeTabShow();
|
ChangeBottomInfo();
|
}
|
|
protected override void OnPreClose()
|
{
|
GlobalTimeEvent.Instance.secondEvent -= secondEvent;
|
}
|
|
private void secondEvent()
|
{
|
ChangeBottomInfo();
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
|
protected override void OnActived()
|
{
|
base.OnActived();
|
buttonGroup.TriggerByOrder(functionOrder);
|
}
|
|
#endregion
|
|
public void OnZhanLing()
|
{
|
CloseChildWin();
|
WindowCenter.Instance.Open<FairyAffinityZhanLingWin>();
|
functionOrder = 0;
|
ChangeTabShow();
|
ChangeBottomInfo();
|
}
|
|
public void OnFuLu()
|
{
|
CloseChildWin();
|
WindowCenter.Instance.Open<FairyAffinityLoginActWin>();
|
functionOrder = 1;
|
ChangeTabShow();
|
ChangeBottomInfo();
|
}
|
|
public void OnTask()
|
{
|
CloseChildWin();
|
WindowCenter.Instance.Open<FairyAffinityMissionActWin>();
|
functionOrder = 2;
|
ChangeTabShow();
|
ChangeBottomInfo();
|
}
|
|
public void OnGift()
|
{
|
CloseChildWin();
|
functionOrder = 3;
|
WindowCenter.Instance.Open<FairyAffinityRechargeGiftActWin>();
|
ChangeTabShow();
|
ChangeBottomInfo();
|
}
|
|
private void CloseChildWin()
|
{
|
var children = WindowConfig.GetChildWindows("FairyAffinityWin");
|
foreach (var window in children)
|
{
|
WindowCenter.Instance.Close(window);
|
}
|
}
|
|
private void ChangeTabShow()
|
{
|
ChangeTabChooseShow();
|
ChangeTitleShow();
|
}
|
|
private void ChangeTabChooseShow()
|
{
|
btnZhanLing.state = btnZhanLing.order == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal;
|
btnZhanLing.image.SetNativeSize();
|
btnZhanLing.title.resizeTextMaxSize = btnZhanLing.order == functionOrder ? 22 : 18;
|
|
btnFuLu.state = btnFuLu.order == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal;
|
btnFuLu.image.SetNativeSize();
|
btnFuLu.title.resizeTextMaxSize = btnFuLu.order == functionOrder ? 22 : 18;
|
|
btnTask.state = btnTask.order == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal;
|
btnTask.image.SetNativeSize();
|
btnTask.title.resizeTextMaxSize = btnTask.order == functionOrder ? 22 : 18;
|
|
btnGift.state = btnGift.order == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal;
|
btnGift.image.SetNativeSize();
|
btnGift.title.resizeTextMaxSize = btnGift.order == functionOrder ? 22 : 18;
|
}
|
|
private void ChangeTitleShow()
|
{
|
imgTitle.SetSprite(btnFuLu.order == functionOrder ? "FairyAffinityTitle_FuLu" : "FairyAffinityTitle_XianYuan");
|
imgTitle.SetNativeSize();
|
|
imgInfo.SetSprite(btnFuLu.order == functionOrder ? "FairyAffinityInfo_FuLu" : "FairyAffinityInfo_XianYuan");
|
imgInfo.SetNativeSize();
|
}
|
|
private void ChangeBottomInfo()
|
{
|
tranBottomInfo.SetActive(functionOrder == 0 || functionOrder == 1);
|
txtCheckInCnt.SetActive(functionOrder == 1);
|
txtTaskResetTime1.SetActive(functionOrder == 0);
|
txtTaskResetTime2.SetActive(functionOrder == 1);
|
|
OperationLoginAct holiday;
|
OperationTimeHepler.Instance.TryGetOperation(FairyAffinityLoginActModel.operaType, out holiday);
|
if (holiday == null)
|
return;
|
if (functionOrder == 0)
|
{
|
txtTaskResetTime1.text = Language.Get("FairyAffinity09", TimeUtility.SecondsToDHMSCHS(holiday.GetResetSurplusTime()));
|
}
|
else if (functionOrder == 1)
|
{
|
txtCheckInCnt.text = Language.Get("FairyAffinity15", fairyAffinityLoginActModel.GetHaveAwardDayCnt());
|
txtTaskResetTime2.text = Language.Get("FairyAffinity09", TimeUtility.SecondsToDHMSCHS(holiday.GetResetSurplusTime()));
|
}
|
}
|
}
|
}
|