少年修仙传客户端代码仓库
hch
5 天以前 50e53441950268933694eeb5aad36147bbe1014d
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using vnxbqy.UI;
using System;
using LitJson;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
class CharmLVUPWin : ILWindow
{
 
    Button closeBtn;
    RichText sourceTxt;
    Text curCharmValue;
    Button lvUPBtn;
    Text title1;
    Text value1;
    RichText proptext1;
    Text title2;
    Text value2;
    RichText proptext2;
 
 
    #region Built-in
    protected override void BindController()
    {
        closeBtn = proxy.GetWidgtEx<Button>("CloseButton");
        sourceTxt = proxy.GetWidgtEx<RichText>("source");
        curCharmValue = proxy.GetWidgtEx<Text>("curCharmValue");
        lvUPBtn = proxy.GetWidgtEx<Button>("CommonButton");
        title1 = proxy.GetWidgtEx<Text>("title1");
        value1 = proxy.GetWidgtEx<Text>("value1");
        proptext1 = proxy.GetWidgtEx<RichText>("proptext1");
        title2 = proxy.GetWidgtEx<Text>("title2");
        value2 = proxy.GetWidgtEx<Text>("value2");
        proptext2 = proxy.GetWidgtEx<RichText>("proptext2");
    }
 
    protected override void AddListeners()
    {
        closeBtn.SetListener(()=> { 
            WindowCenter.Instance.CloseIL<CharmLVUPWin>();
        });
 
        lvUPBtn.SetListener(()=> {
            var charmLV = (int)PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default11);
 
            var config = ILLoveCharmConfig.Get(charmLV);
            if (FlowerGiftModel.Instance.charmValue < config.UpNeedCharm) {
                return;
            }
            LimitedTimeLuxuryGiftModel.Instance.IsItemIdShow(55, 1,1,3,0);
            var pack = new IL_CB319_tagCGCharmLVUp();
            GameNetSystem.Instance.SendInfo(pack);
        });
    }
 
    protected override void OnPreOpen()
    {
        GameEvent.playerDataRefreshEvent += OnPlayerDataRefreshEvent;
        Display();
    }
 
    protected override void OnPreClose()
    {
        GameEvent.playerDataRefreshEvent -= OnPlayerDataRefreshEvent;
    }
 
    #endregion
 
    void Display()
    {
        string source = string.Empty;
        var keyList = FlowerGiftModel.Instance.charmSourceDict.Keys.ToList();
        for (int i = 0; i < keyList.Count; i++)
        {
            source = source + Language.Get("CharmSource", keyList[i], FlowerGiftModel.Instance.charmSourceDict[keyList[i]]);
        }
 
        sourceTxt.text = source;
 
        curCharmValue.text = FlowerGiftModel.Instance.charmValue.ToString();
        ShowProp();
    }
 
 
    void ShowProp()
    {
        var charmLV = (int)PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default11);
        var config = ILLoveCharmConfig.Get(charmLV);
        var nextConfig = ILLoveCharmConfig.Get(charmLV + 1);
        var beforeConfig = ILLoveCharmConfig.Get(charmLV - 1);
        title1.text = config.Name;
        value1.text = beforeConfig == null ? "0" : beforeConfig.UpNeedCharm.ToString();
        proptext1.text = GetProp(config);
 
        if (nextConfig == null)
        {
            title2.text = "";
            value2.text = config.UpNeedCharm.ToString();
            proptext2.text = Language.Get("L1055");
        }
        else
        { 
            title2.text = nextConfig.Name;
            value2.text = config.UpNeedCharm.ToString();
            proptext2.text = GetProp(nextConfig);
        }
    }
 
    string GetProp(ILLoveCharmConfig config)
    {
        string propValue = string.Empty;
        for (int i = 0; i < config.LVAttrType.Length; i++)
        {
            propValue += PlayerPropertyConfig.GetFullDescription(config.LVAttrType[i], config.LVAttrValue[i]) + "</r>";
        }
 
        if (config.LVAwardItemInfo != string.Empty)
        {
            propValue += Language.Get("Charm1", JsonMapper.ToObject<int[][]>(config.LVAwardItemInfo)[0][0]);
        }
 
        return propValue;
    }
 
    void OnPlayerDataRefreshEvent(PlayerDataType dataType)
    {
        if (dataType != PlayerDataType.default11)
        {
            return;
        }
        ShowProp();
    }
}