//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, January 28, 2019
|
//--------------------------------------------------------
|
|
using System;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using vnxbqy.UI;
|
using System.Collections.Generic;
|
|
public class CrossServerQualifyingSettlementWin : ILWindow
|
{
|
Button outBtn;
|
Text outTimeText;
|
Transform backFail;
|
Transform backWin;
|
Text resultScore;
|
Transform caidaiEffect;
|
|
float timer = 0f;
|
int outTime = 5;
|
#region Built-in
|
|
DungeonModel model { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
|
protected override void BindController()
|
{
|
outBtn = proxy.GetWidgtEx<Button>("DropOutBtn");
|
outTimeText = proxy.GetWidgtEx<Text>("DropOutBtn_text");
|
backFail = proxy.GetWidgtEx<Transform>("Back_Failure");
|
backWin = proxy.GetWidgtEx<Transform>("Back_Win");
|
caidaiEffect = proxy.GetWidgtEx<Transform>("CaidaiEffect");
|
resultScore = proxy.GetWidgtEx<Text>("Text_2");
|
}
|
|
protected override void AddListeners()
|
{
|
outBtn.SetListener(ExitDungeon);
|
|
}
|
|
protected override void OnPreOpen()
|
{
|
timer = Time.time;
|
GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
|
var playerID = PlayerDatas.Instance.baseData.PlayerID;
|
if (playerID == CrossServerQualifyingModel.Instance.WinnerID)
|
{
|
backFail.SetActiveIL(false);
|
backWin.SetActiveIL(true);
|
caidaiEffect.SetActiveIL(true);
|
}
|
else
|
{
|
backFail.SetActiveIL(true);
|
backWin.SetActiveIL(false);
|
caidaiEffect.SetActiveIL(false);
|
}
|
resultScore.text = Language.Get("XMZZ106", CrossServerQualifyingModel.Instance.score);
|
}
|
|
|
protected override void OnPreClose()
|
{
|
GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
|
PopupWindowsProcessor.Instance.Add("CrossServerQualifyingWin");
|
}
|
#endregion
|
|
void OnSecondEvent()
|
{
|
if ((Time.time - timer) < outTime)
|
{
|
var seconds = Mathf.RoundToInt(outTime - (Time.time - timer));
|
outTimeText.text = Language.Get("DungeonVictoryWin_Btn_Exit_1", seconds);
|
}
|
else
|
{
|
GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
|
ExitDungeon();
|
}
|
}
|
|
|
private void ExitDungeon()
|
{
|
WindowCenter.Instance.CloseIL<CrossServerQualifyingSettlementWin>();
|
model.ExitCurrentDungeon();
|
}
|
|
}
|