少年修仙传客户端代码仓库
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
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, March 12, 2019
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
 
namespace Snxxz.UI
{
 
    public class TipGemInfoWidget : MonoBehaviour
    {
        [SerializeField] GemBehaviour[] m_GemBehaviours;
 
        public void Display(ItemTipUtility.GemInfo gemInfo)
        {
            for (int i = 0; i < m_GemBehaviours.Length; i++)
            {
                var behaviour = m_GemBehaviours[i];
                var active = gemInfo.activeStates.ContainsKey(i) ? gemInfo.activeStates[i] : false;
                var gem = (gemInfo.gems != null && gemInfo.gems.ContainsKey(i)) ? gemInfo.gems[i] : 0;
                behaviour.Display(active, gem);
            }
        }
 
        [System.Serializable]
        public class GemBehaviour
        {
            public Image gemIcon;
            public Image locked;
            public Text gemName;
            public Text propertyBehaviour;
            public RectTransform unLockContainer;
 
            public void Display(bool active, int gem)
            {
                if (active)
                {
                    if (gem > 0)
                    {
                        var config = ItemConfig.Get(gem);
                        gemIcon.gameObject.SetActive(true);
                        gemIcon.SetSprite(StringUtility.Contact("GemTypeMini_", config.EffectValueA1));
                        gemName.text = config.ItemName;
 
                        var properties = new List<Int2>();
                        if (config.Effect2 > 0)
                        {
                            properties.Add(new Int2(config.Effect2, config.EffectValueA2));
                        }
 
                        if (config.Effect3 > 0)
                        {
                            properties.Add(new Int2(config.Effect3, config.EffectValueA3));
                        }
 
                        if (config.Effect4 > 0)
                        {
                            properties.Add(new Int2(config.Effect4, config.EffectValueA4));
                        }
 
                        if (config.Effect5 > 0)
                        {
                            properties.Add(new Int2(config.Effect5, config.EffectValueA5));
                        }
 
                        var lines = new string[properties.Count];
                        for (int i = 0; i < properties.Count; i++)
                        {
                            var property = properties[i];
                            lines[i] = PlayerPropertyConfig.GetFullDescription(property.x, property.y);
                        }
 
                        propertyBehaviour.text = string.Join("\r\n", lines);
                        propertyBehaviour.gameObject.SetActive(true);
                    }
                    else
                    {
                        gemIcon.gameObject.SetActive(false);
                        gemName.text = "未镶嵌";
                        propertyBehaviour.gameObject.SetActive(false);
                    }
 
                    locked.gameObject.SetActive(false);
                    unLockContainer.gameObject.SetActive(false);
                }
                else
                {
                    locked.gameObject.SetActive(true);
                    gemIcon.gameObject.SetActive(false);
                    gemName.text = "未解锁";
                    propertyBehaviour.gameObject.SetActive(false);
                    unLockContainer.gameObject.SetActive(true);
                }
            }
 
        }
 
 
    }
 
}