mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 03:22:54 +08:00
Remove nullable disable
This commit is contained in:
parent
6bb562db14
commit
6a4872faa8
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -18,7 +16,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
{
|
{
|
||||||
public partial class TestSceneCollectionButton : OsuManualInputManagerTestScene
|
public partial class TestSceneCollectionButton : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private CollectionButton collectionButton;
|
private CollectionButton? collectionButton;
|
||||||
private readonly BeatmapInfo beatmapInfo = new BeatmapInfo { OnlineID = 88 };
|
private readonly BeatmapInfo beatmapInfo = new BeatmapInfo { OnlineID = 88 };
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
@ -43,7 +41,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
{
|
{
|
||||||
AddStep("click collection button", () =>
|
AddStep("click collection button", () =>
|
||||||
{
|
{
|
||||||
InputManager.MoveMouseTo(collectionButton);
|
InputManager.MoveMouseTo(collectionButton!);
|
||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -59,7 +57,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
|
|
||||||
AddStep("click collection button", () =>
|
AddStep("click collection button", () =>
|
||||||
{
|
{
|
||||||
InputManager.MoveMouseTo(collectionButton);
|
InputManager.MoveMouseTo(collectionButton!);
|
||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
@ -17,7 +15,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
{
|
{
|
||||||
public partial class TestSceneFavouriteButton : OsuTestScene
|
public partial class TestSceneFavouriteButton : OsuTestScene
|
||||||
{
|
{
|
||||||
private FavouriteButton favourite;
|
private FavouriteButton? favourite;
|
||||||
|
|
||||||
private readonly BeatmapSetInfo beatmapSetInfo = new BeatmapSetInfo { OnlineID = 88 };
|
private readonly BeatmapSetInfo beatmapSetInfo = new BeatmapSetInfo { OnlineID = 88 };
|
||||||
private readonly BeatmapSetInfo invalidBeatmapSetInfo = new BeatmapSetInfo();
|
private readonly BeatmapSetInfo invalidBeatmapSetInfo = new BeatmapSetInfo();
|
||||||
@ -83,7 +81,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
|
|
||||||
private void checkEnabled(bool expected)
|
private void checkEnabled(bool expected)
|
||||||
{
|
{
|
||||||
AddAssert("is " + (expected ? "enabled" : "disabled"), () => favourite.Enabled.Value == expected);
|
AddAssert("is " + (expected ? "enabled" : "disabled"), () => favourite!.Enabled.Value == expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -27,19 +25,19 @@ namespace osu.Game.Screens.Ranking
|
|||||||
private readonly SpriteIcon icon;
|
private readonly SpriteIcon icon;
|
||||||
|
|
||||||
public readonly BeatmapSetInfo BeatmapSetInfo;
|
public readonly BeatmapSetInfo BeatmapSetInfo;
|
||||||
private APIBeatmapSet beatmapSet;
|
private APIBeatmapSet? beatmapSet;
|
||||||
private readonly Bindable<BeatmapSetFavouriteState> current;
|
private readonly Bindable<BeatmapSetFavouriteState> current;
|
||||||
|
|
||||||
private PostBeatmapFavouriteRequest favouriteRequest;
|
private PostBeatmapFavouriteRequest? favouriteRequest;
|
||||||
private readonly LoadingLayer loading;
|
private readonly LoadingLayer loading;
|
||||||
|
|
||||||
private readonly IBindable<APIUser> localUser = new Bindable<APIUser>();
|
private readonly IBindable<APIUser> localUser = new Bindable<APIUser>();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; }
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; }
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
public FavouriteButton(BeatmapSetInfo beatmapSetInfo)
|
public FavouriteButton(BeatmapSetInfo beatmapSetInfo)
|
||||||
{
|
{
|
||||||
@ -102,6 +100,9 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
private void toggleFavouriteStatus()
|
private void toggleFavouriteStatus()
|
||||||
{
|
{
|
||||||
|
if (beatmapSet == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Enabled.Value = false;
|
Enabled.Value = false;
|
||||||
loading.Show();
|
loading.Show();
|
||||||
|
|
||||||
@ -144,9 +145,6 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
{
|
{
|
||||||
if (current?.Value == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (current.Value.Favourited)
|
if (current.Value.Favourited)
|
||||||
{
|
{
|
||||||
background.Colour = colours.Green;
|
background.Colour = colours.Green;
|
||||||
|
Loading…
Reference in New Issue
Block a user