TH1/Unity/Assets/Scripts/TH1_UI/View/Notify/UINotifyCommonView.cs
2025-09-22 15:22:23 +08:00

57 lines
1.4 KiB
C#

using System.Collections.Generic;
using Logic.CrashSight;
using Logic.Multilingual;
using RuntimeData;
using TH1_Core.Events;
using TH1_Logic.Core;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace TH1_UI.View.Notify
{
public class UINotifyCommonView : Base.View
{
public Button closeButton;
//public TextMeshProUGUI Title;
public TextMeshProUGUI content;
public ViDelegateAssisstant.Dele OnAutoClose;
protected override void InitStart()
{
base.InitStart();
//closeButton.onClick.RemoveAllListeners();
//closeButton.onClick.AddListener(() => { OnBtnCloseClick.Invoke(); });
}
public void SetContent(ShowUINotifyCommon eventType)
{
if (content == null )
{
LogSystem.LogError("ShowUINotifyCommonView.SetContent(): Content is null");
return;
}
switch (eventType.UINotifyCommonType)
{
case UINotifyCommonType.DiplomacyOfferAlly:
MultilingualManager.Instance.SetUIText(content,Table.Instance.DiplomacyDataAssets.DiplomacyUINotifyOfferAlly);
break;
case UINotifyCommonType.DiplomacyEmbassy:
MultilingualManager.Instance.SetUIText(content,Table.Instance.DiplomacyDataAssets.DiplomacyUINotifyEmbassy);
break;
case UINotifyCommonType.Tech:
content.text = "科技已学习";
break;
}
Timer.Instance.TimerRegister(this, AutoClose,1f,"UINotifyCommonView");
}
void AutoClose()
{
if(OnAutoClose != null)
OnAutoClose.Invoke();
}
}
}