少年修仙传客户端代码仓库
hch
2025-04-03 c154ac0832fe4379a00d3e1cda700e7d2a7383c7
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using vnxbqy.UI;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
class FaQiLVUPSuccessWin : ILWindow
{
    Button closeBtn;
    Text upgrateName;
    ScrollerController attrScroll;
    float openTime = 0f;
 
    #region Built-in
    protected override void BindController()
    {
        closeBtn = proxy.GetWidgtEx<Button>("Btn_Close");
        upgrateName = proxy.GetWidgtEx<Text>("upgratetxt");
        attrScroll = proxy.GetWidgtEx<ScrollerController>("prolayoutScroller");
        
    }
 
    protected override void AddListeners()
    {
        closeBtn.SetListener(() => {
            //打开x秒内不响应关闭
            if (Time.time - openTime < 1)
            {
                return;
            }
            WindowCenter.Instance.CloseIL<FaQiLVUPSuccessWin>();
        });
 
    }
 
    protected override void OnPreOpen()
    {
        openTime = Time.time;
        upgrateName.text = Language.Get("FuncRankName", FaQiLVUPModel.Instance.faqiLV);
        attrScroll.OnRefreshCell += OnRefreshCell;
 
    }
 
    protected override void OnPreClose()
    {
        attrScroll.OnRefreshCell -= OnRefreshCell;
    }
 
    protected override void OnAfterOpen()
    {
        attrScroll.Refresh();
 
        var curConfig = ILFaQiLVUpConfig.Get(FaQiLVUPModel.Instance.faqiLV);
        var beforeConfig = ILFaQiLVUpConfig.Get(FaQiLVUPModel.Instance.faqiLV - 1);
 
        var showCnt = curConfig.LVAttrType.Length + beforeConfig.UpItemAttrType.Length;
        for (int i = 0; i < showCnt; i++)
        {
            attrScroll.AddCell(ScrollerDataType.Header, i);
        }
        attrScroll.Restart();
        attrScroll.m_Scorller.RefreshActiveCellViews();
    }
    #endregion
 
    void OnRefreshCell(ScrollerDataType type, CellView cell)
    {
        var curText = cell.FindComponentEx<Text>("Txt_Current");
        var nextText = cell.FindComponentEx<Text>("Txt_Next");
        var index = cell.index;
        var curConfig = ILFaQiLVUpConfig.Get(FaQiLVUPModel.Instance.faqiLV);
        var beforeConfig = ILFaQiLVUpConfig.Get(FaQiLVUPModel.Instance.faqiLV - 1);
        if (index < beforeConfig.UpItemAttrType.Length)
        {
            var value = beforeConfig.UpItemAttrValue[index];
            var id = curConfig.UpItemAttrType[index];
            var nextValue= FaQiLVUPModel.Instance.faqiLVUPAttr[id];
 
            value = nextValue - value;
            curText.text = StringUtility.Contact(PlayerPropertyConfig.Get(id).Name, ":", PlayerPropertyConfig.GetValueDescription(id, value));
            nextText.text = PlayerPropertyConfig.GetValueDescription(id, nextValue);
 
        }
        else
        {
            var lvIndex = index - beforeConfig.UpItemAttrType.Length;
            var id = curConfig.LVAttrType[lvIndex];
            var nextValue = FaQiLVUPModel.Instance.faqiLVUPAttr[id];
            var value = nextValue - curConfig.LVAttrValue[lvIndex];
            curText.text = StringUtility.Contact(PlayerPropertyConfig.Get(id).Name, ":", PlayerPropertyConfig.GetValueDescription(id, value));
            nextText.text = PlayerPropertyConfig.GetValueDescription(id, nextValue);
 
        }
 
    }
}