1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 02:52:54 +08:00

Add logo hat

This commit is contained in:
Dean Herbert 2024-12-19 18:44:44 +09:00
parent 6dd80589dd
commit 63752810fe
No known key found for this signature in database
3 changed files with 61 additions and 2 deletions

View File

@ -4,22 +4,31 @@
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using osuTK;
namespace osu.Game.Tests.Visual.UserInterface namespace osu.Game.Tests.Visual.UserInterface
{ {
public partial class TestSceneOsuLogo : OsuTestScene public partial class TestSceneOsuLogo : OsuTestScene
{ {
private OsuLogo? logo;
[Test] [Test]
public void TestBasic() public void TestBasic()
{ {
AddStep("Add logo", () => AddStep("Add logo", () =>
{ {
Child = new OsuLogo Child = logo = new OsuLogo
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
}; };
}); });
AddSliderStep("scale", 0.1, 2, 1, scale =>
{
if (logo != null)
Child.Scale = new Vector2((float)scale);
});
} }
} }
} }

View File

@ -4,6 +4,7 @@
#nullable disable #nullable disable
using System; using System;
using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
@ -211,6 +212,15 @@ namespace osu.Game.Screens.Menu
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
}, },
SeasonalUI.ENABLED
? hat = new Sprite
{
BypassAutoSizeAxes = Axes.Both,
Alpha = 0,
Origin = Anchor.BottomCentre,
Scale = new Vector2(-1, 1),
}
: Empty(),
} }
}, },
impactContainer = new CircularContainer impactContainer = new CircularContainer
@ -284,6 +294,8 @@ namespace osu.Game.Screens.Menu
logo.Texture = textures.Get(@"Menu/logo"); logo.Texture = textures.Get(@"Menu/logo");
ripple.Texture = textures.Get(@"Menu/logo"); ripple.Texture = textures.Get(@"Menu/logo");
if (hat != null)
hat.Texture = textures.Get(@"Menu/hat");
} }
private int lastBeatIndex; private int lastBeatIndex;
@ -369,6 +381,9 @@ namespace osu.Game.Screens.Menu
const float scale_adjust_cutoff = 0.4f; const float scale_adjust_cutoff = 0.4f;
if (SeasonalUI.ENABLED)
updateHat();
if (musicController.CurrentTrack.IsRunning) if (musicController.CurrentTrack.IsRunning)
{ {
float maxAmplitude = lastBeatIndex >= 0 ? musicController.CurrentTrack.CurrentAmplitudes.Maximum : 0; float maxAmplitude = lastBeatIndex >= 0 ? musicController.CurrentTrack.CurrentAmplitudes.Maximum : 0;
@ -382,6 +397,38 @@ namespace osu.Game.Screens.Menu
} }
} }
private bool hasHat;
private void updateHat()
{
if (hat == null)
return;
bool shouldHat = DrawWidth * Scale.X < 400;
if (shouldHat != hasHat)
{
hasHat = shouldHat;
if (hasHat)
{
hat.Delay(400)
.Then()
.MoveTo(new Vector2(120, 160))
.RotateTo(0)
.RotateTo(-20, 500, Easing.OutQuint)
.FadeIn(250, Easing.OutQuint);
}
else
{
hat.Delay(100)
.Then()
.MoveToOffset(new Vector2(0, -5), 500, Easing.OutQuint)
.FadeOut(500, Easing.OutQuint);
}
}
}
public override bool HandlePositionalInput => base.HandlePositionalInput && Alpha > 0.2f; public override bool HandlePositionalInput => base.HandlePositionalInput && Alpha > 0.2f;
protected override bool OnMouseDown(MouseDownEvent e) protected override bool OnMouseDown(MouseDownEvent e)
@ -459,6 +506,9 @@ namespace osu.Game.Screens.Menu
private Container currentProxyTarget; private Container currentProxyTarget;
private Drawable proxy; private Drawable proxy;
[CanBeNull]
private readonly Sprite hat;
public void StopSamplePlayback() => sampleClickChannel?.Stop(); public void StopSamplePlayback() => sampleClickChannel?.Stop();
public Drawable ProxyToContainer(Container c) public Drawable ProxyToContainer(Container c)

View File

@ -36,7 +36,7 @@
</PackageReference> </PackageReference>
<PackageReference Include="Realm" Version="11.5.0" /> <PackageReference Include="Realm" Version="11.5.0" />
<PackageReference Include="ppy.osu.Framework" Version="2024.1206.0" /> <PackageReference Include="ppy.osu.Framework" Version="2024.1206.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.1219.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2024.1219.1" />
<PackageReference Include="Sentry" Version="4.13.0" /> <PackageReference Include="Sentry" Version="4.13.0" />
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. --> <!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
<PackageReference Include="SharpCompress" Version="0.38.0" /> <PackageReference Include="SharpCompress" Version="0.38.0" />