少年修仙传客户端代码仓库
hch
1 天以前 dbb7a55e47da81a8c7c2b4bff7e053ff36af3d5a
提交 | 用户 | age
ae7213 1 //--------------------------------------------------------
CX 2 //    [Author]:           第二世界
3 //    [  Date ]:           Tuesday, June 04, 2019
4 //--------------------------------------------------------
5 using UnityEngine;
6 using System.Collections;
7 using UnityEngine.UI;
8
4465b6 9 namespace vnxbqy.UI
ae7213 10 {
ab1db0 11     [ExecuteAlways]
ae7213 12     public class FindPreciousItemBehaviour : MonoBehaviour
CX 13     {
14         [SerializeField] Image m_Icon;
15         [SerializeField] Image m_Frame;
16         [SerializeField] Button m_View;
17
18         EquipSuitEffect m_EquipSuitEffect;
19         EquipSuitEffect equipSuitEffect {
20             get {
21                 if (m_EquipSuitEffect == null)
22                 {
23                     m_EquipSuitEffect = EquipSuitEffect.Create(transform as RectTransform);
24                 }
25                 return m_EquipSuitEffect;
26             }
dbb7a5 27         }
H 28
29         //物品基础特效(物品表)
30         ItemBaseEffect m_ItemBaseEffect;
31         ItemBaseEffect itemBaseEffect
32         {
33             get
34             {
35                 if (m_ItemBaseEffect == null)
36                 {
37                     m_ItemBaseEffect = ItemBaseEffect.Create(transform as RectTransform);
38                 }
39                 return m_ItemBaseEffect;
40             }
ae7213 41         }
CX 42
43         int itemId = 0;
033958 44         public void Display(int itemId, int count)
ae7213 45         {
CX 46             this.itemId = itemId;
47             var itemInfo = ItemConfig.Get(itemId);
48             if (m_Icon != null)
49             {
f23c81 50                 m_Icon.SetActive(true);
ae7213 51                 m_Icon.SetSprite(itemInfo.IconKey);
CX 52             }
53
54             if (m_Frame != null)
55             {
f23c81 56                 m_Frame.SetActive(true);
ae7213 57                 m_Frame.SetItemBackGround(itemInfo.ItemColor);
CX 58             }
59
60             equipSuitEffect.Display(itemId);
dbb7a5 61             itemBaseEffect.Display(itemId);
ae7213 62         }
CX 63
ab1db0 64         [ExecuteAlways]
ae7213 65         private void Awake()
CX 66         {
67 //             if (this.GetComponent<ItemBehaviour>())
68 //             {
69 //                 DestroyImmediate(this.GetComponent<ItemBehaviour>(), true);
70 //             }
71 // 
72 //             if (this.transform.Find("Container_Count"))
73 //             {
74 //                 DestroyImmediate(this.transform.Find("Container_Count").gameObject, true);
75 //             }
76 // 
77 //             m_Icon = this.FindComponent("Image", "Img_Icon") as Image;
78 //             m_Frame = this.FindComponent("Image", "Img_BackGround") as Image;
79 // 
80 //             if (this.transform.Find("Img_New"))
81 //             {
82 //                 DestroyImmediate(this.transform.Find("Img_New").gameObject, true);
83 //             }
84 // 
85 //             var instance = GameObject.Instantiate(m_Icon);
86 //             instance.name = "Img_New";
87 //             instance.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
88 //             var rectTransform = instance.GetComponent<RectTransform>();
89 //             rectTransform.anchorMin = rectTransform.anchorMax = rectTransform.pivot = new Vector2(0.5f, 0.5f);
90 //             rectTransform.sizeDelta = new Vector2(58, 22);
91 //             rectTransform.anchoredPosition = new Vector2(0, -20.27f);
92 // 
93 //             m_NewItemLabel = instance.GetComponent<Image>();
94 //             m_NewItemLabel.sprite = UILoader.LoadSprite("6Decorate3", "DB_NewDrop");
95 // 
96 //             m_View = this.GetComponent<Button>();
97         }
98
99         private void Start()
100         {
101             m_View.SetListener(() => { ItemTipUtility.Show(itemId); });
102         }
103
104     }
105
106 }
107
108
109