Encapsulate mod hotkey selection logic in strategy pattern

This commit is contained in:
Bartłomiej Dach
2022-06-21 12:49:01 +02:00
parent b7b7de115f
commit 73124d2b1f
9 changed files with 145 additions and 31 deletions

View File

@ -1,14 +1,10 @@
// 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.
#nullable disable
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using osu.Game.Rulesets.Mods;
using osu.Game.Utils;
using osuTK.Input;
namespace osu.Game.Overlays.Mods
{
@ -19,7 +15,7 @@ namespace osu.Game.Overlays.Mods
{
}
protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new UserModColumn(modType, false, toggleKeys);
protected override ModColumn CreateModColumn(ModType modType) => new UserModColumn(modType, false);
protected override IReadOnlyList<Mod> ComputeNewModsFromSelection(IReadOnlyList<Mod> oldSelection, IReadOnlyList<Mod> newSelection)
{
@ -44,8 +40,8 @@ namespace osu.Game.Overlays.Mods
private class UserModColumn : ModColumn
{
public UserModColumn(ModType modType, bool allowBulkSelection, [CanBeNull] Key[] toggleKeys = null)
: base(modType, allowBulkSelection, toggleKeys)
public UserModColumn(ModType modType, bool allowBulkSelection)
: base(modType, allowBulkSelection)
{
}