33 lines
985 B
C#
33 lines
985 B
C#
using asap.core;
|
|
using cfg;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class Trait : MonoBehaviour
|
|
{
|
|
public Image bg;
|
|
public Image icon;
|
|
public GameObject lockIcon;
|
|
public int id;
|
|
public int level;
|
|
private void Reset()
|
|
{
|
|
bg = transform.Find("bg").GetComponent<Image>();
|
|
icon = transform.Find("icon").GetComponent<Image>();
|
|
lockIcon = transform.Find("noactive").gameObject;
|
|
}
|
|
|
|
public void Init(int id,bool open,int q)
|
|
{
|
|
RodAscendPerk data = GContext.container.Resolve<Tables>().TbRodAscendPerk.GetOrDefault(id);
|
|
if (data == null)
|
|
{
|
|
return;
|
|
}
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(icon, data.Icon, BasePanel.PanelName);
|
|
lockIcon.SetActive(!open);
|
|
string bgName = Perk.peak_bg[Mathf.Clamp(q - 1, 0, Perk.peak_bg.Length - 1)];
|
|
GContext.container.Resolve<IUIService>().SetImageSprite(bg, bgName, BasePanel.PanelName);
|
|
}
|
|
}
|