mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 00:43:25 +08:00
Subclass menu logo visualisation
This commit is contained in:
parent
ad4a8a1e0a
commit
8e9377914d
@ -1,22 +1,19 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Seasonal;
|
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Menu
|
namespace osu.Game.Screens.Menu
|
||||||
{
|
{
|
||||||
internal partial class MenuLogoVisualisation : LogoVisualisation
|
public partial class MenuLogoVisualisation : LogoVisualisation
|
||||||
{
|
{
|
||||||
private IBindable<APIUser> user;
|
private IBindable<APIUser> user = null!;
|
||||||
private Bindable<Skin> skin;
|
private Bindable<Skin> skin = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IAPIProvider api, SkinManager skinManager)
|
private void load(IAPIProvider api, SkinManager skinManager)
|
||||||
@ -24,15 +21,13 @@ namespace osu.Game.Screens.Menu
|
|||||||
user = api.LocalUser.GetBoundCopy();
|
user = api.LocalUser.GetBoundCopy();
|
||||||
skin = skinManager.CurrentSkin.GetBoundCopy();
|
skin = skinManager.CurrentSkin.GetBoundCopy();
|
||||||
|
|
||||||
user.ValueChanged += _ => updateColour();
|
user.ValueChanged += _ => UpdateColour();
|
||||||
skin.BindValueChanged(_ => updateColour(), true);
|
skin.BindValueChanged(_ => UpdateColour(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateColour()
|
protected virtual void UpdateColour()
|
||||||
{
|
{
|
||||||
if (SeasonalUIConfig.ENABLED)
|
if (user.Value?.IsSupporter ?? false)
|
||||||
Colour = SeasonalUIConfig.AMBIENT_COLOUR_1;
|
|
||||||
else if (user.Value?.IsSupporter ?? false)
|
|
||||||
Colour = skin.Value.GetConfig<GlobalSkinColours, Color4>(GlobalSkinColours.MenuGlow)?.Value ?? Color4.White;
|
Colour = skin.Value.GetConfig<GlobalSkinColours, Color4>(GlobalSkinColours.MenuGlow)?.Value ?? Color4.White;
|
||||||
else
|
else
|
||||||
Colour = Color4.White;
|
Colour = Color4.White;
|
||||||
|
@ -53,6 +53,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
private Sample sampleClick;
|
private Sample sampleClick;
|
||||||
private SampleChannel sampleClickChannel;
|
private SampleChannel sampleClickChannel;
|
||||||
|
|
||||||
|
protected virtual MenuLogoVisualisation CreateMenuLogoVisualisation() => new MenuLogoVisualisation();
|
||||||
|
|
||||||
protected virtual double BeatSampleVariance => 0.1;
|
protected virtual double BeatSampleVariance => 0.1;
|
||||||
|
|
||||||
protected Sample SampleBeat;
|
protected Sample SampleBeat;
|
||||||
@ -153,14 +155,14 @@ namespace osu.Game.Screens.Menu
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
visualizer = new MenuLogoVisualisation
|
visualizer = CreateMenuLogoVisualisation().With(v =>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
v.RelativeSizeAxes = Axes.Both;
|
||||||
Origin = Anchor.Centre,
|
v.Origin = Anchor.Centre;
|
||||||
Anchor = Anchor.Centre,
|
v.Anchor = Anchor.Centre;
|
||||||
Alpha = visualizer_default_alpha,
|
v.Alpha = visualizer_default_alpha;
|
||||||
Size = SCALE_ADJUST
|
v.Size = SCALE_ADJUST;
|
||||||
},
|
}),
|
||||||
LogoElements = new Container
|
LogoElements = new Container
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
|
@ -19,6 +19,8 @@ namespace osu.Game.Seasonal
|
|||||||
|
|
||||||
private bool hasHat;
|
private bool hasHat;
|
||||||
|
|
||||||
|
protected override MenuLogoVisualisation CreateMenuLogoVisualisation() => new SeasonalMenuLogoVisualisation();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(TextureStore textures, AudioManager audio)
|
private void load(TextureStore textures, AudioManager audio)
|
||||||
{
|
{
|
||||||
|
12
osu.Game/Seasonal/SeasonalMenuLogoVisualisation.cs
Normal file
12
osu.Game/Seasonal/SeasonalMenuLogoVisualisation.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user