1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 20:43:21 +08:00

Fix code quality issues in ChatTextBar

This commit is contained in:
Jai Sharma 2022-03-30 02:16:50 +01:00
parent 06c32aa136
commit e7d2d94eee

View File

@ -21,14 +21,13 @@ namespace osu.Game.Overlays.Chat
{ {
public readonly BindableBool ShowSearch = new BindableBool(); public readonly BindableBool ShowSearch = new BindableBool();
public ChatTextBox TextBox => chatTextBox; public ChatTextBox TextBox { get; private set; } = null!;
[Resolved] [Resolved]
private Bindable<Channel> currentChannel { get; set; } = null!; private Bindable<Channel> currentChannel { get; set; } = null!;
private OsuTextFlowContainer chattingTextContainer = null!; private OsuTextFlowContainer chattingTextContainer = null!;
private Container searchIconContainer = null!; private Container searchIconContainer = null!;
private ChatTextBox chatTextBox = null!;
private Container enterContainer = null!; private Container enterContainer = null!;
private const float chatting_text_width = 180; private const float chatting_text_width = 180;
@ -89,7 +88,7 @@ namespace osu.Game.Overlays.Chat
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Right = 5 }, Padding = new MarginPadding { Right = 5 },
Child = chatTextBox = new ChatTextBox Child = TextBox = new ChatTextBox
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
@ -156,16 +155,19 @@ namespace osu.Game.Overlays.Chat
currentChannel.BindValueChanged(change => currentChannel.BindValueChanged(change =>
{ {
Channel newChannel = change.NewValue; Channel newChannel = change.NewValue;
switch (newChannel?.Type) switch (newChannel?.Type)
{ {
case ChannelType.Public: case ChannelType.Public:
chattingTextContainer.Text = $"chatting in {newChannel.Name}"; chattingTextContainer.Text = $"chatting in {newChannel.Name}";
break; break;
case ChannelType.PM: case ChannelType.PM:
chattingTextContainer.Text = $"chatting with {newChannel.Name}"; chattingTextContainer.Text = $"chatting with {newChannel.Name}";
break; break;
default: default:
chattingTextContainer.Text = ""; chattingTextContainer.Text = string.Empty;
break; break;
} }
}, true); }, true);