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

Add implementation for new song select "osu!" button #28147

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectFooterV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Select.FooterV2;
using osu.Game.Screens.SelectV2.Footer;
using osuTK.Input;

namespace osu.Game.Tests.Visual.SongSelect
Expand All @@ -24,6 +24,7 @@ public partial class TestSceneSongSelectFooterV2 : OsuManualInputManagerTestScen
private bool nextRandomCalled;
private bool previousRandomCalled;

private FooterV2 footer = null!;
private DummyOverlay overlay = null!;

[Cached]
Expand All @@ -35,8 +36,6 @@ public partial class TestSceneSongSelectFooterV2 : OsuManualInputManagerTestScen
nextRandomCalled = false;
previousRandomCalled = false;

FooterV2 footer;

Children = new Drawable[]
{
new PopoverContainer
Expand All @@ -62,6 +61,14 @@ public partial class TestSceneSongSelectFooterV2 : OsuManualInputManagerTestScen
public void SetUpSteps()
{
AddStep("set beatmap", () => Beatmap.Value = CreateWorkingBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo)));
AddStep("show footer", () => footer.Show());
}

[Test]
public void TestDisplay()
{
AddStep("hide footer", () => footer.Hide());
AddStep("show footer", () => footer.Show());
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// 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.Linq;
using osu.Framework.Testing;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.SelectV2.Footer;
using osuTK.Input;

namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneSongSelectV2Navigation : OsuGameTestScene
{
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("press enter", () => InputManager.Key(Key.Enter));
AddWaitStep("wait", 5);
AddStep("load screen", () => Game.ScreenStack.Push(new SongSelectV2()));
AddWaitStep("wait", 5);
AddStep("move to osu", () => InputManager.MoveMouseTo(this.ChildrenOfType<OsuLogoButton>().Single()));

Check failure on line 21 in osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectV2Navigation.cs

View workflow job for this annotation

GitHub Actions / Test Results (Linux, MultiThreaded)

osu.Game.Tests.Visual.SongSelect.TestSceneSongSelectV2Navigation ► TestConstructor

Failed test found in: TestResults-Linux-MultiThreaded.trx Error: System.InvalidOperationException : Sequence contains no elements
Raw output
System.InvalidOperationException : Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at osu.Game.Tests.Visual.SongSelect.TestSceneSongSelectV2Navigation.<SetUpSteps>b__0_2() in /home/runner/work/osu/osu/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectV2Navigation.cs:line 21
   at osu.Framework.Testing.Drawables.Steps.SingleStepButton.<.ctor>b__1_0()
   at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered)
   at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition)
--- End of stack trace from previous location ---
   at osu.Framework.Testing.TestSceneTestRunner.TestRunner.RunTestBlocking(TestScene test)
   at osu.Game.Tests.Visual.OsuTestScene.OsuTestSceneTestRunner.RunTestBlocking(TestScene test) in /home/runner/work/osu/osu/osu.Game/Tests/Visual/OsuTestScene.cs:line 539
   at osu.Framework.Testing.TestScene.UseTestSceneRunnerAttribute.AfterTest(ITest test)
   at NUnit.Framework.Internal.Commands.TestActionCommand.<>c__DisplayClass0_0.<.ctor>b__1(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__1()
   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

Check failure on line 21 in osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectV2Navigation.cs

View workflow job for this annotation

GitHub Actions / Test Results (Linux, SingleThread)

osu.Game.Tests.Visual.SongSelect.TestSceneSongSelectV2Navigation ► TestConstructor

Failed test found in: TestResults-Linux-SingleThread.trx Error: System.InvalidOperationException : Sequence contains no elements
Raw output
System.InvalidOperationException : Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at osu.Game.Tests.Visual.SongSelect.TestSceneSongSelectV2Navigation.<SetUpSteps>b__0_2() in /home/runner/work/osu/osu/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectV2Navigation.cs:line 21
   at osu.Framework.Testing.Drawables.Steps.SingleStepButton.<.ctor>b__1_0()
   at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered)
   at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition)
--- End of stack trace from previous location ---
   at osu.Framework.Testing.TestSceneTestRunner.TestRunner.RunTestBlocking(TestScene test)
   at osu.Game.Tests.Visual.OsuTestScene.OsuTestSceneTestRunner.RunTestBlocking(TestScene test) in /home/runner/work/osu/osu/osu.Game/Tests/Visual/OsuTestScene.cs:line 539
   at osu.Framework.Testing.TestScene.UseTestSceneRunnerAttribute.AfterTest(ITest test)
   at NUnit.Framework.Internal.Commands.TestActionCommand.<>c__DisplayClass0_0.<.ctor>b__1(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__1()
   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

Check failure on line 21 in osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectV2Navigation.cs

View workflow job for this annotation

GitHub Actions / Test Results (Windows, MultiThreaded)

osu.Game.Tests.Visual.SongSelect.TestSceneSongSelectV2Navigation ► TestConstructor

Failed test found in: TestResults-Windows-MultiThreaded.trx Error: System.InvalidOperationException : Sequence contains no elements
Raw output
System.InvalidOperationException : Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at osu.Game.Tests.Visual.SongSelect.TestSceneSongSelectV2Navigation.<SetUpSteps>b__0_2() in D:\a\osu\osu\osu.Game.Tests\Visual\SongSelect\TestSceneSongSelectV2Navigation.cs:line 21
   at osu.Framework.Testing.Drawables.Steps.SingleStepButton.<.ctor>b__1_0()
   at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered)
   at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition)
--- End of stack trace from previous location ---
   at osu.Framework.Testing.TestSceneTestRunner.TestRunner.RunTestBlocking(TestScene test)
   at osu.Game.Tests.Visual.OsuTestScene.OsuTestSceneTestRunner.RunTestBlocking(TestScene test) in D:\a\osu\osu\osu.Game\Tests\Visual\OsuTestScene.cs:line 539
   at osu.Framework.Testing.TestScene.UseTestSceneRunnerAttribute.AfterTest(ITest test)
   at NUnit.Framework.Internal.Commands.TestActionCommand.<>c__DisplayClass0_0.<.ctor>b__1(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__1()
   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

Check failure on line 21 in osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectV2Navigation.cs

View workflow job for this annotation

GitHub Actions / Test Results (macOS, SingleThread)

osu.Game.Tests.Visual.SongSelect.TestSceneSongSelectV2Navigation ► TestConstructor

Failed test found in: TestResults-macOS-SingleThread.trx Error: System.InvalidOperationException : Sequence contains no elements
Raw output
System.InvalidOperationException : Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at osu.Game.Tests.Visual.SongSelect.TestSceneSongSelectV2Navigation.<SetUpSteps>b__0_2() in /Users/runner/work/osu/osu/osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectV2Navigation.cs:line 21
   at osu.Framework.Testing.Drawables.Steps.SingleStepButton.<.ctor>b__1_0()
   at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered)
   at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition)
--- End of stack trace from previous location ---
   at osu.Framework.Testing.TestSceneTestRunner.TestRunner.RunTestBlocking(TestScene test)
   at osu.Game.Tests.Visual.OsuTestScene.OsuTestSceneTestRunner.RunTestBlocking(TestScene test) in /Users/runner/work/osu/osu/osu.Game/Tests/Visual/OsuTestScene.cs:line 539
   at osu.Framework.Testing.TestScene.UseTestSceneRunnerAttribute.AfterTest(ITest test)
   at NUnit.Framework.Internal.Commands.TestActionCommand.<>c__DisplayClass0_0.<.ctor>b__1(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__1()
   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

Check failure on line 21 in osu.Game.Tests/Visual/SongSelect/TestSceneSongSelectV2Navigation.cs

View workflow job for this annotation

GitHub Actions / Test Results (Windows, SingleThread)

osu.Game.Tests.Visual.SongSelect.TestSceneSongSelectV2Navigation ► TestConstructor

Failed test found in: TestResults-Windows-SingleThread.trx Error: System.InvalidOperationException : Sequence contains no elements
Raw output
System.InvalidOperationException : Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at osu.Game.Tests.Visual.SongSelect.TestSceneSongSelectV2Navigation.<SetUpSteps>b__0_2() in D:\a\osu\osu\osu.Game.Tests\Visual\SongSelect\TestSceneSongSelectV2Navigation.cs:line 21
   at osu.Framework.Testing.Drawables.Steps.SingleStepButton.<.ctor>b__1_0()
   at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered)
   at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition)
--- End of stack trace from previous location ---
   at osu.Framework.Testing.TestSceneTestRunner.TestRunner.RunTestBlocking(TestScene test)
   at osu.Game.Tests.Visual.OsuTestScene.OsuTestSceneTestRunner.RunTestBlocking(TestScene test) in D:\a\osu\osu\osu.Game\Tests\Visual\OsuTestScene.cs:line 539
   at osu.Framework.Testing.TestScene.UseTestSceneRunnerAttribute.AfterTest(ITest test)
   at NUnit.Framework.Internal.Commands.TestActionCommand.<>c__DisplayClass0_0.<.ctor>b__1(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__1()
   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)
AddStep("click", () => InputManager.Click(MouseButton.Left));
}
}
}
14 changes: 11 additions & 3 deletions osu.Game/Graphics/UserInterface/ShearedButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public Colour4 TextColour
private Colour4? textColour;

private readonly Container backgroundLayer;

protected Container ButtonContent { get; }

private readonly Box flashLayer;

/// <summary>
Expand Down Expand Up @@ -109,12 +112,17 @@ public ShearedButton(float? width = null)
{
RelativeSizeAxes = Axes.Both
},
text = new OsuSpriteText
ButtonContent = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.TorusAlternate.With(size: 17),
Shear = new Vector2(-shear, 0)
Shear = new Vector2(-shear, 0),
Child = text = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.TorusAlternate.With(size: 17),
}
},
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
using osuTK.Input;
using WebCommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings;

namespace osu.Game.Screens.Select.FooterV2
namespace osu.Game.Screens.SelectV2.Footer
{
public partial class BeatmapOptionsPopover : OsuPopover
{
Expand All @@ -43,7 +43,7 @@ public BeatmapOptionsPopover(FooterButtonOptionsV2 footerButton)
}

[BackgroundDependencyLoader]
private void load(ManageCollectionsDialog? manageCollectionsDialog, SongSelect? songSelect, OsuColour colours, BeatmapManager? beatmapManager)
private void load(ManageCollectionsDialog? manageCollectionsDialog, OsuColour colours, BeatmapManager? beatmapManager)
{
Content.Padding = new MarginPadding(5);

Expand All @@ -60,15 +60,15 @@ private void load(ManageCollectionsDialog? manageCollectionsDialog, SongSelect?
addButton(SongSelectStrings.ManageCollections, FontAwesome.Solid.Book, () => manageCollectionsDialog?.Show());

addHeader(SongSelectStrings.ForAllDifficulties, beatmapWhenOpening.BeatmapSetInfo.ToString());
addButton(SongSelectStrings.DeleteBeatmap, FontAwesome.Solid.Trash, () => songSelect?.DeleteBeatmap(beatmapWhenOpening.BeatmapSetInfo), colours.Red1);
// addButton(SongSelectStrings.DeleteBeatmap, FontAwesome.Solid.Trash, () => songSelect?.DeleteBeatmap(beatmapWhenOpening.BeatmapSetInfo), colours.Red1);

addHeader(SongSelectStrings.ForSelectedDifficulty, beatmapWhenOpening.BeatmapInfo.DifficultyName);
// TODO: make work, and make show "unplayed" or "played" based on status.
addButton(SongSelectStrings.MarkAsPlayed, FontAwesome.Regular.TimesCircle, null);
addButton(SongSelectStrings.ClearAllLocalScores, FontAwesome.Solid.Eraser, () => songSelect?.ClearScores(beatmapWhenOpening.BeatmapInfo), colours.Red1);
// addButton(SongSelectStrings.ClearAllLocalScores, FontAwesome.Solid.Eraser, () => songSelect?.ClearScores(beatmapWhenOpening.BeatmapInfo), colours.Red1);

if (songSelect != null && songSelect.AllowEditing)
addButton(SongSelectStrings.EditBeatmap, FontAwesome.Solid.PencilAlt, () => songSelect.Edit(beatmapWhenOpening.BeatmapInfo));
// if (songSelect != null && songSelect.AllowEditing)
// addButton(SongSelectStrings.EditBeatmap, FontAwesome.Solid.PencilAlt, () => songSelect.Edit(beatmapWhenOpening.BeatmapInfo));

addButton(WebCommonStrings.ButtonsHide.ToSentence(), FontAwesome.Solid.Magic, () => beatmapManager?.Hide(beatmapWhenOpening.BeatmapInfo));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;

namespace osu.Game.Screens.Select.FooterV2
namespace osu.Game.Screens.SelectV2.Footer
{
public partial class FooterButtonModsV2 : FooterButtonV2
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using osu.Game.Graphics;
using osu.Game.Input.Bindings;

namespace osu.Game.Screens.Select.FooterV2
namespace osu.Game.Screens.SelectV2.Footer
{
public partial class FooterButtonOptionsV2 : FooterButtonV2, IHasPopover
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using osuTK;
using osuTK.Input;

namespace osu.Game.Screens.Select.FooterV2
namespace osu.Game.Screens.SelectV2.Footer
{
public partial class FooterButtonRandomV2 : FooterButtonV2
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Screens.Select.FooterV2
namespace osu.Game.Screens.SelectV2.Footer
{
public partial class FooterButtonV2 : OsuClickableContainer, IKeyBindingHandler<GlobalAction>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
// 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;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Screens.Menu;
using osuTK;

namespace osu.Game.Screens.Select.FooterV2
namespace osu.Game.Screens.SelectV2.Footer
{
public partial class FooterV2 : InputBlockingContainer
public partial class FooterV2 : VisibilityContainer
{
//Should be 60, setting to 50 for now for the sake of matching the current BackButton height.
private const int height = 50;
private const int padding = 80;

private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();

private OsuLogoButton osuLogoButton = null!;

public Action? OnOsu;

/// <param name="button">The button to be added.</param>
/// <param name="overlay">The <see cref="OverlayContainer"/> to be toggled by this button.</param>
public void AddButton(FooterButtonV2 button, OverlayContainer? overlay = null)
Expand All @@ -46,6 +51,7 @@ private void showOverlay(OverlayContainer overlay)
}
}

private Box background = null!;
private FillFlowContainer<FooterButtonV2> buttons = null!;

public FooterV2()
Expand All @@ -61,21 +67,81 @@ private void load(OverlayColourProvider colourProvider)
{
InternalChildren = new Drawable[]
{
new Box
background = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5
},
buttons = new FillFlowContainer<FooterButtonV2>
{
Position = new Vector2(TwoLayerButton.SIZE_EXTENDED.X + padding, 10),
Margin = new MarginPadding { Left = TwoLayerButton.SIZE_EXTENDED.X + padding },
Y = 10f,
RelativePositionAxes = Axes.X,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(-FooterButtonV2.SHEAR_WIDTH + 7, 0),
AutoSizeAxes = Axes.Both
},
osuLogoButton = new OsuLogoButton(0)
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
RelativeSizeAxes = Axes.X,
Width = 0.3f,
Margin = new MarginPadding { Right = 17, Bottom = 5 },
Action = () => OnOsu?.Invoke(),
}
};
}

private const float off_screen_y = 100;
private const float buttons_pop_delay = 30;

protected override void PopIn()
{
background.MoveToY(0, 400, Easing.OutQuint);
buttons.Delay(buttons_pop_delay)
.MoveToX(0, 400, Easing.OutQuint)
.FadeIn(400, Easing.OutQuint);
}

protected override void PopOut()
{
buttons.MoveToX(-0.5f, 400, Easing.OutQuint)
.FadeOut(400, Easing.OutQuint);

background.Delay(buttons_pop_delay).MoveToY(off_screen_y, 400, Easing.OutQuint);
osuLogoButton.Delay(buttons_pop_delay).MoveToY(off_screen_y, 400, Easing.OutQuint);
}

private OsuLogo? logo;

public void AttachLogo(OsuLogo logo, bool resuming)
{
this.logo = logo;

osuLogoButton.AttachLogo(logo, resuming ? 240 : 0, Easing.OutQuint);
osuLogoButton.MoveToY(0, 240, Easing.OutQuint);

if (resuming)
logo.FadeOut(180, Easing.InQuint);
}

public void DetachLogo(bool pushLogoUpwards)
{
if (logo == null)
return;

osuLogoButton.DetachLogo(60, Easing.OutQuint, pushLogoUpwards);

if (pushLogoUpwards)
{
logo.MoveToOffset(new Vector2(0, -0.15f), 240, Easing.OutQuint);
logo.FadeIn(240, Easing.OutQuint);
}

logo = null;
}
}
}
77 changes: 77 additions & 0 deletions osu.Game/Screens/SelectV2/Footer/OsuLogoButton.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Menu;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Screens.SelectV2.Footer
{
public partial class OsuLogoButton : ShearedButton
{
private const float logo_scale = 0.15f;

private LogoTrackingContainer logoTrackingContainer = null!;
private Sprite logoTextSprite = null!;

public OsuLogoButton(float? width = null)
: base(width)
{
}

[BackgroundDependencyLoader]
private void load(OsuColour colours, TextureStore textures)
{
ButtonContent.Child = (logoTrackingContainer = new LogoTrackingContainer
{
RelativeSizeAxes = Axes.Both,
}).WithChildren(new Drawable[]
{
logoTextSprite = new Sprite
{
Alpha = 0f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = textures.Get(@"Menu/logo-without-border"),
Scale = new Vector2(logo_scale),
},
logoTrackingContainer.LogoFacade.With(f =>
{
f.Anchor = Anchor.Centre;
f.Origin = Anchor.Centre;
}),
});

DarkerColour = colours.Pink1;
LighterColour = Color4.White;
}

public void AttachLogo(OsuLogo logo, double duration, Easing easing)
{
logoTextSprite.Delay(duration)
.FadeIn(duration, easing)
.MoveToY(0, duration, easing);

logoTrackingContainer.StartTracking(logo, duration, easing);
}

public void DetachLogo(double duration, Easing easing, bool fadeTextOut)
{
if (fadeTextOut)
{
logoTextSprite.FadeOut(duration, easing)
.MoveToY(-10, duration, easing);
}

logoTrackingContainer.StopTracking();
}
}
}
Loading
Loading