-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24409 from cdwcgt/tournament-nullable
Remove #nullable disable in tournament
- Loading branch information
Showing
61 changed files
with
345 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using NUnit.Framework; | ||
using osu.Game.Tests.Visual; | ||
using osu.Game.Tournament.Components; | ||
|
@@ -13,7 +11,7 @@ namespace osu.Game.Tournament.Tests.Components | |
{ | ||
public partial class TestSceneDateTextBox : OsuManualInputManagerTestScene | ||
{ | ||
private DateTextBox textBox; | ||
private DateTextBox textBox = null!; | ||
|
||
[SetUp] | ||
public void Setup() => Schedule(() => | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
|
@@ -22,7 +20,7 @@ public partial class TestSceneSongBar : OsuTestScene | |
[Test] | ||
public void TestSongBar() | ||
{ | ||
SongBar songBar = null; | ||
SongBar songBar = null!; | ||
|
||
AddStep("create bar", () => Child = songBar = new SongBar | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
|
@@ -19,12 +17,12 @@ namespace osu.Game.Tournament.Tests.Components | |
public partial class TestSceneTournamentModDisplay : TournamentTestScene | ||
{ | ||
[Resolved] | ||
private IAPIProvider api { get; set; } | ||
private IAPIProvider api { get; set; } = null!; | ||
|
||
[Resolved] | ||
private IRulesetStore rulesets { get; set; } | ||
private IRulesetStore rulesets { get; set; } = null!; | ||
|
||
private FillFlowContainer<TournamentBeatmapPanel> fillFlow; | ||
private FillFlowContainer<TournamentBeatmapPanel> fillFlow = null!; | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
|
@@ -45,7 +43,7 @@ private void load() | |
|
||
private void success(APIBeatmap beatmap) | ||
{ | ||
var ruleset = rulesets.GetRuleset(Ladder.Ruleset.Value.OnlineID); | ||
var ruleset = rulesets.GetRuleset(Ladder.Ruleset.Value?.OnlineID ?? -1); | ||
|
||
if (ruleset == null) | ||
return; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
@@ -81,11 +79,11 @@ public void TestUnavailableRuleset() | |
public partial class TestTournament : TournamentGameBase | ||
{ | ||
private readonly bool resetRuleset; | ||
private readonly Action runOnLoadComplete; | ||
private readonly Action? runOnLoadComplete; | ||
|
||
public new Task BracketLoadTask => base.BracketLoadTask; | ||
|
||
public TestTournament(bool resetRuleset = false, [InstantHandle] Action runOnLoadComplete = null) | ||
public TestTournament(bool resetRuleset = false, [InstantHandle] Action? runOnLoadComplete = null) | ||
{ | ||
this.resetRuleset = resetRuleset; | ||
this.runOnLoadComplete = runOnLoadComplete; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System.IO; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
|
@@ -36,11 +34,11 @@ public void CheckIPCLocation() | |
{ | ||
var osu = LoadTournament(host); | ||
TournamentStorage storage = (TournamentStorage)osu.Dependencies.Get<Storage>(); | ||
FileBasedIPC ipc = null; | ||
FileBasedIPC? ipc = null; | ||
|
||
WaitForOrAssert(() => (ipc = osu.Dependencies.Get<MatchIPCInfo>() as FileBasedIPC)?.IsLoaded == true, @"ipc could not be populated in a reasonable amount of time"); | ||
|
||
Assert.True(ipc.SetIPCLocation(testStableInstallDirectory)); | ||
Assert.True(ipc!.SetIPCLocation(testStableInstallDirectory)); | ||
Assert.True(storage.AllTournaments.Exists("stable.json")); | ||
} | ||
finally | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
@@ -13,7 +11,7 @@ namespace osu.Game.Tournament.Tests.NonVisual | |
{ | ||
public abstract class TournamentHostTest | ||
{ | ||
public static TournamentGameBase LoadTournament(GameHost host, TournamentGameBase tournament = null) | ||
public static TournamentGameBase LoadTournament(GameHost host, TournamentGameBase? tournament = null) | ||
{ | ||
tournament ??= new TournamentGameBase(); | ||
Task.Factory.StartNew(() => host.Run(tournament), TaskCreationOptions.LongRunning) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
|
@@ -16,7 +14,7 @@ namespace osu.Game.Tournament.Tests.Screens | |
{ | ||
public partial class TestSceneMapPoolScreen : TournamentScreenTestScene | ||
{ | ||
private MapPoolScreen screen; | ||
private MapPoolScreen screen = null!; | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
|
@@ -32,7 +30,7 @@ public void TestFewMaps() | |
{ | ||
AddStep("load few maps", () => | ||
{ | ||
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear(); | ||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear(); | ||
for (int i = 0; i < 8; i++) | ||
addBeatmap(); | ||
|
@@ -52,7 +50,7 @@ public void TestJustEnoughMaps() | |
{ | ||
AddStep("load just enough maps", () => | ||
{ | ||
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear(); | ||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear(); | ||
for (int i = 0; i < 18; i++) | ||
addBeatmap(); | ||
|
@@ -72,7 +70,7 @@ public void TestManyMaps() | |
{ | ||
AddStep("load many maps", () => | ||
{ | ||
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear(); | ||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear(); | ||
for (int i = 0; i < 19; i++) | ||
addBeatmap(); | ||
|
@@ -92,7 +90,7 @@ public void TestJustEnoughMods() | |
{ | ||
AddStep("load many maps", () => | ||
{ | ||
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear(); | ||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear(); | ||
for (int i = 0; i < 11; i++) | ||
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM"); | ||
|
@@ -118,7 +116,7 @@ public void TestManyMods() | |
{ | ||
AddStep("load many maps", () => | ||
{ | ||
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear(); | ||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear(); | ||
for (int i = 0; i < 12; i++) | ||
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM"); | ||
|
@@ -138,7 +136,7 @@ public void TestSplitMapPoolByMods() | |
{ | ||
AddStep("load many maps", () => | ||
{ | ||
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear(); | ||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear(); | ||
for (int i = 0; i < 12; i++) | ||
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM"); | ||
|
@@ -155,7 +153,7 @@ public void TestSplitMapPoolByMods() | |
|
||
private void addBeatmap(string mods = "NM") | ||
{ | ||
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Add(new RoundBeatmap | ||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Add(new RoundBeatmap | ||
{ | ||
Beatmap = CreateSampleBeatmap(), | ||
Mods = mods | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using JetBrains.Annotations; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
|
@@ -17,14 +15,14 @@ namespace osu.Game.Tournament.Components | |
{ | ||
public partial class DrawableTeamFlag : Container | ||
{ | ||
private readonly TournamentTeam team; | ||
private readonly TournamentTeam? team; | ||
|
||
[UsedImplicitly] | ||
private Bindable<string> flag; | ||
private Bindable<string>? flag; | ||
|
||
private Sprite flagSprite; | ||
private Sprite? flagSprite; | ||
|
||
public DrawableTeamFlag(TournamentTeam team) | ||
public DrawableTeamFlag(TournamentTeam? team) | ||
{ | ||
this.team = team; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using JetBrains.Annotations; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
|
@@ -12,12 +10,12 @@ namespace osu.Game.Tournament.Components | |
{ | ||
public partial class DrawableTeamTitle : TournamentSpriteTextWithBackground | ||
{ | ||
private readonly TournamentTeam team; | ||
private readonly TournamentTeam? team; | ||
|
||
[UsedImplicitly] | ||
private Bindable<string> acronym; | ||
private Bindable<string>? acronym; | ||
|
||
public DrawableTeamTitle(TournamentTeam team) | ||
public DrawableTeamTitle(TournamentTeam? team) | ||
{ | ||
this.team = team; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using JetBrains.Annotations; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
|
@@ -14,15 +12,15 @@ namespace osu.Game.Tournament.Components | |
{ | ||
public abstract partial class DrawableTournamentTeam : CompositeDrawable | ||
{ | ||
public readonly TournamentTeam Team; | ||
public readonly TournamentTeam? Team; | ||
|
||
protected readonly Container Flag; | ||
protected readonly TournamentSpriteText AcronymText; | ||
|
||
[UsedImplicitly] | ||
private Bindable<string> acronym; | ||
private Bindable<string>? acronym; | ||
|
||
protected DrawableTournamentTeam(TournamentTeam team) | ||
protected DrawableTournamentTeam(TournamentTeam? team) | ||
{ | ||
Team = team; | ||
|
||
|
@@ -36,7 +34,8 @@ protected DrawableTournamentTeam(TournamentTeam team) | |
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
if (Team == null) return; | ||
if (Team == null) | ||
return; | ||
|
||
(acronym = Team.Acronym.GetBoundCopy()).BindValueChanged(_ => AcronymText.Text = Team?.Acronym.Value?.ToUpperInvariant() ?? string.Empty, true); | ||
} | ||
|
Oops, something went wrong.