1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 04:33:21 +08:00

revert mod store

This commit is contained in:
cdwcgt 2023-03-16 19:15:50 +09:00
parent 15f11bb1e8
commit 42bcc8bafc
2 changed files with 10 additions and 15 deletions

View File

@ -18,12 +18,10 @@ using osu.Game.Rulesets.Mods;
namespace osu.Game.Overlays.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 Live<ModPreset> Preset;
public readonly Bindable<List<Mod>> Mods = new Bindable<List<Mod>>();
public override BindableBool Active { get; } = new BindableBool(); public override BindableBool Active { get; } = new BindableBool();
[Resolved] [Resolved]
@ -37,7 +35,6 @@ namespace osu.Game.Overlays.Mods
public ModPresetPanel(Live<ModPreset> preset) public ModPresetPanel(Live<ModPreset> preset)
{ {
Preset = preset; Preset = preset;
Mods.Value = preset.Value.Mods.ToList();
Title = preset.Value.Name; Title = preset.Value.Name;
Description = preset.Value.Description; Description = preset.Value.Description;
@ -54,7 +51,6 @@ namespace osu.Game.Overlays.Mods
base.LoadComplete(); base.LoadComplete();
selectedMods.BindValueChanged(_ => selectedModsChanged(), true); selectedMods.BindValueChanged(_ => selectedModsChanged(), true);
Mods.BindValueChanged(_ => updateActiveState(), true);
} }
protected override void Select() protected override void Select()
@ -82,13 +78,13 @@ namespace osu.Game.Overlays.Mods
private void updateActiveState() 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 #region IHasCustomTooltip
public List<Mod> TooltipContent => Mods.Value; public ModPreset TooltipContent => Preset.Value;
public ITooltip<List<Mod>> GetCustomTooltip() => new ModPresetTooltip(ColourProvider); public ITooltip<ModPreset> GetCustomTooltip() => new ModPresetTooltip(ColourProvider);
#endregion #endregion

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 System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -12,7 +11,7 @@ using osuTK;
namespace osu.Game.Overlays.Mods 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; } 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; return;
lastPreset = mods; lastPreset = preset;
Content.ChildrenEnumerable = mods.Select(mod => new ModPresetRow(mod)); Content.ChildrenEnumerable = preset.Mods.Select(mod => new ModPresetRow(mod));
} }
protected override void PopIn() => this.FadeIn(transition_duration, Easing.OutQuint); protected override void PopIn() => this.FadeIn(transition_duration, Easing.OutQuint);