//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, January 28, 2019
|
//--------------------------------------------------------
|
|
using System;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using vnxbqy.UI;
|
using System.Collections.Generic;
|
|
public class CrossServerQualifyingWin : ILWindow
|
{
|
Button close;
|
Button war64Button;
|
Button war8Button;
|
Button hallOfFame;
|
Button officialPosition;
|
Button storeBtn;
|
List<Image> selectImgs = new List<Image>();
|
TextEx timeInfo;
|
|
List<string> windowNames = new List<string>() { "CrossServerQualifying64Win", "CrossServerQualifying8Win",
|
"CrossServerQualifyingHallOfFameWin", "CrossServerQualifyingOfficialWin"};
|
#region Built-in
|
protected override void BindController()
|
{
|
close = proxy.GetWidgtEx<Button>("Button_Close");
|
war64Button = proxy.GetWidgtEx<Button>("war64Button");
|
war8Button = proxy.GetWidgtEx<Button>("war8Button");
|
hallOfFame = proxy.GetWidgtEx<Button>("hallOfFame");
|
officialPosition = proxy.GetWidgtEx<Button>("officialPosition");
|
|
for (int i = 0; i < 4; i++)
|
{
|
selectImgs.Add(proxy.GetWidgtEx<Image>("select" + i));
|
}
|
storeBtn = proxy.GetWidgtEx<Button>("ShoppingBtn");
|
timeInfo = proxy.GetWidgtEx<TextEx>("timeinfo");
|
}
|
|
protected override void AddListeners()
|
{
|
close.SetListener(()=> {
|
WindowCenter.Instance.CloseIL<CrossServerQualifyingWin>();
|
});
|
|
war64Button.SetListener(OpenWar64);
|
war8Button.SetListener(OpenWar8);
|
officialPosition.SetListener(OpenOfficial);
|
hallOfFame.SetListener(OpenHallOfFame);
|
storeBtn.SetListener(()=> {
|
ModelCenter.Instance.GetModel<StoreModel>().OpenStoreWin(false, 5);
|
});
|
}
|
|
protected override void OnPreOpen()
|
{
|
GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
|
//根据赛程显示,红点不影响
|
var groupMark = CrossServerQualifyingModel.Instance.nowGroupMark;
|
if (groupMark == 0)
|
{
|
//膜拜
|
CrossServerQualifyingModel.Instance.selectIndex = 1;
|
}
|
else if (groupMark <= 64 && groupMark >= 16)
|
{
|
//64强,需引导投注
|
CrossServerQualifyingModel.Instance.selectIndex = 0;
|
}
|
else if (groupMark <= 8)
|
{
|
CrossServerQualifyingModel.Instance.selectIndex = 1;
|
}
|
OnSelectEvent();
|
CrossServerQualifyingModel.Instance.QueryAllKaiKingInfo();
|
CrossServerQualifyingModel.Instance.loginRedpoint.state = RedPointState.None;
|
}
|
|
protected override void OnPreClose()
|
{
|
GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
|
for (int i = 0; i < windowNames.Count; i++)
|
{
|
WindowCenter.Instance.Close(windowNames[i]);
|
}
|
}
|
|
#endregion
|
|
|
void OpenWar64()
|
{
|
CrossServerQualifyingModel.Instance.selectIndex = 0;
|
OnSelectEvent();
|
}
|
|
void OpenWar8()
|
{
|
CrossServerQualifyingModel.Instance.selectIndex = 1;
|
OnSelectEvent();
|
}
|
void OpenHallOfFame()
|
{
|
CrossServerQualifyingModel.Instance.selectIndex = 2;
|
OnSelectEvent();
|
}
|
|
void OpenOfficial()
|
{
|
CrossServerQualifyingModel.Instance.selectIndex = 3;
|
OnSelectEvent();
|
}
|
|
|
void OnSelectEvent()
|
{
|
|
for (int i = 0; i < selectImgs.Count; i++)
|
{
|
if (i == CrossServerQualifyingModel.Instance.selectIndex)
|
{
|
selectImgs[i].SetActiveIL(true);
|
WindowCenter.Instance.Open(windowNames[i]);
|
}
|
else
|
{
|
selectImgs[i].SetActiveIL(false);
|
WindowCenter.Instance.Close(windowNames[i]);
|
}
|
|
}
|
}
|
|
void OnSecondEvent()
|
{
|
timeInfo.text = StringUtility.Contact(ILTimeUtility.ServerCrossNow.ToString("yyyy-MM-dd HH:mm:ss"), " ", CrossServerQualifyingModel.Instance.GetBattleID());
|
}
|
|
}
|