mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 05:52:56 +08:00
Update ModCustomisationPanel to use ExpandedState enum
This commit is contained in:
parent
188ddbcad6
commit
051d52c23f
@ -61,7 +61,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
AddStep("select difficulty adjust", () => freeModSelectOverlay.SelectedMods.Value = new[] { new OsuModDifficultyAdjust() });
|
AddStep("select difficulty adjust", () => freeModSelectOverlay.SelectedMods.Value = new[] { new OsuModDifficultyAdjust() });
|
||||||
AddWaitStep("wait some", 3);
|
AddWaitStep("wait some", 3);
|
||||||
AddAssert("customisation area not expanded", () => !this.ChildrenOfType<ModCustomisationPanel>().Single().Expanded.Value);
|
AddAssert("customisation area not expanded", () => !this.ChildrenOfType<ModCustomisationPanel>().Single().Expanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -51,22 +51,22 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddStep("set DT", () =>
|
AddStep("set DT", () =>
|
||||||
{
|
{
|
||||||
SelectedMods.Value = new[] { new OsuModDoubleTime() };
|
SelectedMods.Value = new[] { new OsuModDoubleTime() };
|
||||||
panel.Enabled.Value = panel.Expanded.Value = true;
|
panel.Enabled.Value = panel.Expanded = true;
|
||||||
});
|
});
|
||||||
AddStep("set DA", () =>
|
AddStep("set DA", () =>
|
||||||
{
|
{
|
||||||
SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() };
|
SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() };
|
||||||
panel.Enabled.Value = panel.Expanded.Value = true;
|
panel.Enabled.Value = panel.Expanded = true;
|
||||||
});
|
});
|
||||||
AddStep("set FL+WU+DA+AD", () =>
|
AddStep("set FL+WU+DA+AD", () =>
|
||||||
{
|
{
|
||||||
SelectedMods.Value = new Mod[] { new OsuModFlashlight(), new ModWindUp(), new OsuModDifficultyAdjust(), new OsuModApproachDifferent() };
|
SelectedMods.Value = new Mod[] { new OsuModFlashlight(), new ModWindUp(), new OsuModDifficultyAdjust(), new OsuModApproachDifferent() };
|
||||||
panel.Enabled.Value = panel.Expanded.Value = true;
|
panel.Enabled.Value = panel.Expanded = true;
|
||||||
});
|
});
|
||||||
AddStep("set empty", () =>
|
AddStep("set empty", () =>
|
||||||
{
|
{
|
||||||
SelectedMods.Value = Array.Empty<Mod>();
|
SelectedMods.Value = Array.Empty<Mod>();
|
||||||
panel.Enabled.Value = panel.Expanded.Value = false;
|
panel.Enabled.Value = panel.Expanded = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +77,11 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
AddStep("hover header", () => InputManager.MoveMouseTo(header));
|
AddStep("hover header", () => InputManager.MoveMouseTo(header));
|
||||||
|
|
||||||
AddAssert("not expanded", () => !panel.Expanded.Value);
|
AddAssert("not expanded", () => !panel.Expanded);
|
||||||
|
|
||||||
AddStep("hover content", () => InputManager.MoveMouseTo(content));
|
AddStep("hover content", () => InputManager.MoveMouseTo(content));
|
||||||
|
|
||||||
AddAssert("neither expanded", () => !panel.Expanded.Value);
|
AddAssert("neither expanded", () => !panel.Expanded);
|
||||||
|
|
||||||
AddStep("left from content", () => InputManager.MoveMouseTo(Vector2.One));
|
AddStep("left from content", () => InputManager.MoveMouseTo(Vector2.One));
|
||||||
}
|
}
|
||||||
@ -96,40 +96,40 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
AddStep("hover header", () => InputManager.MoveMouseTo(header));
|
AddStep("hover header", () => InputManager.MoveMouseTo(header));
|
||||||
|
|
||||||
AddAssert("expanded", () => panel.Expanded.Value);
|
AddAssert("expanded", () => panel.Expanded);
|
||||||
|
|
||||||
AddStep("hover content", () => InputManager.MoveMouseTo(content));
|
AddStep("hover content", () => InputManager.MoveMouseTo(content));
|
||||||
|
|
||||||
AddAssert("still expanded", () => panel.Expanded.Value);
|
AddAssert("still expanded", () => panel.Expanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will collapse when mouse left from content
|
// Will collapse when mouse left from content
|
||||||
{
|
{
|
||||||
AddStep("left from content", () => InputManager.MoveMouseTo(Vector2.One));
|
AddStep("left from content", () => InputManager.MoveMouseTo(Vector2.One));
|
||||||
|
|
||||||
AddAssert("not expanded", () => !panel.Expanded.Value);
|
AddAssert("not expanded", () => !panel.Expanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will collapse when mouse left from header
|
// Will collapse when mouse left from header
|
||||||
{
|
{
|
||||||
AddStep("hover header", () => InputManager.MoveMouseTo(header));
|
AddStep("hover header", () => InputManager.MoveMouseTo(header));
|
||||||
|
|
||||||
AddAssert("expanded", () => panel.Expanded.Value);
|
AddAssert("expanded", () => panel.Expanded);
|
||||||
|
|
||||||
AddStep("left from header", () => InputManager.MoveMouseTo(Vector2.One));
|
AddStep("left from header", () => InputManager.MoveMouseTo(Vector2.One));
|
||||||
|
|
||||||
AddAssert("not expanded", () => !panel.Expanded.Value);
|
AddAssert("not expanded", () => !panel.Expanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not collapse when mouse left if not expanded by hovering
|
// Not collapse when mouse left if not expanded by hovering
|
||||||
{
|
{
|
||||||
AddStep("expand not by hovering", () => panel.Expanded.Value = true);
|
AddStep("expand not by hovering", () => panel.Expanded = true);
|
||||||
|
|
||||||
AddStep("hover content", () => InputManager.MoveMouseTo(content));
|
AddStep("hover content", () => InputManager.MoveMouseTo(content));
|
||||||
|
|
||||||
AddStep("moust left", () => InputManager.MoveMouseTo(Vector2.One));
|
AddStep("moust left", () => InputManager.MoveMouseTo(Vector2.One));
|
||||||
|
|
||||||
AddAssert("still expanded", () => panel.Expanded.Value);
|
AddAssert("still expanded", () => panel.Expanded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -999,7 +999,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddStep("press mouse", () => InputManager.PressButton(MouseButton.Left));
|
AddStep("press mouse", () => InputManager.PressButton(MouseButton.Left));
|
||||||
AddAssert("search still not focused", () => !this.ChildrenOfType<ShearedSearchTextBox>().Single().HasFocus);
|
AddAssert("search still not focused", () => !this.ChildrenOfType<ShearedSearchTextBox>().Single().HasFocus);
|
||||||
AddStep("release mouse", () => InputManager.ReleaseButton(MouseButton.Left));
|
AddStep("release mouse", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||||
AddAssert("customisation panel closed by click", () => !this.ChildrenOfType<ModCustomisationPanel>().Single().Expanded.Value);
|
AddAssert("customisation panel closed by click", () => !this.ChildrenOfType<ModCustomisationPanel>().Single().Expanded);
|
||||||
|
|
||||||
if (textSearchStartsActive)
|
if (textSearchStartsActive)
|
||||||
AddAssert("search focused", () => this.ChildrenOfType<ShearedSearchTextBox>().Single().HasFocus);
|
AddAssert("search focused", () => this.ChildrenOfType<ShearedSearchTextBox>().Single().HasFocus);
|
||||||
@ -1022,7 +1022,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
private void assertCustomisationToggleState(bool disabled, bool active)
|
private void assertCustomisationToggleState(bool disabled, bool active)
|
||||||
{
|
{
|
||||||
AddUntilStep($"customisation panel is {(disabled ? "" : "not ")}disabled", () => modSelectOverlay.ChildrenOfType<ModCustomisationPanel>().Single().Enabled.Value == !disabled);
|
AddUntilStep($"customisation panel is {(disabled ? "" : "not ")}disabled", () => modSelectOverlay.ChildrenOfType<ModCustomisationPanel>().Single().Enabled.Value == !disabled);
|
||||||
AddAssert($"customisation panel is {(active ? "" : "not ")}active", () => modSelectOverlay.ChildrenOfType<ModCustomisationPanel>().Single().Expanded.Value == active);
|
AddAssert($"customisation panel is {(active ? "" : "not ")}active", () => modSelectOverlay.ChildrenOfType<ModCustomisationPanel>().Single().Expanded == active);
|
||||||
}
|
}
|
||||||
|
|
||||||
private T getSelectedMod<T>() where T : Mod => SelectedMods.Value.OfType<T>().Single();
|
private T getSelectedMod<T>() where T : Mod => SelectedMods.Value.OfType<T>().Single();
|
||||||
|
@ -14,6 +14,7 @@ using osu.Game.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
|
using static osu.Game.Overlays.Mods.ModCustomisationPanel;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
@ -27,14 +28,13 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
||||||
|
|
||||||
public readonly BindableBool Expanded = new BindableBool();
|
public readonly Bindable<ModCustomisationPanelState> ExpandedState = new Bindable<ModCustomisationPanelState>(ModCustomisationPanelState.Collapsed);
|
||||||
|
|
||||||
private readonly ModCustomisationPanel panel;
|
private readonly ModCustomisationPanel panel;
|
||||||
|
|
||||||
public ModCustomisationHeader(ModCustomisationPanel panel)
|
public ModCustomisationHeader(ModCustomisationPanel panel)
|
||||||
{
|
{
|
||||||
this.panel = panel;
|
this.panel = panel;
|
||||||
Action = Expanded.Toggle;
|
|
||||||
Enabled.Value = false;
|
Enabled.Value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,12 +90,26 @@ namespace osu.Game.Overlays.Mods
|
|||||||
: ModSelectOverlayStrings.CustomisationPanelDisabledReason;
|
: ModSelectOverlayStrings.CustomisationPanelDisabledReason;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
Expanded.BindValueChanged(v =>
|
ExpandedState.BindValueChanged(v =>
|
||||||
{
|
{
|
||||||
icon.ScaleTo(v.NewValue ? new Vector2(1, -1) : Vector2.One, 300, Easing.OutQuint);
|
icon.ScaleTo(v.NewValue > ModCustomisationPanelState.Collapsed ? new Vector2(1, -1) : Vector2.One, 300, Easing.OutQuint);
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
{
|
||||||
|
if (Enabled.Value)
|
||||||
|
{
|
||||||
|
ExpandedState.Value = ExpandedState.Value switch
|
||||||
|
{
|
||||||
|
ModCustomisationPanelState.Collapsed => ModCustomisationPanelState.Expanded,
|
||||||
|
_ => ModCustomisationPanelState.Collapsed
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnClick(e);
|
||||||
|
}
|
||||||
|
|
||||||
private bool touchedThisFrame;
|
private bool touchedThisFrame;
|
||||||
|
|
||||||
protected override bool OnTouchDown(TouchDownEvent e)
|
protected override bool OnTouchDown(TouchDownEvent e)
|
||||||
@ -114,7 +128,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
if (Enabled.Value)
|
if (Enabled.Value)
|
||||||
{
|
{
|
||||||
if (!touchedThisFrame)
|
if (!touchedThisFrame)
|
||||||
panel.UpdateHoverExpansion(true);
|
panel.UpdateHoverExpansion(ModCustomisationPanelState.ExpandedByHover);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnHover(e);
|
return base.OnHover(e);
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -39,7 +38,13 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
public readonly BindableBool Enabled = new BindableBool();
|
public readonly BindableBool Enabled = new BindableBool();
|
||||||
|
|
||||||
public readonly BindableBool Expanded = new BindableBool();
|
public readonly Bindable<ModCustomisationPanelState> ExpandedState = new Bindable<ModCustomisationPanelState>(ModCustomisationPanelState.Collapsed);
|
||||||
|
|
||||||
|
public bool Expanded
|
||||||
|
{
|
||||||
|
get => ExpandedState.Value > ModCustomisationPanelState.Collapsed;
|
||||||
|
set => ExpandedState.Value = value ? ModCustomisationPanelState.Expanded : ModCustomisationPanelState.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
public Bindable<IReadOnlyList<Mod>> SelectedMods { get; } = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
public Bindable<IReadOnlyList<Mod>> SelectedMods { get; } = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||||
|
|
||||||
@ -48,8 +53,8 @@ namespace osu.Game.Overlays.Mods
|
|||||||
// Handle{Non}PositionalInput controls whether the panel should act as a blocking layer on the screen. only block when the panel is expanded.
|
// Handle{Non}PositionalInput controls whether the panel should act as a blocking layer on the screen. only block when the panel is expanded.
|
||||||
// These properties are used because they correctly handle blocking/unblocking hover when mouse is pointing at a drawable outside
|
// These properties are used because they correctly handle blocking/unblocking hover when mouse is pointing at a drawable outside
|
||||||
// (returning Expanded.Value to OnHover or overriding Block{Non}PositionalInput doesn't work).
|
// (returning Expanded.Value to OnHover or overriding Block{Non}PositionalInput doesn't work).
|
||||||
public override bool HandlePositionalInput => Expanded.Value;
|
public override bool HandlePositionalInput => Expanded;
|
||||||
public override bool HandleNonPositionalInput => Expanded.Value;
|
public override bool HandleNonPositionalInput => Expanded;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
@ -64,7 +69,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = header_height,
|
Height = header_height,
|
||||||
Enabled = { BindTarget = Enabled },
|
Enabled = { BindTarget = Enabled },
|
||||||
Expanded = { BindTarget = Expanded },
|
ExpandedState = { BindTarget = ExpandedState },
|
||||||
},
|
},
|
||||||
content = new FocusGrabbingContainer(this)
|
content = new FocusGrabbingContainer(this)
|
||||||
{
|
{
|
||||||
@ -81,8 +86,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Roundness = 5f,
|
Roundness = 5f,
|
||||||
Colour = Color4.Black.Opacity(0.25f),
|
Colour = Color4.Black.Opacity(0.25f),
|
||||||
},
|
},
|
||||||
Expanded = { BindTarget = Expanded },
|
ExpandedState = { BindTarget = ExpandedState },
|
||||||
ExpandedByHovering = { BindTarget = ExpandedByHovering },
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
@ -124,7 +128,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
this.FadeColour(OsuColour.Gray(e.NewValue ? 1f : 0.6f), 300, Easing.OutQuint);
|
this.FadeColour(OsuColour.Gray(e.NewValue ? 1f : 0.6f), 300, Easing.OutQuint);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
Expanded.BindValueChanged(_ => updateDisplay(), true);
|
ExpandedState.BindValueChanged(_ => updateDisplay(), true);
|
||||||
SelectedMods.BindValueChanged(_ => updateMods(), true);
|
SelectedMods.BindValueChanged(_ => updateMods(), true);
|
||||||
|
|
||||||
FinishTransforms(true);
|
FinishTransforms(true);
|
||||||
@ -136,7 +140,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
Expanded.Value = false;
|
Expanded = false;
|
||||||
return base.OnClick(e);
|
return base.OnClick(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +153,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
switch (e.Action)
|
switch (e.Action)
|
||||||
{
|
{
|
||||||
case GlobalAction.Back:
|
case GlobalAction.Back:
|
||||||
Expanded.Value = false;
|
Expanded = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +168,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
content.ClearTransforms();
|
content.ClearTransforms();
|
||||||
|
|
||||||
if (Expanded.Value)
|
if (Expanded)
|
||||||
{
|
{
|
||||||
content.AutoSizeDuration = 400;
|
content.AutoSizeDuration = 400;
|
||||||
content.AutoSizeEasing = Easing.OutQuint;
|
content.AutoSizeEasing = Easing.OutQuint;
|
||||||
@ -177,30 +181,19 @@ namespace osu.Game.Overlays.Mods
|
|||||||
content.ResizeHeightTo(header_height, 400, Easing.OutQuint);
|
content.ResizeHeightTo(header_height, 400, Easing.OutQuint);
|
||||||
content.FadeOut(400, Easing.OutSine);
|
content.FadeOut(400, Easing.OutSine);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpandedByHovering.Value = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly BindableBool ExpandedByHovering = new BindableBool();
|
public void UpdateHoverExpansion(ModCustomisationPanelState state)
|
||||||
|
|
||||||
public void UpdateHoverExpansion(bool hovered)
|
|
||||||
{
|
{
|
||||||
if (hovered && !Expanded.Value)
|
if (state > ModCustomisationPanelState.Collapsed && state <= ExpandedState.Value)
|
||||||
{
|
return;
|
||||||
Expanded.Value = true;
|
|
||||||
ExpandedByHovering.Value = true;
|
|
||||||
}
|
|
||||||
else if (!hovered && ExpandedByHovering.Value)
|
|
||||||
{
|
|
||||||
Debug.Assert(Expanded.Value);
|
|
||||||
|
|
||||||
Expanded.Value = false;
|
ExpandedState.Value = state;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMods()
|
private void updateMods()
|
||||||
{
|
{
|
||||||
Expanded.Value = false;
|
Expanded = false;
|
||||||
sectionsFlow.Clear();
|
sectionsFlow.Clear();
|
||||||
|
|
||||||
// Importantly, the selected mods bindable is already ordered by the mod select overlay (following the order of mod columns and panels).
|
// Importantly, the selected mods bindable is already ordered by the mod select overlay (following the order of mod columns and panels).
|
||||||
@ -223,11 +216,10 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
private partial class FocusGrabbingContainer : InputBlockingContainer
|
private partial class FocusGrabbingContainer : InputBlockingContainer
|
||||||
{
|
{
|
||||||
public IBindable<bool> Expanded { get; } = new BindableBool();
|
public readonly IBindable<ModCustomisationPanelState> ExpandedState = new Bindable<ModCustomisationPanelState>(ModCustomisationPanelState.Collapsed);
|
||||||
public IBindable<bool> ExpandedByHovering { get; } = new BindableBool();
|
|
||||||
|
|
||||||
public override bool RequestsFocus => Expanded.Value;
|
public override bool RequestsFocus => panel.Expanded;
|
||||||
public override bool AcceptsFocus => Expanded.Value;
|
public override bool AcceptsFocus => panel.Expanded;
|
||||||
|
|
||||||
private readonly ModCustomisationPanel panel;
|
private readonly ModCustomisationPanel panel;
|
||||||
|
|
||||||
@ -238,11 +230,21 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
if (ExpandedByHovering.Value && !ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
if (ExpandedState.Value is ModCustomisationPanelState.ExpandedByHover
|
||||||
panel.UpdateHoverExpansion(false);
|
&& !ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
||||||
|
{
|
||||||
|
panel.UpdateHoverExpansion(ModCustomisationPanelState.Collapsed);
|
||||||
|
}
|
||||||
|
|
||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ModCustomisationPanelState
|
||||||
|
{
|
||||||
|
Collapsed = 0,
|
||||||
|
ExpandedByHover = 1,
|
||||||
|
Expanded = 2,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
ActiveMods.Value = ComputeActiveMods();
|
ActiveMods.Value = ComputeActiveMods();
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
customisationPanel.Expanded.BindValueChanged(_ => updateCustomisationVisualState(), true);
|
customisationPanel.ExpandedState.BindValueChanged(_ => updateCustomisationVisualState(), true);
|
||||||
|
|
||||||
SearchTextBox.Current.BindValueChanged(query =>
|
SearchTextBox.Current.BindValueChanged(query =>
|
||||||
{
|
{
|
||||||
@ -368,18 +368,18 @@ namespace osu.Game.Overlays.Mods
|
|||||||
customisationPanel.Enabled.Value = true;
|
customisationPanel.Enabled.Value = true;
|
||||||
|
|
||||||
if (anyModPendingConfiguration)
|
if (anyModPendingConfiguration)
|
||||||
customisationPanel.Expanded.Value = true;
|
customisationPanel.Expanded = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
customisationPanel.Expanded.Value = false;
|
customisationPanel.Expanded = false;
|
||||||
customisationPanel.Enabled.Value = false;
|
customisationPanel.Enabled.Value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCustomisationVisualState()
|
private void updateCustomisationVisualState()
|
||||||
{
|
{
|
||||||
if (customisationPanel.Expanded.Value)
|
if (customisationPanel.Expanded)
|
||||||
{
|
{
|
||||||
columnScroll.FadeColour(OsuColour.Gray(0.5f), 400, Easing.OutQuint);
|
columnScroll.FadeColour(OsuColour.Gray(0.5f), 400, Easing.OutQuint);
|
||||||
SearchTextBox.FadeColour(OsuColour.Gray(0.5f), 400, Easing.OutQuint);
|
SearchTextBox.FadeColour(OsuColour.Gray(0.5f), 400, Easing.OutQuint);
|
||||||
@ -544,7 +544,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
nonFilteredColumnCount += 1;
|
nonFilteredColumnCount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
customisationPanel.Expanded.Value = false;
|
customisationPanel.Expanded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -571,7 +571,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
// wherein activating the binding will both change the contents of the search text box and deselect all mods.
|
// wherein activating the binding will both change the contents of the search text box and deselect all mods.
|
||||||
case GlobalAction.DeselectAllMods:
|
case GlobalAction.DeselectAllMods:
|
||||||
{
|
{
|
||||||
if (!SearchTextBox.HasFocus && !customisationPanel.Expanded.Value)
|
if (!SearchTextBox.HasFocus && !customisationPanel.Expanded)
|
||||||
{
|
{
|
||||||
DisplayedFooterContent?.DeselectAllModsButton?.TriggerClick();
|
DisplayedFooterContent?.DeselectAllModsButton?.TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
@ -637,7 +637,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
if (e.Repeat || e.Key != Key.Tab)
|
if (e.Repeat || e.Key != Key.Tab)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (customisationPanel.Expanded.Value)
|
if (customisationPanel.Expanded)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`)
|
// TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`)
|
||||||
|
Loading…
Reference in New Issue
Block a user