mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
Remove unused RealmBackedStore base class
This commit is contained in:
parent
fcb4a53f37
commit
5fa3a22f28
@ -1,29 +0,0 @@
|
||||
// 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.Platform;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Database
|
||||
{
|
||||
public abstract class RealmBackedStore
|
||||
{
|
||||
protected readonly Storage? Storage;
|
||||
|
||||
protected readonly IRealmFactory RealmFactory;
|
||||
|
||||
protected RealmBackedStore(IRealmFactory realmFactory, Storage? storage = null)
|
||||
{
|
||||
RealmFactory = realmFactory;
|
||||
Storage = storage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform any common clean-up tasks. Should be run when idle, or whenever necessary.
|
||||
/// </summary>
|
||||
public virtual void Cleanup()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Rulesets;
|
||||
@ -14,11 +13,13 @@ using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Input
|
||||
{
|
||||
public class RealmKeyBindingStore : RealmBackedStore
|
||||
public class RealmKeyBindingStore
|
||||
{
|
||||
public RealmKeyBindingStore(RealmContextFactory realmFactory, Storage? storage = null)
|
||||
: base(realmFactory, storage)
|
||||
private readonly RealmContextFactory realmFactory;
|
||||
|
||||
public RealmKeyBindingStore(RealmContextFactory realmFactory)
|
||||
{
|
||||
this.realmFactory = realmFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -28,7 +29,7 @@ namespace osu.Game.Input
|
||||
/// <returns>A set of display strings for all the user's key configuration for the action.</returns>
|
||||
public IEnumerable<string> GetReadableKeyCombinationsFor(GlobalAction globalAction)
|
||||
{
|
||||
foreach (var action in RealmFactory.Context.All<RealmKeyBinding>().Where(b => (GlobalAction)b.ActionInt == globalAction))
|
||||
foreach (var action in realmFactory.Context.All<RealmKeyBinding>().Where(b => (GlobalAction)b.ActionInt == globalAction))
|
||||
{
|
||||
string str = action.KeyCombination.ReadableString();
|
||||
|
||||
@ -52,7 +53,7 @@ namespace osu.Game.Input
|
||||
{
|
||||
var instance = ruleset.CreateInstance();
|
||||
|
||||
using (RealmFactory.GetForWrite())
|
||||
using (realmFactory.GetForWrite())
|
||||
{
|
||||
foreach (var variant in instance.AvailableVariants)
|
||||
insertDefaults(instance.GetDefaultKeyBindings(variant), ruleset.ID, variant);
|
||||
@ -61,7 +62,7 @@ namespace osu.Game.Input
|
||||
|
||||
private void insertDefaults(IEnumerable<IKeyBinding> defaults, int? rulesetId = null, int? variant = null)
|
||||
{
|
||||
using (var usage = RealmFactory.GetForWrite())
|
||||
using (var usage = realmFactory.GetForWrite())
|
||||
{
|
||||
// compare counts in database vs defaults
|
||||
foreach (var group in defaults.GroupBy(k => k.Action))
|
||||
|
Loading…
Reference in New Issue
Block a user