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,18 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Dodger : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@@ -6,7 +6,7 @@ using UnityEngine;
namespace Ichni.RhythmGame
{
public partial class SkyboxSubsetter : GameElement
public partial class SkyboxSubsetter : GameElement, IScheduledElement
{
#region [] Core Components & Skybox Lists
public SkyboxBlender skyboxBlender;
@@ -46,6 +46,18 @@ namespace Ichni.RhythmGame
skyboxSubsetter.selectedSkybox = String.Empty;
return skyboxSubsetter;
}
public override void AfterInitialize()
{
base.AfterInitialize();
CoreServices.UpdateScheduler.Register(UpdatePhase.Misc, this);
}
public override void OnDelete()
{
base.OnDelete();
CoreServices.UpdateScheduler.Unregister(UpdatePhase.Misc, this);
}
#endregion
#region [] Internal Configs & Utils
@@ -81,28 +93,31 @@ namespace Ichni.RhythmGame
#endregion
#region [] Main Update
private void Update()
#region [IScheduledElement] Scheduler Interface
public void ScheduledUpdate(UpdatePhase phase, float songTime)
{
if (skyBoxThemeBundleList.Count > 1)
{
float songTime = CoreServices.TimeProvider.SongTime;
float delay = GameManager.Instance.songInformation.delay;
float finalTime = 32767; // 曲目长度
const float finalTime = 32767f; // 曲目长度上限
for (var index = 0; index < blendTimeList.Count + 1; index++)
{
float startTime = index == 0 ? -delay : blendTimeList[index - 1];
float endTime = index >= blendTimeList.Count ? finalTime : blendTimeList[index];
if(songTime >= startTime && songTime < endTime && currentSkyboxIndex != index)
if (songTime >= startTime && songTime < endTime && currentSkyboxIndex != index)
{
currentSkyboxIndex = index;
if(currentSkyboxIndex != 0) skyboxBlender.blendSpeed = blendSpeedList[currentSkyboxIndex - 1];
if (currentSkyboxIndex != 0) skyboxBlender.blendSpeed = blendSpeedList[currentSkyboxIndex - 1];
skyboxBlender.Blend(currentSkyboxIndex, false);
DynamicGI.UpdateEnvironment();
}
}
}
}
public bool IsScheduledActive => isActiveAndEnabled;
#endregion
#endregion
}

View File

@@ -25,6 +25,12 @@ namespace Ichni.RhythmGame
public float orthographicSize;
public float perspectiveOffset;
public float zoomOffset; // 用于效果如CameraZoomEffect的临时视野偏移
public void RefreshFOV()
{
cam.fieldOfView = perspectiveAngle + perspectiveOffset + zoomOffset;
}
#endregion
#region [] Submodules & References
@@ -54,14 +60,14 @@ namespace Ichni.RhythmGame
float ratioDifference = UIManager.GetScreenRatio() - UIManager.StandardRatio;
if (ratioDifference > 0)
{
gameCamera.perspectiveOffset = -22f * ratioDifference;
//gameCamera.perspectiveOffset = 12.5f * ratioDifference;
}
else
{
//gameCamera.perspectiveOffset = 11f * ratioDifference;
gameCamera.perspectiveOffset = -25f * ratioDifference;
}
gameCamera.cam.fieldOfView = perspectiveAngle + gameCamera.perspectiveOffset;
gameCamera.RefreshFOV();
return gameCamera;
}

View File

@@ -7,7 +7,7 @@ using Object = UnityEngine.Object;
namespace Ichni.RhythmGame
{
public partial class ParticleEmitter : GameElement, IHaveParticles, IHaveTimeDurationSubmodule, IHaveTransformSubmodule, IHaveColorSubmodule
public partial class ParticleEmitter : GameElement, IHaveParticles, IHaveTimeDurationSubmodule, IHaveTransformSubmodule, IHaveColorSubmodule, IScheduledElement
{
#region [] Essential Configs
public string themeBundleName;
@@ -85,15 +85,26 @@ namespace Ichni.RhythmGame
transformSubmodule = new TransformSubmodule(this);
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 [] Main Update & Behavior Overrides
public partial class ParticleEmitter
{
private void Update()
private void UpdateParticlePlayState(float songTime)
{
float songTime = CoreServices.TimeProvider.SongTime;
if (playTime > songTime || stopTime < songTime)
{
particle.Stop();
@@ -107,6 +118,15 @@ namespace Ichni.RhythmGame
}
}
#region [IScheduledElement] Scheduler Interface
public void ScheduledUpdate(UpdatePhase phase, float songTime)
{
UpdateParticlePlayState(songTime);
}
public bool IsScheduledActive => isActiveAndEnabled;
#endregion
public override void Refresh()
{
base.Refresh();

View File

@@ -8,12 +8,18 @@ using UnityEngine;
namespace Ichni.RhythmGame
{
public partial class TimeEffectsCollection : GameElement, IHaveTransformSubmodule, IHaveEffectSubmodule
public partial class TimeEffectsCollection : GameElement, IHaveTransformSubmodule, IHaveEffectSubmodule, IScheduledElement
{
#region [] Essential Configs
public float time; //触发效果的时间
#endregion
#region [] Cached Effect Lists
private List<EffectBase> _priorEffects;
private List<EffectBase> _defaultEffects;
private List<EffectBase> _lateEffects;
#endregion
#region [] Submodules
public TransformSubmodule transformSubmodule { get; set; }
public EffectSubmodule effectSubmodule { get; set; }
@@ -34,31 +40,55 @@ namespace Ichni.RhythmGame
transformSubmodule = new TransformSubmodule(this);
effectSubmodule = new EffectSubmodule(this);
}
public override void AfterInitialize()
{
base.AfterInitialize();
CacheEffectLists();
CoreServices.UpdateScheduler.Register(UpdatePhase.Effect, this);
}
public override void OnDelete()
{
base.OnDelete();
CoreServices.UpdateScheduler.Unregister(UpdatePhase.Effect, this);
}
/// <summary>
/// 缓存 effectCollection 中的 Prior/Default/Late 列表引用,
/// 避免 ScheduledUpdate 中每帧执行 Dictionary string key 查找。
/// </summary>
private void CacheEffectLists()
{
if (effectSubmodule?.effectCollection == null) return;
effectSubmodule.effectCollection.TryGetValue("Prior", out _priorEffects);
effectSubmodule.effectCollection.TryGetValue("Default", out _defaultEffects);
effectSubmodule.effectCollection.TryGetValue("Late", out _lateEffects);
}
#endregion
#region [] Main Update
private void Update()
#region [IScheduledElement] Scheduler Interface
public void ScheduledUpdate(UpdatePhase phase, float songTime)
{
if (!GameManager.Instance.songPlayer.isUpdating || effectSubmodule == null)
{
return;
}
if (effectSubmodule == null) return;
foreach (EffectBase effect in effectSubmodule.effectCollection["Prior"])
{
effect.UpdateEffect(time);
}
UpdateEffectList(_priorEffects, time);
UpdateEffectList(_defaultEffects, time);
UpdateEffectList(_lateEffects, time);
}
foreach (EffectBase effect in effectSubmodule.effectCollection["Default"])
private static void UpdateEffectList(List<EffectBase> effects, float effectTime)
{
if (effects == null) return;
for (int i = 0; i < effects.Count; i++)
{
effect.UpdateEffect(time);
}
foreach (EffectBase effect in effectSubmodule.effectCollection["Late"])
{
effect.UpdateEffect(time);
effects[i].UpdateEffect(effectTime);
}
}
public bool IsScheduledActive => isActiveAndEnabled;
#endregion
#endregion
}

View File

@@ -42,7 +42,7 @@ namespace Ichni.RhythmGame
public override bool CheckJudgeAvailability(InputUnit inputUnit)
{
Vector2 inputScreenPosition = inputUnit.inputPosition;
Vector2 noteScreenPosition = note.GetScreenPosition();
Vector2 noteScreenPosition = note.noteScreenPosition != Vector2.zero ? note.noteScreenPosition : note.GetScreenPosition();
float scaledBaseRadius = areaRadius * CurrentScreenRatio;
float dx = Mathf.Abs(inputScreenPosition.x - noteScreenPosition.x) / ellipseXMultiplier;

View File

@@ -295,6 +295,7 @@ namespace Ichni.RhythmGame
protected virtual void ExecuteJudge(NoteJudgeType judgeType, float triggerTime)
{
isDuringJudging = false;
isFirstJudged = true;
judgedTriggerTime = triggerTime;
judgedType = judgeType;

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