mirror of
https://github.com/osukey/osukey.git
synced 2025-05-21 21:47:31 +09:00
Add basic beat response to osu! logo
This commit is contained in:
parent
d1eb8937b7
commit
3e0aaa1aa0
@ -16,12 +16,19 @@ namespace osu.Game.Graphics.Containers
|
|||||||
private int lastBeat;
|
private int lastBeat;
|
||||||
private ControlPoint lastControlPoint;
|
private ControlPoint lastControlPoint;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The amount of time before a beat we should fire <see cref="OnNewBeat(int, double, TimeSignatures, bool)"/>.
|
||||||
|
/// This allows for adding easing to animations that may be synchronised to the beat.
|
||||||
|
/// </summary>
|
||||||
|
protected double EarlyActivationMilliseconds;
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
if (beatmap.Value?.Track == null)
|
if (beatmap.Value?.Track == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double currentTrackTime = beatmap.Value.Track.CurrentTime;
|
double currentTrackTime = beatmap.Value.Track.CurrentTime + EarlyActivationMilliseconds;
|
||||||
|
|
||||||
ControlPoint overridePoint;
|
ControlPoint overridePoint;
|
||||||
ControlPoint controlPoint = beatmap.Value.Beatmap.TimingInfo.TimingPointAt(currentTrackTime, out overridePoint);
|
ControlPoint controlPoint = beatmap.Value.Beatmap.TimingInfo.TimingPointAt(currentTrackTime, out overridePoint);
|
||||||
|
|
||||||
|
@ -12,21 +12,24 @@ using osu.Framework.Graphics.Textures;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Menu
|
namespace osu.Game.Screens.Menu
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// osu! logo and its attachments (pulsing, visualiser etc.)
|
/// osu! logo and its attachments (pulsing, visualiser etc.)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OsuLogo : Container
|
public class OsuLogo : BeatSyncedContainer
|
||||||
{
|
{
|
||||||
public readonly Color4 OsuPink = OsuColour.FromHex(@"e967a1");
|
public readonly Color4 OsuPink = OsuColour.FromHex(@"e967a1");
|
||||||
|
|
||||||
private readonly Sprite logo;
|
private readonly Sprite logo;
|
||||||
private readonly CircularContainer logoContainer;
|
private readonly CircularContainer logoContainer;
|
||||||
private readonly Container logoBounceContainer;
|
private readonly Container logoBounceContainer;
|
||||||
|
private readonly Container logoBeatContainer;
|
||||||
private readonly Container logoHoverContainer;
|
private readonly Container logoHoverContainer;
|
||||||
|
|
||||||
private SampleChannel sampleClick;
|
private SampleChannel sampleClick;
|
||||||
@ -67,8 +70,12 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private const float default_size = 480;
|
private const float default_size = 480;
|
||||||
|
|
||||||
|
private const double beat_in_time = 60;
|
||||||
|
|
||||||
public OsuLogo()
|
public OsuLogo()
|
||||||
{
|
{
|
||||||
|
EarlyActivationMilliseconds = beat_in_time;
|
||||||
|
|
||||||
Size = new Vector2(default_size);
|
Size = new Vector2(default_size);
|
||||||
|
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
@ -76,6 +83,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
logoBeatContainer = new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
logoBounceContainer = new Container
|
logoBounceContainer = new Container
|
||||||
@ -186,6 +198,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,6 +220,15 @@ namespace osu.Game.Screens.Menu
|
|||||||
ripple.Loop(300);
|
ripple.Loop(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai)
|
||||||
|
{
|
||||||
|
base.OnNewBeat(newBeat, beatLength, timeSignature, kiai);
|
||||||
|
|
||||||
|
logoBeatContainer.ScaleTo(0.97f, beat_in_time, EasingTypes.Out);
|
||||||
|
using (logoBeatContainer.BeginDelayedSequence(beat_in_time))
|
||||||
|
logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
{
|
{
|
||||||
if (!Interactive) return false;
|
if (!Interactive) return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user