1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 18:42:56 +08:00

Remove need for logo relativePositionAxes none

This commit is contained in:
David Zhao 2019-04-03 20:32:53 +09:00
parent 2ed945605e
commit 8a40b27e8f
4 changed files with 4 additions and 10 deletions

View File

@ -177,7 +177,6 @@ namespace osu.Game.Tests.Visual
Scheduler.AddDelayed(() => Scheduler.AddDelayed(() =>
{ {
logoFacadeContainer.Tracking = true; logoFacadeContainer.Tracking = true;
//logo.RelativePositionAxes = Axes.None;
visualBox.Colour = Color4.Tomato; visualBox.Colour = Color4.Tomato;
}, 700); }, 700);
}); });

View File

@ -54,7 +54,7 @@ namespace osu.Game.Graphics.Containers
startPosition = null; startPosition = null;
} }
private Vector2 localSpaceConversion() private Vector2 logoTrackingPosition()
{ {
Vector2 local; Vector2 local;
local.X = logo.Parent.ToLocalSpace(LogoFacade.ScreenSpaceDrawQuad.Centre).X / logo.Parent.RelativeToAbsoluteFactor.X; local.X = logo.Parent.ToLocalSpace(LogoFacade.ScreenSpaceDrawQuad.Centre).X / logo.Parent.RelativeToAbsoluteFactor.X;
@ -62,8 +62,6 @@ namespace osu.Game.Graphics.Containers
return local; return local;
} }
private Vector2 logoTrackingPosition => logo.RelativePositionAxes == Axes.None ? logo.Parent.ToLocalSpace(LogoFacade.ScreenSpaceDrawQuad.Centre) : localSpaceConversion();
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
@ -74,7 +72,7 @@ namespace osu.Game.Graphics.Containers
// Account for the scale of the actual logo container, as SizeForFlow only accounts for the sprite scale. // Account for the scale of the actual logo container, as SizeForFlow only accounts for the sprite scale.
LogoFacade.Size = new Vector2(logo.SizeForFlow * logo.Scale.X * facadeScale); LogoFacade.Size = new Vector2(logo.SizeForFlow * logo.Scale.X * facadeScale);
if (LogoFacade.Parent != null && logo.Position != logoTrackingPosition) if (LogoFacade.Parent != null && logo.Position != logoTrackingPosition())
{ {
// If this is our first update since tracking has started, initialize our starting values for interpolation // If this is our first update since tracking has started, initialize our starting values for interpolation
if (startTime == null || startPosition == null) if (startTime == null || startPosition == null)
@ -90,11 +88,11 @@ namespace osu.Game.Graphics.Containers
var mount = (float)Interpolation.ApplyEasing(easing, Math.Min(elapsedDuration / duration, 1)); var mount = (float)Interpolation.ApplyEasing(easing, Math.Min(elapsedDuration / duration, 1));
// Interpolate the position of the logo, where mount 0 is where the logo was when it first began interpolating, and mount 1 is the target location. // Interpolate the position of the logo, where mount 0 is where the logo was when it first began interpolating, and mount 1 is the target location.
logo.Position = Vector2.Lerp(startPosition ?? throw new ArgumentNullException(nameof(startPosition)), logoTrackingPosition, mount); logo.Position = Vector2.Lerp(startPosition ?? throw new ArgumentNullException(nameof(startPosition)), logoTrackingPosition(), mount);
} }
else else
{ {
logo.Position = logoTrackingPosition; logo.Position = logoTrackingPosition();
} }
} }
} }

View File

@ -290,7 +290,6 @@ namespace osu.Game.Screens.Menu
break; break;
case ButtonSystemState.Initial: case ButtonSystemState.Initial:
logo.ClearTransforms(targetMember: nameof(Position)); logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.None;
bool impact = logo.Scale.X > 0.6f; bool impact = logo.Scale.X > 0.6f;
@ -311,7 +310,6 @@ namespace osu.Game.Screens.Menu
break; break;
default: default:
logo.ClearTransforms(targetMember: nameof(Position)); logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.None;
logoFacadeContainer.Tracking = true; logoFacadeContainer.Tracking = true;
logo.ScaleTo(0.5f, 200, Easing.OutQuint); logo.ScaleTo(0.5f, 200, Easing.OutQuint);
break; break;

View File

@ -175,7 +175,6 @@ namespace osu.Game.Screens.Play
Scheduler.AddDelayed(() => Scheduler.AddDelayed(() =>
{ {
content.Tracking = true; content.Tracking = true;
//logo.RelativePositionAxes = Axes.None;
}, resuming ? 0 : 500); }, resuming ? 0 : 500);
} }