mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 00:52:56 +08:00
Use #nullable enable
in ChatLine
This commit is contained in:
parent
187086e4ec
commit
dfa31df2af
@ -1,6 +1,8 @@
|
|||||||
// 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 enable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -26,33 +28,6 @@ namespace osu.Game.Overlays.Chat
|
|||||||
{
|
{
|
||||||
public class ChatLine : CompositeDrawable
|
public class ChatLine : CompositeDrawable
|
||||||
{
|
{
|
||||||
protected virtual float TextSize => 20;
|
|
||||||
|
|
||||||
protected virtual float Spacing => 15;
|
|
||||||
|
|
||||||
protected virtual float TimestampWidth => 60;
|
|
||||||
|
|
||||||
protected virtual float UsernameWidth => 130;
|
|
||||||
|
|
||||||
private Color4 usernameColour;
|
|
||||||
|
|
||||||
private OsuSpriteText timestamp;
|
|
||||||
|
|
||||||
public ChatLine(Message message)
|
|
||||||
{
|
|
||||||
Message = message;
|
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
AutoSizeAxes = Axes.Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
|
||||||
private ChannelManager chatManager { get; set; }
|
|
||||||
|
|
||||||
private Message message;
|
|
||||||
private OsuSpriteText username;
|
|
||||||
|
|
||||||
public LinkFlowContainer ContentFlow { get; private set; }
|
|
||||||
|
|
||||||
public Message Message
|
public Message Message
|
||||||
{
|
{
|
||||||
get => message;
|
get => message;
|
||||||
@ -69,10 +44,40 @@ namespace osu.Game.Overlays.Chat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LinkFlowContainer ContentFlow { get; private set; } = null!;
|
||||||
|
|
||||||
|
protected virtual float TextSize => 20;
|
||||||
|
|
||||||
|
protected virtual float Spacing => 15;
|
||||||
|
|
||||||
|
protected virtual float TimestampWidth => 60;
|
||||||
|
|
||||||
|
protected virtual float UsernameWidth => 130;
|
||||||
|
|
||||||
|
private Color4 usernameColour;
|
||||||
|
|
||||||
|
private OsuSpriteText timestamp = null!;
|
||||||
|
|
||||||
|
private Message message = null!;
|
||||||
|
|
||||||
|
private OsuSpriteText username = null!;
|
||||||
|
|
||||||
|
private Container? highlight;
|
||||||
|
|
||||||
private bool senderHasColour => !string.IsNullOrEmpty(message.Sender.Colour);
|
private bool senderHasColour => !string.IsNullOrEmpty(message.Sender.Colour);
|
||||||
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private ChannelManager? chatManager { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; }
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
|
public ChatLine(Message message)
|
||||||
|
{
|
||||||
|
Message = message;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
@ -151,8 +156,6 @@ namespace osu.Game.Overlays.Chat
|
|||||||
FinishTransforms(true);
|
FinishTransforms(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Container highlight;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs a highlight animation on this <see cref="ChatLine"/>.
|
/// Performs a highlight animation on this <see cref="ChatLine"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -250,10 +253,10 @@ namespace osu.Game.Overlays.Chat
|
|||||||
{
|
{
|
||||||
private readonly APIUser sender;
|
private readonly APIUser sender;
|
||||||
|
|
||||||
private Action startChatAction;
|
private Action startChatAction = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; }
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
public MessageSender(APIUser sender)
|
public MessageSender(APIUser sender)
|
||||||
{
|
{
|
||||||
@ -261,7 +264,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(UserProfileOverlay profile, ChannelManager chatManager)
|
private void load(UserProfileOverlay? profile, ChannelManager? chatManager)
|
||||||
{
|
{
|
||||||
Action = () => profile?.ShowUser(sender);
|
Action = () => profile?.ShowUser(sender);
|
||||||
startChatAction = () => chatManager?.OpenPrivateChannel(sender);
|
startChatAction = () => chatManager?.OpenPrivateChannel(sender);
|
||||||
|
Loading…
Reference in New Issue
Block a user