Files
back_cantanBuilding/Assets/Scripts/UI/Tips/EventInfoPopupPanelTitle.cs
2026-05-26 16:15:54 +08:00

38 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class EventInfoPopupPanelTitle : MonoBehaviour
{
public int eventItemID;
public string infoTextKey = "UI_EventSandDigPanel_4";
public string tipsTextKey = "UI_EventSandDigPanel_7";
public Image icon;
public TMP_Text text_info;
public TMP_Text text_tips;
private void Reset()
{
text_info = transform.Find("root/info1/text_info").GetComponent<TMP_Text>();
text_tips = transform.Find("root/text_tips").GetComponent<TMP_Text>();
}
private void Start()
{
Tables tables = GContext.container.Resolve<Tables>();
Item item = tables.TbItem.GetOrDefault(eventItemID);
if (item == null)
{
#if UNITY_EDITOR
Debug.LogError($"见大你填错了{gameObject.name},没有这个代币 eventItemID {eventItemID}");
#endif
return;
}
GContext.container.Resolve<IUIService>().SetImageSprite(icon, item.Icon);
string itemName = LocalizationMgr.GetText(item.Name_l10n_key);
text_info.text = LocalizationMgr.GetFormatTextValue(infoTextKey, itemName);
text_tips.text = LocalizationMgr.GetFormatTextValue(tipsTextKey, itemName);
}
}