//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, January 29, 2018
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
|
|
namespace vnxbqy.UI
|
{
|
|
public class DungeonRewardItem : CommonItemBaisc
|
{
|
[SerializeField] UIEffect m_FirstPass;
|
public ServerItem serverItem { get; set; }
|
public bool firstPassItem { get; set; }
|
|
|
UIEffect itemColorSfx = null;
|
|
private void OnEnable()
|
{
|
button.AddListener(ShowItemTip);
|
RequestSfx();
|
RequestFirstPassSfx();
|
}
|
|
private void OnDisable()
|
{
|
button.RemoveAllListeners();
|
RecycleSfx();
|
}
|
|
private void ShowItemTip()
|
{
|
ItemTipUtility.Show(itemId);
|
}
|
|
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;
|
}
|
}
|
|
private void RequestFirstPassSfx()
|
{
|
if (firstPassItem && m_FirstPass != null)
|
{
|
m_FirstPass.Play();
|
}
|
}
|
}
|
|
}
|
|
|
|