Merge branch 'master' into beatmap-video

This commit is contained in:
Dean Herbert 2019-09-13 23:08:57 +09:00 committed by GitHub
commit 2cd3657b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 63 additions and 31 deletions

View File

@ -16,6 +16,8 @@ public TestSceneHyperDash()
{
}
protected override bool Autoplay => true;
[Test]
public void TestHyperDash()
{

View File

@ -50,6 +50,10 @@ protected DrawableCatchHitObject(CatchHitObject hitObject)
public Func<CatchHitObject, bool> CheckPosition;
public bool IsOnPlate;
public override bool RemoveWhenNotAlive => IsOnPlate;
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (CheckPosition == null) return;

View File

@ -69,10 +69,12 @@ void runAfterLoaded(Action action)
caughtFruit.RelativePositionAxes = Axes.None;
caughtFruit.Position = new Vector2(MovableCatcher.ToLocalSpace(fruit.ScreenSpaceDrawQuad.Centre).X - MovableCatcher.DrawSize.X / 2, 0);
caughtFruit.IsOnPlate = true;
caughtFruit.Anchor = Anchor.TopCentre;
caughtFruit.Origin = Anchor.Centre;
caughtFruit.Scale *= 0.7f;
caughtFruit.LifetimeStart = caughtFruit.HitObject.StartTime;
caughtFruit.LifetimeEnd = double.MaxValue;
MovableCatcher.Add(caughtFruit);
@ -205,7 +207,8 @@ private void beginTrail()
AdditiveTarget.Add(additive);
additive.FadeTo(0.4f).FadeOut(800, Easing.OutQuint).Expire();
additive.FadeTo(0.4f).FadeOut(800, Easing.OutQuint);
additive.Expire(true);
Scheduler.AddDelayed(beginTrail, HyperDashing ? 25 : 50);
}
@ -300,6 +303,7 @@ public void SetHyperDashState(double modifier = 1, float targetPosition = -1)
{
this.FadeColour(Color4.White, hyper_dash_transition_length, Easing.OutQuint);
this.FadeTo(1, hyper_dash_transition_length, Easing.OutQuint);
Trail &= Dashing;
}
}
else
@ -406,6 +410,9 @@ public void Drop()
f.MoveToY(f.Y + 75, 750, Easing.InSine);
f.FadeOut(750);
// todo: this shouldn't exist once DrawableHitObject's ClearTransformsAfter overrides are repaired.
f.LifetimeStart = Time.Current;
f.Expire();
}
}
@ -436,10 +443,13 @@ public void Explode(DrawableHitObject fruit)
ExplodingFruitTarget.Add(fruit);
}
fruit.ClearTransforms();
fruit.MoveToY(fruit.Y - 50, 250, Easing.OutSine).Then().MoveToY(fruit.Y + 50, 500, Easing.InSine);
fruit.MoveToX(fruit.X + originalX * 6, 1000);
fruit.FadeOut(750);
// todo: this shouldn't exist once DrawableHitObject's ClearTransformsAfter overrides are repaired.
fruit.LifetimeStart = Time.Current;
fruit.Expire();
}
}

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Online.API;
using osu.Game.Screens.Menu;
using osu.Game.Users;
@ -11,17 +10,17 @@ namespace osu.Game.Tests.Visual.Menus
public class TestSceneDisclaimer : ScreenTestScene
{
[BackgroundDependencyLoader]
private void load(IAPIProvider api)
private void load()
{
AddStep("load disclaimer", () => LoadScreen(new Disclaimer()));
AddStep("toggle support", () =>
{
api.LocalUser.Value = new User
API.LocalUser.Value = new User
{
Username = api.LocalUser.Value.Username,
Id = api.LocalUser.Value.Id,
IsSupporter = !api.LocalUser.Value.IsSupporter,
Username = API.LocalUser.Value.Username,
Id = API.LocalUser.Value.Id,
IsSupporter = !API.LocalUser.Value.IsSupporter,
};
});
}

View File

@ -14,7 +14,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
public class TestSceneMatchLeaderboard : MultiplayerTestScene
{
protected override bool RequiresAPIAccess => true;
protected override bool UseOnlineAPI => true;
public TestSceneMatchLeaderboard()
{

View File

@ -12,7 +12,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
[TestFixture]
public class TestSceneMultiScreen : ScreenTestScene
{
protected override bool RequiresAPIAccess => true;
protected override bool UseOnlineAPI => true;
public override IReadOnlyList<Type> RequiredTypes => new[]
{

View File

@ -4,9 +4,9 @@
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Overlays;
using osu.Game.Overlays.AccountCreation;
using osu.Game.Users;
@ -27,6 +27,8 @@ public class TestSceneAccountCreationOverlay : OsuTestScene
private readonly Container userPanelArea;
private Bindable<User> localUser;
public TestSceneAccountCreationOverlay()
{
AccountCreationOverlay accountCreation;
@ -47,12 +49,14 @@ public TestSceneAccountCreationOverlay()
}
[BackgroundDependencyLoader]
private void load(IAPIProvider api)
private void load()
{
api.Logout();
api.LocalUser.BindValueChanged(user => { userPanelArea.Child = new UserPanel(user.NewValue) { Width = 200 }; }, true);
API.Logout();
AddStep("logout", api.Logout);
localUser = API.LocalUser.GetBoundCopy();
localUser.BindValueChanged(user => { userPanelArea.Child = new UserPanel(user.NewValue) { Width = 200 }; }, true);
AddStep("logout", API.Logout);
}
}
}

View File

@ -42,7 +42,7 @@ public class TestSceneBeatmapSetOverlay : OsuTestScene
typeof(BeatmapAvailability),
};
protected override bool RequiresAPIAccess => true;
protected override bool UseOnlineAPI => true;
private RulesetInfo taikoRuleset;
private RulesetInfo maniaRuleset;

View File

@ -27,7 +27,7 @@ public class TestSceneChangelogOverlay : OsuTestScene
typeof(Comments),
};
protected override bool RequiresAPIAccess => true;
protected override bool UseOnlineAPI => true;
protected override void LoadComplete()
{

View File

@ -13,7 +13,7 @@ public class TestSceneDirectOverlay : OsuTestScene
{
private DirectOverlay direct;
protected override bool RequiresAPIAccess => true;
protected override bool UseOnlineAPI => true;
protected override void LoadComplete()
{

View File

@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.Online
[TestFixture]
public class TestSceneHistoricalSection : OsuTestScene
{
protected override bool RequiresAPIAccess => true;
protected override bool UseOnlineAPI => true;
public override IReadOnlyList<Type> RequiredTypes => new[]
{

View File

@ -13,7 +13,7 @@ namespace osu.Game.Tests.Visual.Online
[TestFixture]
public class TestSceneSocialOverlay : OsuTestScene
{
protected override bool RequiresAPIAccess => true;
protected override bool UseOnlineAPI => true;
public override IReadOnlyList<Type> RequiredTypes => new[]
{

View File

@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.Online
{
public class TestSceneUserProfileHeader : OsuTestScene
{
protected override bool RequiresAPIAccess => true;
protected override bool UseOnlineAPI => true;
public override IReadOnlyList<Type> RequiredTypes => new[]
{

View File

@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Online
[TestFixture]
public class TestSceneUserProfileOverlay : OsuTestScene
{
protected override bool RequiresAPIAccess => true;
protected override bool UseOnlineAPI => true;
private readonly TestUserProfileOverlay profile;

View File

@ -18,7 +18,7 @@ namespace osu.Game.Tests.Visual.Online
[TestFixture]
public class TestSceneUserRanks : OsuTestScene
{
protected override bool RequiresAPIAccess => true;
protected override bool UseOnlineAPI => true;
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(DrawableProfileScore), typeof(RanksSection) };

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneUpdateableBeatmapBackgroundSprite : OsuTestScene
{
protected override bool RequiresAPIAccess => true;
protected override bool UseOnlineAPI => true;
private BeatmapSetInfo testBeatmap;
private IAPIProvider api;

View File

@ -170,7 +170,7 @@ private Task fetchListing()
var tcs = new TaskCompletionSource<bool>();
var req = new GetChangelogRequest();
req.Success += res =>
req.Success += res => Schedule(() =>
{
// remap streams to builds to ensure model equality
res.Builds.ForEach(b => b.UpdateStream = res.Streams.Find(s => s.Id == b.UpdateStream.Id));
@ -182,7 +182,7 @@ private Task fetchListing()
header.Streams.Populate(res.Streams);
tcs.SetResult(true);
};
});
req.Failure += _ => initialFetchTask = null;
req.Perform(API);

View File

@ -46,13 +46,27 @@ public abstract class OsuTestScene : TestScene
protected Storage LocalStorage => localStorage.Value;
private readonly Lazy<DatabaseContextFactory> contextFactory;
protected IAPIProvider API
{
get
{
if (UseOnlineAPI)
throw new InvalidOperationException($"Using the {nameof(OsuTestScene)} dummy API is not supported when {nameof(UseOnlineAPI)} is true");
return dummyAPI;
}
}
private DummyAPIAccess dummyAPI;
protected DatabaseContextFactory ContextFactory => contextFactory.Value;
/// <summary>
/// Whether this test scene requires API access
/// Setting this will cache an actual <see cref="APIAccess"/>.
/// Whether this test scene requires real-world API access.
/// If true, this will bypass the local <see cref="DummyAPIAccess"/> and use the <see cref="OsuGameBase"/> provided one.
/// </summary>
protected virtual bool RequiresAPIAccess => false;
protected virtual bool UseOnlineAPI => false;
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
@ -66,10 +80,9 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl
Dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
if (!RequiresAPIAccess)
if (!UseOnlineAPI)
{
var dummyAPI = new DummyAPIAccess();
dummyAPI = new DummyAPIAccess();
Dependencies.CacheAs<IAPIProvider>(dummyAPI);
Add(dummyAPI);
}