This commit is contained in:
SoulliesOfficial
2026-06-05 04:45:57 -04:00
parent 3a63641a2c
commit 7c60c40d6b
377 changed files with 10970 additions and 843 deletions

View File

@@ -1,25 +1,31 @@
namespace Ichni.RhythmGame
{
/// <summary>
/// 轻量级核心服务定位器,允许游戏编辑器分别注册自己的时间引擎
/// 轻量级核心服务定位器,允许游戏本体与谱面编辑器分别注册自己的时间引擎
/// </summary>
public static class CoreServices
{
public static ISongTimeProvider TimeProvider { get; set; }
/// <summary>
/// 集中式元素更新调度器。
/// 所有 GameElement 子类应通过此属性访问调度器进行 Register / Unregister
/// 而非直接引用 EditorManager 或 GameManager。
/// </summary>
public static ElementUpdateScheduler UpdateScheduler { get; set; }
}
/// <summary>
/// 全局时间供应器接口
/// 无论是在游戏本体还是在谱面编辑器,一切与时间强相关的运作(特效、生成、判定
/// 全局时间供应器接口
/// 无论是在游戏本体还是在谱面编辑器,一切与时间强相关的运作(特效、动画、生成)
/// 只能依赖此接口,严禁直接调用 GameManager
/// </summary>
public interface ISongTimeProvider
{
/// <summary>当前音频的播放进度时间 (秒)</summary>
/// <summary>当前音频的播放进度时间(秒),已扣除 offset</summary>
float SongTime { get; }
/// <summary>当前时间轴是否处于流转播放状态</summary>
bool IsPlaying { get; }
}
}
}

View File

@@ -0,0 +1,22 @@
namespace Ichni.RhythmGame
{
/// <summary>
/// 所有参与集中更新调度的元素需实现的接口。
/// 同一元素可注册到多个 <see cref="UpdatePhase"/>
/// 通过 <paramref name="phase"/> 参数区分当前所处阶段并执行对应逻辑。
/// </summary>
public interface IScheduledElement
{
/// <summary>
/// 由 <see cref="ElementUpdateScheduler"/> 在对应阶段调用。
/// </summary>
/// <param name="phase">当前执行的更新阶段</param>
/// <param name="songTime">当前音频播放时间(秒)</param>
void ScheduledUpdate(UpdatePhase phase, float songTime);
/// <summary>
/// 元素是否处于活跃状态。调度器跳过非活跃元素以节省开销。
/// </summary>
bool IsScheduledActive { get; }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8b0489cd9b9f44b4f9a7c73cf2b07de2

View File

@@ -2,7 +2,6 @@ using System;
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UniRx;
using UnityEngine;
using UnityEngine.Events;
@@ -21,7 +20,7 @@ namespace Ichni.RhythmGame
{
gameElementList = new List<GameElement>();
lowPriorityActions = new List<UnityAction>();
Observable.EveryUpdate().Subscribe(_ => ExecuteLowPriorityActions());
// UniRx Observable.EveryUpdate 已移除:低优先级操作由 ElementUpdateScheduler Phase 8 在 TickLate 中驱动
}
public void ExecuteLowPriorityActions()

View File

@@ -0,0 +1,38 @@
namespace Ichni.RhythmGame
{
/// <summary>
/// 集中式更新调度器的阶段定义。
/// 每帧按数值升序执行,保证严格的依赖顺序:
/// 动画先于变换应用 → 变换先于 Spline 重建 → 轨道先于音符。
/// 数值留有间隔,便于未来插入新阶段。
/// </summary>
public enum UpdatePhase
{
/// <summary>判定元素激活/隐藏状态</summary>
TimeDuration = 0,
/// <summary>更新动画值,设置脏标记</summary>
Animation = 10,
/// <summary>执行 DirtyRefresh + Transform + Color</summary>
Apply = 20,
/// <summary>手动重建 Dreamteck SplineComputer同时执行 LookAt 等 Transform 后处理覆盖</summary>
SplineRebuild = 30,
/// <summary>更新轨道时间、裁剪区间</summary>
TrackCore = 40,
/// <summary>更新轨道跟踪器CrossTrackPoint / HeadPoint / PercentPoint 等)</summary>
TrackFollower = 50,
/// <summary>音符可见性、轨道位置、判定、特效</summary>
Note = 60,
/// <summary>ParticleEmitter / TimeEffectsCollection / ParticleTracker 等特效</summary>
Effect = 70,
/// <summary>SkyboxSubsetter / LowPriorityActions 等杂项</summary>
Misc = 80
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5b8c1372937779c4ab43eeddbce7cf29