2025-06-03 02:42:28 -04:00
|
|
|
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<GameElement> gameElementList;
|
|
|
|
|
|
|
|
|
|
[NonSerialized]
|
|
|
|
|
public List<UnityAction> lowPriorityActions;
|
|
|
|
|
|
|
|
|
|
public BaseElement_BM matchedBM { get; set; }
|
|
|
|
|
|
|
|
|
|
public BeatmapContainer()
|
|
|
|
|
{
|
|
|
|
|
gameElementList = new List<GameElement>();
|
|
|
|
|
lowPriorityActions = new List<UnityAction>();
|
2026-06-05 04:45:57 -04:00
|
|
|
// UniRx Observable.EveryUpdate 已移除:低优先级操作由 ElementUpdateScheduler Phase 8 在 TickLate 中驱动
|
2025-06-03 02:42:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ExecuteLowPriorityActions()
|
|
|
|
|
{
|
|
|
|
|
if (lowPriorityActions.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
lowPriorityActions.ForEach(low => low.Invoke());
|
|
|
|
|
lowPriorityActions.Clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-19 16:44:58 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// 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.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void RebuildRuntimeTimeDurations()
|
|
|
|
|
{
|
|
|
|
|
List<TimeDurationSubmodule> 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 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.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void SyncRuntimeTimeDurationStates(float songTime)
|
|
|
|
|
{
|
|
|
|
|
List<TimeDurationSubmodule> runtimeTimeDurations = GameManager.Instance.timeDurations;
|
|
|
|
|
for (int i = 0; i < runtimeTimeDurations.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
runtimeTimeDurations[i]?.DetectAndSwitchActiveState(songTime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-03 02:42:28 -04:00
|
|
|
public void SetUpInspector()
|
|
|
|
|
{
|
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Refresh()
|
|
|
|
|
{
|
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-19 16:44:58 -04:00
|
|
|
}
|