using System; using System.Collections; using System.Collections.Generic; using Ichni.RhythmGame.Beatmap; using UnityEngine; using UnityEngine.Events; namespace Ichni.RhythmGame { public class BeatmapContainer : IBaseElement { public List gameElementList; [NonSerialized] public List lowPriorityActions; public BaseElement_BM matchedBM { get; set; } public BeatmapContainer() { gameElementList = new List(); lowPriorityActions = new List(); // UniRx Observable.EveryUpdate 已移除:低优先级操作由 ElementUpdateScheduler Phase 8 在 TickLate 中驱动 } public void ExecuteLowPriorityActions() { if (lowPriorityActions.Count > 0) { lowPriorityActions.ForEach(low => low.Invoke()); lowPriorityActions.Clear(); } } /// /// Rebuilds the list of elements whose active state is driven by a finite time duration. /// This preserves the existing runtime filter, while avoiding a LINQ allocation during /// every project load. /// public void RebuildRuntimeTimeDurations() { List runtimeTimeDurations = GameManager.Instance.timeDurations; runtimeTimeDurations.Clear(); float songLength = GameManager.Instance.songInformation.songLength; for (int i = 0; i < gameElementList.Count; i++) { if (gameElementList[i] is not IHaveTimeDurationSubmodule timeDurationHost) { continue; } TimeDurationSubmodule timeDuration = timeDurationHost.timeDurationSubmodule; if (timeDuration != null && (timeDuration.startTime > 0f || timeDuration.endTime < songLength)) { runtimeTimeDurations.Add(timeDuration); } } } /// /// Immediately applies the active state for the registered time-duration elements. /// Used at loading-state boundaries so the first rendered frame already matches the /// current song timeline. /// public void SyncRuntimeTimeDurationStates(float songTime) { List runtimeTimeDurations = GameManager.Instance.timeDurations; for (int i = 0; i < runtimeTimeDurations.Count; i++) { runtimeTimeDurations[i]?.DetectAndSwitchActiveState(songTime); } } public void SetUpInspector() { throw new System.NotImplementedException(); } public void Refresh() { throw new System.NotImplementedException(); } } }