Apply NRT to MainMenuButton

This commit is contained in:
Dean Herbert 2023-11-24 11:05:57 +09:00
parent 8ad414488a
commit 1d1b3ca982
No known key found for this signature in database

View File

@ -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; using System;
using System.Linq; using System.Linq;
using osu.Framework; using osu.Framework;
@ -33,7 +31,7 @@ namespace osu.Game.Screens.Menu
/// </summary> /// </summary>
public partial class MainMenuButton : BeatSyncedContainer, IStateful<ButtonState> public partial class MainMenuButton : BeatSyncedContainer, IStateful<ButtonState>
{ {
public event Action<ButtonState> StateChanged; public event Action<ButtonState>? StateChanged;
public readonly Key[] TriggerKeys; public readonly Key[] TriggerKeys;
@ -48,14 +46,14 @@ namespace osu.Game.Screens.Menu
/// </summary> /// </summary>
public ButtonSystemState VisibleState = ButtonSystemState.TopLevel; public ButtonSystemState VisibleState = ButtonSystemState.TopLevel;
private readonly Action clickAction; private readonly Action? clickAction;
private Sample sampleClick; private Sample? sampleClick;
private Sample sampleHover; private Sample? sampleHover;
private SampleChannel sampleChannel; private SampleChannel? sampleChannel;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos); public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos);
public MainMenuButton(LocalisableString text, string sampleName, IconUsage symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, params Key[] triggerKeys) public MainMenuButton(LocalisableString text, string sampleName, IconUsage symbol, Color4 colour, Action? clickAction = null, float extraWidth = 0, params Key[] triggerKeys)
{ {
this.sampleName = sampleName; this.sampleName = sampleName;
this.clickAction = clickAction; this.clickAction = clickAction;