Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mod customization header/panel changes #29626

Merged
merged 10 commits into from
Sep 4, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ public void TestDisplay()
{
SelectedMods.Value = new[] { new OsuModDoubleTime() };
panel.Enabled.Value = true;
panel.ExpandedState.Value = ModCustomisationPanel.ModCustomisationPanelState.Expanded;
panel.ExpandedState.Value = ModCustomisationPanel.ModCustomisationPanelState.ExpandedByMod;
});
AddStep("set DA", () =>
{
SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() };
panel.Enabled.Value = true;
panel.ExpandedState.Value = ModCustomisationPanel.ModCustomisationPanelState.Expanded;
panel.ExpandedState.Value = ModCustomisationPanel.ModCustomisationPanelState.ExpandedByMod;
});
AddStep("set FL+WU+DA+AD", () =>
{
SelectedMods.Value = new Mod[] { new OsuModFlashlight(), new ModWindUp(), new OsuModDifficultyAdjust(), new OsuModApproachDifferent() };
panel.Enabled.Value = true;
panel.ExpandedState.Value = ModCustomisationPanel.ModCustomisationPanelState.Expanded;
panel.ExpandedState.Value = ModCustomisationPanel.ModCustomisationPanelState.ExpandedByMod;
});
AddStep("set empty", () =>
{
Expand Down
16 changes: 1 addition & 15 deletions osu.Game/Overlays/Mods/ModCustomisationHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,6 @@ protected override void LoadComplete()
}, 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;

protected override bool OnTouchDown(TouchDownEvent e)
Expand All @@ -144,7 +130,7 @@ protected override bool OnHover(HoverEvent e)
if (Enabled.Value)
{
if (!touchedThisFrame && panel.ExpandedState.Value == ModCustomisationPanelState.Collapsed)
panel.ExpandedState.Value = ModCustomisationPanelState.ExpandedByHover;
panel.ExpandedState.Value = ModCustomisationPanelState.Expanded;
}

return base.OnHover(e);
Expand Down
6 changes: 3 additions & 3 deletions osu.Game/Overlays/Mods/ModCustomisationPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ protected override void Update()
{
base.Update();

if (ExpandedState.Value == ModCustomisationPanelState.ExpandedByHover
if (ExpandedState.Value == ModCustomisationPanelState.Expanded
&& !ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position)
&& inputManager.DraggedDrawable == null)
{
Expand All @@ -239,8 +239,8 @@ protected override void Update()
public enum ModCustomisationPanelState
{
Collapsed = 0,
ExpandedByHover = 1,
Expanded = 2,
Expanded = 1,
ExpandedByMod = 2,
}
}
}
2 changes: 1 addition & 1 deletion osu.Game/Overlays/Mods/ModSelectOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ private void updateCustomisation()
customisationPanel.Enabled.Value = true;

if (anyModPendingConfiguration)
customisationPanel.ExpandedState.Value = ModCustomisationPanel.ModCustomisationPanelState.Expanded;
customisationPanel.ExpandedState.Value = ModCustomisationPanel.ModCustomisationPanelState.ExpandedByMod;
}
else
{
Expand Down
Loading