少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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); });
        }
    }
}