设置扩展
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using Sirenix.OdinInspector;
|
||||
using SLSUtilities.General;
|
||||
using SLSUtilities.Rendering.PostProcessing;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
@@ -13,6 +14,11 @@ namespace Ichni
|
||||
{
|
||||
public class PostProcessingManager : Singleton<PostProcessingManager>
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前已加载的 GameScene 后处理管理器。MenuScene 等未创建该对象的场景会返回 <c>null</c>。
|
||||
/// </summary>
|
||||
public static PostProcessingManager Instance => instance;
|
||||
|
||||
public static Volume GlobalVolume => instance.globalVolume;
|
||||
|
||||
[ShowInInspector]
|
||||
@@ -26,6 +32,29 @@ namespace Ichni
|
||||
// Force instantiate the volume profile on awake so it doesn't happen mid-game
|
||||
_ = globalVolume.profile;
|
||||
}
|
||||
|
||||
// GameScene 的 Global Volume 创建时,重新应用已加载的玩家设置,覆盖场景切换时的默认值。
|
||||
SettingsManager.instance?.ApplyPostProcessingSettings();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将全局后处理状态与 Anime Bloom 档位写入 GameScene 的运行时 Profile。
|
||||
/// Volume.profile 会提供运行时实例,因此不会修改磁盘上的 SampleSceneProfile 资产。
|
||||
/// </summary>
|
||||
public void ApplySettings(bool enablePostProcessing, BloomQuality bloomQuality)
|
||||
{
|
||||
globalVolume.enabled = enablePostProcessing;
|
||||
|
||||
if (!enablePostProcessing || !globalVolume.profile.TryGet(out AnimeBloom animeBloom))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
animeBloom.active = bloomQuality != BloomQuality.Off;
|
||||
if (animeBloom.active)
|
||||
{
|
||||
animeBloom.diffusion.value = bloomQuality == BloomQuality.Performance ? 5 : 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user