//-------------------------------------------------------- // [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()) // { // DestroyImmediate(this.GetComponent(), 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.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(); // m_NewItemLabel.sprite = UILoader.LoadSprite("6Decorate3", "DB_NewDrop"); // // m_View = this.GetComponent