71 lines
2.3 KiB
C#
71 lines
2.3 KiB
C#
using System.Collections.Generic;
|
|
using Logic.Audio;
|
|
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 OnInit()
|
|
{
|
|
base.OnInit();
|
|
//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:
|
|
MultilingualManager.Instance.SetUIText(content,Table.Instance.TextDataAssets.NotifyUITechHint);
|
|
break;
|
|
case UINotifyCommonType.ExamineTech:
|
|
MultilingualManager.Instance.SetUIText(content,Table.Instance.TextDataAssets.NotifyUIExamineTechHint);
|
|
break;
|
|
case UINotifyCommonType.ExamineCityExp:
|
|
MultilingualManager.Instance.SetUIText(content,Table.Instance.TextDataAssets.NotifyUIExamineCityExpHint);
|
|
break;
|
|
case UINotifyCommonType.TurnHint:
|
|
MultilingualManager.Instance.SetUIText(content,Table.Instance.TextDataAssets.NotifyUITurnHint,new List<string>(){(Main.MapData.CurPlayer.Turn + 1).ToString()});
|
|
AudioManager.Instance.PlayAudio("SFX/start");
|
|
break;
|
|
case UINotifyCommonType.InfiltrateStealCoin:
|
|
MultilingualManager.Instance.SetUIText(content,Table.Instance.TextDataAssets.NotifyUIInfiltrateStealCoin,new List<string>(){eventType.IntParam.ToString()});
|
|
break;
|
|
}
|
|
Timer.Instance.TimerRegister(this, AutoClose,1f,"UINotifyCommonView");
|
|
}
|
|
|
|
void AutoClose()
|
|
{
|
|
if(OnAutoClose != null)
|
|
OnAutoClose.Invoke();
|
|
}
|
|
}
|
|
|
|
}
|