//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, January 29, 2018 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; namespace Snxxz.UI { public class DungeonRewardItem : CommonItemBaisc { public ServerItem serverItem { get; set; } ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel(); } } UIEffect itemColorSfx = null; private void OnEnable() { button.AddListener(ShowItemTip); RequestSfx(); } private void OnDisable() { button.RemoveAllListeners(); RecycleSfx(); } private void ShowItemTip() { var attrData = new ItemAttrData(serverItem.ItemID, false, (ulong)serverItem.Count, -1, false, PackType.Deleted, "", ConfigParse.Analysis(serverItem.UserData)); itemTipsModel.SetItemTipsModel(attrData); } private void RequestSfx() { RecycleSfx(); var config = ItemConfig.Get(itemId); if (config != null) { var effect = config.ItemColor == 3 ? 1136 : config.ItemColor == 4 ? 1137 : config.ItemColor == 5 ? 1138 : 0; if (effect != 0) { itemColorSfx = EffectMgr.Instance.PlayUIEffect(effect, 2500, transform, true); } } } private void RecycleSfx() { if (itemColorSfx != null) { itemColorSfx = null; } } } }