using System.Collections.Generic;
|
using System.Linq;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
|
namespace vnxbqy.UI
|
{
|
public class FamilyRechargeConnCell : CellView
|
{
|
[SerializeField] Text finishInfo;
|
[SerializeField] Slider slider;
|
[SerializeField] Text numText;
|
[SerializeField] List<ItemCell> itemCells;
|
[SerializeField] Image gotImg;
|
[SerializeField] Text gotInfo;
|
[SerializeField] Button getBtn;
|
|
FamilyRechargeConnModel model { get { return ModelCenter.Instance.GetModel<FamilyRechargeConnModel>(); } }
|
public void Display(int index)
|
{
|
OperationFamilyRechargeConn act;
|
OperationTimeHepler.Instance.TryGetOperation(FamilyRechargeConnModel.operaType, out act);
|
int needNum = act.needPlayers[index];
|
finishInfo.text = Language.Get("FamilyRechargeTogether4", needNum);
|
slider.value = (float)model.rechargePlayerIDs.Count / needNum;
|
numText.text = model.rechargePlayerIDs.Count + "/" + needNum;
|
for (int i = 0; i < itemCells.Count; i++)
|
{
|
if (i < act.rechargeInfo[needNum].Length)
|
{
|
itemCells[i].SetActive(true);
|
int itemID = (int)act.rechargeInfo[needNum][i].ItemID;
|
itemCells[i].Init(new ItemCellModel(itemID, false, (ulong)act.rechargeInfo[needNum][i].ItemCount));
|
itemCells[i].button.AddListener(() => { ItemTipUtility.Show(itemID); });
|
}
|
else
|
{
|
itemCells[i].SetActive(false);
|
}
|
}
|
int memberCnt =0;
|
PlayerFairyData.FairyData fairy = PlayerDatas.Instance.fairyData.fairy;
|
if (fairy != null)
|
{
|
FamilyConfig cfg = FamilyConfig.Get(fairy.FamilyLV);
|
memberCnt = cfg.memberCnt;
|
}
|
int state = model.GetAwardState(index);
|
gotImg.SetActive(state == 2);
|
int getNum = 0;
|
model.getAwardPlayerNums.TryGetValue(needNum, out getNum);
|
gotInfo.text = Language.Get("FamilyRechargeTogether6", getNum, memberCnt);
|
getBtn.SetActive(state != 2);
|
getBtn.interactable = state == 1;
|
getBtn.SetColorful(null, state == 1);
|
getBtn.AddListener(() => { model.SendGetAward(needNum); });
|
}
|
}
|
}
|