Code quality fixes

This commit is contained in:
Jai Sharma
2022-03-14 19:42:55 +00:00
parent 39c30516d0
commit c0d82dfb41
4 changed files with 10 additions and 11 deletions

View File

@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual.Online
[Cached]
private readonly Bindable<Channel> selected = new Bindable<Channel>();
private static List<Channel> channels = new List<Channel>
private static readonly List<Channel> channels = new List<Channel>
{
createPublicChannel("#public-channel"),
createPublicChannel("#public-channel-long-name"),
@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Online
var item = new ControlItem(channel);
flow.Add(item);
channelMap.Add(channel, item);
item.OnRequestSelect += channel => selected.Value = channel;
item.OnRequestSelect += c => selected.Value = c;
item.OnRequestLeave += leaveChannel;
}
});

View File

@ -95,7 +95,7 @@ namespace osu.Game.Overlays.Chat.ChannelControl
},
Content = new[]
{
new Drawable[]
new[]
{
createAvatar(),
text = new ControlItemText(channel)

View File

@ -15,7 +15,8 @@ namespace osu.Game.Overlays.Chat.ChannelControl
{
public class ControlItemMention : CircularContainer
{
private int mentionCount = 0;
private int mentionCount;
public int MentionCount
{
get => mentionCount;
@ -63,15 +64,12 @@ namespace osu.Game.Overlays.Chat.ChannelControl
private void updateText()
{
if (mentionCount > 99)
countText!.Text = "99+";
else
countText!.Text = mentionCount.ToString();
countText!.Text = MentionCount > 99 ? "99+" : MentionCount.ToString();
if (mentionCount > 0)
this.Show();
Show();
else
this.Hide();
Hide();
}
}
}

View File

@ -14,6 +14,8 @@ namespace osu.Game.Overlays.Chat.ChannelControl
{
public class ControlItemText : Container
{
private bool hasUnread;
public bool HasUnread
{
get => hasUnread;
@ -27,7 +29,6 @@ namespace osu.Game.Overlays.Chat.ChannelControl
}
}
private bool hasUnread = false;
private OsuSpriteText? text;
[Resolved]