//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, January 29, 2018 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; using TableConfig; 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() { cellBtn.AddListener(ShowItemTip); RequestSfx(); } private void OnDisable() { cellBtn.RemoveAllListeners(); RecycleSfx(); } private void ShowItemTip() { var attrData = new ItemAttrData(serverItem.ItemID, false, (ulong)serverItem.Count, -1, serverItem.IsBind, false, PackType.rptDeleted, "", ConfigParse.Analysis(serverItem.UserData)); itemTipsModel.SetItemTipsModel(attrData); } private void RequestSfx() { RecycleSfx(); if (base.itemConfig == null) { return; } var _effect = itemConfig.ItemColor == 3 ? 1136 : itemConfig.ItemColor == 4 ? 1137 : itemConfig.ItemColor == 5 ? 1138 : 0; if (_effect != 0) { itemColorSfx = EffectMgr.Instance.PlayUIEffect(_effect, 2500, transform, true); } } private void RecycleSfx() { if (itemColorSfx != null) { itemColorSfx = null; } } } }