1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 14:43:22 +08:00

Clean up code slightly

This commit is contained in:
Salman Alshamrani 2024-12-05 02:48:46 -05:00
parent 7c1be5eca2
commit 1b1e7b63e9
3 changed files with 17 additions and 18 deletions

View File

@ -1,7 +1,6 @@
// 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.Development;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation; using osu.Framework.Localisation;
@ -12,7 +11,7 @@ namespace osu.Game.Overlays.Settings.Sections
{ {
public partial class DebugSection : SettingsSection public partial class DebugSection : SettingsSection
{ {
public override LocalisableString Header => "Debug"; public override LocalisableString Header => @"Debug";
public override Drawable CreateIcon() => new SpriteIcon public override Drawable CreateIcon() => new SpriteIcon
{ {
@ -21,12 +20,12 @@ namespace osu.Game.Overlays.Settings.Sections
public DebugSection() public DebugSection()
{ {
Add(new GeneralSettings()); Children = new Drawable[]
{
if (DebugUtils.IsDebugBuild) new GeneralSettings(),
Add(new BatchImportSettings()); new BatchImportSettings(),
new MemorySettings(),
Add(new MemorySettings()); };
} }
} }
} }

View File

@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings
{ {
public partial class GeneralSettings : SettingsSubsection public partial class GeneralSettings : SettingsSubsection
{ {
protected override LocalisableString Header => "General"; protected override LocalisableString Header => @"General";
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig) private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig)
@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings
{ {
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Show log overlay", LabelText = @"Show log overlay",
Current = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay) Current = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay)
}, },
new SettingsCheckbox new SettingsCheckbox

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings
{ {
public partial class MemorySettings : SettingsSubsection public partial class MemorySettings : SettingsSubsection
{ {
protected override LocalisableString Header => "Memory"; protected override LocalisableString Header => @"Memory";
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(GameHost host, RealmAccess realm) private void load(GameHost host, RealmAccess realm)
@ -28,27 +28,27 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings
{ {
new SettingsButton new SettingsButton
{ {
Text = "Clear all caches", Text = @"Clear all caches",
Action = host.Collect Action = host.Collect
}, },
new SettingsButton new SettingsButton
{ {
Text = "Compact realm", Text = @"Compact realm",
Action = () => Action = () =>
{ {
// Blocking operations implicitly causes a Compact(). // Blocking operations implicitly causes a Compact().
using (realm.BlockAllOperations("compact")) using (realm.BlockAllOperations(@"compact"))
{ {
} }
} }
}, },
blockAction = new SettingsButton blockAction = new SettingsButton
{ {
Text = "Block realm", Text = @"Block realm",
}, },
unblockAction = new SettingsButton unblockAction = new SettingsButton
{ {
Text = "Unblock realm", Text = @"Unblock realm",
}, },
}; };
@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings
{ {
try try
{ {
IDisposable? token = realm.BlockAllOperations("maintenance"); IDisposable? token = realm.BlockAllOperations(@"maintenance");
blockAction.Enabled.Value = false; blockAction.Enabled.Value = false;
@ -88,7 +88,7 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings
} }
catch (Exception e) catch (Exception e)
{ {
Logger.Error(e, "Blocking realm failed"); Logger.Error(e, @"Blocking realm failed");
} }
}; };
} }