少年修仙传客户端代码仓库
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
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
    public class ReikiRootPromoteBehaviour : MonoBehaviour
    {
        [SerializeField] Image m_Icon;
        [SerializeField] Text m_QualityName0;
        [SerializeField] Text m_QualityName1;
        [SerializeField] PropertyBehaviour[] m_Propertys;
        [SerializeField] Transform m_ContainerNewProperty;
        [SerializeField] Text m_NextQuality;
        [SerializeField] Text m_NewProperty;
 
        ReikiRootModel model { get { return ModelCenter.Instance.GetModel<ReikiRootModel>(); } }
 
        static List<int> displayPropertys = new List<int>();
 
        public void Display(int id, int lastPoint, int point, bool isLastIndex)
        {
            m_Icon.SetSprite("XT_LGL_" + id);
 
            var quality = model.GetReikiRootQuality(id, lastPoint);
            var newQuality = model.GetReikiRootQuality(id, point);
 
            m_QualityName0.text = ReikiRootModel.GetQualityLabel(quality);
            m_QualityName0.color = UIHelper.GetUIColor(model.GetQualityColor(quality), true);
 
            m_QualityName1.text = ReikiRootModel.GetQualityLabel(newQuality);
            m_QualityName1.color = UIHelper.GetUIColor(model.GetQualityColor(newQuality), true);
 
            displayPropertys.Clear();
 
            Int2 newProperty = Int2.zero;
 
            var qualityPropertys = model.GetReikiQualityProperties(id);
            for (int i = 0; i < m_Propertys.Length; i++)
            {
                m_Propertys[i].SetActive(i < qualityPropertys.Count);
 
                if (i < qualityPropertys.Count)
                {
                    var lastPropertyValue = model.GetQualityProperty(quality, qualityPropertys[i].propertyValues);
                    var propertyValue = model.GetQualityProperty(newQuality, qualityPropertys[i].propertyValues);
 
                    m_Propertys[i].SetActive(propertyValue > lastPropertyValue);
 
                    if (propertyValue > lastPropertyValue)
                    {
                        var config = ReikiRootConfig.Get(id);
                        m_Propertys[i].DisplayAdd(qualityPropertys[i].property, lastPropertyValue, propertyValue);
 
                        displayPropertys.Add(qualityPropertys[i].property);
                    }
                }
            }
 
            var max = model.GetMaxReikiRootQuality(id);
            for (int i = 0; i < qualityPropertys.Count; i++)
            {
                if (displayPropertys.Contains(qualityPropertys[i].property))
                {
                    continue;
                }
                for (int j = newQuality; j <= max; j++)
                {
                    if(model.GetQualityProperty(j, qualityPropertys[i].propertyValues) > 0)
                    {
                        newProperty.x = j;
                        newProperty.y = qualityPropertys[i].property;
                        break;
                    }
                }
                if (newProperty.y != 0)
                {
                    break;
                }
            }
 
            m_ContainerNewProperty.SetActive(newProperty.y != 0);
            if (newProperty.y != 0)
            {
                var qualityLabel = UIHelper.AppendColor(model.GetQualityColor(newProperty.x), ReikiRootModel.GetQualityLabel(newProperty.x));
                m_NextQuality.text = Language.Get("ReikiRoot1", qualityLabel);
                var propertyConfig = PlayerPropertyConfig.Get(newProperty.y);
                m_NewProperty.text = propertyConfig.Name;
            }
        }
    }
}