2025-08-11 14:04:06 -04:00
|
|
|
|
using Ichni.RhythmGame.Beatmap;
|
2026-03-14 03:13:10 -04:00
|
|
|
|
using SLSUtilities.Rendering.PostProcessing; // 直接调取你的新版 Volume
|
2025-08-11 14:04:06 -04:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Ichni.RhythmGame
|
|
|
|
|
|
{
|
|
|
|
|
|
public class RadialBlurEffect : EffectBase
|
|
|
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
|
#region [效果参数] Effect Parameters
|
2026-03-31 07:51:40 -04:00
|
|
|
|
public int sampleLevel;
|
2026-03-14 03:13:10 -04:00
|
|
|
|
public float position; // 注:虽然新版可能未用此值或代表意义不同,为了兼容旧读写表保持传入
|
|
|
|
|
|
public float fadeRange; // 注:同上,保留以使 ConvertToBM 存取数据兼容
|
2025-08-11 14:04:06 -04:00
|
|
|
|
public float peakIntensity;
|
|
|
|
|
|
public AnimationCurve intensityCurve;
|
2026-03-14 03:13:10 -04:00
|
|
|
|
|
|
|
|
|
|
private RadialBlur _radialBlurVolume;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region [初始化] Initialization
|
2026-03-31 07:51:40 -04:00
|
|
|
|
public RadialBlurEffect(float effectTime, int sampleLevel, float position, float fadeRange, float peakIntensity, AnimationCurve intensityCurve)
|
|
|
|
|
|
: base(effectTime) // 【修改】对接 EffectBase 含时控制
|
2025-08-11 14:04:06 -04:00
|
|
|
|
{
|
2026-03-31 07:51:40 -04:00
|
|
|
|
this.effectTime = effectTime;
|
2025-08-11 14:04:06 -04:00
|
|
|
|
this.sampleLevel = sampleLevel;
|
|
|
|
|
|
this.position = position;
|
|
|
|
|
|
this.fadeRange = fadeRange;
|
|
|
|
|
|
this.peakIntensity = peakIntensity;
|
|
|
|
|
|
this.intensityCurve = intensityCurve;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-14 03:13:10 -04:00
|
|
|
|
private void PrepareHandle()
|
2025-08-11 14:04:06 -04:00
|
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
|
if (_radialBlurVolume == null && PostProcessingManager.GlobalVolume != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 用管家提取我们在全局体积域中注册的 RadialBlur 面板副本
|
|
|
|
|
|
PostProcessingManager.GlobalVolume.profile.TryGet(out _radialBlurVolume);
|
|
|
|
|
|
}
|
2025-08-11 14:04:06 -04:00
|
|
|
|
}
|
2026-03-14 03:13:10 -04:00
|
|
|
|
#endregion
|
2025-08-11 14:04:06 -04:00
|
|
|
|
|
2026-03-14 03:13:10 -04:00
|
|
|
|
#region [效果逻辑覆盖] Effect Pattern Overrides
|
2025-08-11 14:04:06 -04:00
|
|
|
|
public override void PreExecute()
|
|
|
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
|
PrepareHandle();
|
|
|
|
|
|
if (_radialBlurVolume != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 直接把数值映射为你的 Quality Level 枚举 (限制在 0-3 之间防越界)
|
|
|
|
|
|
_radialBlurVolume.qualityLevel.value = RadialBlurQuality.RadialBlur_8Tap_Balance;
|
|
|
|
|
|
//(RadialBlurQuality)Mathf.Clamp(sampleLevel, 0, 3);
|
|
|
|
|
|
|
|
|
|
|
|
// 将径向中心点归位于正中(未来你可以在这里利用传入的 position 或改造一个 Vector2 支持屏幕任意位置暴气)
|
|
|
|
|
|
_radialBlurVolume.radialCenterX.value = 0.5f;
|
|
|
|
|
|
_radialBlurVolume.radialCenterY.value = 0.5f;
|
|
|
|
|
|
}
|
2025-08-11 14:04:06 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Execute()
|
|
|
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
|
if (_radialBlurVolume != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 完美跟随时间推移变换强度
|
|
|
|
|
|
float intensity = Mathf.Lerp(0, peakIntensity, intensityCurve.Evaluate(effectProgressPercent));
|
|
|
|
|
|
_radialBlurVolume.blurRadius.value = intensity;
|
|
|
|
|
|
}
|
2025-08-11 14:04:06 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-14 03:13:10 -04:00
|
|
|
|
public override void Adjust() { ResetEffect(); }
|
|
|
|
|
|
public override void Recover() { ResetEffect(); }
|
|
|
|
|
|
public override void Disrupt() { ResetEffect(); }
|
2025-08-11 14:04:06 -04:00
|
|
|
|
|
2026-03-14 03:13:10 -04:00
|
|
|
|
private void ResetEffect()
|
2025-08-11 14:04:06 -04:00
|
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
|
if (_radialBlurVolume != null)
|
2025-08-11 14:04:06 -04:00
|
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
|
// 新版里只要 radius = 0,IsActive就为 false,自动关闭!极其优雅。
|
|
|
|
|
|
_radialBlurVolume.blurRadius.value = 0f;
|
2025-08-11 14:04:06 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-03-14 03:13:10 -04:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2025-08-11 14:04:06 -04:00
|
|
|
|
}
|
2026-03-14 03:13:10 -04:00
|
|
|
|
|
|
|
|
|
|
}
|
2026-03-31 07:51:40 -04:00
|
|
|
|
|
|
|
|
|
|
|