mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:25:11 +08:00
Better medal sprite loading, fade in particles, visual test update.
This commit is contained in:
parent
204d2ee43d
commit
ca12fd3042
@ -13,12 +13,15 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
public TestCaseMedalOverlay()
|
||||
{
|
||||
Add(new MedalOverlay(new Medal
|
||||
AddStep(@"display", () =>
|
||||
{
|
||||
Name = @"Animations",
|
||||
InternalName = @"all-intro-doubletime",
|
||||
Description = @"More complex than you think.",
|
||||
}));
|
||||
Add(new MedalOverlay(new Medal
|
||||
{
|
||||
Name = @"Animations",
|
||||
InternalName = @"all-intro-doubletime",
|
||||
Description = @"More complex than you think.",
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,17 +32,19 @@ namespace osu.Game.Overlays
|
||||
|
||||
private const float border_width = 5;
|
||||
|
||||
private readonly Medal medal;
|
||||
private readonly Box background;
|
||||
private readonly Container backgroundStrip, particleContainer;
|
||||
private readonly BackgroundStrip leftStrip, rightStrip;
|
||||
private readonly CircularContainer disc;
|
||||
private readonly Sprite innerSpin, outterSpin;
|
||||
private readonly DrawableMedal drawableMedal;
|
||||
private DrawableMedal drawableMedal;
|
||||
|
||||
private SampleChannel getSample;
|
||||
|
||||
public MedalOverlay(Medal medal)
|
||||
{
|
||||
this.medal = medal;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Alpha = 0f;
|
||||
AlwaysPresent = true;
|
||||
@ -103,6 +105,7 @@ namespace osu.Game.Overlays
|
||||
particleContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0f,
|
||||
},
|
||||
disc = new CircularContainer
|
||||
{
|
||||
@ -137,14 +140,6 @@ namespace osu.Game.Overlays
|
||||
Size = new Vector2(1.05f),
|
||||
Alpha = 0.25f,
|
||||
},
|
||||
drawableMedal = new DrawableMedal(medal)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AlwaysPresent = true,
|
||||
OnSpriteLoadComplete = drawable => Show(),
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -162,6 +157,13 @@ namespace osu.Game.Overlays
|
||||
Colour = colours.Blue.Opacity(0.5f),
|
||||
Radius = 50,
|
||||
};
|
||||
|
||||
LoadComponentAsync(drawableMedal = new DrawableMedal(medal)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
}, m => { disc.Add(m); Show(); });
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@ -217,6 +219,7 @@ namespace osu.Game.Overlays
|
||||
outterSpin.Transforms.Add(outerRotate);
|
||||
|
||||
disc.FadeIn(duration1);
|
||||
particleContainer.FadeIn(duration1);
|
||||
outterSpin.FadeTo(0.1f, duration1 * 2);
|
||||
disc.ScaleTo(1f, duration1 * 2, EasingTypes.OutElastic);
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
@ -19,18 +18,17 @@ namespace osu.Game.Overlays.MedalSplash
|
||||
private const float scale_when_unlocked = 0.76f;
|
||||
private const float scale_when_full = 0.6f;
|
||||
|
||||
private readonly Medal medal;
|
||||
private readonly Container medalContainer;
|
||||
private readonly Sprite medalGlow;
|
||||
private readonly Sprite medalSprite, medalGlow;
|
||||
private readonly OsuSpriteText unlocked, name;
|
||||
private readonly TextFlowContainer description;
|
||||
private readonly FillFlowContainer infoFlow;
|
||||
|
||||
public Action<Drawable> OnSpriteLoadComplete;
|
||||
|
||||
public DrawableMedal(Medal medal)
|
||||
{
|
||||
this.medal = medal;
|
||||
Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2);
|
||||
AlwaysPresent = true;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -40,17 +38,12 @@ namespace osu.Game.Overlays.MedalSplash
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Alpha = 0f,
|
||||
AlwaysPresent = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new AsyncLoadWrapper(new MedalSprite(medal)
|
||||
{
|
||||
OnLoadComplete = drawable => OnSpriteLoadComplete?.Invoke(drawable),
|
||||
})
|
||||
medalSprite = new Sprite
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Scale = new Vector2(0.81f),
|
||||
},
|
||||
medalGlow = new Sprite
|
||||
@ -115,6 +108,7 @@ namespace osu.Game.Overlays.MedalSplash
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, TextureStore textures)
|
||||
{
|
||||
medalSprite.Texture = textures.Get(medal.ImageUrl);
|
||||
medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow");
|
||||
description.Colour = colours.BlueLight;
|
||||
|
||||
@ -151,22 +145,5 @@ namespace osu.Game.Overlays.MedalSplash
|
||||
MedalUnlocked,
|
||||
Full,
|
||||
}
|
||||
|
||||
private class MedalSprite : Sprite
|
||||
{
|
||||
private readonly Medal medal;
|
||||
|
||||
public MedalSprite(Medal medal)
|
||||
{
|
||||
this.medal = medal;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
if (medal?.InternalName != null)
|
||||
Texture = textures.Get(medal.ImageUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user