mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Merge remote-tracking branch 'upstream/master' into HoutarouOreki-changelog-overlay
This commit is contained in:
@ -63,8 +63,10 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
{
|
||||
get
|
||||
{
|
||||
var first = (OsuHitObject)Objects.First();
|
||||
return first.StartTime - Math.Max(2000, first.TimePreempt);
|
||||
if (Objects.FirstOrDefault() is OsuHitObject first)
|
||||
return first.StartTime - Math.Max(2000, first.TimePreempt);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
bool logoVisible = false;
|
||||
|
||||
AddStep("begin loading", () => LoadScreen(loader = new TestLoader()));
|
||||
AddWaitStep("wait", 2);
|
||||
AddWaitStep("wait", 3);
|
||||
AddStep("finish loading", () =>
|
||||
{
|
||||
logoVisible = loader.Logo?.Alpha > 0;
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -23,6 +22,7 @@ using osu.Game.Online.API;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Skinning;
|
||||
@ -43,8 +43,6 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
typeof(OsuGame),
|
||||
typeof(RavenLogger),
|
||||
typeof(Bindable<RulesetInfo>),
|
||||
typeof(IBindable<RulesetInfo>),
|
||||
typeof(OsuLogo),
|
||||
typeof(IdleTracker),
|
||||
typeof(OnScreenDisplay),
|
||||
@ -60,12 +58,17 @@ namespace osu.Game.Tests.Visual
|
||||
typeof(MusicController),
|
||||
typeof(AccountCreationOverlay),
|
||||
typeof(DialogOverlay),
|
||||
typeof(ScreenshotManager)
|
||||
};
|
||||
|
||||
private IReadOnlyList<Type> requiredGameBaseDependencies => new[]
|
||||
{
|
||||
typeof(OsuGameBase),
|
||||
typeof(DatabaseContextFactory),
|
||||
typeof(Bindable<RulesetInfo>),
|
||||
typeof(IBindable<RulesetInfo>),
|
||||
typeof(Bindable<IReadOnlyList<Mod>>),
|
||||
typeof(IBindable<IReadOnlyList<Mod>>),
|
||||
typeof(LargeTextureStore),
|
||||
typeof(OsuConfigManager),
|
||||
typeof(SkinManager),
|
||||
@ -86,7 +89,7 @@ namespace osu.Game.Tests.Visual
|
||||
};
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host)
|
||||
private void load(GameHost host, OsuGameBase gameBase)
|
||||
{
|
||||
OsuGame game = new OsuGame();
|
||||
game.SetHost(host);
|
||||
@ -103,8 +106,22 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
AddUntilStep("wait for load", () => game.IsLoaded);
|
||||
|
||||
AddAssert("check OsuGame DI members", () => requiredGameDependencies.All(d => game.Dependencies.Get(d) != null));
|
||||
AddAssert("check OsuGameBase DI members", () => requiredGameBaseDependencies.All(d => Dependencies.Get(d) != null));
|
||||
AddAssert("check OsuGame DI members", () =>
|
||||
{
|
||||
foreach (var type in requiredGameDependencies)
|
||||
if (game.Dependencies.Get(type) == null)
|
||||
throw new Exception($"{type} has not been cached");
|
||||
|
||||
return true;
|
||||
});
|
||||
AddAssert("check OsuGameBase DI members", () =>
|
||||
{
|
||||
foreach (var type in requiredGameBaseDependencies)
|
||||
if (gameBase.Dependencies.Get(type) == null)
|
||||
throw new Exception($"{type} has not been cached");
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestCaseLoadingAnimation : GridTestCase
|
||||
public class TestCaseLoadingAnimation : GridTestScene //todo: this should be an OsuTestCase
|
||||
{
|
||||
public TestCaseLoadingAnimation()
|
||||
: base(2, 2)
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
@ -17,7 +16,7 @@ using osuTK.Graphics;
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestCaseOsuIcon : TestCase
|
||||
public class TestCaseOsuIcon : OsuTestCase
|
||||
{
|
||||
public TestCaseOsuIcon()
|
||||
{
|
||||
|
@ -31,11 +31,9 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Input;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Graphics;
|
||||
using osu.Game.Overlays.Volume;
|
||||
@ -89,7 +87,6 @@ namespace osu.Game
|
||||
private Intro introScreen;
|
||||
|
||||
private Bindable<int> configRuleset;
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
private Bindable<int> configSkin;
|
||||
|
||||
@ -99,12 +96,9 @@ namespace osu.Game
|
||||
|
||||
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
||||
|
||||
private readonly List<OverlayContainer> visibleBlockingOverlays = new List<OverlayContainer>();
|
||||
private readonly List<OverlayContainer> toolbarElements = new List<OverlayContainer>();
|
||||
|
||||
// todo: move this to SongSelect once Screen has the ability to unsuspend.
|
||||
[Cached]
|
||||
[Cached(typeof(IBindable<IReadOnlyList<Mod>>))]
|
||||
private readonly Bindable<IReadOnlyList<Mod>> mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||
private readonly List<OverlayContainer> visibleBlockingOverlays = new List<OverlayContainer>();
|
||||
|
||||
public OsuGame(string[] args = null)
|
||||
{
|
||||
@ -134,12 +128,17 @@ namespace osu.Game
|
||||
/// <summary>
|
||||
/// Close all game-wide overlays.
|
||||
/// </summary>
|
||||
/// <param name="toolbar">Whether the toolbar should also be hidden.</param>
|
||||
public void CloseAllOverlays(bool toolbar = true)
|
||||
/// <param name="hideToolbarElements">Whether the toolbar (and accompanying controls) should also be hidden.</param>
|
||||
public void CloseAllOverlays(bool hideToolbarElements = true)
|
||||
{
|
||||
foreach (var overlay in overlays)
|
||||
overlay.State = Visibility.Hidden;
|
||||
if (toolbar) Toolbar.State = Visibility.Hidden;
|
||||
|
||||
if (hideToolbarElements)
|
||||
{
|
||||
foreach (var overlay in toolbarElements)
|
||||
overlay.State = Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
@ -169,15 +168,12 @@ namespace osu.Game
|
||||
|
||||
dependencies.Cache(RavenLogger);
|
||||
|
||||
dependencies.CacheAs(ruleset);
|
||||
dependencies.CacheAs<IBindable<RulesetInfo>>(ruleset);
|
||||
|
||||
dependencies.Cache(osuLogo = new OsuLogo { Alpha = 0 });
|
||||
|
||||
// bind config int to database RulesetInfo
|
||||
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
|
||||
ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First();
|
||||
ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ID ?? 0;
|
||||
Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First();
|
||||
Ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ID ?? 0;
|
||||
|
||||
// bind config int to database SkinInfo
|
||||
configSkin = LocalConfig.GetBindable<int>(OsuSetting.Skin);
|
||||
@ -248,9 +244,9 @@ namespace osu.Game
|
||||
}
|
||||
|
||||
// Use first beatmap available for current ruleset, else switch ruleset.
|
||||
var first = databasedSet.Beatmaps.Find(b => b.Ruleset == ruleset.Value) ?? databasedSet.Beatmaps.First();
|
||||
var first = databasedSet.Beatmaps.Find(b => b.Ruleset == Ruleset.Value) ?? databasedSet.Beatmaps.First();
|
||||
|
||||
ruleset.Value = first.Ruleset;
|
||||
Ruleset.Value = first.Ruleset;
|
||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(first);
|
||||
}, $"load {beatmap}", bypassScreenAllowChecks: true, targetScreen: typeof(PlaySongSelect));
|
||||
}
|
||||
@ -280,9 +276,9 @@ namespace osu.Game
|
||||
|
||||
performFromMainMenu(() =>
|
||||
{
|
||||
ruleset.Value = databasedScoreInfo.Ruleset;
|
||||
Ruleset.Value = databasedScoreInfo.Ruleset;
|
||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
||||
mods.Value = databasedScoreInfo.Mods;
|
||||
Mods.Value = databasedScoreInfo.Mods;
|
||||
|
||||
menuScreen.Push(new PlayerLoader(() => new ReplayPlayer(databasedScore)));
|
||||
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
||||
@ -415,7 +411,11 @@ namespace osu.Game
|
||||
CloseAllOverlays(false);
|
||||
menuScreen?.MakeCurrent();
|
||||
},
|
||||
}, topMostOverlayContent.Add);
|
||||
}, d =>
|
||||
{
|
||||
topMostOverlayContent.Add(d);
|
||||
toolbarElements.Add(d);
|
||||
});
|
||||
|
||||
loadComponentSingleFile(volume = new VolumeOverlay(), leftFloatingOverlayContent.Add);
|
||||
loadComponentSingleFile(new OnScreenDisplay(), Add, true);
|
||||
@ -451,7 +451,11 @@ namespace osu.Game
|
||||
GetToolbarHeight = () => ToolbarOffset,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
}, rightFloatingOverlayContent.Add, true);
|
||||
}, d =>
|
||||
{
|
||||
rightFloatingOverlayContent.Add(d);
|
||||
toolbarElements.Add(d);
|
||||
}, true);
|
||||
|
||||
loadComponentSingleFile(new AccountCreationOverlay(), topMostOverlayContent.Add, true);
|
||||
loadComponentSingleFile(new DialogOverlay(), topMostOverlayContent.Add, true);
|
||||
|
@ -29,6 +29,7 @@ using osu.Game.Input;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Input;
|
||||
@ -69,7 +70,16 @@ namespace osu.Game
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private Bindable<WorkingBeatmap> beatmap;
|
||||
private Bindable<WorkingBeatmap> beatmap; // cached via load() method
|
||||
|
||||
[Cached]
|
||||
[Cached(typeof(IBindable<RulesetInfo>))]
|
||||
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
// todo: move this to SongSelect once Screen has the ability to unsuspend.
|
||||
[Cached]
|
||||
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
|
||||
protected readonly Bindable<IReadOnlyList<Mod>> Mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||
|
||||
protected Bindable<WorkingBeatmap> Beatmap => beatmap;
|
||||
|
||||
@ -220,8 +230,10 @@ namespace osu.Game
|
||||
// TODO: This is temporary until we reimplement the local FPS display.
|
||||
// It's just to allow end-users to access the framework FPS display without knowing the shortcut key.
|
||||
fpsDisplayVisible = LocalConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay);
|
||||
fpsDisplayVisible.ValueChanged += visible => { FrameStatisticsMode = visible.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; };
|
||||
fpsDisplayVisible.ValueChanged += visible => { FrameStatistics.Value = visible.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; };
|
||||
fpsDisplayVisible.TriggerChange();
|
||||
|
||||
FrameStatistics.ValueChanged += e => fpsDisplayVisible.Value = e.NewValue != FrameStatisticsMode.None;
|
||||
}
|
||||
|
||||
private void runMigrations()
|
||||
|
@ -15,7 +15,7 @@ using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public abstract class OsuTestCase : TestCase
|
||||
public abstract class OsuTestCase : TestScene
|
||||
{
|
||||
[Cached(typeof(Bindable<WorkingBeatmap>))]
|
||||
[Cached(typeof(IBindable<WorkingBeatmap>))]
|
||||
@ -76,21 +76,21 @@ namespace osu.Game.Tests.Visual
|
||||
}
|
||||
}
|
||||
|
||||
protected override ITestCaseTestRunner CreateRunner() => new OsuTestCaseTestRunner();
|
||||
protected override ITestSceneTestRunner CreateRunner() => new OsuTestCaseTestRunner();
|
||||
|
||||
public class OsuTestCaseTestRunner : OsuGameBase, ITestCaseTestRunner
|
||||
public class OsuTestCaseTestRunner : OsuGameBase, ITestSceneTestRunner
|
||||
{
|
||||
private TestCaseTestRunner.TestRunner runner;
|
||||
private TestSceneTestRunner.TestRunner runner;
|
||||
|
||||
protected override void LoadAsyncComplete()
|
||||
{
|
||||
// this has to be run here rather than LoadComplete because
|
||||
// TestCase.cs is checking the IsLoaded state (on another thread) and expects
|
||||
// the runner to be loaded at that point.
|
||||
Add(runner = new TestCaseTestRunner.TestRunner());
|
||||
Add(runner = new TestSceneTestRunner.TestRunner());
|
||||
}
|
||||
|
||||
public void RunTestBlocking(TestCase test) => runner.RunTestBlocking(test);
|
||||
public void RunTestBlocking(TestScene test) => runner.RunTestBlocking(test);
|
||||
}
|
||||
|
||||
private class OsuTestBeatmap : BindableBeatmap
|
||||
|
@ -15,7 +15,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.502.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.508.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.514.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.23.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
@ -105,8 +105,8 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.502.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.502.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.514.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.514.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Reference in New Issue
Block a user