using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using System;
|
using vnxbqy.UI;
|
|
public class ILDayOnlineCell : ILBehaviour
|
{
|
Text m_TimeInfo;
|
List<ItemCell> m_Items = new List<ItemCell>();
|
Image m_StateImg;
|
ButtonEx m_GetBtn;
|
UIEffect m_GetEffect;
|
|
ILDayOnlineModel model = ILDayOnlineModel.Instance;
|
|
protected override void Awake()
|
{
|
m_TimeInfo = proxy.GetWidgtEx<Text>("time");
|
m_StateImg = proxy.GetWidgtEx<Image>("Img_State");
|
m_GetBtn = proxy.GetWidgtEx<ButtonEx>("Btn_Get");
|
m_GetEffect = proxy.GetWidgtEx<UIEffect>("Effect_Get");
|
m_Items.Add(proxy.GetWidgtEx<ItemCell>("0"));
|
m_Items.Add(proxy.GetWidgtEx<ItemCell>("1"));
|
m_Items.Add(proxy.GetWidgtEx<ItemCell>("2"));
|
m_Items.Add(proxy.GetWidgtEx<ItemCell>("3"));
|
m_Items.Add(proxy.GetWidgtEx<ItemCell>("4"));
|
}
|
|
public void Display(int index)
|
{
|
//原索引对应的物品奖励;index是排序后的索引
|
int realIndex = Array.IndexOf(model.timeArr, model.indexSort[index]) + 1;
|
|
for (int i = 0; i < m_Items.Count; i++)
|
{
|
if (model.awards.ContainsKey(realIndex) && i < model.awards[realIndex].Count)
|
{
|
m_Items[i].SetActiveIL(true);
|
var itemID = model.awards[realIndex][i][0];
|
var itemCount = model.awards[realIndex][i][1];
|
|
var Item = ItemConfig.Get(itemID);
|
ItemCellModel cellModel = new ItemCellModel(itemID, true, (ulong)itemCount);
|
m_Items[i].Init(cellModel);
|
m_Items[i].button.SetListener(() =>
|
{
|
ItemTipUtility.Show(itemID);
|
});
|
|
}
|
else
|
{
|
m_Items[i].SetActiveIL(false);
|
}
|
}
|
|
m_TimeInfo.text = Language.Get("dayOnline_2", model.indexSort[index]);
|
m_GetEffect.SetActiveIL(false);
|
m_GetEffect.Stop();
|
var state = model.GetAwardState(realIndex - 1);
|
if (state == 2)
|
{
|
m_StateImg.SetActiveIL(true);
|
m_GetBtn.SetActiveIL(false);
|
}
|
else
|
{
|
m_StateImg.SetActiveIL(false);
|
m_GetBtn.SetActiveIL(true);
|
if (state == 0)
|
{
|
m_GetEffect.SetActiveIL(true);
|
m_GetEffect.Play();
|
}
|
m_GetBtn.SetColorful(null, state == 0);
|
|
m_GetBtn.SetListener(() => {
|
CA506_tagCMGetOnlinePrize pack = new CA506_tagCMGetOnlinePrize();
|
pack.Index = (byte)realIndex;
|
pack.IsDaily = 1;
|
GameNetSystem.Instance.SendInfo(pack);
|
});
|
}
|
}
|
}
|