Update
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.MainGame.UI
|
||||
@@ -13,6 +14,10 @@ namespace Continentis.MainGame.UI
|
||||
public float cardSpacingFactor = 500f; // 手牌间距调整因子
|
||||
public float maxVerticalOffset = 50f; // 控制最外侧卡牌的垂直偏移
|
||||
|
||||
[SerializeField]
|
||||
[ReadOnly]
|
||||
private float cardSpacing;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isUpdatingLayout)
|
||||
@@ -26,7 +31,7 @@ namespace Continentis.MainGame.UI
|
||||
if (count == 0 || index < 0)
|
||||
return Vector2.zero;
|
||||
|
||||
float cardSpacing = cardSpacingBase + Mathf.Max((cardSpacingFactor - (count * 20)), -200) / count;
|
||||
cardSpacing = cardSpacingBase + Mathf.Max((cardSpacingFactor - (count * 40)), -200) / count;
|
||||
|
||||
// 计算中间索引,保证手牌居中排列
|
||||
float midIndex = (count - 1) / 2f;
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Continentis.MainGame.UI
|
||||
{
|
||||
base.Awake();
|
||||
cardViews = new List<CardViewBase>();
|
||||
UpdateCountText();
|
||||
}
|
||||
|
||||
public virtual void AddCard(CardViewBase cardObject)
|
||||
|
||||
Reference in New Issue
Block a user