41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
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>();
|
||
}
|
||
protected virtual 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;
|
||
}
|
||
if(icon)
|
||
GContext.container.Resolve<IUIService>().SetImageSprite(icon, item.Icon);
|
||
string itemName = LocalizationMgr.GetText(item.Name_l10n_key);
|
||
if(text_info)
|
||
text_info.text = LocalizationMgr.GetFormatTextValue(infoTextKey, itemName);
|
||
if(text_tips)
|
||
text_tips.text = LocalizationMgr.GetFormatTextValue(tipsTextKey, itemName);
|
||
}
|
||
}
|