Merge branch 'master' into judgement-rework

This commit is contained in:
Dean Herbert 2018-08-07 18:09:06 +09:00 committed by GitHub
commit 70ce9da321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 72 additions and 8 deletions

View File

@ -27,7 +27,7 @@
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="System.IO.Packaging" Version="4.5.0" />
<PackageReference Include="ppy.squirrel.windows" Version="1.8.0.3" />
<PackageReference Include="ppy.squirrel.windows" Version="1.8.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.1" />
</ItemGroup>

View File

@ -1,25 +1,61 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Threading;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual
{
public class TestCasePlayerLoader : OsuTestCase
public class TestCasePlayerLoader : ManualInputManagerTestCase
{
private PlayerLoader loader;
[BackgroundDependencyLoader]
private void load(OsuGameBase game)
{
Beatmap.Value = new DummyWorkingBeatmap(game);
AddStep("load dummy beatmap", () => Add(new PlayerLoader(new Player
AddStep("load dummy beatmap", () => Add(loader = new PlayerLoader(new Player
{
AllowPause = false,
AllowLeadIn = false,
AllowResults = false,
})));
AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre));
AddUntilStep(() => !loader.IsCurrentScreen, "wait for no longer current");
AddStep("load slow dummy beatmap", () =>
{
SlowLoadPlayer slow;
Add(loader = new PlayerLoader(slow = new SlowLoadPlayer
{
AllowPause = false,
AllowLeadIn = false,
AllowResults = false,
}));
Scheduler.AddDelayed(() => slow.Ready = true, 5000);
});
AddUntilStep(() => !loader.IsCurrentScreen, "wait for no longer current");
}
protected class SlowLoadPlayer : Player
{
public bool Ready;
[BackgroundDependencyLoader]
private void load()
{
while (!Ready)
Thread.Sleep(1);
}
}
}
}

View File

@ -14,9 +14,11 @@ using osu.Framework.Threading;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play.PlayerSettings;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Screens.Play
{
@ -69,21 +71,25 @@ namespace osu.Game.Screens.Play
}
});
loadTask = LoadComponentAsync(player);
loadTask = LoadComponentAsync(player, playerLoaded);
}
private void playerLoaded(Player player) => info.Loading = false;
protected override void OnResuming(Screen last)
{
base.OnResuming(last);
contentIn();
info.Loading = true;
//we will only be resumed if the player has requested a re-run (see ValidForResume setting above)
loadTask = LoadComponentAsync(player = new Player
{
RestartCount = player.RestartCount + 1,
RestartRequested = player.RestartRequested,
});
}, playerLoaded);
this.Delay(400).Schedule(pushWhenLoaded);
}
@ -258,6 +264,25 @@ namespace osu.Game.Screens.Play
}
private readonly WorkingBeatmap beatmap;
private LoadingAnimation loading;
private Sprite backgroundSprite;
public bool Loading
{
set
{
if (value)
{
loading.Show();
backgroundSprite.FadeColour(OsuColour.Gray(0.5f), 400, Easing.OutQuint);
}
else
{
loading.Hide();
backgroundSprite.FadeColour(Color4.White, 400, Easing.OutQuint);
}
}
}
public BeatmapMetadataDisplay(WorkingBeatmap beatmap)
{
@ -304,9 +329,9 @@ namespace osu.Game.Screens.Play
Anchor = Anchor.TopCentre,
CornerRadius = 10,
Masking = true,
Children = new[]
Children = new Drawable[]
{
new Sprite
backgroundSprite = new Sprite
{
RelativeSizeAxes = Axes.Both,
Texture = beatmap?.Background,
@ -314,6 +339,7 @@ namespace osu.Game.Screens.Play
Anchor = Anchor.Centre,
FillMode = FillMode.Fill,
},
loading = new LoadingAnimation { Scale = new Vector2(1.3f) }
}
},
new OsuSpriteText
@ -341,6 +367,8 @@ namespace osu.Game.Screens.Play
},
}
};
Loading = true;
}
}
}

View File

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="ppy.osu.Framework" Version="2018.803.0" />
<PackageReference Include="ppy.osu.Framework" Version="2018.806.0" />
<PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />