mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 01:02:54 +08:00
Add a test case which starts the game
This commit is contained in:
parent
713d730d10
commit
d8d7165164
39
osu.Game.Tests/Visual/TestCaseOsuGame.cs
Normal file
39
osu.Game.Tests/Visual/TestCaseOsuGame.cs
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Menu;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public class TestCaseOsuGame : OsuTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(OsuLogo),
|
||||
};
|
||||
|
||||
public TestCaseOsuGame()
|
||||
{
|
||||
var rateAdjustClock = new StopwatchClock(true);
|
||||
var framedClock = new FramedClock(rateAdjustClock);
|
||||
framedClock.ProcessFrame();
|
||||
|
||||
Add(new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
});
|
||||
|
||||
Add(new Loader());
|
||||
|
||||
AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v);
|
||||
}
|
||||
}
|
||||
}
|
@ -122,6 +122,7 @@
|
||||
<Compile Include="Visual\TestCaseNotificationOverlay.cs" />
|
||||
<Compile Include="Visual\TestCaseOnScreenDisplay.cs" />
|
||||
<Compile Include="Visual\TestCaseAllPlayers.cs" />
|
||||
<Compile Include="Visual\TestCaseOsuGame.cs" />
|
||||
<Compile Include="Visual\TestCasePlaySongSelect.cs" />
|
||||
<Compile Include="Visual\TestCaseReplay.cs" />
|
||||
<Compile Include="Visual\TestCaseReplaySettingsOverlay.cs" />
|
||||
|
@ -8,7 +8,7 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Screens
|
||||
{
|
||||
internal class Loader : OsuScreen
|
||||
public class Loader : OsuScreen
|
||||
{
|
||||
public override bool ShowOverlays => false;
|
||||
|
||||
@ -30,7 +30,7 @@ namespace osu.Game.Screens
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGame game)
|
||||
private void load(OsuGameBase game)
|
||||
{
|
||||
if (game.IsDeployedBuild)
|
||||
LoadComponentAsync(new Disclaimer(), d => Push(d));
|
||||
|
@ -59,13 +59,16 @@ namespace osu.Game.Screens.Menu
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGame game)
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuGame game = null)
|
||||
{
|
||||
LoadComponentAsync(background);
|
||||
|
||||
buttons.OnSettings = game.ToggleSettings;
|
||||
buttons.OnDirect = game.ToggleDirect;
|
||||
if (game != null)
|
||||
{
|
||||
buttons.OnSettings = game.ToggleSettings;
|
||||
buttons.OnDirect = game.ToggleDirect;
|
||||
}
|
||||
|
||||
preloadSongSelect();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user