少年修仙传客户端代码仓库
client_Wu Xijin
2019-06-13 033958214c0b16d7e7b93cc821b018c295251867
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Friday, March 15, 2019
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
 
namespace Snxxz.UI
{
 
    public class TipStarPropertyWidget : MonoBehaviour
    {
        [SerializeField] Image[] m_Stars;
        [SerializeField] Text m_Property;
 
        public void Display(ItemTipUtility.StarInfo starInfo)
        {
            for (int i = 0; i < m_Stars.Length; i++)
            {
                var behaviour = m_Stars[i];
                if (i < starInfo.maxLevel)
                {
                    behaviour.gameObject.SetActive(true);
                    behaviour.SetSprite(i < starInfo.starLevel ? "BJKM_6" : "BJKM_7");
                }
                else
                {
                    behaviour.gameObject.SetActive(false);
                }
            }
 
            var starConfigs = EquipStarConfig.GetConfigs(starInfo.equipPosition.x, starInfo.equipPosition.y);
            var levelUpProperties = new Dictionary<int, Int2>();
            var prePropertiesCount = 0;
            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;
                }
            }
 
            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, string.Format("{0}({1}星激活)", description, star)));
                }
            }
 
            m_Property.text = string.Join("\r\n", lines.ToArray());
        }
 
 
    }
 
}