1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 04:02:59 +08:00

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

View File

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

View File

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

View File

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