-
Notifications
You must be signed in to change notification settings - Fork 16
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 #2064 from andy840119/remove-nullable-disable-anno…
…tation-in-the-graphic-namepace Remove nullable disable annotation in the graphic namespace.
- Loading branch information
Showing
22 changed files
with
58 additions
and
92 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
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) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics.Sprites; | ||
|
@@ -15,14 +13,14 @@ namespace osu.Game.Rulesets.Karaoke.Graphics.Containers; | |
public partial class MessageContainer : OsuTextFlowContainer | ||
{ | ||
[Resolved] | ||
private OsuColour colours { get; set; } | ||
private OsuColour colours { get; set; } = null!; | ||
|
||
public MessageContainer(Action<SpriteText> defaultCreationParameters = null) | ||
public MessageContainer(Action<SpriteText>? defaultCreationParameters = null) | ||
: base(defaultCreationParameters) | ||
{ | ||
} | ||
|
||
public void AddSuccessParagraph(string text, Action<SpriteText> creationParameters = null) | ||
public void AddSuccessParagraph(string text, Action<SpriteText>? creationParameters = null) | ||
{ | ||
NewParagraph(); | ||
AddIcon(FontAwesome.Solid.Check, icon => | ||
|
@@ -32,7 +30,7 @@ public void AddSuccessParagraph(string text, Action<SpriteText> creationParamete | |
AddText($" {text}", creationParameters); | ||
} | ||
|
||
public void AddWarningParagraph(string text, Action<SpriteText> creationParameters = null) | ||
public void AddWarningParagraph(string text, Action<SpriteText>? creationParameters = null) | ||
{ | ||
NewParagraph(); | ||
AddIcon(FontAwesome.Solid.ExclamationTriangle, icon => | ||
|
@@ -43,7 +41,7 @@ public void AddWarningParagraph(string text, Action<SpriteText> creationParamete | |
AddText($" {text}", creationParameters); | ||
} | ||
|
||
public void AddAlertParagraph(string text, Action<SpriteText> creationParameters = null) | ||
public void AddAlertParagraph(string text, Action<SpriteText>? creationParameters = null) | ||
{ | ||
NewParagraph(); | ||
AddIcon(FontAwesome.Solid.TimesCircle, icon => | ||
|
@@ -53,7 +51,7 @@ public void AddAlertParagraph(string text, Action<SpriteText> creationParameters | |
AddText($" {text}", creationParameters); | ||
} | ||
|
||
public void AddHighlightText(string text, Action<SpriteText> creationParameters = null) | ||
public void AddHighlightText(string text, Action<SpriteText>? creationParameters = null) | ||
{ | ||
AddText($" {text}", c => | ||
{ | ||
|
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,10 +1,10 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.Collections.Specialized; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Game.Graphics.Containers; | ||
|
@@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Karaoke.Graphics.Containers; | |
|
||
public abstract partial class OrderRearrangeableListContainer<TModel> : OsuRearrangeableListContainer<TModel> | ||
{ | ||
public event Action<TModel, int> OnOrderChanged; | ||
public event Action<TModel, int>? OnOrderChanged; | ||
|
||
protected abstract Vector2 Spacing { get; } | ||
|
||
|
@@ -25,13 +25,15 @@ protected OrderRearrangeableListContainer() | |
Items.CollectionChanged += collectionChanged; | ||
} | ||
|
||
private void collectionChanged(object sender, NotifyCollectionChangedEventArgs e) | ||
private void collectionChanged(object? sender, NotifyCollectionChangedEventArgs e) | ||
{ | ||
switch (e.Action) | ||
{ | ||
// should get the event if user change the position. | ||
case NotifyCollectionChangedAction.Move: | ||
var item = (TModel)e.NewItems[0]; | ||
Debug.Assert(e.NewItems != null); | ||
|
||
var item = e.NewItems.OfType<TModel>().First(); | ||
int newIndex = e.NewStartingIndex; | ||
OnOrderChanged?.Invoke(item, newIndex); | ||
break; | ||
|
@@ -42,7 +44,7 @@ protected override FillFlowContainer<RearrangeableListItem<TModel>> CreateListFi | |
=> base.CreateListFillFlowContainer().With(x => x.Spacing = Spacing); | ||
|
||
private bool displayBottomDrawable; | ||
private Drawable bottomDrawable; | ||
private Drawable? bottomDrawable; | ||
|
||
public bool DisplayBottomDrawable | ||
{ | ||
|
@@ -78,5 +80,5 @@ public bool DisplayBottomDrawable | |
} | ||
} | ||
|
||
protected virtual Drawable CreateBottomDrawable() => null; | ||
protected virtual Drawable? CreateBottomDrawable() => null; | ||
} |
2 changes: 0 additions & 2 deletions
2
osu.Game.Rulesets.Karaoke/Graphics/Cursor/BackgroundToolTip.cs
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) andy840119 <[email protected]>. Licensed under the GPL 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; | ||
|
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) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Game.Rulesets.Karaoke.Graphics.Sprites; | ||
|
@@ -12,7 +10,7 @@ namespace osu.Game.Rulesets.Karaoke.Graphics.Cursor; | |
|
||
public partial class LyricTooltip : BackgroundToolTip<Lyric> | ||
{ | ||
private Lyric lastLyric; | ||
private Lyric? lastLyric; | ||
|
||
public override void SetContent(Lyric lyric) | ||
{ | ||
|
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) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Extensions.Color4Extensions; | ||
|
@@ -134,7 +132,7 @@ public SingerToolTip() | |
bindableDescription.BindValueChanged(e => singerDescription.Text = string.IsNullOrEmpty(e.NewValue) ? "<No description>" : e.NewValue, true); | ||
} | ||
|
||
private ISinger lastSinger; | ||
private ISinger? lastSinger; | ||
|
||
public override void SetContent(ISinger singer) | ||
{ | ||
|
4 changes: 1 addition & 3 deletions
4
osu.Game.Rulesets.Karaoke/Graphics/Overlays/Dialog/OkPopupDialog.cs
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,16 +1,14 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using osu.Game.Overlays.Dialog; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Graphics.Overlays.Dialog; | ||
|
||
public partial class OkPopupDialog : PopupDialog | ||
{ | ||
public OkPopupDialog(Action<bool> okAction = null) | ||
public OkPopupDialog(Action<bool>? okAction = null) | ||
{ | ||
Buttons = new PopupDialogButton[] | ||
{ | ||
|
2 changes: 0 additions & 2 deletions
2
osu.Game.Rulesets.Karaoke/Graphics/Shapes/CornerBackground.cs
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) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Shapes; | ||
|
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,12 +1,10 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics.Textures; | ||
using osu.Game.Graphics; | ||
using osu.Game.Rulesets.Karaoke.Beatmaps.Metadatas; | ||
using osu.Game.Rulesets.Karaoke.Beatmaps.Metadatas.Types; | ||
using osu.Game.Rulesets.Karaoke.Beatmaps.Utils; | ||
|
@@ -18,19 +16,19 @@ public partial class DrawableCircleSingerAvatar : DrawableSingerAvatar | |
private readonly IBindable<float> bindableHue = new Bindable<float>(); | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(LargeTextureStore textures) | ||
private void load(OsuColour colour) | ||
{ | ||
Masking = true; | ||
CornerRadius = Math.Min(DrawSize.X, DrawSize.Y) / 2f; | ||
BorderThickness = 5; | ||
|
||
bindableHue.BindValueChanged(_ => | ||
{ | ||
BorderColour = SingerUtils.GetContentColour(Singer); | ||
BorderColour = Singer != null ? SingerUtils.GetContentColour(Singer) : colour.Gray0; | ||
}, true); | ||
} | ||
|
||
public override ISinger Singer | ||
public override ISinger? Singer | ||
{ | ||
get => base.Singer; | ||
set | ||
|
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) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
|
@@ -49,9 +47,9 @@ Texture getDefaultAvatar() | |
=> textures.Get(@"Online/avatar-guest"); | ||
} | ||
|
||
private ISinger singer; | ||
private ISinger? singer; | ||
|
||
public virtual ISinger Singer | ||
public virtual ISinger? Singer | ||
{ | ||
get => singer; | ||
set | ||
|
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) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using osu.Framework.Graphics.Sprites; | ||
using osu.Game.Graphics; | ||
|
||
|
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) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using osu.Framework.Allocation; | ||
using osu.Framework.Audio; | ||
using osu.Framework.Audio.Sample; | ||
|
@@ -28,8 +26,8 @@ public partial class CircleCheckbox : Checkbox, IHasAccentColour, IHasTooltip | |
private readonly SpriteIcon border; | ||
private readonly SpriteIcon selectedIcon; | ||
|
||
private Sample sampleChecked; | ||
private Sample sampleUnchecked; | ||
private Sample? sampleChecked; | ||
private Sample? sampleUnchecked; | ||
|
||
/// <summary> | ||
/// Whether to play sounds when the state changes as a result of user interaction. | ||
|
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) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using osu.Framework.Allocation; | ||
|
@@ -83,7 +81,7 @@ public MicrophoneSoundVisualizer() | |
updateDeviceInfo(); | ||
} | ||
|
||
private string deviceName; | ||
private string deviceName = string.Empty; | ||
|
||
public string DeviceName | ||
{ | ||
|
@@ -169,7 +167,7 @@ internal partial class MicrophoneInfo : CompositeDrawable | |
private readonly OsuSpriteText deviceName; | ||
|
||
[Resolved] | ||
private OsuColour colours { get; set; } | ||
private OsuColour colours { get; set; } = null!; | ||
|
||
public MicrophoneInfo() | ||
{ | ||
|
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) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using osu.Framework.Allocation; | ||
|
@@ -26,9 +24,9 @@ public partial class RearrangeableTextFlowListContainer<TModel> : OsuRearrangeab | |
{ | ||
public readonly Bindable<TModel> SelectedSet = new(); | ||
|
||
public Action<TModel> RequestSelection; | ||
public Action<TModel>? RequestSelection; | ||
|
||
private SearchContainer<RearrangeableListItem<TModel>> searchContainer; | ||
private SearchContainer<RearrangeableListItem<TModel>> searchContainer = null!; | ||
|
||
protected sealed override FillFlowContainer<RearrangeableListItem<TModel>> CreateListFillFlowContainer() => searchContainer = new SearchContainer<RearrangeableListItem<TModel>> | ||
{ | ||
|
@@ -56,9 +54,9 @@ public partial class DrawableTextListItem : OsuRearrangeableListItem<TModel>, IF | |
{ | ||
public readonly Bindable<TModel> SelectedSet = new(); | ||
|
||
public Action<TModel> RequestSelection; | ||
public Action<TModel>? RequestSelection; | ||
|
||
private TextFlowContainer text; | ||
private TextFlowContainer text = null!; | ||
|
||
private Color4 selectedColour; | ||
|
||
|
@@ -112,11 +110,11 @@ protected override bool OnClick(ClickEvent e) | |
|
||
public virtual IEnumerable<LocalisableString> FilterTerms => new[] | ||
{ | ||
new LocalisableString(Model.ToString()) | ||
new LocalisableString(Model?.ToString() ?? string.Empty) | ||
}; | ||
|
||
protected virtual void CreateDisplayContent(OsuTextFlowContainer textFlowContainer, TModel model) | ||
=> textFlowContainer.AddText(model.ToString()); | ||
=> textFlowContainer.AddText(model?.ToString() ?? string.Empty); | ||
|
||
private bool matchingFilter = true; | ||
|
||
|
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) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using osu.Framework.Bindables; | ||
|
@@ -135,7 +133,7 @@ private partial class DrawableSinger : DrawableCircleSingerAvatar, IHasCustomToo | |
{ | ||
public ITooltip<ISinger> GetCustomTooltip() => new SingerToolTip(); | ||
|
||
public ISinger TooltipContent => Singer; | ||
public ISinger? TooltipContent => Singer; | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.