using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
|
namespace Snxxz.UI
|
{
|
public class RareItem : CommonItemBaisc
|
{
|
[SerializeField] UIEffect m_RareSfx;
|
|
public override void Init(ItemCellModel model, int compareScore = 0)
|
{
|
if (m_RareSfx != null)
|
{
|
m_RareSfx.StopImediatly();
|
}
|
base.Init(model);
|
}
|
|
public void SetItemRare(ItemCellModel model, int _itemColor = 0, int compareScore = 0)
|
{
|
if (model == null)
|
{
|
return;
|
}
|
Init(model);
|
if (_itemColor == 0)
|
{
|
return;
|
}
|
var config = ItemConfig.Get(model.itemId);
|
if (config != null && config.ItemColor >= _itemColor)
|
{
|
DisplayRareSfx();
|
}
|
}
|
|
public void SetItemRare(ItemCellModel model, bool _rare = false)
|
{
|
if (model == null)
|
{
|
return;
|
}
|
Init(model);
|
if (_rare)
|
{
|
DisplayRareSfx();
|
}
|
}
|
|
public void DisplayRareSfx()
|
{
|
if (m_RareSfx != null)
|
{
|
if (!m_RareSfx.IsPlaying)
|
{
|
m_RareSfx.Play();
|
}
|
}
|
}
|
}
|
}
|
|