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

@@ -5,7 +5,7 @@ using UnityEngine;
namespace Ichni.RhythmGame
{
public abstract partial class AnimationBase : GameElement, IHaveTimeDurationSubmodule
public abstract partial class AnimationBase : GameElement, IHaveTimeDurationSubmodule, IScheduledElement
{
#region [] Attributes & Related Objects
public GameElement animatedObject;
@@ -27,8 +27,7 @@ namespace Ichni.RhythmGame
{
base.AfterInitialize();
// 【新增】受管家管控
GameManager.Instance.animationManager.RegisterAnimation(this);
CoreServices.UpdateScheduler.Register(UpdatePhase.Animation, this);
float delay = GameManager.Instance.songInformation.delay;
if (timeDurationSubmodule.CheckTimeInDuration(-delay))
{
@@ -36,6 +35,12 @@ namespace Ichni.RhythmGame
}
}
public override void OnDelete()
{
base.OnDelete();
CoreServices.UpdateScheduler.Unregister(UpdatePhase.Animation, this);
}
/// <summary>
/// 更新动画
/// </summary>
@@ -51,10 +56,19 @@ namespace Ichni.RhythmGame
if (timeDurationSubmodule.CheckAfterEndTime(currentSongTime))
{
GameManager.Instance.animationManager.UnregisterAnimation(this);
CoreServices.UpdateScheduler.Unregister(UpdatePhase.Animation, this);
}
}
#region [IScheduledElement] Scheduler Interface
public virtual void ScheduledUpdate(UpdatePhase phase, float songTime)
{
ManualUpdate(songTime);
}
public bool IsScheduledActive => isActiveAndEnabled;
#endregion
/// <summary>
/// 施加时间偏移即移动所有Flexible参数的时间
/// </summary>

View File

@@ -44,7 +44,7 @@ namespace Ichni.RhythmGame
if (forceUpdate || fieldOfView.returnType == FlexibleReturnType.MiddleExecuting)
{
targetGameCamera.perspectiveAngle = fieldOfView.value;
targetGameCamera.cam.fieldOfView = fieldOfView.value;
targetGameCamera.RefreshFOV();
}
}

View File

@@ -1,7 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame
@@ -89,32 +87,4 @@ namespace Ichni.RhythmGame
#endregion
}
}
namespace Ichni.RhythmGame.Beatmap
{
public class TrackGlobalColorChange_BM : AnimationBase_BM
{
public FlexibleFloat_BM colorR, colorG, colorB, colorA;
public TrackGlobalColorChange_BM()
{
}
public TrackGlobalColorChange_BM(string elementName, Guid elementGuid, List<string> tags,
GameElement_BM attachedElement, FlexibleFloat_BM colorR, FlexibleFloat_BM colorG, FlexibleFloat_BM colorB, FlexibleFloat_BM colorA)
: base(elementName, elementGuid, tags, attachedElement)
{
this.colorR = colorR;
this.colorG = colorG;
this.colorB = colorB;
this.colorA = colorA;
}
public override void ExecuteBM()
{
matchedElement = TrackGlobalColorChange.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid),
colorR.ConvertToGameType(), colorG.ConvertToGameType(), colorB.ConvertToGameType(), colorA.ConvertToGameType());
}
}
}

View File

@@ -45,16 +45,44 @@ namespace Ichni.RhythmGame
public override void AfterInitialize()
{
base.AfterInitialize();
// 注册 Phase 7Effect确保在 Track/TrackFollowerPhase 4/5和 NotePhase 6
// 全部更新完毕后再计算旋转覆盖,避免因位置尚未就绪导致的旋转抖动
CoreServices.UpdateScheduler.Register(UpdatePhase.Effect, this);
}
public override void OnDelete()
{
base.OnDelete();
CoreServices.UpdateScheduler.Unregister(UpdatePhase.Effect, this);
}
public override void ManualUpdate(float songTime, bool forceUpdate = false)
{
base.ManualUpdate(songTime, forceUpdate);
// 动画结束时同步注销 Phase 7
if (timeDurationSubmodule.CheckAfterEndTime(songTime))
{
CoreServices.UpdateScheduler.Unregister(UpdatePhase.Effect, this);
}
}
#endregion
#region [] Core Animation Logic
void LateUpdate()
public override void ScheduledUpdate(UpdatePhase phase, float songTime)
{
if (enabling.value)
switch (phase)
{
(animatedObject as IHaveTransformSubmodule)?.UpdateLookAt(this);
case UpdatePhase.Animation:
base.ScheduledUpdate(phase, songTime);
break;
case UpdatePhase.Effect:
// 在所有 Track/TrackFollower/Note 位置更新完毕后覆盖旋转
if (enabling.value)
{
(animatedObject as IHaveTransformSubmodule)?.UpdateLookAt(this);
}
break;
}
}