少年修仙传客户端代码仓库
hch
1 天以前 dbb7a55e47da81a8c7c2b4bff7e053ff36af3d5a
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, June 04, 2019
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
    [ExecuteAlways]
    public class FindPreciousItemBehaviour : MonoBehaviour
    {
        [SerializeField] Image m_Icon;
        [SerializeField] Image m_Frame;
        [SerializeField] Button m_View;
 
        EquipSuitEffect m_EquipSuitEffect;
        EquipSuitEffect equipSuitEffect {
            get {
                if (m_EquipSuitEffect == null)
                {
                    m_EquipSuitEffect = EquipSuitEffect.Create(transform as RectTransform);
                }
                return m_EquipSuitEffect;
            }
        }
 
        //物品基础特效(物品表)
        ItemBaseEffect m_ItemBaseEffect;
        ItemBaseEffect itemBaseEffect
        {
            get
            {
                if (m_ItemBaseEffect == null)
                {
                    m_ItemBaseEffect = ItemBaseEffect.Create(transform as RectTransform);
                }
                return m_ItemBaseEffect;
            }
        }
 
        int itemId = 0;
        public void Display(int itemId, int count)
        {
            this.itemId = itemId;
            var itemInfo = ItemConfig.Get(itemId);
            if (m_Icon != null)
            {
                m_Icon.SetActive(true);
                m_Icon.SetSprite(itemInfo.IconKey);
            }
 
            if (m_Frame != null)
            {
                m_Frame.SetActive(true);
                m_Frame.SetItemBackGround(itemInfo.ItemColor);
            }
 
            equipSuitEffect.Display(itemId);
            itemBaseEffect.Display(itemId);
        }
 
        [ExecuteAlways]
        private void Awake()
        {
//             if (this.GetComponent<ItemBehaviour>())
//             {
//                 DestroyImmediate(this.GetComponent<ItemBehaviour>(), true);
//             }
// 
//             if (this.transform.Find("Container_Count"))
//             {
//                 DestroyImmediate(this.transform.Find("Container_Count").gameObject, true);
//             }
// 
//             m_Icon = this.FindComponent("Image", "Img_Icon") as Image;
//             m_Frame = this.FindComponent("Image", "Img_BackGround") as Image;
// 
//             if (this.transform.Find("Img_New"))
//             {
//                 DestroyImmediate(this.transform.Find("Img_New").gameObject, true);
//             }
// 
//             var instance = GameObject.Instantiate(m_Icon);
//             instance.name = "Img_New";
//             instance.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
//             var rectTransform = instance.GetComponent<RectTransform>();
//             rectTransform.anchorMin = rectTransform.anchorMax = rectTransform.pivot = new Vector2(0.5f, 0.5f);
//             rectTransform.sizeDelta = new Vector2(58, 22);
//             rectTransform.anchoredPosition = new Vector2(0, -20.27f);
// 
//             m_NewItemLabel = instance.GetComponent<Image>();
//             m_NewItemLabel.sprite = UILoader.LoadSprite("6Decorate3", "DB_NewDrop");
// 
//             m_View = this.GetComponent<Button>();
        }
 
        private void Start()
        {
            m_View.SetListener(() => { ItemTipUtility.Show(itemId); });
        }
 
    }
 
}