using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using asap.core; using Assets.Scripts.UI.AnimationSimulator; using GameCore; using cfg; using DataCenter; using DG.Tweening; using EnhancedUI.EnhancedScroller; using EventPartnerGather; using game; using Game; using TMPro; using UniRx; using UnityEngine; using UnityEngine.Serialization; using UnityEngine.UI; using EEventBuildState = EventPartnerGatherRequests.EEventBuildState; using Tween = DG.Tweening.Tween; namespace UI.PartnerGather.Mining { /// /// 事件合作伙伴抽奖挖矿面板控制器 /// 负责管理抽奖转盘UI、挖矿进度显示、场景控制器绑定等核心功能 /// /// 建议挂载在:EventPartnerDrawMiningPanel UI预制体的根对象上 /// /// UI结构建议: /// EventPartnerDrawMiningPanel (挂载此脚本) /// ├── root/ /// │ ├── turntable/Scroll_item (转盘滚动区域) /// │ ├── btn_common_green/btn_green (抽奖按钮) /// │ └── turnable/select (选中效果) /// ├── btn_close (关闭按钮) /// └── SettlementPanel/ (结算面板,可选) /// ├── Rewards/ (奖励显示区域) /// └── Trophy/ (奖杯显示区域) /// /// 重要说明: /// - 此脚本会自动查找和绑定采集场景控制器 /// - 需要正确设置转盘相关的UI引用 /// - 支持节点结算过场动画和奖杯显示系统 /// /// // public class SpinItemData // { // public EventPartnerMineSpinPoint spinPoint; // public int _dataId; // public float _moreValue = 0F; // public int _multiple = 1; // public bool isSelected = false; // } public class EventPartnerDrawMiningPanel : BasePanel, IEnhancedScrollerDelegate { private const bool EnableTraceLogs = false; // 管理器 private EventPartnerGatherManager _manager; [Header("倍数选择")] [SerializeField] private EventPartnerMiningMultiplierController multiplierController; // [Header("采集场景配置(运行时自动设置)")] [SerializeField] private EventPartnerMiningSceneController miningScene; private bool _isProcessingResult = false; [Header("Complete Spin Curve")] [SerializeField] private AnimationCurve completeMoveProfile; [FormerlySerializedAs("AnimationSimulator")] [Header("转盘移动参数")] public AnimationSimulatorComponent animationSimulator; #region LEVEL_BAR // 更新点数即等级 [Header("=== 等级进度显示 ===")] [Tooltip("等级节点控制器数组 - 每个节点对应一个挖矿阶段")] public EventPartnerMiningLevelController[] levels; private readonly List _levelBars = new(); // private readonly List _levelTransform = new(); private const float FillTime = 0.4f; #endregion private Transform _turntable; // 转盘 // private PanelScroll _scrollList; // 滚动列表 // 滚动列表 private EnhancedScroller _enhancedScroller; // Cell private EventPartnerSpinItemView _cellView; private Transform _select; // 选中效果 private Transform _priceItem; // 列表滚动中的数据 private Button _clickMask; private Button _btnDebug; // 按钮 private Button _btnClose; private Button _btnSpin; private Button _btnMoreSpin; private Button _btnFreeSpin; // FreeSpin按钮 private Button _btnAdd; private Transform _transBtnSpin; private Transform _transMoreSpin; private Transform _transFreeSpin; private TMP_Text _txtMoreSpinTime; private Transform _iconTicket; private TMP_Text _ticketTextNum; // 切换倍率按钮 private Button _btnBeilv; private ScrollRect _scrollRect; private RectTransform _viewport; private RectTransform _content; private RectTransform _itemTemplate; // 记录当前的Item private readonly List _spinItemViews = new(); // private readonly List _dataIndexMap = new(); // private Transform tag_more; private Transform tag_super; private Transform tag_free; private Transform _fxUIFinished; // [Header("结算过场配置")] // public Transform settlementPanel; // 结算面板 // public Transform trophyDisplay; // 奖杯显示区域 // public Transform nodeCompletionEffect; // 节点完成特效 // public AudioClip settlementSound; // 结算音效 // public AudioClip trophySound; // 奖杯音效 private bool _isShowingSettlement = false; // 当前点数列表 // private List _spinPointDatas; // private readonly List _spinItemDatas = new (); // 0,1,2 停靠在第二个格子 private int _starGrid = 2; private float offsetX = 0; private int _dataCount; private int _poolSize; private float _itemWidth; private float _startX = 0f; private bool _animating; private float _autoScrollSpeed = 60f; private bool _autoScroll = false; // 自动滚动累积位移(用于与步进动画叠加) private float _autoScrollAccumulation = 0f; // 移动几个格子 private int _moveGridNum = 0; // 移动位移 private float _moveAccumulation = 0f; private float _autoMoveScrollAccumulation = 0f; // private Tween _spinSequence; // private float _totalDuration = 2.5f; [SerializeField] private float gridDuration = 0.1f; // 每个格子的速度 // 收集的点数 private int _currentPoints; // 当前的倍数 private int _multipleValue = 1; // // private float cellViewSize = 235.02f; // 当前的Spin 状态 public ESpinState CurrentSpinState { get; set; } private Timer _moreSpinTimer; // 定时器 private CompositeDisposable _disposables = new(); private void Awake() { // animationSimulator=this.GetComponent(); _manager = GContext.container.Resolve(); // _btnDebug = transform.Find("btn_debug").GetComponent