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