74 lines
1.9 KiB
C#
74 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Logic;
|
|
using Logic.Action;
|
|
using Logic.Multilingual;
|
|
using Microsoft.Win32.SafeHandles;
|
|
using RuntimeData;
|
|
using TH1_Logic.Core;
|
|
using TH1_UI.View.Announce;
|
|
using TH1_UI.View.Info;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace TH1_UI.View.Interaction
|
|
{
|
|
public class UIInteractionCityLevelupView : Base.View
|
|
{
|
|
|
|
public TextMeshProUGUI Title;
|
|
public MultilingualTextMono TitleMultilingual;
|
|
public UIInfoCommonBaseActionCircleMono ChoiceCircleA;
|
|
public UIInfoCommonBaseActionCircleMono ChoiceCircleB;
|
|
|
|
private CommonActionId _choiceA;
|
|
private CommonActionId _choiceB;
|
|
public ViDelegateAssisstant.Dele OnItemClick;
|
|
protected override void OnInit()
|
|
{
|
|
base.OnInit();
|
|
|
|
|
|
|
|
}
|
|
|
|
public void SetContent(int cid, CommonActionId choiceA,CommonActionId choiceB,CommonActionParams choiceParamA,CommonActionParams choiceParamB,Action<CommonActionId,CommonActionParams> onChoice)
|
|
{
|
|
//Step #1 设置城市标题
|
|
_choiceA = choiceA;
|
|
_choiceB = choiceB;
|
|
if (Main.MapData.CityMap.GetCityById((uint)cid, out var city)
|
|
&& Table.Instance.CivDataAssets.GetCityInfo(city.Name, out var cityInfo))
|
|
MultilingualManager.Instance.SetUIText(Title,TitleMultilingual.ID.ToString(),new List<string>(){MultilingualManager.Instance.GetMultilingualTextSafe(cityInfo.CityName)});
|
|
|
|
//Step #2 设置ChoiceA
|
|
ChoiceCircleA.SetContent(choiceA,ShowType.None,choiceParamA,onChoice);
|
|
|
|
//Step #3 设置ChoiceB
|
|
ChoiceCircleB.SetContent(choiceB,ShowType.None,choiceParamB,onChoice);
|
|
}
|
|
|
|
public bool GetPos(CityLevelUpActionType actionType, out Vector3 pos)
|
|
{
|
|
pos = Vector3.zero;
|
|
if (_choiceA.CityLevelUpActionType == actionType)
|
|
{
|
|
pos = ChoiceCircleA.transform.position;
|
|
return true;
|
|
}
|
|
if (_choiceB.CityLevelUpActionType == actionType)
|
|
{
|
|
pos = ChoiceCircleB.transform.position;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|