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

View File

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

View File

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

View File

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