12.10 进度 基本完成
This commit is contained in:
@@ -5,6 +5,7 @@ using Continentis.MainGame.Combat;
|
||||
using DG.Tweening;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Continentis.MainGame.UI
|
||||
@@ -13,15 +14,16 @@ namespace Continentis.MainGame.UI
|
||||
{
|
||||
[Header("UI References")]
|
||||
[SerializeField] private GameObject portraitPrefab;
|
||||
[SerializeField] private Transform portraitsContainer;
|
||||
[SerializeField] private RectTransform currentTurnPointer;
|
||||
|
||||
[FormerlySerializedAs("portraitsContainer")] public Transform avatarContainer;
|
||||
|
||||
[Header("Animation Settings")]
|
||||
[SerializeField] private float rearrangeAnimDuration = 0.4f; // 头像重新排列的动画时长
|
||||
|
||||
[FormerlySerializedAs("portraitWidth")]
|
||||
[Header("Layout Settings")]
|
||||
[SerializeField] private float portraitWidth = 133f; // 单个头像的宽度
|
||||
[SerializeField] private float portraitSpacing = 0f; // 头像之间的间距
|
||||
[SerializeField] private float avatarWidth = 133f; // 单个头像的宽度
|
||||
[FormerlySerializedAs("portraitSpacing")] [SerializeField] private float avatarSpacing = 0f; // 头像之间的间距
|
||||
|
||||
private List<CharacterBase> actionOrder => CombatMainManager.Instance.characterController.actionOrderList;
|
||||
public List<CharacterAvatar> avatars = new List<CharacterAvatar>();
|
||||
@@ -57,7 +59,7 @@ namespace Continentis.MainGame.UI
|
||||
{
|
||||
LeanPool.Despawn(currentAvatar.gameObject);
|
||||
}).Play();
|
||||
|
||||
|
||||
// 播放重新排列动画
|
||||
RearrangePortraitsWithAnimation();
|
||||
}
|
||||
@@ -69,7 +71,7 @@ namespace Continentis.MainGame.UI
|
||||
// 核心函数:创建单个头像UI
|
||||
private CharacterAvatar CreatePortraitUI(CharacterBase character, int index)
|
||||
{
|
||||
CharacterAvatar avatar = LeanPool.Spawn(portraitPrefab, portraitsContainer).GetComponent<CharacterAvatar>();
|
||||
CharacterAvatar avatar = LeanPool.Spawn(portraitPrefab, avatarContainer).GetComponent<CharacterAvatar>();
|
||||
avatar.Initialize(character);
|
||||
avatar.GetComponent<RectTransform>().anchoredPosition = new Vector2(-900, 0);
|
||||
if (index >= 0 && index < avatars.Count)
|
||||
@@ -81,6 +83,7 @@ namespace Continentis.MainGame.UI
|
||||
{
|
||||
avatars.Add(avatar);
|
||||
}
|
||||
|
||||
return avatar;
|
||||
}
|
||||
|
||||
@@ -89,7 +92,7 @@ namespace Continentis.MainGame.UI
|
||||
{
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
{
|
||||
float targetX = -110 - i * (portraitWidth + portraitSpacing);
|
||||
float targetX = -110 - i * (avatarWidth + avatarSpacing);
|
||||
avatars[i].GetComponent<RectTransform>().anchoredPosition = new Vector2(targetX, 0);
|
||||
}
|
||||
}
|
||||
@@ -102,7 +105,7 @@ namespace Continentis.MainGame.UI
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
{
|
||||
// 计算每个头像的目标X坐标
|
||||
float targetX = -110 - i * (portraitWidth + portraitSpacing);
|
||||
float targetX = -110 - i * (avatarWidth + avatarSpacing);
|
||||
RectTransform rt = avatars[i].GetComponent<RectTransform>();
|
||||
|
||||
// 将移动动画加入到序列中
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
using Continentis.MainGame.Card;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Continentis.MainGame.UI
|
||||
{
|
||||
public class DiscardPile : PileBase
|
||||
public class DiscardPile : PileBase, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
string title = "Discard Pile";
|
||||
string description = $"When you discard cards, they go here. Currently, it has {cardViews.Count} cards.\n" +
|
||||
$"If the draw pile is empty, the discard pile will be shuffled to form a new draw pile.";
|
||||
RectTransform canvasTransform = CombatUIManager.Instance.combatMainPage.rectTransform;
|
||||
Vector2 basePosition = canvasTransform.InverseTransformPoint(rectTransform.position);
|
||||
InformationBox.Create(canvasTransform, ref infoBox).Initialize(title, description, basePosition);
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
InformationBox.Despawn(ref infoBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
using Continentis.MainGame.Card;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Continentis.MainGame.UI
|
||||
{
|
||||
public class DrawPile : PileBase
|
||||
public class DrawPile : PileBase, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
string title = "Draw Pile";
|
||||
string description = $"Contains the cards you can draw during your turn, now it have {cardViews.Count} cards.";
|
||||
RectTransform canvasTransform = CombatUIManager.Instance.combatMainPage.rectTransform;
|
||||
Vector2 basePosition = canvasTransform.InverseTransformPoint(rectTransform.position);
|
||||
InformationBox.Create(canvasTransform, ref infoBox).Initialize(title, description, basePosition);
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
InformationBox.Despawn(ref infoBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,23 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Continentis.MainGame.UI
|
||||
{
|
||||
public class ExhaustPile : PileBase
|
||||
public class ExhaustPile : PileBase, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
string title = "Exhaust Pile";
|
||||
string description = $"When you exhaust cards, they go here. Currently, it has {cardViews.Count} cards.\n" +
|
||||
$"Exhausted cards are usually removed from play for the rest of the combat.";
|
||||
RectTransform canvasTransform = CombatUIManager.Instance.combatMainPage.rectTransform;
|
||||
Vector2 basePosition = canvasTransform.InverseTransformPoint(rectTransform.position);
|
||||
InformationBox.Create(canvasTransform, ref infoBox).Initialize(title, description, basePosition);
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
InformationBox.Despawn(ref infoBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,11 +83,11 @@ namespace Continentis.MainGame.UI
|
||||
targetPos.y = 0;
|
||||
|
||||
cardRect.localPosition =
|
||||
Vector3.Lerp(cardRect.localPosition, targetPos + new Vector3(0, 150f, 0), Time.deltaTime * 20f);
|
||||
Vector3.Lerp(cardRect.localPosition, targetPos + new Vector3(0, 100f, 0), Time.deltaTime * 20f);
|
||||
cardRect.localRotation =
|
||||
Quaternion.Lerp(cardRect.localRotation, Quaternion.identity, Time.deltaTime * 20f);
|
||||
cardRect.localScale =
|
||||
Vector3.Lerp(cardRect.localScale, Vector3.one * 1.2f, Time.deltaTime * 20f);
|
||||
Vector3.Lerp(cardRect.localScale, Vector3.one, Time.deltaTime * 20f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -10,7 +10,14 @@ namespace Continentis.MainGame.UI
|
||||
{
|
||||
public List<CardViewBase> cardViews;
|
||||
public TMP_Text cardCountText;
|
||||
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
cardViews = new List<CardViewBase>();
|
||||
UpdateCountText();
|
||||
}
|
||||
|
||||
public virtual void AddCard(CardViewBase cardObject)
|
||||
{
|
||||
cardViews.Add(cardObject);
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Continentis.MainGame.UI
|
||||
}));
|
||||
|
||||
seq.AppendInterval(0.1f);
|
||||
seq.Append(CombatUIManager.Instance.combatMainPage.handPile.rectTransform.DOAnchorPosY(150f, 0.2f));
|
||||
seq.Append(CombatUIManager.Instance.combatMainPage.handPile.rectTransform.DOAnchorPosY(80f, 0.2f));
|
||||
seq.Play();
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Continentis.MainGame.UI
|
||||
playerHero.deckSubmodule.SetUpHandCardViews();
|
||||
}));
|
||||
seq.AppendInterval(0.1f);
|
||||
seq.Append(CombatUIManager.Instance.combatMainPage.handPile.rectTransform.DOAnchorPosY(150f, 0.2f));
|
||||
seq.Append(CombatUIManager.Instance.combatMainPage.handPile.rectTransform.DOAnchorPosY(80f, 0.2f));
|
||||
seq.Play();
|
||||
}
|
||||
else
|
||||
@@ -81,6 +81,9 @@ namespace Continentis.MainGame.UI
|
||||
public void UpdateTeamPileText(CombatTeam team)
|
||||
{
|
||||
int currentCardCount = team.deckSubmodule.HandPile.Count;
|
||||
|
||||
gameObject.SetActive(currentCardCount != 0);
|
||||
|
||||
teamPileText.text = $"{currentCardCount}/10";
|
||||
Debug.Log($"Updated team pile text: {teamPileText.text}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user