少年修仙传客户端代码仓库
hch
2024-12-16 9377811d0ba27047e1e5ec2348a28eba1033d59d
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Friday, March 15, 2019
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
 
namespace vnxbqy.UI
{
 
    public class TipStarPropertyWidget : MonoBehaviour
    {
        [SerializeField] Image[] m_Stars;
        [SerializeField] Text m_Property;
 
        public void Display(ItemTipUtility.StarInfo starInfo)
        {
            var iconCnt = m_Stars.Length;
            for (int i = 0; i < iconCnt; i++)
            {
                var behaviour = m_Stars[i];
                if (i < starInfo.maxLevel)
                {
                    behaviour.gameObject.SetActive(true);
                    var loop = (starInfo.starLevel - 1) / iconCnt;
                    var starIndex = loop * iconCnt + i < starInfo.starLevel ? loop : loop - 1;
                    behaviour.SetSprite(i < starInfo.starLevel ? "ImgStar_" + starIndex : "BJKM_7");
                }
                else
                {
                    behaviour.SetActive(false);
                }
            }
 
            var starConfigs = EquipStarConfig.GetConfigs(starInfo.equipPosition.x, starInfo.equipPosition.y);
            var levelUpProperties = new Dictionary<int, Int2>();
            var prePropertiesCount = 0;
            if (starConfigs != null)
            {
                this.transform.SetActive(true);
                foreach (var config in starConfigs)
                {
                    if (config.StarAttrInfo.Length > prePropertiesCount)
                    {
                        var length = config.StarAttrInfo.Length;
                        levelUpProperties[config.Star] = config.StarAttrInfo[length - 1];
                        prePropertiesCount = config.StarAttrInfo.Length;
                    }
                }
            }
            else
            {
                this.transform.SetActive(false);
            }
 
            var lines = new List<string>();
            foreach ( var item in levelUpProperties  )
            {
                var star = item.Key;
                var property = item.Value;
                var actived = starInfo.starLevel >= item.Key;
                var description = PlayerPropertyConfig.GetFullDescription(property.x, property.y);
 
                if (actived)
                {
                    lines.Add(UIHelper.AppendColor(TextColType.Green, description));
                }
                else
                {
                    lines.Add(UIHelper.AppendColor(TextColType.Gray, Language.Get("EquipStar16", description, star)));
                }
            }
 
            m_Property.text = string.Join("\r\n", lines.ToArray());
        }
 
 
    }
 
}