mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Initial implementation
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osuTK;
|
||||
@ -13,14 +14,62 @@ namespace osu.Game.Graphics.Containers
|
||||
[Cached]
|
||||
private Facade facade;
|
||||
|
||||
private OsuLogo logo;
|
||||
|
||||
private bool tracking;
|
||||
private bool smoothTransform;
|
||||
|
||||
public FacadeContainer()
|
||||
{
|
||||
facade = new Facade();
|
||||
}
|
||||
|
||||
public void SetLogo(OsuLogo logo)
|
||||
private Vector2 logoTrackingPosition => logo.Parent.ToLocalSpace(facade.ScreenSpaceDrawQuad.Centre);
|
||||
|
||||
public void SetLogo(OsuLogo logo, bool resuming, double transformDelay)
|
||||
{
|
||||
facade.Size = new Vector2(logo.SizeForFlow);
|
||||
if (logo != null)
|
||||
{
|
||||
facade.Size = new Vector2(logo.SizeForFlow * 0.3f);
|
||||
this.logo = logo;
|
||||
Scheduler.AddDelayed(() =>
|
||||
{
|
||||
tracking = true;
|
||||
smoothTransform = !resuming;
|
||||
}, transformDelay);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
facade.Size = new Vector2(logo.SizeForFlow * 0.3f);
|
||||
|
||||
if (!tracking)
|
||||
return;
|
||||
|
||||
logo.RelativePositionAxes = Axes.None;
|
||||
|
||||
bool childrenLoaded = true;
|
||||
|
||||
foreach (var d in Children)
|
||||
{
|
||||
if (!d.IsAlive)
|
||||
childrenLoaded = false;
|
||||
}
|
||||
|
||||
if (smoothTransform && childrenLoaded)
|
||||
{
|
||||
// Our initial movement to the tracking location should be smooth.
|
||||
Schedule(() => logo.MoveTo(logoTrackingPosition, 500, Easing.InOutExpo));
|
||||
smoothTransform = false;
|
||||
}
|
||||
else if (logo.Transforms.Count == 0)
|
||||
{
|
||||
// If all transforms have finished playing, the logo constantly track the position of the facade.
|
||||
logo.Position = logoTrackingPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user