1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 04:02:57 +08:00

Revert beatmap option button state changes

This commit is contained in:
Salman Ahmed 2022-11-17 03:54:35 +03:00
parent 5d8d8ffce5
commit 0e46614c57
5 changed files with 4 additions and 69 deletions

View File

@ -1063,15 +1063,8 @@ namespace osu.Game.Tests.Visual.SongSelect
addRulesetImportStep(0);
AddAssert("delete option enabled", () => !songSelect!.DeleteOptionButton.Disabled);
AddAssert("clear option enabled", () => !songSelect!.ClearOptionButton.Disabled);
AddAssert("edit option enabled", () => songSelect!.EditOptionButton?.Disabled == false);
AddStep("delete all beatmaps", () => manager.Delete());
AddAssert("delete option disabled", () => songSelect!.DeleteOptionButton.Disabled);
AddAssert("clear option disabled", () => songSelect!.ClearOptionButton.Disabled);
AddAssert("edit option disabled", () => songSelect!.EditOptionButton?.Disabled == true);
}
private void waitForInitialSelection()

View File

@ -33,29 +33,6 @@ namespace osu.Game.Screens.Select.Options
private const float disabled_alpha = 0.5f;
private bool disabled;
public bool Disabled
{
get => disabled;
set
{
disabled = value;
if (disabled)
{
firstLine.Alpha = disabled_alpha;
secondLine.Alpha = disabled_alpha;
iconText.Alpha = disabled_alpha;
return;
}
firstLine.Alpha = 1;
secondLine.Alpha = 1;
iconText.Alpha = 1;
}
}
public Color4 ButtonColour
{
get => background.Colour;
@ -82,24 +59,18 @@ namespace osu.Game.Screens.Select.Options
protected override bool OnMouseDown(MouseDownEvent e)
{
if (disabled) return true;
flash.FadeTo(0.1f, 1000, Easing.OutQuint);
return base.OnMouseDown(e);
}
protected override void OnMouseUp(MouseUpEvent e)
{
if (disabled) return;
flash.FadeTo(0, 1000, Easing.OutQuint);
base.OnMouseUp(e);
}
protected override bool OnClick(ClickEvent e)
{
if (disabled) return true;
flash.ClearTransforms();
flash.Alpha = 0.9f;
flash.FadeOut(800, Easing.OutExpo);

View File

@ -66,7 +66,7 @@ namespace osu.Game.Screens.Select.Options
/// <param name="colour">Colour of the button.</param>
/// <param name="icon">Icon of the button.</param>
/// <param name="action">Binding the button does.</param>
public BeatmapOptionsButton AddButton(LocalisableString firstLine, string secondLine, IconUsage icon, Color4 colour, Action action)
public void AddButton(LocalisableString firstLine, string secondLine, IconUsage icon, Color4 colour, Action action)
{
var button = new BeatmapOptionsButton
{
@ -82,8 +82,6 @@ namespace osu.Game.Screens.Select.Options
};
buttonsContainer.Add(button);
return button;
}
protected override void PopIn()

View File

@ -34,12 +34,10 @@ namespace osu.Game.Screens.Select
private PlayBeatmapDetailArea playBeatmapDetailArea = null!;
protected BeatmapOptionsButton? EditOptionButton;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
EditOptionButton = BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, colours.Yellow, () => Edit());
BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, colours.Yellow, () => Edit());
}
protected void PresentScore(ScoreInfo score) =>
@ -145,12 +143,5 @@ namespace osu.Game.Screens.Select
playerLoader = null;
}
}
protected override void OnBeatmapOptionsButtonDisabledChanged(bool disabled)
{
base.OnBeatmapOptionsButtonDisabledChanged(disabled);
if (EditOptionButton != null) EditOptionButton.Disabled = disabled;
}
}
}

View File

@ -116,10 +116,6 @@ namespace osu.Game.Screens.Select
private double audioFeedbackLastPlaybackTime;
protected BeatmapOptionsButton DeleteOptionButton;
protected BeatmapOptionsButton ClearOptionButton;
[CanBeNull]
private IDisposable modSelectOverlayRegistration;
@ -290,8 +286,8 @@ namespace osu.Game.Screens.Select
BeatmapOptions.AddButton(@"Manage", @"collections", FontAwesome.Solid.Book, colours.Green, () => manageCollectionsDialog?.Show());
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null);
DeleteOptionButton = BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo));
ClearOptionButton = BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo));
BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo));
BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo));
}
sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty");
@ -417,14 +413,6 @@ namespace osu.Game.Screens.Select
{
var beatmap = e?.NewValue ?? Beatmap.Value;
if (beatmap is DummyWorkingBeatmap || !this.IsCurrentScreen())
{
OnBeatmapOptionsButtonDisabledChanged(true);
return;
}
OnBeatmapOptionsButtonDisabledChanged(false);
Logger.Log($"Song select working beatmap updated to {beatmap}");
if (!Carousel.SelectBeatmap(beatmap.BeatmapInfo, false))
@ -658,12 +646,6 @@ namespace osu.Game.Screens.Select
return false;
}
protected virtual void OnBeatmapOptionsButtonDisabledChanged(bool disabled)
{
DeleteOptionButton.Disabled = disabled;
ClearOptionButton.Disabled = disabled;
}
private void playExitingTransition()
{
ModSelect.Hide();