发包版本
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Ichni.Menu;
|
||||
using Ichni.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Sirenix.OdinInspector;
|
||||
@@ -112,6 +113,7 @@ namespace Ichni
|
||||
{
|
||||
string savePath = Application.persistentDataPath + "/GameData/" + SettingsSaveFileName;
|
||||
bool migratedLegacyLanguageIndex = false;
|
||||
bool migratedUiEffectsSetting = false;
|
||||
if (ES3.FileExists(savePath))
|
||||
{
|
||||
// 保留原有 ES3 Key,确保本次数据模型重命名不会让已有本地设置失效。
|
||||
@@ -123,12 +125,13 @@ namespace Ichni
|
||||
}
|
||||
|
||||
migratedLegacyLanguageIndex = MigrateLanguageCodeIfNeeded();
|
||||
migratedUiEffectsSetting = MigrateUiEffectsSettingIfNeeded();
|
||||
ApplyAudioSettings();
|
||||
ApplyGraphicSettings();
|
||||
ApplyLanguageSettings();
|
||||
|
||||
// 旧语言索引只应参与一次迁移;立刻写回稳定 Code,避免每次启动都重复依赖旧字段。
|
||||
if (migratedLegacyLanguageIndex)
|
||||
if (migratedLegacyLanguageIndex || migratedUiEffectsSetting)
|
||||
{
|
||||
SaveGameSettings();
|
||||
}
|
||||
@@ -176,6 +179,7 @@ namespace Ichni
|
||||
currentUrpAsset.renderScale = 0.5f + 0.1f * settingsSaveData.renderScaleLevel;
|
||||
ApplyDisplaySettings();
|
||||
ApplyPostProcessingSettings();
|
||||
ApplyUiEffectsSettings();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -206,6 +210,33 @@ namespace Ichni
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用 UI 特效总开关。
|
||||
/// <para>
|
||||
/// 仅处理显式挂载 <see cref="UiExpandingContoursEffect"/> 的装饰性 UI Image,而不修改共享材质本身。
|
||||
/// 这样关闭特效时会移除对应 Shader 的绘制开销,同时保留页面布局和其它 UI 元素。
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// 使用 Include 是为了让当前处于隐藏状态的 SongSelectionPage、SettingsPage 也同步保存目标状态;
|
||||
/// 它们下次显示时无需再经过一帧特效可见的过渡。
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public void ApplyUiEffectsSettings()
|
||||
{
|
||||
if (settingsSaveData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UiExpandingContoursEffect[] effectTargets =
|
||||
FindObjectsByType<UiExpandingContoursEffect>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
|
||||
foreach (UiExpandingContoursEffect effectTarget in effectTargets)
|
||||
{
|
||||
effectTarget.ApplyEnabledState(settingsSaveData.enableUiEffects);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理场景切换后新加载的相机与 Global Volume。SettingsManager 会跨场景保留,
|
||||
/// 因此不能只在首次读取存档时应用一次图形设置。
|
||||
@@ -215,6 +246,7 @@ namespace Ichni
|
||||
if (settingsSaveData != null)
|
||||
{
|
||||
ApplyPostProcessingSettings();
|
||||
ApplyUiEffectsSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,6 +298,7 @@ namespace Ichni
|
||||
private SettingsSaveData CreateDefaultSettingsSaveData()
|
||||
{
|
||||
SettingsSaveData defaultSettings = new SettingsSaveData();
|
||||
defaultSettings.uiEffectsSettingInitialized = true;
|
||||
defaultSettings.languageCode = DefaultLocaleCode;
|
||||
defaultSettings.languageIndex = GetLanguageDropdownIndex(DefaultLocaleCode);
|
||||
defaultSettings.graphicsQualityPreset = GetGraphicsQualityPreset(QualitySettings.GetQualityLevel());
|
||||
@@ -277,6 +310,25 @@ namespace Ichni
|
||||
return defaultSettings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将旧版 SettingsSave 中不存在的 UI 特效开关迁移为默认开启。
|
||||
/// <para>
|
||||
/// 不提升 Schema Version:项目尚未发布,且本字段只补齐一个布尔默认值。迁移标记会随即写回 ES3,
|
||||
/// 之后玩家主动关闭 UI 效果时不会被再次覆盖。
|
||||
/// </para>
|
||||
/// </summary>
|
||||
private bool MigrateUiEffectsSettingIfNeeded()
|
||||
{
|
||||
if (settingsSaveData.uiEffectsSettingInitialized)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
settingsSaveData.enableUiEffects = true;
|
||||
settingsSaveData.uiEffectsSettingInitialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
private FullScreenMode GetFullScreenMode(GraphicsDisplayMode displayMode)
|
||||
{
|
||||
return displayMode switch
|
||||
|
||||
@@ -109,6 +109,19 @@ namespace Ichni
|
||||
/// </summary>
|
||||
public VfxQuality vfxQuality = VfxQuality.High;
|
||||
|
||||
/// <summary>
|
||||
/// UI 特效总开关。当前控制使用 <c>UI_ExpandingContours</c> Shader 的装饰性 Image;
|
||||
/// 关闭后会停止这些 Image 的绘制,以降低选曲与设置页面在移动设备上的 GPU 开销。
|
||||
/// </summary>
|
||||
public bool enableUiEffects = true;
|
||||
|
||||
/// <summary>
|
||||
/// UI 特效开关的迁移标记。
|
||||
/// 早于该字段的 ES3 存档没有此标记;SettingsManager 读取到 false 时会将 UI 特效安全地初始化为开启,
|
||||
/// 从而保证新增设置不会在旧存档中意外以关闭状态首次出现。
|
||||
/// </summary>
|
||||
public bool uiEffectsSettingInitialized;
|
||||
|
||||
// Desktop display settings. These values are saved on every platform but only applied on PC and in the Unity Editor.
|
||||
public bool vSyncEnabled = false;
|
||||
public GraphicsDisplayMode displayMode = GraphicsDisplayMode.BorderlessFullscreen;
|
||||
|
||||
Reference in New Issue
Block a user