using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
using vnxbqy.UI;
|
using System.Linq;
|
|
public class CSRechargeCell : ILBehaviour
|
{
|
Text m_RankTip;
|
List<RareItem> m_Items = new List<RareItem>();
|
Button m_BtnGet;
|
Image m_NoCompleteImg;
|
Image m_HasGetImg;
|
UIEffect m_GetEffect;
|
Image m_RankImg;
|
Text m_NameText;
|
Text m_RankIndexText;
|
Transform m_ObjTop3;
|
Transform m_RankIndexs;
|
Transform m_ObjTarget;
|
Button m_BtnBill;
|
|
protected override void Awake()
|
{
|
m_RankTip = proxy.GetWidgtEx<Text>("Txt_Tip");
|
m_Items.Clear();
|
m_Items.Add(proxy.GetWidgtEx<RareItem>("Item0"));
|
m_Items.Add(proxy.GetWidgtEx<RareItem>("Item1"));
|
m_Items.Add(proxy.GetWidgtEx<RareItem>("Item2"));
|
m_Items.Add(proxy.GetWidgtEx<RareItem>("Item3"));
|
m_Items.Add(proxy.GetWidgtEx<RareItem>("Item4"));
|
|
m_BtnGet = proxy.GetWidgtEx<Button>("Btn_Get");
|
m_NoCompleteImg = proxy.GetWidgtEx<Image>("Img_NoComplete");
|
m_HasGetImg = proxy.GetWidgtEx<Image>("Img_HasGet");
|
|
m_GetEffect = proxy.GetWidgtEx<UIEffect>("Effect_Get");
|
m_GetEffect.SetActiveIL(false);
|
m_RankImg = proxy.GetWidgtEx<Image>("Img_Rank");
|
m_NameText = proxy.GetWidgtEx<Text>("Txt_Name");
|
m_RankIndexText = proxy.GetWidgtEx<Text>("Txt_RankIndex");
|
|
m_ObjTop3 = proxy.GetWidgtEx<Transform>("Container_Top3");
|
m_RankIndexs = proxy.GetWidgtEx<Transform>("Container_RankIndex");
|
m_ObjTarget = proxy.GetWidgtEx<Transform>("Container_Target");
|
|
m_BtnBill = proxy.GetWidgtEx<Button>("Btn_Bill");
|
}
|
|
|
public void Display(int index)
|
{
|
OperationBase operationBase;
|
if (!OperationTimeHepler.Instance.TryGetOperationTime(CSRechargeModel.operationType, out operationBase))
|
{
|
return;
|
}
|
OperationCSRecharge operation = operationBase as OperationCSRecharge;
|
|
int BiliBoardCount = operation.orderList.Count;
|
|
m_RankIndexs.SetActiveIL(false);
|
m_ObjTop3.SetActiveIL(false);
|
m_ObjTarget.SetActiveIL(false);
|
if (index < BiliBoardCount)
|
{
|
int tmp = index;
|
var data = operation.orderList[index];
|
int order = operation.orderList[index].OrderA - 1;
|
m_ObjTop3.SetActiveIL(order < 3);
|
m_RankIndexs.SetActiveIL(order >= 3);
|
|
if (order < 3)
|
{
|
m_RankImg.SetSprite(order == 0 ? "Rank_First" : order == 1 ? "Rank_Second" : "Rank_Third");
|
if (CSRechargeModel.Instance.CrossBillboardDataList.Count > order)
|
{
|
var BillBoardData = CSRechargeModel.Instance.CrossBillboardDataList[order];
|
m_NameText.text = BillBoardData.Name1;
|
}else
|
{
|
m_NameText.text = Language.Get("L1046");
|
}
|
}
|
else
|
{
|
m_RankIndexText.text =StringUtility.Contact( data.OrderA.ToString(),"-",data.OrderB.ToString());
|
m_BtnBill.SetListener(() =>
|
{
|
WindowCenter.Instance.OpenIL<CSRankWin>();
|
});
|
}
|
|
for (int i = 0; i < m_Items.Count; i++)
|
{
|
var awards = data.AwardItemList;
|
if (i < awards.Length)
|
{
|
m_Items[i].SetActiveIL(true);
|
var itemId = (int)awards[i].ItemID;
|
var model = new ItemCellModel(itemId, false, (ulong)awards[i].ItemCount);
|
m_Items[i].Init(model);
|
m_Items[i].button.SetListener(() =>
|
{
|
ItemTipUtility.Show(itemId);
|
});
|
}
|
else
|
{
|
m_Items[i].SetActiveIL(false);
|
}
|
}
|
}
|
else
|
{
|
m_ObjTarget.SetActiveIL(true);
|
var rechargeList = CSRechargeModel.Instance.rechargeList;
|
|
int _index = index - BiliBoardCount;
|
m_BtnGet.transform.Find("RedPoint").GetComponent<RedpointBehaviour>().redpointId = CSRechargeModel.Instance.titleRedpoints[rechargeList[_index]].id;
|
var recharge = operation.drlcInfoDict[rechargeList[_index]];
|
m_RankTip.text = Language.Get("CSRechargeTip", (recharge.NeedRMB / 100.0).ToString("0.##"));
|
|
var result = CSRechargeModel.Instance.GetRechargeStateByIndex(_index, recharge.AwardIndex);
|
m_HasGetImg.SetActiveIL(false);
|
m_BtnGet.SetActiveIL(false);
|
m_NoCompleteImg.SetActiveIL(false);
|
if (CSRechargeModel.Instance.getRechareDic.ContainsKey(recharge.NeedRMB))
|
{
|
result = CSRechargeModel.Instance.getRechareDic[recharge.NeedRMB];
|
}
|
if (result == 0)
|
{
|
m_NoCompleteImg.SetActiveIL(true);
|
}
|
else if (result == 1)
|
{
|
m_BtnGet.SetActiveIL(true);
|
m_BtnGet.SetColorful(null, true);
|
int tmp = index;
|
m_BtnGet.SetListener(() =>
|
{
|
CSRechargeModel.Instance.SendPlayerGetReward(recharge.AwardIndex);
|
CSRechargeModel.Instance.getRechareDic.Add(recharge.NeedRMB, 2);
|
Display(tmp);
|
CSRechargeModel.Instance.titleRedpoints[rechargeList[_index]].state = RedPointState.None;
|
});
|
}
|
else if (result == 2)
|
{
|
m_HasGetImg.SetActiveIL(true);
|
}
|
|
for (int i = 0; i < m_Items.Count; i++)
|
{
|
var awards = recharge.AwardItemList;
|
if (i < awards.Length)
|
{
|
m_Items[i].SetActiveIL(true);
|
var itemId = (int)awards[i].ItemID;
|
var model = new ItemCellModel(itemId, false, (ulong)awards[i].ItemCount);
|
m_Items[i].Init(model);
|
m_Items[i].button.SetListener(() =>
|
{
|
ItemTipUtility.Show(itemId);
|
});
|
}
|
else
|
{
|
m_Items[i].SetActiveIL(false);
|
}
|
}
|
}
|
}
|
}
|