From e7d2d94eeef6b11cc13660855b8267247ffc202c Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Wed, 30 Mar 2022 02:16:50 +0100 Subject: [PATCH] Fix code quality issues in `ChatTextBar` --- osu.Game/Overlays/Chat/ChatTextBar.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTextBar.cs b/osu.Game/Overlays/Chat/ChatTextBar.cs index 00284fdd33..66f9f281c9 100644 --- a/osu.Game/Overlays/Chat/ChatTextBar.cs +++ b/osu.Game/Overlays/Chat/ChatTextBar.cs @@ -21,14 +21,13 @@ namespace osu.Game.Overlays.Chat { public readonly BindableBool ShowSearch = new BindableBool(); - public ChatTextBox TextBox => chatTextBox; + public ChatTextBox TextBox { get; private set; } = null!; [Resolved] private Bindable currentChannel { get; set; } = null!; private OsuTextFlowContainer chattingTextContainer = null!; private Container searchIconContainer = null!; - private ChatTextBox chatTextBox = null!; private Container enterContainer = null!; private const float chatting_text_width = 180; @@ -89,7 +88,7 @@ namespace osu.Game.Overlays.Chat { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Right = 5 }, - Child = chatTextBox = new ChatTextBox + Child = TextBox = new ChatTextBox { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, @@ -156,16 +155,19 @@ namespace osu.Game.Overlays.Chat currentChannel.BindValueChanged(change => { Channel newChannel = change.NewValue; + switch (newChannel?.Type) { case ChannelType.Public: chattingTextContainer.Text = $"chatting in {newChannel.Name}"; break; + case ChannelType.PM: chattingTextContainer.Text = $"chatting with {newChannel.Name}"; break; + default: - chattingTextContainer.Text = ""; + chattingTextContainer.Text = string.Empty; break; } }, true);