From d29421bf1c1a5a4a3db664111efe76ef446004b1 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期五, 20 三月 2026 16:24:28 +0800
Subject: [PATCH] 492 武将登场 实现招募历史滚动
---
Main/System/HeroDebut/HeroDebutCallHistoryOutCell.cs | 14 ++++--
Main/System/HeroDebut/HeroDebutCallWin.cs | 61 +++++++++++++++++++++++++++++-
2 files changed, 67 insertions(+), 8 deletions(-)
diff --git a/Main/System/HeroDebut/HeroDebutCallHistoryOutCell.cs b/Main/System/HeroDebut/HeroDebutCallHistoryOutCell.cs
index 560240f..1fad1cb 100644
--- a/Main/System/HeroDebut/HeroDebutCallHistoryOutCell.cs
+++ b/Main/System/HeroDebut/HeroDebutCallHistoryOutCell.cs
@@ -3,15 +3,19 @@
public class HeroDebutCallHistoryOutCell : HeroDebutCallHistoryCell
{
- [SerializeField] ButtonEx clickButton;
[SerializeField] CanvasGroup canvasGroup;
- float[] alphas = new float[4] { 0.45f, 0.60f, 0.80f, 1f };
+
public override void Display(int index, List<HeroDebutGameRec> list)
{
base.Display(index, list);
- clickButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallHistoryWin>());
+ }
- float alpha = alphas[index];
- canvasGroup.alpha = alpha;
+ // 鎻愪緵缁欏閮ㄨ缃�忔槑搴︾殑鏂规硶
+ public void SetAlpha(float alpha)
+ {
+ if (canvasGroup != null)
+ {
+ canvasGroup.alpha = alpha;
+ }
}
}
diff --git a/Main/System/HeroDebut/HeroDebutCallWin.cs b/Main/System/HeroDebut/HeroDebutCallWin.cs
index 8c31f02..87ab600 100644
--- a/Main/System/HeroDebut/HeroDebutCallWin.cs
+++ b/Main/System/HeroDebut/HeroDebutCallWin.cs
@@ -3,6 +3,7 @@
using UnityEngine.UI;
using DG.Tweening;
using System.Linq;
+using EnhancedUI.EnhancedScroller;
public class HeroDebutCallWin : UIBase
{
@@ -38,6 +39,7 @@
[SerializeField] TextEx rankTipText;
[SerializeField] ButtonEx rateButton;
[SerializeField] ScrollerController scroller;
+ [SerializeField] ButtonEx historyButton;
[SerializeField] UIHeroController lhController;
[SerializeField] UIHeroController uiHeroController;
[SerializeField] HeroDebutCallBubbleCell[] bubbleCell;
@@ -53,6 +55,7 @@
changeHeroButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallChangeWin>());
rankButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutRankWin>());
rateButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallRateWin>());
+ historyButton.SetListener(() => UIManager.Instance.OpenWindow<HeroDebutCallHistoryWin>());
previewButton.SetListener(OnClickPreview);
skipToggle.AddListener((value) =>
{
@@ -74,7 +77,6 @@
PackManager.Instance.RefreshItemEvent += RefreshItemEvent;
scroller.OnRefreshCell += OnRefreshCell;
manager.OnUpdateGameRecInfo += OnUpdateGameRecInfo;
- manager.OnUpdateHeroAppearPlayerInfoEvent += OnUpdateHeroAppearPlayerInfoEvent;
if (manager.isSendFirst)
{
@@ -104,6 +106,8 @@
manager.OnUpdateGameRecInfo -= OnUpdateGameRecInfo;
manager.OnUpdateHeroAppearPlayerInfoEvent -= OnUpdateHeroAppearPlayerInfoEvent;
}
+
+
// 1. 鍦ㄧ被涓0鏄庝竴涓叏灞�鐨� Sequence 鍙橀噺锛岀敤浜庣粺涓�绠℃帶鍔ㄧ敾
private Sequence heroAnimSeq;
@@ -322,19 +326,70 @@
_cell.Display(cell.index, list);
}
+ float autoScrollInterval = 2f;
+ private float autoScrollTimer = 0f;
+ private int currentScrollerIndex = 0;
+ private bool isScrollerReady = false; // 鍒ゅ畾鏍囧織
void CreateScroller()
{
- list = manager.GetLastFourRecords();
+ list = manager.GetGameRecList();
scroller.Refresh();
+
+ int listCount = list?.Count ?? 0;
if (list != null)
{
- for (int i = 0; i < list.Count; i++)
+ for (int i = 0; i < listCount; i++)
{
scroller.AddCell(ScrollerDataType.Header, i);
}
}
+
+
+ bool canScroll = listCount > 4;// 鍙湁鏁伴噺 > 4 鏃舵墠寮�鍚� Loop 鍜岃鏃跺櫒
+ scroller.m_Scorller.Loop = canScroll;
+ isScrollerReady = canScroll;
+
+ scroller.vertical = false;
+ scroller.horizontal = false;
scroller.Restart();
+
+ // 濡傛灉鏄惊鐜ā寮忥紝纭繚鍒濆浣嶇疆姝g‘
+ if (canScroll)
+ {
+ scroller.m_Scorller.JumpToDataIndex(0,
+ tweenType: EnhancedScroller.TweenType.immediate);
+ }
+ autoScrollTimer = 0f;
+ currentScrollerIndex = 0;
}
+ private void LateUpdate()
+ {
+ // 鍙湁鍦ㄦ暟鎹氨缁笖瓒呰繃 4 涓椂锛屾墠鎵ц璁℃椂閫昏緫
+ if (isScrollerReady)
+ {
+ autoScrollTimer += Time.deltaTime;
+ if (autoScrollTimer >= autoScrollInterval)
+ {
+ autoScrollTimer = 0f;
+ AutoScrollNext();
+ }
+ }
+ }
+ private void AutoScrollNext()
+ {
+ if (list?.Count <= 4)
+ {
+ isScrollerReady = false;
+ return;
+ }
+
+ currentScrollerIndex++;
+ // 鍦� Loop 妯″紡涓嬭繘琛屽钩婊戣烦杞�
+ scroller.m_Scorller.JumpToDataIndex(
+ currentScrollerIndex % list.Count,
+ tweenType: EnhancedScroller.TweenType.easeInOutQuad,
+ tweenTime: 0.5f);
+ }
}
--
Gitblit v1.8.0