using System.Collections;
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
public class RealmIcon : MonoBehaviour
|
{
|
[SerializeField] Image m_RealmIcon;
|
[SerializeField] UIEffect m_LightSfx;
|
|
int realmLv { get; set; }
|
|
public void Display(int _realmLv)
|
{
|
realmLv = _realmLv;
|
var config = RealmConfig.Get(realmLv);
|
if (config != null)
|
{
|
m_RealmIcon.SetSprite(config.Img);
|
m_RealmIcon.SetNativeSize();
|
}
|
DisplaySfx(realmLv);
|
}
|
|
void DisplaySfx(int _realmLv)
|
{
|
var effectId = GetLightSfx(_realmLv);
|
if (m_LightSfx != null)
|
{
|
m_LightSfx.StopImediatly();
|
if (effectId != 0)
|
{
|
m_LightSfx.effect = effectId;
|
m_LightSfx.Play();
|
}
|
}
|
}
|
|
private void OnEnable()
|
{
|
if (realmLv != 0)
|
{
|
DisplaySfx(realmLv);
|
}
|
}
|
|
|
public static int GetLightSfx(int _realmLv)
|
{
|
var config = RealmConfig.Get(_realmLv);
|
if (config != null)
|
{
|
return config.requireIconEffect;
|
}
|
return 0;
|
}
|
}
|
}
|