备份CatanBuilding瘦身独立工程
This commit is contained in:
32
Assets/Scripts/UI/Rod/Trait.cs
Normal file
32
Assets/Scripts/UI/Rod/Trait.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user