Merge branch 'master' into applicable-to-hud

This commit is contained in:
Dean Herbert 2019-07-07 01:03:50 +09:00 committed by GitHub
commit 3f332cca2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 19 deletions

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Shapes;
using osu.Game.Screens.Menu;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.UserInterface
@ -23,11 +24,12 @@ namespace osu.Game.Tests.Visual.UserInterface
typeof(Button)
};
public TestSceneButtonSystem()
{
OsuLogo logo;
ButtonSystem buttons;
private OsuLogo logo;
private ButtonSystem buttons;
[SetUp]
public void SetUp() => Schedule(() =>
{
Children = new Drawable[]
{
new Box
@ -36,13 +38,47 @@ namespace osu.Game.Tests.Visual.UserInterface
RelativeSizeAxes = Axes.Both,
},
buttons = new ButtonSystem(),
logo = new OsuLogo { RelativePositionAxes = Axes.Both }
logo = new OsuLogo
{
RelativePositionAxes = Axes.Both,
Position = new Vector2(0.5f)
}
};
buttons.SetOsuLogo(logo);
});
[Test]
public void TestAllStates()
{
foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType<ButtonSystemState>().Skip(1))
AddStep($"State to {s}", () => buttons.State = s);
AddStep("Enter mode", performEnterMode);
AddStep("Return to menu", () =>
{
buttons.State = ButtonSystemState.Play;
buttons.FadeIn(MainMenu.FADE_IN_DURATION, Easing.OutQuint);
buttons.MoveTo(new Vector2(0), MainMenu.FADE_IN_DURATION, Easing.OutQuint);
logo.FadeColour(Color4.White, 100, Easing.OutQuint);
logo.FadeIn(100, Easing.OutQuint);
});
}
[Test]
public void TestSmoothExit()
{
AddStep("Enter mode", performEnterMode);
}
private void performEnterMode()
{
buttons.State = ButtonSystemState.EnteringMode;
buttons.FadeOut(MainMenu.FADE_OUT_DURATION, Easing.InSine);
buttons.MoveTo(new Vector2(-800, 0), MainMenu.FADE_OUT_DURATION, Easing.InSine);
logo.FadeOut(300, Easing.InSine)
.ScaleTo(0.2f, 300, Easing.InSine);
}
}
}

View File

@ -35,15 +35,15 @@ namespace osu.Game.Beatmaps.Drawables
protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func<Drawable> createContentFunc, double timeBeforeLoad)
=> new DelayedLoadUnloadWrapper(createContentFunc, timeBeforeLoad, UnloadDelay);
protected override double TransformDuration => 400;
protected override Drawable CreateDrawable(BeatmapInfo model)
{
Drawable drawable = getDrawableForModel(model);
var drawable = getDrawableForModel(model);
drawable.RelativeSizeAxes = Axes.Both;
drawable.Anchor = Anchor.Centre;
drawable.Origin = Anchor.Centre;
drawable.FillMode = FillMode.Fill;
drawable.OnLoadComplete += d => d.FadeInFromZero(400);
return drawable;
}

View File

@ -332,7 +332,7 @@ namespace osu.Game.Screens.Menu
break;
case ButtonSystemState.EnteringMode:
logoTrackingContainer.StartTracking(logo, 0, Easing.In);
logoTrackingContainer.StartTracking(logo, lastState == ButtonSystemState.Initial ? MainMenu.FADE_OUT_DURATION : 0, Easing.InSine);
break;
}
}

View File

@ -23,7 +23,9 @@ namespace osu.Game.Screens.Menu
{
public class MainMenu : OsuScreen
{
private ButtonSystem buttons;
public const float FADE_IN_DURATION = 300;
public const float FADE_OUT_DURATION = 400;
public override bool HideOverlaysOnEnter => buttons == null || buttons.State == ButtonSystemState.Initial;
@ -35,6 +37,8 @@ namespace osu.Game.Screens.Menu
private MenuSideFlashes sideFlashes;
private ButtonSystem buttons;
[Resolved]
private GameHost host { get; set; }
@ -141,12 +145,10 @@ namespace osu.Game.Screens.Menu
{
buttons.State = ButtonSystemState.TopLevel;
const float length = 300;
this.FadeIn(FADE_IN_DURATION, Easing.OutQuint);
this.MoveTo(new Vector2(0, 0), FADE_IN_DURATION, Easing.OutQuint);
this.FadeIn(length, Easing.OutQuint);
this.MoveTo(new Vector2(0, 0), length, Easing.OutQuint);
sideFlashes.Delay(length).FadeIn(64, Easing.InQuint);
sideFlashes.Delay(FADE_IN_DURATION).FadeIn(64, Easing.InQuint);
}
}
@ -171,12 +173,10 @@ namespace osu.Game.Screens.Menu
{
base.OnSuspending(next);
const float length = 400;
buttons.State = ButtonSystemState.EnteringMode;
this.FadeOut(length, Easing.InSine);
this.MoveTo(new Vector2(-800, 0), length, Easing.InSine);
this.FadeOut(FADE_OUT_DURATION, Easing.InSine);
this.MoveTo(new Vector2(-800, 0), FADE_OUT_DURATION, Easing.InSine);
sideFlashes.FadeOut(64, Easing.OutQuint);
}