2020-03-03 22:37:01 +08:00
|
|
|
|
// 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.
|
|
|
|
|
|
2020-03-04 05:28:47 +08:00
|
|
|
|
using System;
|
2021-07-01 03:16:21 +08:00
|
|
|
|
using osu.Framework.Extensions;
|
|
|
|
|
using osu.Framework.Localisation;
|
2020-03-04 05:28:47 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2020-03-03 22:37:01 +08:00
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
2020-03-16 14:42:21 +08:00
|
|
|
|
namespace osu.Game.Overlays.Dashboard.Friends
|
2020-03-03 22:37:01 +08:00
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public partial class FriendsOnlineStatusItem : OverlayStreamItem<FriendStream>
|
2020-03-03 22:37:01 +08:00
|
|
|
|
{
|
2020-03-23 09:47:27 +08:00
|
|
|
|
public FriendsOnlineStatusItem(FriendStream value)
|
2020-03-03 22:37:01 +08:00
|
|
|
|
: base(value)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-01 03:16:21 +08:00
|
|
|
|
protected override LocalisableString MainText => Value.Status.GetLocalisableDescription();
|
2020-03-03 22:37:01 +08:00
|
|
|
|
|
2021-07-01 03:16:21 +08:00
|
|
|
|
protected override LocalisableString AdditionalText => Value.Count.ToString();
|
2020-03-03 22:37:01 +08:00
|
|
|
|
|
2020-03-04 05:28:47 +08:00
|
|
|
|
protected override Color4 GetBarColour(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
switch (Value.Status)
|
|
|
|
|
{
|
2020-03-23 09:47:27 +08:00
|
|
|
|
case OnlineStatus.All:
|
2020-03-04 05:28:47 +08:00
|
|
|
|
return Color4.White;
|
|
|
|
|
|
2020-03-23 09:47:27 +08:00
|
|
|
|
case OnlineStatus.Online:
|
2020-03-04 05:28:47 +08:00
|
|
|
|
return colours.GreenLight;
|
|
|
|
|
|
2020-03-23 09:47:27 +08:00
|
|
|
|
case OnlineStatus.Offline:
|
2020-03-04 05:28:47 +08:00
|
|
|
|
return Color4.Black;
|
2020-03-05 04:03:02 +08:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
throw new ArgumentException($@"{Value.Status} status does not provide a colour in {nameof(GetBarColour)}.");
|
2020-03-04 05:28:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-03 22:37:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|