mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:43:00 +08:00
Medal sprite, make MedalOverlay auto-show when loaded.
This commit is contained in:
parent
c71f34c507
commit
0133f9c086
@ -15,14 +15,12 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
MedalOverlay overlay;
|
Add(new MedalOverlay(new Medal
|
||||||
Add(overlay = new MedalOverlay(new Medal
|
|
||||||
{
|
{
|
||||||
Name = @"Animations",
|
Name = @"Animations",
|
||||||
|
InternalName = @"all-intro-doubletime",
|
||||||
Description = @"More complex than you think.",
|
Description = @"More complex than you think.",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AddStep(@"show", overlay.Show);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,6 +168,8 @@ namespace osu.Game.Overlays
|
|||||||
Colour = colours.Blue.Opacity(0.5f),
|
Colour = colours.Blue.Opacity(0.5f),
|
||||||
Radius = 50,
|
Radius = 50,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -19,8 +19,9 @@ namespace osu.Game.Overlays.MedalSplash
|
|||||||
private const float scale_when_unlocked = 0.76f;
|
private const float scale_when_unlocked = 0.76f;
|
||||||
private const float scale_when_full = 0.6f;
|
private const float scale_when_full = 0.6f;
|
||||||
|
|
||||||
private readonly Container medal;
|
private readonly Medal medal;
|
||||||
private readonly Sprite medalGlow;
|
private readonly Container medalContainer;
|
||||||
|
private readonly Sprite medalGlow, medalSprite;
|
||||||
private readonly OsuSpriteText unlocked, name;
|
private readonly OsuSpriteText unlocked, name;
|
||||||
private readonly TextFlowContainer description;
|
private readonly TextFlowContainer description;
|
||||||
private readonly FillFlowContainer infoFlow;
|
private readonly FillFlowContainer infoFlow;
|
||||||
@ -28,11 +29,12 @@ namespace osu.Game.Overlays.MedalSplash
|
|||||||
|
|
||||||
public DrawableMedal(Medal medal)
|
public DrawableMedal(Medal medal)
|
||||||
{
|
{
|
||||||
|
this.medal = medal;
|
||||||
Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2);
|
Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
this.medal = new Container
|
this.medalContainer = new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -40,6 +42,12 @@ namespace osu.Game.Overlays.MedalSplash
|
|||||||
Alpha = 0f,
|
Alpha = 0f,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
|
medalSprite = new Sprite
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Scale = new Vector2(0.81f),
|
||||||
|
},
|
||||||
medalGlow = new Sprite
|
medalGlow = new Sprite
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -102,12 +110,13 @@ namespace osu.Game.Overlays.MedalSplash
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, TextureStore textures)
|
private void load(OsuColour colours, TextureStore textures)
|
||||||
{
|
{
|
||||||
|
medalSprite.Texture = textures.Get(medal.ImageUrl);
|
||||||
medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow");
|
medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow");
|
||||||
|
|
||||||
foreach (var s in descriptionSprites)
|
foreach (var s in descriptionSprites)
|
||||||
s.Colour = colours.BlueLight;
|
s.Colour = colours.BlueLight;
|
||||||
|
|
||||||
var pos = new Vector2(0f, medal.Size.Y / 2 + 10);
|
var pos = new Vector2(0f, medalContainer.Size.Y / 2 + 10);
|
||||||
unlocked.Position = pos;
|
unlocked.Position = pos;
|
||||||
pos.Y += 90;
|
pos.Y += 90;
|
||||||
infoFlow.Position = pos;
|
infoFlow.Position = pos;
|
||||||
@ -118,9 +127,9 @@ namespace osu.Game.Overlays.MedalSplash
|
|||||||
switch (newState)
|
switch (newState)
|
||||||
{
|
{
|
||||||
case DisplayState.Icon:
|
case DisplayState.Icon:
|
||||||
medal.Scale = Vector2.Zero;
|
medalContainer.Scale = Vector2.Zero;
|
||||||
medal.ScaleTo(1, duration, EasingTypes.OutElastic);
|
medalContainer.ScaleTo(1, duration, EasingTypes.OutElastic);
|
||||||
medal.FadeInFromZero(duration);
|
medalContainer.FadeInFromZero(duration);
|
||||||
break;
|
break;
|
||||||
case DisplayState.MedalUnlocked:
|
case DisplayState.MedalUnlocked:
|
||||||
ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo);
|
ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo);
|
||||||
|
@ -6,6 +6,8 @@ namespace osu.Game.Users
|
|||||||
public class Medal
|
public class Medal
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
public string InternalName { get; set; }
|
||||||
|
public string ImageUrl => $@"https://s.ppy.sh/images/medals-client/{InternalName}@2x.png";
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user