备份CatanBuilding瘦身独立工程
This commit is contained in:
57
Assets/Scripts/UI/Rod/Perk.cs
Normal file
57
Assets/Scripts/UI/Rod/Perk.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Perk : MonoBehaviour
|
||||
{
|
||||
public Image bg;
|
||||
public Image icon;
|
||||
public GameObject lockIcon;
|
||||
public TMP_Text text_level;
|
||||
public TMP_Text text_lock;
|
||||
public Transform kuang_duel;
|
||||
public Transform tag_duel;
|
||||
public TMP_Text perk_text_name;
|
||||
public static string[] peak_bg = { "sp_rod_buff_white", "sp_rod_buff_blue", "sp_rod_buff_purple", "sp_rod_buff_yellow", "sp_rod_buff_yellow" };
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
bg = transform.Find("bg").GetComponent<Image>();
|
||||
icon = transform.Find("bg/icon").GetComponent<Image>();
|
||||
text_level = transform.Find("bg/text_level").GetComponent<TMP_Text>();
|
||||
text_lock = transform.Find("empty/text_lock").GetComponent<TMP_Text>();
|
||||
lockIcon = transform.Find("empty").gameObject;
|
||||
}
|
||||
|
||||
public void SetData(int id, int level, int quality)
|
||||
{
|
||||
text_level.gameObject.SetActive(level > 0);
|
||||
lockIcon.SetActive(level == 0);
|
||||
text_level.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePopupPanel_1", level);
|
||||
RodAscendPerk data = GContext.container.Resolve<Tables>().TbRodAscendPerk.GetOrDefault(id);
|
||||
if (data == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string peakBgName = peak_bg[quality - 1];
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(bg, peakBgName, BasePanel.PanelName);
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(icon, data.Icon, BasePanel.PanelName);
|
||||
kuang_duel = transform.Find("bg/kuang_duel");
|
||||
tag_duel = transform.Find("bg/tag_duel");
|
||||
if (kuang_duel != null)
|
||||
{
|
||||
kuang_duel.gameObject.SetActive(data.DuelPerk);
|
||||
}
|
||||
if (tag_duel != null)
|
||||
{
|
||||
tag_duel.gameObject.SetActive(data.DuelPerk);
|
||||
}
|
||||
if (perk_text_name != null)
|
||||
{
|
||||
perk_text_name.text = LocalizationMgr.GetText(data.Title_l10n_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user