1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-20 15:53:22 +08:00

Subclass menu logo visualisation

This commit is contained in:
Dean Herbert 2024-12-20 15:04:37 +09:00
parent ad4a8a1e0a
commit 8e9377914d
No known key found for this signature in database
4 changed files with 30 additions and 19 deletions

View File

@ -1,22 +1,19 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Seasonal;
using osu.Game.Skinning;
using osuTK.Graphics;
namespace osu.Game.Screens.Menu
{
internal partial class MenuLogoVisualisation : LogoVisualisation
public partial class MenuLogoVisualisation : LogoVisualisation
{
private IBindable<APIUser> user;
private Bindable<Skin> skin;
private IBindable<APIUser> user = null!;
private Bindable<Skin> skin = null!;
[BackgroundDependencyLoader]
private void load(IAPIProvider api, SkinManager skinManager)
@ -24,15 +21,13 @@ namespace osu.Game.Screens.Menu
user = api.LocalUser.GetBoundCopy();
skin = skinManager.CurrentSkin.GetBoundCopy();
user.ValueChanged += _ => updateColour();
skin.BindValueChanged(_ => updateColour(), true);
user.ValueChanged += _ => UpdateColour();
skin.BindValueChanged(_ => UpdateColour(), true);
}
private void updateColour()
protected virtual void UpdateColour()
{
if (SeasonalUIConfig.ENABLED)
Colour = SeasonalUIConfig.AMBIENT_COLOUR_1;
else if (user.Value?.IsSupporter ?? false)
if (user.Value?.IsSupporter ?? false)
Colour = skin.Value.GetConfig<GlobalSkinColours, Color4>(GlobalSkinColours.MenuGlow)?.Value ?? Color4.White;
else
Colour = Color4.White;

View File

@ -53,6 +53,8 @@ namespace osu.Game.Screens.Menu
private Sample sampleClick;
private SampleChannel sampleClickChannel;
protected virtual MenuLogoVisualisation CreateMenuLogoVisualisation() => new MenuLogoVisualisation();
protected virtual double BeatSampleVariance => 0.1;
protected Sample SampleBeat;
@ -153,14 +155,14 @@ namespace osu.Game.Screens.Menu
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
visualizer = new MenuLogoVisualisation
visualizer = CreateMenuLogoVisualisation().With(v =>
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Alpha = visualizer_default_alpha,
Size = SCALE_ADJUST
},
v.RelativeSizeAxes = Axes.Both;
v.Origin = Anchor.Centre;
v.Anchor = Anchor.Centre;
v.Alpha = visualizer_default_alpha;
v.Size = SCALE_ADJUST;
}),
LogoElements = new Container
{
AutoSizeAxes = Axes.Both,

View File

@ -19,6 +19,8 @@ namespace osu.Game.Seasonal
private bool hasHat;
protected override MenuLogoVisualisation CreateMenuLogoVisualisation() => new SeasonalMenuLogoVisualisation();
[BackgroundDependencyLoader]
private void load(TextureStore textures, AudioManager audio)
{

View File

@ -0,0 +1,12 @@
// 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.Game.Screens.Menu;
namespace osu.Game.Seasonal
{
internal partial class SeasonalMenuLogoVisualisation : MenuLogoVisualisation
{
protected override void UpdateColour() => Colour = SeasonalUIConfig.AMBIENT_COLOUR_1;
}
}