少年修仙传客户端代码仓库
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
61
62
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
 
namespace vnxbqy.UI
{
    public class BossTrialSubmitCell : CellView
    {
        [SerializeField] ItemCell itemCell;
        [SerializeField] UIEffect uieffect;
        [SerializeField] Image gotImg;
        [SerializeField] Slider slider;
        [SerializeField] Text numText;
 
 
        BossTrialModel model { get { return ModelCenter.Instance.GetModel<BossTrialModel>(); } }
        public void Display(int tagetCnt)
        {
            var submitInfo = model.operationBossTrial.bossTrialSubmitInfo[tagetCnt];
            int itemID = submitInfo.items[0].id;
            var state = model.GetSubmitAwardState(tagetCnt);
            itemCell.Init(new ItemCellModel(itemID, false, (ulong)submitInfo.items[0].count));
            itemCell.button.AddListener(() => {
                if (state == 1)
                {
                    var pack = new CAA24_tagCMActBossTrialGetAward();
                    pack.ActNum = model.actNum;
                    pack.SubmitCount = (ushort)tagetCnt;
                    GameNetSystem.Instance.SendInfo(pack);
                    return;
                }
                ItemTipUtility.Show(itemID); });
 
            if (state == 1)
                uieffect.Play();
            else
                uieffect.Stop();
            gotImg.SetActive(state == 2);
            numText.text = tagetCnt.ToString();//Language.Get("BossTrial6", tagetCnt);
 
            var keys = model.operationBossTrial.bossTrialSubmitInfo.Keys.ToList();
            keys.Sort();
            //当前数量最小的整数
            int index = 0;
            foreach (var key in keys)
            {
                if (key < tagetCnt)
                {
                    index = key;
                }
                else
                {
                    break;
                }
            }
            slider.minValue = 0;
            slider.maxValue = tagetCnt - index;
            slider.value = model.submitCount - index;
        }
    }
}