Bugfix/master

This commit is contained in:
2025-07-24 09:38:08 +00:00
parent 6937a2d6e8
commit 14affc5c6e
322 changed files with 61050 additions and 14851 deletions
@@ -9,7 +9,7 @@ public class ScreenEffectManager : MonoBehaviour
public Volume saturation;
private ColorAdjustments colorAdjustments;
// private ColorAdjustments colorAdjustments;
private void Awake()
{
@@ -28,26 +28,31 @@ public class ScreenEffectManager : MonoBehaviour
private void Start()
{
// 获取 ColorAdjustments 设置
if (saturation.profile.TryGet(out colorAdjustments))
{
Debug.Log("ColorAdjustments is available.");
}
else
{
Debug.LogError("ColorAdjustments settings not found in PostProcessProfile.");
}
// if (saturation.profile.TryGet(out colorAdjustments))
// {
// Debug.Log("ColorAdjustments is available.");
// }
// else
// {
// Debug.LogError("ColorAdjustments settings not found in PostProcessProfile.");
// }
}
// 动态调整饱和度
public Tween TweenSaturation(float targetSaturation, float duration)
{
if (colorAdjustments != null)
if (saturation != null)
{
// 使用 DOTween 创建一个饱和度过渡动画
// 将targetSaturation (0~1) 转换为weight (1~0)
// targetSaturation = 0 时,weight = 1 (完全褪色)
// targetSaturation = 1 时,weight = 0 (正常颜色)
float targetWeight = 1f - targetSaturation;
// 使用 DOTween 创建一个weight过渡动画
Tween tween = DOTween.To(
() => colorAdjustments.saturation.value, // 获取当前饱和度
x => colorAdjustments.saturation.value = x, // 设置新的饱和度
targetSaturation, // 目标饱和度
() => saturation.weight, // 获取当前weight
x => saturation.weight = x, // 设置新的weight
targetWeight, // 目标weight
duration // 过渡持续时间
);
@@ -55,8 +60,18 @@ public class ScreenEffectManager : MonoBehaviour
}
else
{
Debug.LogError("ColorAdjustments settings not found.");
Debug.LogError("Saturation Volume not found.");
return null; // 如果找不到设置,返回 null
}
}
// 重置饱和度效果
public void ResetSaturation()
{
if (saturation != null)
{
// 直接设置weight为0,恢复正常颜色
saturation.weight = 0f;
}
}
}