This commit is contained in:
2026-10-02 17:29:47 +08:00
parent 47d427a6f3
commit fa6214375d
4 changed files with 58 additions and 19 deletions
@@ -15028,7 +15028,7 @@ PrefabInstance:
- target: {fileID: 3429558903206714841, guid: 6c8512965de208f498306fbdfeb8eb5b,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3783151213167614958, guid: 6c8512965de208f498306fbdfeb8eb5b,
type: 3}
@@ -15038,7 +15038,7 @@ PrefabInstance:
- target: {fileID: 3783151213167614958, guid: 6c8512965de208f498306fbdfeb8eb5b,
type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6114408877341087527, guid: 6c8512965de208f498306fbdfeb8eb5b,
type: 3}
@@ -15173,7 +15173,7 @@ PrefabInstance:
- target: {fileID: 7125234996501131867, guid: 6c8512965de208f498306fbdfeb8eb5b,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7125234996501131867, guid: 6c8512965de208f498306fbdfeb8eb5b,
type: 3}
@@ -21,6 +21,14 @@ public class GameMainPanel_XJMH : GameMainPanel_FishBase
public GoldColumnController goldColumnController;
private GoldColumnController _goldColumn;
[Header("金币柱位置(面板上实时调,每次出柱生效)")]
[Tooltip("首柱相对座位的 X 偏移(以此处为准,控制器组件上的同名字段会被覆盖)")]
public float goldColumnOffsetX = 150f;
[Tooltip("相邻金币柱的 X 间距")]
public float goldColumnDeltaX = 40f;
[Tooltip("金币柱 Y(相对面板底边,0=贴着底边往上长)")]
public float goldColumnOffsetY = 0f;
public override void Awake()
{
base.Awake();
@@ -111,6 +119,11 @@ public class GameMainPanel_XJMH : GameMainPanel_FishBase
_goldColumn.Init(transform as RectTransform);
}
// ⭐ 位置参数以面板上的字段为准(每次出柱前同步,Play 模式下改完立即生效)
_goldColumn.offsetX = goldColumnOffsetX;
_goldColumn.deltaX = goldColumnDeltaX;
_goldColumn.offsetY = goldColumnOffsetY;
bool isSelf = currSitData != null && sit == currSitData;
_goldColumn.ShowOne(sit, earn, isSelf);
}
@@ -108,7 +108,7 @@ public class GoldColumnController : MonoBehaviour
_selfTemplate = FindChildByName(_panelRoot, selfTemplateName)?.gameObject;
_otherTemplate = FindChildByName(_panelRoot, otherTemplateName)?.gameObject;
if (_selfTemplate == null || _otherTemplate == null)
{
Debug.LogWarning($"[GoldColumn] 未在面板下找到模板 {selfTemplateName}({_selfTemplate != null}) / " +
@@ -261,19 +261,22 @@ public class GoldColumnController : MonoBehaviour
$"barW={_barWidth} text={item.numText != null} tmp={item.numTmp != null}");
// 生长(动画 sizeDelta.y,不能动 fillAmount:柱头/数字锚在父顶边,靠父变高上移)
item.rt.DOKill();
// ⭐ 尺寸/位移用各自独立的 tween:补位平移时只打断位移,绝不动尺寸,否则柱高会卡在半途
item.sizeTween?.Kill();
item.moveTween?.Kill();
item.alphaTween?.Kill();
item.moveTween = null;
item.rt.sizeDelta = new Vector2(_barWidth, 0f);
item.alpha = 0f;
ApplyAlpha(item, 0f);
item.rtTween = item.rt.DOSizeDelta(new Vector2(_barWidth, aimHeight), growDuration).SetEase(Ease.OutCubic);
item.sizeTween = item.rt.DOSizeDelta(new Vector2(_barWidth, aimHeight), growDuration).SetEase(Ease.OutCubic);
item.alphaTween = DOTween.To(() => item.alpha, a => { item.alpha = a; ApplyAlpha(item, a); }, 1f, growDuration)
.SetEase(Ease.OutQuad);
list.Add(item);
// 单根独占时走 holdDuration(PW:EnterAction 里 index==1 → 2 秒)
if (list.Count == 1)
if (item.index == 0)
item.holdRemaining = holdDuration;
}
@@ -284,23 +287,42 @@ public class GoldColumnController : MonoBehaviour
if (list.Count == 0) return;
var head = list[0];
head.fading = true;
list.RemoveAt(0);
if (head.fading) return; // 已在淡出中
head.rtTween?.Kill();
// ⭐ 队头淡出期间仍留在列表里占 0 号位:这 0.3s 内新柱的序号从 1 起,
// 不会生成到 0 号位跟正在淡出的柱重叠;等淡完(复刻 PW onEnd)再从列表移除 + 回收 + 补位
head.fading = true;
head.sizeTween?.Kill();
head.moveTween?.Kill();
head.alphaTween?.Kill();
head.alphaTween = DOTween.To(() => head.alpha, a => { head.alpha = a; ApplyAlpha(head, a); }, 0f, fadeDuration)
.SetEase(Ease.InQuad)
.OnComplete(() => RecycleItem(head));
.OnComplete(() =>
{
var l = _list != null && pos < _list.Length ? _list[pos] : null;
if (l != null)
{
if (l.Count > 0 && l[0] == head) l.RemoveAt(0);
else l.Remove(head);
}
RecycleItem(head);
ShiftAfterHead(pos);
});
}
/// <summary>队头淡出完成后:剩余柱按新序号补位(用 basePos 绝对定位,避免多次补位误差累积)。</summary>
private void ShiftAfterHead(int pos)
{
var list = _list[pos];
if (list == null) return;
// 补位:所有剩余柱 index-1,向座位方向移动 deltaX
for (int i = 0; i < list.Count; i++)
{
var item = list[i];
item.index = i;
float targetX = item.rt.anchoredPosition.x - item.sign * deltaX;
item.rtTween?.Kill();
item.rtTween = item.rt.DOAnchorPosX(targetX, shiftDuration).SetEase(Ease.Linear);
float targetX = item.basePos.x + item.sign * (offsetX + i * deltaX);
item.moveTween?.Kill();
item.moveTween = item.rt.DOAnchorPosX(targetX, shiftDuration).SetEase(Ease.Linear);
}
// 新队头停顿(PW:队伍数量 > 3 → 0,否则 crowdDelay)
@@ -379,8 +401,10 @@ public class GoldColumnController : MonoBehaviour
{
if (item == null) return;
item.rt?.DOKill();
item.sizeTween?.Kill();
item.moveTween?.Kill();
item.alphaTween?.Kill();
item.moveTween = null;
var pool = item.isSelf ? _poolSelf : _poolOther;
if (pool.Count < preloadNum)
@@ -399,7 +423,8 @@ public class GoldColumnController : MonoBehaviour
private void DestroyItem(GoldColumnItem item)
{
if (item == null) return;
item.rt?.DOKill();
item.sizeTween?.Kill();
item.moveTween?.Kill();
item.alphaTween?.Kill();
if (item.go != null) Destroy(item.go);
}
@@ -495,7 +520,8 @@ public class GoldColumnController : MonoBehaviour
public bool fading;
public float alpha;
public Tween rtTween;
public Tween alphaTween;
public Tween sizeTween; // 生长/尺寸
public Tween moveTween; // 补位平移
public Tween alphaTween; // 淡入/淡出
}
}