1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 01:47:25 +08:00
osu-lazer/osu.Game/Overlays/Settings/Sections/DebugSettings/MemorySettings.cs
2022-01-15 01:06:39 +01:00

42 lines
1.3 KiB
C#

// 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.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Game.Database;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Settings.Sections.DebugSettings
{
public class MemorySettings : SettingsSubsection
{
protected override LocalisableString Header => DebugSettingsStrings.MemoryHeader;
[BackgroundDependencyLoader]
private void load(GameHost host, RealmContextFactory realmFactory)
{
Children = new Drawable[]
{
new SettingsButton
{
Text = DebugSettingsStrings.ClearAllCaches,
Action = host.Collect
},
new SettingsButton
{
Text = DebugSettingsStrings.CompactRealm,
Action = () =>
{
// Blocking operations implicitly causes a Compact().
using (realmFactory.BlockAllOperations())
{
}
}
},
};
}
}
}