//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, January 28, 2019
|
//--------------------------------------------------------
|
|
using System;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using vnxbqy.UI;
|
using System.Collections.Generic;
|
|
public class CrossServerBattleFieldBuyWin : ILWindow
|
{
|
Button close;
|
Button cancle;
|
Button okBtn;
|
List<ItemCell> itemsCell = new List<ItemCell>();
|
Text title;
|
|
public static int hour;
|
public static int minute;
|
|
PackModel packModel = ModelCenter.Instance.GetModelEx<PackModel>();
|
#region Built-in
|
protected override void BindController()
|
{
|
close = proxy.GetWidgtEx<Button>("CloseBtn");
|
cancle = proxy.GetWidgtEx<Button>("cancel");
|
okBtn = proxy.GetWidgtEx<Button>("ok");
|
for (int i = 0; i < 4; i++)
|
{
|
itemsCell.Add(proxy.GetWidgtEx<ItemCell>("itemcell" + i));
|
}
|
title = proxy.GetWidgtEx<Text>("title");
|
}
|
|
protected override void AddListeners()
|
{
|
close.SetListener(()=> {
|
WindowCenter.Instance.CloseIL<CrossServerBattleFieldBuyWin>();
|
});
|
|
cancle.SetListener(() => {
|
WindowCenter.Instance.CloseIL<CrossServerBattleFieldBuyWin>();
|
});
|
|
okBtn.SetListener(() => {
|
int count = packModel.GetItemCountByID(PackType.Item, ILCrossServerModel.Instance.callItemID);
|
if (count == 0)
|
{
|
SysNotifyMgr.Instance.ShowTip("RealmLevelUpError_3");
|
return;
|
}
|
|
int index = ILCrossServerModel.Instance.GetCurBattleFieldIndex();
|
var int3Config = ILCrossServerModel.Instance.crossBattleFieldOpenTimes[index];
|
var state = ILCrossServerModel.Instance.GetActionState(index);
|
if (state != 1)
|
{
|
SysNotifyMgr.Instance.ShowTip("CrossBattlefieldBuyLimit");
|
return;
|
}
|
|
var pack = new IL_CC109_tagCMCrossBattlefieldBuyOpen();
|
pack.Hour = (byte)hour;
|
pack.Minute = (byte)minute;
|
GameNetSystem.Instance.SendInfo(pack);
|
|
WindowCenter.Instance.CloseIL<CrossServerBattleFieldBuyWin>();
|
});
|
|
}
|
|
protected override void OnPreOpen()
|
{
|
for (int i = 0; i < itemsCell.Count; i++)
|
{
|
if (i < ILCrossServerModel.Instance.callAward.Length)
|
{
|
itemsCell[i].SetActiveIL(true);
|
|
var itemId = ILCrossServerModel.Instance.callAward[i][0];
|
var model = new ItemCellModel(itemId, false, (ulong)ILCrossServerModel.Instance.callAward[i][1]);
|
itemsCell[i].Init(model);
|
itemsCell[i].auctionIcon.SetActiveIL(ILCrossServerModel.Instance.callAward[i][2] != 0);
|
itemsCell[i].button.SetListener(() =>
|
{
|
ItemTipUtility.Show(itemId);
|
});
|
}
|
else
|
{
|
itemsCell[i].SetActiveIL(false);
|
}
|
}
|
title.text = Language.Get("CrossBattleField53");
|
}
|
|
#endregion
|
|
|
}
|