mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 13:42:59 +08:00
revert mod store
This commit is contained in:
parent
15f11bb1e8
commit
42bcc8bafc
@ -18,12 +18,10 @@ using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public partial class ModPresetPanel : ModSelectPanel, IHasCustomTooltip<List<Mod>>, IHasContextMenu, IHasPopover
|
||||
public partial class ModPresetPanel : ModSelectPanel, IHasCustomTooltip<ModPreset>, IHasContextMenu, IHasPopover
|
||||
{
|
||||
public readonly Live<ModPreset> Preset;
|
||||
|
||||
public readonly Bindable<List<Mod>> Mods = new Bindable<List<Mod>>();
|
||||
|
||||
public override BindableBool Active { get; } = new BindableBool();
|
||||
|
||||
[Resolved]
|
||||
@ -37,7 +35,6 @@ namespace osu.Game.Overlays.Mods
|
||||
public ModPresetPanel(Live<ModPreset> preset)
|
||||
{
|
||||
Preset = preset;
|
||||
Mods.Value = preset.Value.Mods.ToList();
|
||||
|
||||
Title = preset.Value.Name;
|
||||
Description = preset.Value.Description;
|
||||
@ -54,7 +51,6 @@ namespace osu.Game.Overlays.Mods
|
||||
base.LoadComplete();
|
||||
|
||||
selectedMods.BindValueChanged(_ => selectedModsChanged(), true);
|
||||
Mods.BindValueChanged(_ => updateActiveState(), true);
|
||||
}
|
||||
|
||||
protected override void Select()
|
||||
@ -82,13 +78,13 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
private void updateActiveState()
|
||||
{
|
||||
Active.Value = new HashSet<Mod>(Mods.Value).SetEquals(selectedMods.Value);
|
||||
Active.Value = new HashSet<Mod>(Preset.Value.Mods).SetEquals(selectedMods.Value);
|
||||
}
|
||||
|
||||
#region IHasCustomTooltip
|
||||
|
||||
public List<Mod> TooltipContent => Mods.Value;
|
||||
public ITooltip<List<Mod>> GetCustomTooltip() => new ModPresetTooltip(ColourProvider);
|
||||
public ModPreset TooltipContent => Preset.Value;
|
||||
public ITooltip<ModPreset> GetCustomTooltip() => new ModPresetTooltip(ColourProvider);
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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 System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -12,7 +11,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public partial class ModPresetTooltip : VisibilityContainer, ITooltip<List<Mod>>
|
||||
public partial class ModPresetTooltip : VisibilityContainer, ITooltip<ModPreset>
|
||||
{
|
||||
protected override Container<Drawable> Content { get; }
|
||||
|
||||
@ -43,15 +42,15 @@ namespace osu.Game.Overlays.Mods
|
||||
};
|
||||
}
|
||||
|
||||
private List<Mod>? lastPreset;
|
||||
private ModPreset? lastPreset;
|
||||
|
||||
public void SetContent(List<Mod> mods)
|
||||
public void SetContent(ModPreset preset)
|
||||
{
|
||||
if (ReferenceEquals(mods, lastPreset))
|
||||
if (ReferenceEquals(preset, lastPreset))
|
||||
return;
|
||||
|
||||
lastPreset = mods;
|
||||
Content.ChildrenEnumerable = mods.Select(mod => new ModPresetRow(mod));
|
||||
lastPreset = preset;
|
||||
Content.ChildrenEnumerable = preset.Mods.Select(mod => new ModPresetRow(mod));
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.FadeIn(transition_duration, Easing.OutQuint);
|
||||
|
Loading…
Reference in New Issue
Block a user