116 lines
3.3 KiB
C#
116 lines
3.3 KiB
C#
using System;
|
|
using Sirenix.OdinInspector;
|
|
using SLSUtilities.Feedback;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame.Effects.Feedback
|
|
{
|
|
/// <summary>
|
|
/// 高级暗角反馈动作,通过 VignetteShakeEvent 触发 VignetteShaker。
|
|
/// </summary>
|
|
[Serializable]
|
|
[FeedbackActionColor(0.9f, 0.5f, 0.3f)]
|
|
public class VignetteAction : PostprocessingActionBase
|
|
{
|
|
public override string DisplayName => "Vignette";
|
|
|
|
|
|
public FloatCurveChannel intensityCurve = FloatCurveChannel.CreateDefault(remapMax: 1f);
|
|
|
|
/// <summary>
|
|
/// 是否修改暗角中心点。
|
|
/// </summary>
|
|
[LabelText("修改中心点")]
|
|
public bool modifyCenter;
|
|
|
|
/// <summary>
|
|
/// 模糊中心的屏幕坐标 (0-1)。(0.5, 0.5) 为屏幕正中心。
|
|
/// </summary>
|
|
[HideIf("modifyCenter")]
|
|
[LabelText("中心点")]
|
|
public Vector2 center = new Vector2(0.5f, 0.5f);
|
|
|
|
[ShowIf("modifyCenter")]
|
|
public Vector2CurveChannel centerCurve = Vector2CurveChannel.CreateDefault();
|
|
|
|
/// <summary>
|
|
/// 是否修改颜色。
|
|
/// </summary>
|
|
[LabelText("修改颜色")]
|
|
public bool modifyColors;
|
|
|
|
[HideIf("modifyColors")]
|
|
public Color outColor;
|
|
|
|
[HideIf("modifyColors")]
|
|
public Color innerColor;
|
|
|
|
/// <summary>
|
|
/// 外圈颜色。
|
|
/// </summary>
|
|
[ShowIf("modifyColors")]
|
|
[LabelText("外圈颜色")]
|
|
public ColorCurveChannel outerColorCurve = ColorCurveChannel.CreateDefault();
|
|
|
|
/// <summary>
|
|
/// 内圈颜色。
|
|
/// </summary>
|
|
[ShowIf("modifyColors")]
|
|
[LabelText("内圈颜色")]
|
|
public ColorCurveChannel innerColorCurve = ColorCurveChannel.CreateDefault();
|
|
|
|
/// <summary>
|
|
/// 是否修改形状。
|
|
/// </summary>
|
|
[LabelText("修改形状")]
|
|
public bool modifyShape;
|
|
|
|
[HideIf("modifyShape")]
|
|
public float smoothness;
|
|
|
|
[HideIf("modifyShape")]
|
|
public float roundness;
|
|
|
|
/// <summary>
|
|
/// 柔和度曲线。
|
|
/// </summary>
|
|
[ShowIf("modifyShape")]
|
|
[LabelText("柔和度曲线")]
|
|
public FloatCurveChannel smoothnessCurve = FloatCurveChannel.CreateDefault(remapMax: 0.5f);
|
|
|
|
/// <summary>
|
|
/// 圆度曲线。
|
|
/// </summary>
|
|
[ShowIf("modifyShape")]
|
|
[LabelText("圆度曲线")]
|
|
public FloatCurveChannel roundnessCurve = FloatCurveChannel.CreateDefault(remapMax: 1f);
|
|
|
|
protected override void TriggerEvent(FeedbackContext context)
|
|
{
|
|
VignetteShakeEvent.Trigger(
|
|
context,
|
|
intensityCurve,
|
|
modifyCenter,
|
|
center,
|
|
modifyColors,
|
|
outerColorCurve,
|
|
innerColorCurve,
|
|
modifyShape,
|
|
smoothnessCurve,
|
|
roundnessCurve
|
|
);
|
|
}
|
|
|
|
protected override void StopEvent(FeedbackContext context)
|
|
{
|
|
VignetteShakeEvent.Trigger(context, intensityCurve, stop: true);
|
|
}
|
|
|
|
public override bool Validate(out string error)
|
|
{
|
|
error = null;
|
|
return true;
|
|
}
|
|
}
|
|
}
|