mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 14:46:38 +09:00
Add animated osu! logo.
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -22,13 +23,26 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
Alpha = 0.3f;
|
||||
}
|
||||
|
||||
private float triangleScale = 1;
|
||||
|
||||
public float TriangleScale
|
||||
{
|
||||
get { return triangleScale; }
|
||||
set
|
||||
{
|
||||
triangleScale = value;
|
||||
|
||||
Children.ForEach(t => t.ScaleTo(triangleScale));
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
triangle = textures.Get(@"Play/osu/triangle@2x");
|
||||
}
|
||||
|
||||
private int aimTriangleCount => (int)((DrawWidth * DrawHeight) / 800);
|
||||
private int aimTriangleCount => (int)((DrawWidth * DrawHeight) / 800 / triangleScale);
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
@ -36,7 +50,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
|
||||
foreach (Drawable d in Children)
|
||||
{
|
||||
d.Position -= new Vector2(0, (float)(d.Scale.X * (Time.Elapsed / 880)));
|
||||
d.Position -= new Vector2(0, (float)(d.Scale.X * (50 / DrawHeight) * (Time.Elapsed / 880)) / triangleScale);
|
||||
if (d.DrawPosition.Y + d.DrawSize.Y * d.Scale.Y < 0)
|
||||
d.Expire();
|
||||
}
|
||||
@ -47,17 +61,26 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
|
||||
}
|
||||
|
||||
private void addTriangle(bool randomX)
|
||||
protected virtual Sprite CreateTriangle()
|
||||
{
|
||||
Add(new Sprite
|
||||
var scale = triangleScale * RNG.NextSingle() * 0.4f + 0.2f;
|
||||
|
||||
return new Sprite
|
||||
{
|
||||
Texture = triangle,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = new Vector2(RNG.NextSingle(), randomX ? RNG.NextSingle() : 1),
|
||||
Scale = new Vector2(RNG.NextSingle() * 0.4f + 0.2f),
|
||||
Alpha = RNG.NextSingle()
|
||||
});
|
||||
Scale = new Vector2(scale),
|
||||
Alpha = RNG.NextSingle(),
|
||||
Depth = scale,
|
||||
};
|
||||
}
|
||||
|
||||
private void addTriangle(bool randomX)
|
||||
{
|
||||
var sprite = CreateTriangle();
|
||||
sprite.Position = new Vector2(RNG.NextSingle(), randomX ? RNG.NextSingle() : 1);
|
||||
Add(sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user