设置扩展

This commit is contained in:
SoulliesOfficial
2026-07-19 16:44:58 -04:00
parent dda354ebb9
commit 9fd5f098ab
110 changed files with 8386 additions and 2311 deletions

View File

@@ -100,7 +100,7 @@ namespace Ichni.RhythmGame
private void OnTap(int id, Vector2 position)
{
if (SettingsManager.instance.gameSettings.debugMode)
if (SettingsManager.instance.settingsSaveData.debugMode)
{
GenerateTapMark(id, position);
}
@@ -110,7 +110,7 @@ namespace Ichni.RhythmGame
private void OnTouch(int id, Vector2 position)
{
if (SettingsManager.instance.gameSettings.debugMode)
if (SettingsManager.instance.settingsSaveData.debugMode)
{
GenerateTouchMark(id, position);
}
@@ -120,7 +120,7 @@ namespace Ichni.RhythmGame
private void OnSwipe(int id, Vector2 position, bool isGeneric, bool isFirst, Vector2 direction)
{
if (SettingsManager.instance.gameSettings.debugMode)
if (SettingsManager.instance.settingsSaveData.debugMode)
{
GenerateSwipeMark(id, position, isGeneric, isFirst, direction);
@@ -378,7 +378,7 @@ namespace Ichni.RhythmGame
if (_activeTouches.ContainsKey(touchId))
{
_activeTouches.Remove(touchId);
if (SettingsManager.instance.gameSettings.debugMode)
if (SettingsManager.instance.settingsSaveData.debugMode)
{
GenerateEndMark(position);
}
@@ -390,7 +390,7 @@ namespace Ichni.RhythmGame
if (_activeTouches.ContainsKey(touchId))
{
_activeTouches.Remove(touchId);
if (SettingsManager.instance.gameSettings.debugMode)
if (SettingsManager.instance.settingsSaveData.debugMode)
{
GenerateCanceledMark(position);
}
@@ -540,4 +540,4 @@ namespace Ichni.RhythmGame
ss.Play();
}
}
}
}

View File

@@ -54,7 +54,7 @@ namespace Ichni
public SummaryPageCanvas summaryPageCanvas;
public float SongTime => songPlayer.isStarting ? 0 :
songPlayer.songTimeSegment - songInformation.offset - (SettingsManager.instance.gameSettings.beatmapOffset / 1000f);
songPlayer.songTimeSegment - songInformation.offset - (SettingsManager.instance.settingsSaveData.beatmapOffset / 1000f);
public bool IsPlaying => songPlayer != null && songPlayer.isPlaying;

View File

@@ -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;
}
}
}
}
}

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using DG.Tweening;
using Ichni.RhythmGame;
using Ichni.RhythmGame.Beatmap;
@@ -51,8 +50,7 @@ namespace Ichni
fakeLoadPercent = 0f;
Observable.EveryUpdate()
.Where(_ => ThemeBundleManager.instance.waitingBundleAmount.Value == 0 &&
GameManager.Instance.gameLoadingCanvas.allPartsSet)
.Where(_ => ThemeBundleManager.instance.waitingBundleAmount.Value == 0 && GameManager.Instance.gameLoadingCanvas.allPartsSet)
.First()
.Subscribe(_ =>
{
@@ -72,6 +70,8 @@ namespace Ichni
{
fakeLoadObserver.Dispose();
GameManager.Instance.beatmapContainer.RebuildRuntimeTimeDurations();
Observable.Timer(TimeSpan.FromSeconds(1f)).First().Subscribe(_ =>
{
GameManager.Instance.gameLoadingCanvas.FadeOut();
@@ -79,33 +79,27 @@ namespace Ichni
GameManager.Instance.songPlayer.isStarting = true;
GameManager.Instance.beatmapContainer.gameElementList.ForEach(element => element.BeforeStart());
GameManager.Instance.gameUICanvas.readyText.DOFade(1, 0.5f)
.SetLoops(4, LoopType.Yoyo).SetEase(Ease.InOutFlash).Play();
// isStarting maps the Ready screen to song time zero. Apply the
// duration-controlled active states before that screen becomes visible.
GameManager.Instance.beatmapContainer.SyncRuntimeTimeDurationStates(GameManager.Instance.SongTime);
GameManager.Instance.gameUICanvas.readyText.DOFade(1, 0.5f).SetLoops(4, LoopType.Yoyo).SetEase(Ease.InOutFlash).Play();
Observable.Timer(TimeSpan.FromSeconds(2)).First().Subscribe(_ =>
{
GameManager.Instance.songPlayer.isDelaying = true;
GameManager.Instance.songPlayer.isStarting = false;
// SongInformation.delay can make this timeline position negative.
// Re-sync immediately after the state switch so negative-time
// elements are correct before the first scheduler tick.
GameManager.Instance.beatmapContainer.SyncRuntimeTimeDurationStates(GameManager.Instance.SongTime);
Observable.NextFrame().Subscribe(_ =>
{
GameManager.Instance.timeDurations = GameManager.Instance.beatmapContainer.gameElementList
.Select(x => (x as IHaveTimeDurationSubmodule)?.timeDurationSubmodule)
.Where(x => x != null && (x.startTime > 0 || x.endTime < GameManager.Instance.songInformation.songLength)).ToList();
GameManager.Instance.beatmapContainer.gameElementList.ForEach(element => element.WhenStart());
});
});
});
});
});
/*Observable.EveryUpdate()
.Where(_ => !GameManager.Instance.audioManager.isStarting)
.First()
.Subscribe(_ =>
{
});*/
});
}
public void Load(string chapterName, string musicName, string difficultyName)
@@ -143,4 +137,4 @@ namespace Ichni
}
}
}
}

View File

@@ -154,6 +154,16 @@ namespace Ichni
StopMusicEvent.Post(gameObject);
}
/// <summary>
/// 清除由谱面音乐特效写入的滤波 RTPC。
/// SettingsManager 在玩家关闭游戏内音乐特效时调用此方法,确保设置立即生效。
/// </summary>
public void ResetInGameAudioEffects()
{
HighPassFilter.SetValue(gameObject, 0f);
LowPassFilter.SetValue(gameObject, 0f);
}
private void OnMusicEvent(object in_cookie, AkCallbackType in_type, AkCallbackInfo in_info)
{
Debug.Log(in_type + " " + in_info);