mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:07:52 +08:00
Move transitions inside ScreenFooterButton
and re-use Content
from base implementation instead
The point is to apply the transitions against a container that's inside of `ScreenFooterButton`, because the `ScreenFooterButton` drawable's position is being controlled by the flow container it's contained within, and we cannot apply the transitions on it directly.
This commit is contained in:
parent
8c4931eeec
commit
f59d94bba4
@ -97,11 +97,9 @@ namespace osu.Game.Screens.Footer
|
||||
removedButtonsContainer.Add(oldButton);
|
||||
|
||||
if (buttons.Count > 0)
|
||||
fadeButtonToLeft(oldButton, i, oldButtons.Length);
|
||||
makeButtonDisappearToRightAndExpire(oldButton, i, oldButtons.Length);
|
||||
else
|
||||
fadeButtonToBottom(oldButton, i, oldButtons.Length);
|
||||
|
||||
Scheduler.AddDelayed(() => oldButton.Expire(), oldButton.TopLevelContent.LatestTransformEndTime - Time.Current);
|
||||
makeButtonDisappearToBottomAndExpire(oldButton, i, oldButtons.Length);
|
||||
}
|
||||
|
||||
for (int i = 0; i < buttons.Count; i++)
|
||||
@ -123,52 +121,24 @@ namespace osu.Game.Screens.Footer
|
||||
newButton.OnLoadComplete += _ =>
|
||||
{
|
||||
if (oldButtons.Length > 0)
|
||||
fadeButtonFromRight(newButton, index, buttons.Count, 240);
|
||||
makeButtonAppearFromLeft(newButton, index, buttons.Count, 240);
|
||||
else
|
||||
fadeButtonFromBottom(newButton, index);
|
||||
makeButtonAppearFromBottom(newButton, index);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void fadeButtonFromRight(ScreenFooterButton button, int index, int count, float startDelay)
|
||||
{
|
||||
button.TopLevelContent
|
||||
.MoveToX(-300f)
|
||||
.FadeOut();
|
||||
private void makeButtonAppearFromLeft(ScreenFooterButton button, int index, int count, float startDelay)
|
||||
=> button.AppearFromLeft(startDelay + (count - index) * delay_per_button);
|
||||
|
||||
button.TopLevelContent
|
||||
.Delay(startDelay + (count - index) * delay_per_button)
|
||||
.MoveToX(0f, 240, Easing.OutCubic)
|
||||
.FadeIn(240, Easing.OutCubic);
|
||||
}
|
||||
private void makeButtonAppearFromBottom(ScreenFooterButton button, int index)
|
||||
=> button.AppearFromBottom(index * delay_per_button);
|
||||
|
||||
private void fadeButtonFromBottom(ScreenFooterButton button, int index)
|
||||
{
|
||||
button.TopLevelContent
|
||||
.MoveToY(100f)
|
||||
.FadeOut();
|
||||
private void makeButtonDisappearToRightAndExpire(ScreenFooterButton button, int index, int count)
|
||||
=> button.DisappearToRightAndExpire((count - index) * delay_per_button);
|
||||
|
||||
button.TopLevelContent
|
||||
.Delay(index * delay_per_button)
|
||||
.MoveToY(0f, 240, Easing.OutCubic)
|
||||
.FadeIn(240, Easing.OutCubic);
|
||||
}
|
||||
|
||||
private void fadeButtonToLeft(ScreenFooterButton button, int index, int count)
|
||||
{
|
||||
button.TopLevelContent
|
||||
.Delay((count - index) * delay_per_button)
|
||||
.FadeOut(240, Easing.InOutCubic)
|
||||
.MoveToX(300f, 360, Easing.InOutCubic);
|
||||
}
|
||||
|
||||
private void fadeButtonToBottom(ScreenFooterButton button, int index, int count)
|
||||
{
|
||||
button.TopLevelContent
|
||||
.Delay((count - index) * delay_per_button)
|
||||
.FadeOut(240, Easing.InOutCubic)
|
||||
.MoveToY(100f, 240, Easing.InOutCubic);
|
||||
}
|
||||
private void makeButtonDisappearToBottomAndExpire(ScreenFooterButton button, int index, int count)
|
||||
=> button.DisappearToBottomAndExpire((count - index) * delay_per_button);
|
||||
|
||||
private void showOverlay(OverlayContainer overlay)
|
||||
{
|
||||
|
@ -69,7 +69,6 @@ namespace osu.Game.Screens.Footer
|
||||
private readonly Box glowBox;
|
||||
private readonly Box flashLayer;
|
||||
|
||||
public readonly Container TopLevelContent;
|
||||
public readonly OverlayContainer? Overlay;
|
||||
|
||||
public ScreenFooterButton(OverlayContainer? overlay = null)
|
||||
@ -78,9 +77,6 @@ namespace osu.Game.Screens.Footer
|
||||
|
||||
Size = new Vector2(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
|
||||
Child = TopLevelContent = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
@ -161,7 +157,6 @@ namespace osu.Game.Screens.Footer
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -230,5 +225,41 @@ namespace osu.Game.Screens.Footer
|
||||
|
||||
glowBox.FadeColour(ColourInfo.GradientVertical(buttonAccentColour.Opacity(0f), buttonAccentColour.Opacity(0.2f)), 150, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public void AppearFromLeft(double delay)
|
||||
{
|
||||
Content.MoveToX(-300f)
|
||||
.FadeOut()
|
||||
.Delay(delay)
|
||||
.MoveToX(0f, 240, Easing.OutCubic)
|
||||
.FadeIn(240, Easing.OutCubic);
|
||||
}
|
||||
|
||||
public void AppearFromBottom(double delay)
|
||||
{
|
||||
Content.MoveToY(100f)
|
||||
.FadeOut()
|
||||
.Delay(delay)
|
||||
.MoveToY(0f, 240, Easing.OutCubic)
|
||||
.FadeIn(240, Easing.OutCubic);
|
||||
}
|
||||
|
||||
public void DisappearToRightAndExpire(double delay)
|
||||
{
|
||||
Content.Delay(delay)
|
||||
.FadeOut(240, Easing.InOutCubic)
|
||||
.MoveToX(300f, 360, Easing.InOutCubic);
|
||||
|
||||
this.Delay(Content.LatestTransformEndTime - Time.Current).Expire();
|
||||
}
|
||||
|
||||
public void DisappearToBottomAndExpire(double delay)
|
||||
{
|
||||
Content.Delay(delay)
|
||||
.FadeOut(240, Easing.InOutCubic)
|
||||
.MoveToY(100f, 240, Easing.InOutCubic);
|
||||
|
||||
this.Delay(Content.LatestTransformEndTime - Time.Current).Expire();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Screens.SelectV2.Footer
|
||||
Icon = FontAwesome.Solid.ExchangeAlt;
|
||||
AccentColour = colours.Lime1;
|
||||
|
||||
TopLevelContent.AddRange(new[]
|
||||
AddRange(new[]
|
||||
{
|
||||
unrankedBadge = new UnrankedBadge(),
|
||||
modDisplayBar = new Container
|
||||
|
Loading…
Reference in New Issue
Block a user