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

@@ -10,7 +10,7 @@ using UnityEngine.Serialization;
namespace Ichni.RhythmGame
{
public partial class Track : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule
public partial class Track : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule, IScheduledElement
{
#region [] Essential Configs
public GameObject trackRenderer;
@@ -50,7 +50,11 @@ namespace Ichni.RhythmGame
{
base.AfterInitialize();
GameManager.Instance.trackManager.RegisterTrack(this);
// 保留 TrackManager 注册以维持 ManualLateUpdate 的 refreshedThisFrame 清除逻辑
GameManager.Instance.trackManager.RegisterTrack(this);
// 注册调度器 Phase 4TrackCore驱动 ManualUpdate
CoreServices.UpdateScheduler.Register(UpdatePhase.TrackCore, this);
CoreServices.UpdateScheduler.RegisterTrackSpline(this);
if (trackPathSubmodule != null && trackPathSubmodule.pathNodeList.Count > 3)
{
@@ -77,6 +81,15 @@ namespace Ichni.RhythmGame
{
if(trackPathSubmodule != null) trackPathSubmodule.refreshedThisFrame = false;
}
#region [IScheduledElement] Scheduler Interface
public void ScheduledUpdate(UpdatePhase phase, float songTime)
{
ManualUpdate(songTime);
}
public bool IsScheduledActive => isActiveAndEnabled;
#endregion
#endregion
#region [] Behavior Overrides
@@ -91,6 +104,8 @@ namespace Ichni.RhythmGame
public override void OnDelete()
{
GameManager.Instance.trackManager.UnregisterTrack(this);
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackCore, this);
CoreServices.UpdateScheduler.UnregisterTrackSpline(this);
if (parentElement is ElementFolder folder) folder.trackList.Remove(this);
}
#endregion

View File

@@ -9,7 +9,7 @@ using UnityEngine;
namespace Ichni.RhythmGame
{
public partial class CrossTrackPoint : GameElement, IHaveTimeDurationSubmodule
public partial class CrossTrackPoint : GameElement, IHaveTimeDurationSubmodule, IScheduledElement
{
#region [] Essential Configs
public ElementFolder trackListFolder;
@@ -45,10 +45,16 @@ namespace Ichni.RhythmGame
public override void AfterInitialize()
{
GameManager.Instance.trackManager.RegisterCrossPoint(this);
CoreServices.UpdateScheduler.Register(UpdatePhase.TrackFollower, this);
base.AfterInitialize();
}
public override void OnDelete()
{
base.OnDelete();
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
}
public override void SetDefaultSubmodules()
{
timeDurationSubmodule = new TimeDurationSubmodule(this);
@@ -68,11 +74,20 @@ namespace Ichni.RhythmGame
trackPercent.returnType == FlexibleReturnType.After)
{
trackPositioner.SetPercent(1);
GameManager.Instance.trackManager.UnregisterCrossPoint(this);
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
}
}
}
#region [IScheduledElement] Scheduler Interface
public void ScheduledUpdate(UpdatePhase phase, float songTime)
{
ManualUpdate(songTime);
}
public bool IsScheduledActive => isActiveAndEnabled;
#endregion
private void SetPoint()
{
if (nowAttachedTrackIndex != trackSwitch.value &&
@@ -82,6 +97,7 @@ namespace Ichni.RhythmGame
nowAttachedTrack = trackListFolder.trackList[trackSwitch.value];
nowAttachedTrackIndex = trackSwitch.value;
trackPositioner.spline = trackListFolder.trackList[trackSwitch.value].trackPathSubmodule.path;
trackPositioner.RebuildImmediate();
}
trackPositioner.SetPercent(trackPercent.value);

View File

@@ -8,7 +8,7 @@ using UnityEngine;
namespace Ichni.RhythmGame
{
public partial class TrackHeadPoint : GameElement, IHaveTimeDurationSubmodule
public partial class TrackHeadPoint : GameElement, IHaveTimeDurationSubmodule, IScheduledElement
{
#region [] Essential Configs
public Track track;
@@ -53,9 +53,15 @@ namespace Ichni.RhythmGame
public override void AfterInitialize()
{
GameManager.Instance.trackManager.RegisterHeadPoint(this);
CoreServices.UpdateScheduler.Register(UpdatePhase.TrackFollower, this);
base.AfterInitialize();
}
public override void OnDelete()
{
base.OnDelete();
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
}
#endregion
#region [] Main Update
@@ -68,9 +74,18 @@ namespace Ichni.RhythmGame
if(track.timeDurationSubmodule.CheckAfterEndTime(currentSongTime))
{
GameManager.Instance.trackManager.UnregisterHeadPoint(this);
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
}
}
#region [IScheduledElement] Scheduler Interface
public void ScheduledUpdate(UpdatePhase phase, float songTime)
{
ManualUpdate(songTime);
}
public bool IsScheduledActive => isActiveAndEnabled;
#endregion
#endregion
}

View File

@@ -13,7 +13,7 @@ namespace Ichni.RhythmGame
/// <summary>
/// 在轨道上根据百分比进行运动的点
/// </summary>
public partial class TrackPercentPoint : GameElement, IHaveTimeDurationSubmodule
public partial class TrackPercentPoint : GameElement, IHaveTimeDurationSubmodule, IScheduledElement
{
#region [] Essential Configs
public Track track;
@@ -52,9 +52,15 @@ namespace Ichni.RhythmGame
public override void AfterInitialize()
{
GameManager.Instance.trackManager.RegisterPercentPoint(this);
CoreServices.UpdateScheduler.Register(UpdatePhase.TrackFollower, this);
base.AfterInitialize();
}
public override void OnDelete()
{
base.OnDelete();
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
}
#endregion
#region [] Main Update
@@ -73,10 +79,19 @@ namespace Ichni.RhythmGame
if (trackPercent.returnType == FlexibleReturnType.After)
{
trackPositioner.SetPercent(1);
GameManager.Instance.trackManager.UnregisterPercentPoint(this);
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
}
}
}
#region [IScheduledElement] Scheduler Interface
public void ScheduledUpdate(UpdatePhase phase, float songTime)
{
ManualUpdate(songTime);
}
public bool IsScheduledActive => isActiveAndEnabled;
#endregion
#endregion
}

View File

@@ -65,14 +65,17 @@ namespace Ichni.RhythmGame
path.type = Spline.Type.Linear;
path.sampleRate = 1;
}
if (isClosed)
if (pathNodeList.Count >= 3)
{
path.Close();
}
else
{
path.Break();
if (isClosed)
{
path.Close();
}
else
{
path.Break();
}
}
}

View File

@@ -14,6 +14,11 @@ namespace Ichni.RhythmGame
public string materialThemeBundleName;
public string materialName;
public string customTextureThemeBundleName = "None";
public string customTextureName = "None";
public MeshGenerator.UVMode uvMode = MeshGenerator.UVMode.UniformClip;
public float uvRotation = 0f;
public float size = 1f;
public bool enableEmission;
public float emissionIntensity;
public bool zWrite;
@@ -86,6 +91,9 @@ namespace Ichni.RhythmGame
{
meshGenerator.uvScale = uvScale;
meshGenerator.uvOffset = uvOffset;
meshGenerator.uvRotation = uvRotation;
meshGenerator.uvMode = uvMode;
meshGenerator.size = size;
}
}
#endregion

View File

@@ -32,8 +32,8 @@ namespace Ichni.RhythmGame
this.splineRenderer.updateMethod = SplineUser.UpdateMethod.Update;
this.meshRenderer.material = renderMaterial;
this.splineRenderer.color = Color.white;
this.splineRenderer.uvRotation = 90;
this.splineRenderer.uvMode = MeshGenerator.UVMode.UniformClip;
this.uvRotation = 0f;
this.uvMode = MeshGenerator.UVMode.UniformClip;
SetMesh();
}

View File

@@ -31,8 +31,8 @@ namespace Ichni.RhythmGame
this.pathGenerator.updateMethod = SplineUser.UpdateMethod.Update;
this.meshRenderer.material = renderMaterial;
this.pathGenerator.color = Color.white;
this.pathGenerator.uvRotation = 90;
this.pathGenerator.uvMode = MeshGenerator.UVMode.UniformClip;
this.uvRotation = 90f;
this.uvMode = MeshGenerator.UVMode.UniformClip;
SetMesh();
}

View File

@@ -56,7 +56,10 @@ namespace Ichni.RhythmGame
{
track.trackRendererSubmodule.meshGenerator.clipFrom = tailPercent;
track.trackRendererSubmodule.meshGenerator.clipTo = headPercent;
track.trackRendererSubmodule.meshGenerator.RebuildImmediate();
}
//track.trackPathSubmodule.path.Rebuild(true);
}
public float GetTrackPercent(float songTimeInTime)

View File

@@ -1,18 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ObjectTracker : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@@ -8,7 +8,7 @@ using UnityEngine.Serialization;
namespace Ichni.RhythmGame
{
public partial class ParticleTracker : GameElement, IHaveParticles, IHaveColorSubmodule
public partial class ParticleTracker : GameElement, IHaveParticles, IHaveColorSubmodule, IScheduledElement
{
#region [] Essential Configs
public Track track;
@@ -66,6 +66,18 @@ namespace Ichni.RhythmGame
{
colorSubmodule = new ColorSubmodule(this, Color.white, true, Color.white, 0);
}
public override void AfterInitialize()
{
base.AfterInitialize();
CoreServices.UpdateScheduler.Register(UpdatePhase.Effect, this);
}
public override void OnDelete()
{
base.OnDelete();
CoreServices.UpdateScheduler.Unregister(UpdatePhase.Effect, this);
}
#endregion
#region [] Runtime Settings
@@ -91,9 +103,8 @@ namespace Ichni.RhythmGame
#region [] Main Update
public partial class ParticleTracker
{
private void Update()
private void UpdateParticlePlayState(float songTime)
{
float songTime = CoreServices.TimeProvider.SongTime;
if (playTime > songTime || stopTime < songTime)
{
particle.Stop();
@@ -106,6 +117,15 @@ namespace Ichni.RhythmGame
}
}
}
#region [IScheduledElement] Scheduler Interface
public void ScheduledUpdate(UpdatePhase phase, float songTime)
{
UpdateParticlePlayState(songTime);
}
public bool IsScheduledActive => isActiveAndEnabled;
#endregion
}
#endregion