Mark required dependencies as non-nullable

This commit is contained in:
Jai Sharma 2022-03-14 20:14:04 +00:00
parent e9f0ad33ef
commit 12472593cc
4 changed files with 15 additions and 14 deletions

View File

@ -40,6 +40,8 @@ namespace osu.Game.Overlays.Chat.ChannelControl
} }
} }
private readonly Channel channel;
private Box? hoverBox; private Box? hoverBox;
private Box? selectBox; private Box? selectBox;
private ControlItemText? text; private ControlItemText? text;
@ -47,12 +49,10 @@ namespace osu.Game.Overlays.Chat.ChannelControl
private ControlItemClose? close; private ControlItemClose? close;
[Resolved] [Resolved]
private Bindable<Channel>? selectedChannel { get; set; } private Bindable<Channel> selectedChannel { get; set; } = null!;
[Resolved] [Resolved]
private OverlayColourProvider? colourProvider { get; set; } private OverlayColourProvider colourProvider { get; set; } = null!;
private readonly Channel channel;
public ControlItem(Channel channel) public ControlItem(Channel channel)
{ {
@ -70,13 +70,13 @@ namespace osu.Game.Overlays.Chat.ChannelControl
hoverBox = new Box hoverBox = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colourProvider!.Background3, Colour = colourProvider.Background3,
Alpha = 0f, Alpha = 0f,
}, },
selectBox = new Box selectBox = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colourProvider!.Background4, Colour = colourProvider.Background4,
Alpha = 0f, Alpha = 0f,
}, },
new Container new Container
@ -126,7 +126,7 @@ namespace osu.Game.Overlays.Chat.ChannelControl
{ {
base.LoadComplete(); base.LoadComplete();
selectedChannel?.BindValueChanged(change => selectedChannel.BindValueChanged(change =>
{ {
if (change.NewValue == channel) if (change.NewValue == channel)
selectBox?.Show(); selectBox?.Show();

View File

@ -16,9 +16,10 @@ namespace osu.Game.Overlays.Chat.ChannelControl
{ {
public class ControlItemAvatar : CircularContainer public class ControlItemAvatar : CircularContainer
{ {
private DrawableAvatar? avatar;
private readonly Channel channel; private readonly Channel channel;
private DrawableAvatar? avatar;
public ControlItemAvatar(Channel channel) public ControlItemAvatar(Channel channel)
{ {
this.channel = channel; this.channel = channel;

View File

@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Chat.ChannelControl
private OsuSpriteText? countText; private OsuSpriteText? countText;
[Resolved] [Resolved]
private OverlayColourProvider? colourProvider { get; set; } private OverlayColourProvider colourProvider { get; set; } = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Chat.ChannelControl
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colourProvider!.Colour1, Colour = colourProvider.Colour1,
}, },
countText = new OsuSpriteText countText = new OsuSpriteText
{ {

View File

@ -29,12 +29,12 @@ namespace osu.Game.Overlays.Chat.ChannelControl
} }
} }
private readonly Channel channel;
private OsuSpriteText? text; private OsuSpriteText? text;
[Resolved] [Resolved]
private OverlayColourProvider? colourProvider { get; set; } private OverlayColourProvider colourProvider { get; set; } = null!;
private readonly Channel channel;
public ControlItemText(Channel channel) public ControlItemText(Channel channel)
{ {
@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Chat.ChannelControl
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Text = channel.Type == ChannelType.Public ? $"# {channel.Name.Substring(1)}" : channel.Name, Text = channel.Type == ChannelType.Public ? $"# {channel.Name.Substring(1)}" : channel.Name,
Font = OsuFont.Torus.With(size: 17, weight: FontWeight.SemiBold), Font = OsuFont.Torus.With(size: 17, weight: FontWeight.SemiBold),
Colour = colourProvider!.Light3, Colour = colourProvider.Light3,
Margin = new MarginPadding { Bottom = 2 }, Margin = new MarginPadding { Bottom = 2 },
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Truncate = true, Truncate = true,