105 lines
3.2 KiB
C#
105 lines
3.2 KiB
C#
using System.Collections.Generic;
|
|
using Logic.Action;
|
|
using Logic.CrashSight;
|
|
using Logic.Multilingual;
|
|
using RuntimeData;
|
|
using TH1_Core.Events;
|
|
using TH1_Logic.Core;
|
|
using TH1Resource;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace TH1_UI.View.Info
|
|
{
|
|
public class UIInfoDiplomacyView : Base.View
|
|
{
|
|
public Button closeButton;
|
|
public TextMeshProUGUI Title;
|
|
public Image Avatar;
|
|
public Image WarStateBG;
|
|
public TextMeshProUGUI WarStateText;
|
|
|
|
public TextMeshProUGUI NoMeetText;
|
|
public TextMeshProUGUI RelationText;
|
|
public GameObject RelationBar;
|
|
public RectTransform RelationHandle;
|
|
public GameObject BubbleChat;
|
|
public TextMeshProUGUI BubbleChatText;
|
|
|
|
public Button AllyButton;
|
|
public Transform EmbassyButton;
|
|
|
|
|
|
public ViDelegateAssisstant.Dele OnBtnCloseClick;
|
|
|
|
protected override void InitStart()
|
|
{
|
|
base.InitStart();
|
|
closeButton.onClick.RemoveAllListeners();
|
|
closeButton.onClick.AddListener(() => { OnBtnCloseClick.Invoke(); });
|
|
}
|
|
|
|
public void SetContent(uint pid)
|
|
{
|
|
if (!Main.MapData.PlayerMap.GetPlayerDataByPlayerID(pid, out var player)) return;
|
|
if (!Table.Instance.PlayerDataAssets.GetPlayerInfo(player, out var info)) return;
|
|
var selfp = Main.MapData.PlayerMap.SelfPlayerData;
|
|
player.DiplomacyData.GetCountryDiplomacyInfo(selfp.Id, out var dipInfo);
|
|
var dipTable = Table.Instance.DiplomacyDataAssets;
|
|
|
|
//step #1 设置title
|
|
if (Title != null && Title.gameObject.GetComponent<MultilingualTextMono>() != null)
|
|
{
|
|
var mid = Title.gameObject.GetComponent<MultilingualTextMono>().ID;
|
|
var forceName = MultilingualManager.Instance.GetMultilingualText(uint.Parse(info.ForceName));
|
|
MultilingualManager.Instance.SetUIText(Title,mid.ToString(),new List<string>(){forceName});
|
|
}
|
|
|
|
//step #2 设置avatar和warstate
|
|
if (Avatar != null)
|
|
Avatar.sprite = info.LeaderIllustration;
|
|
if (WarStateBG != null && WarStateText!= null && dipTable.GetStateInfo(dipInfo.DiplomacyState,out var stateInfo))
|
|
{
|
|
WarStateBG.material = stateInfo.stateBGMat;
|
|
MultilingualManager.Instance.SetUIText(WarStateText,stateInfo.stateText) ;
|
|
}
|
|
|
|
//step #3 设置relation
|
|
if (NoMeetText != null && RelationHandle != null && RelationText != null && RelationBar != null && dipTable.GetFeelingInfo(dipInfo.FeelingState,out var feelingInfo))
|
|
{
|
|
//如果对方还未发现我们
|
|
if (dipInfo.DiplomacyState == DiplomacyState.NoDiplomacy)
|
|
{
|
|
NoMeetText.gameObject.SetActive(true);
|
|
RelationBar.SetActive(false);
|
|
RelationText.gameObject.SetActive(false);
|
|
}
|
|
//如果对方已经发现了我们
|
|
else
|
|
{
|
|
NoMeetText.gameObject.SetActive(false);
|
|
RelationBar.SetActive(true);
|
|
RelationText.gameObject.SetActive(true);
|
|
MultilingualManager.Instance.SetUIText(RelationText,feelingInfo.feelingText);
|
|
RelationText.color = feelingInfo.feelingColor;
|
|
RelationHandle.anchoredPosition = new Vector2(Mathf.Lerp(-330f, -30f, dipInfo.FeelingValue/100f),RelationHandle.anchoredPosition.y);
|
|
}
|
|
|
|
}
|
|
|
|
//step #4 设置Action List
|
|
if (AllyButton != null && EmbassyButton != null)
|
|
{
|
|
//先处理AllyButton
|
|
//if(selfp.TechTree.CheckActionCan(new CommonActionId(ActionType)))
|
|
}
|
|
|
|
//Step #5 设置该玩家和其他玩家的关系
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|