1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-26 13:43:23 +08:00

persist analysis settings

This commit is contained in:
Sheppsu 2024-09-03 04:49:50 -04:00
parent 56db29d0f5
commit a549cdd5b9
3 changed files with 38 additions and 9 deletions

View File

@ -1,5 +1,4 @@
 // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
@ -38,28 +37,38 @@ namespace osu.Game.Rulesets.Osu.UI
HitMarkers = new HitMarkersContainer(), HitMarkers = new HitMarkersContainer(),
AimMarkers = new AimMarkersContainer { Depth = float.MinValue } AimMarkers = new AimMarkersContainer { Depth = float.MinValue }
}; };
} }
protected override OsuAnalysisSettings CreateAnalysisSettings() protected override OsuAnalysisSettings CreateAnalysisSettings()
{ {
var settings = new OsuAnalysisSettings(); var settings = new OsuAnalysisSettings();
settings.HitMarkersEnabled.ValueChanged += e => HitMarkers.FadeTo(e.NewValue ? 1 : 0); settings.HitMarkersEnabled.ValueChanged += e => toggleHitMarkers(e.NewValue);
settings.AimMarkersEnabled.ValueChanged += e => AimMarkers.FadeTo(e.NewValue ? 1 : 0); settings.AimMarkersEnabled.ValueChanged += e => toggleAimMarkers(e.NewValue);
settings.AimLinesEnabled.ValueChanged += e => AimLines.FadeTo(e.NewValue ? 1 : 0); settings.AimLinesEnabled.ValueChanged += e => toggleAimLines(e.NewValue);
settings.CursorHideEnabled.ValueChanged += e => Playfield.Cursor.FadeTo(e.NewValue ? 0 : 1); settings.CursorHideEnabled.ValueChanged += e => toggleCursorHidden(e.NewValue);
return settings; return settings;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
HitMarkers.Hide(); toggleHitMarkers(AnalysisSettings.HitMarkersEnabled.Value);
AimMarkers.Hide(); toggleAimMarkers(AnalysisSettings.AimMarkersEnabled.Value);
AimLines.Hide(); toggleAimLines(AnalysisSettings.AimLinesEnabled.Value);
toggleCursorHidden(AnalysisSettings.CursorHideEnabled.Value);
LoadReplay(); LoadReplay();
} }
private void toggleHitMarkers(bool value) => HitMarkers.FadeTo(value ? 1 : 0);
private void toggleAimMarkers(bool value) => AimMarkers.FadeTo(value ? 1 : 0);
private void toggleAimLines(bool value) => AimLines.FadeTo(value ? 1 : 0);
private void toggleCursorHidden(bool value) => Playfield.Cursor.FadeTo(value ? 0 : 1);
protected void LoadReplay() protected void LoadReplay()
{ {
bool leftHeld = false; bool leftHeld = false;

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Screens.Play.PlayerSettings; using osu.Game.Screens.Play.PlayerSettings;
@ -20,5 +21,14 @@ namespace osu.Game.Rulesets.Osu.UI
[SettingSource("Hide cursor", SettingControlType = typeof(PlayerCheckbox))] [SettingSource("Hide cursor", SettingControlType = typeof(PlayerCheckbox))]
public BindableBool CursorHideEnabled { get; } = new BindableBool(); public BindableBool CursorHideEnabled { get; } = new BindableBool();
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
config.BindWith(OsuSetting.ReplayHitMarkersEnabled, HitMarkersEnabled);
config.BindWith(OsuSetting.ReplayAimMarkersEnabled, AimMarkersEnabled);
config.BindWith(OsuSetting.ReplayAimLinesEnabled, AimLinesEnabled);
config.BindWith(OsuSetting.ReplayCursorHideEnabled, CursorHideEnabled);
}
} }
} }

View File

@ -154,6 +154,12 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.IncreaseFirstObjectVisibility, true); SetDefault(OsuSetting.IncreaseFirstObjectVisibility, true);
SetDefault(OsuSetting.GameplayDisableWinKey, true); SetDefault(OsuSetting.GameplayDisableWinKey, true);
// Replay
SetDefault(OsuSetting.ReplayHitMarkersEnabled, false);
SetDefault(OsuSetting.ReplayAimMarkersEnabled, false);
SetDefault(OsuSetting.ReplayAimLinesEnabled, false);
SetDefault(OsuSetting.ReplayCursorHideEnabled, false);
// Update // Update
SetDefault(OsuSetting.ReleaseStream, ReleaseStream.Lazer); SetDefault(OsuSetting.ReleaseStream, ReleaseStream.Lazer);
@ -413,6 +419,10 @@ namespace osu.Game.Configuration
EditorShowHitMarkers, EditorShowHitMarkers,
EditorAutoSeekOnPlacement, EditorAutoSeekOnPlacement,
DiscordRichPresence, DiscordRichPresence,
ReplayHitMarkersEnabled,
ReplayAimMarkersEnabled,
ReplayAimLinesEnabled,
ReplayCursorHideEnabled,
ShowOnlineExplicitContent, ShowOnlineExplicitContent,
LastProcessedMetadataId, LastProcessedMetadataId,