2019-01-24 16:43:03 +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.
|
2018-04-14 19:32:48 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-03-27 18:29:27 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2018-04-14 19:32:48 +08:00
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Online.Chat;
|
2019-06-18 02:55:07 +08:00
|
|
|
|
using osu.Game.Users.Drawables;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
2018-04-14 19:32:48 +08:00
|
|
|
|
|
2018-07-10 01:42:57 +08:00
|
|
|
|
namespace osu.Game.Overlays.Chat.Tabs
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
2018-09-06 15:21:31 +08:00
|
|
|
|
public class PrivateChannelTabItem : ChannelTabItem
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
2019-04-02 18:55:24 +08:00
|
|
|
|
protected override IconUsage DisplayIcon => FontAwesome.Solid.At;
|
2018-04-14 19:32:48 +08:00
|
|
|
|
|
2018-07-24 11:17:57 +08:00
|
|
|
|
public PrivateChannelTabItem(Channel value)
|
2018-04-14 19:32:48 +08:00
|
|
|
|
: base(value)
|
|
|
|
|
{
|
2018-11-13 14:20:40 +08:00
|
|
|
|
if (value.Type != ChannelType.PM)
|
2018-04-14 19:32:48 +08:00
|
|
|
|
throw new ArgumentException("Argument value needs to have the targettype user!");
|
|
|
|
|
|
2021-07-30 20:32:08 +08:00
|
|
|
|
DrawableAvatar avatar;
|
2019-03-17 12:43:23 +08:00
|
|
|
|
|
2018-09-06 15:21:31 +08:00
|
|
|
|
AddRange(new Drawable[]
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
AutoSizeAxes = Axes.X,
|
2018-09-06 15:21:31 +08:00
|
|
|
|
Margin = new MarginPadding
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
2018-09-06 15:21:31 +08:00
|
|
|
|
Horizontal = 3
|
|
|
|
|
},
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new CircularContainer
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
2018-09-06 15:21:31 +08:00
|
|
|
|
Scale = new Vector2(0.95f),
|
|
|
|
|
Size = new Vector2(ChatOverlay.TAB_AREA_HEIGHT),
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Masking = true,
|
2021-07-30 20:32:08 +08:00
|
|
|
|
Child = new DelayedLoadWrapper(avatar = new DrawableAvatar(value.Users.First())
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
2021-07-30 20:32:08 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both
|
2018-09-06 15:21:31 +08:00
|
|
|
|
})
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
2018-09-06 15:21:31 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-04-14 19:32:48 +08:00
|
|
|
|
}
|
2018-09-06 15:21:31 +08:00
|
|
|
|
},
|
|
|
|
|
});
|
2018-07-10 05:12:41 +08:00
|
|
|
|
|
2019-03-17 12:43:23 +08:00
|
|
|
|
avatar.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint);
|
2018-04-14 19:32:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-29 01:47:26 +08:00
|
|
|
|
protected override float LeftTextPadding => base.LeftTextPadding + ChatOverlay.TAB_AREA_HEIGHT;
|
|
|
|
|
|
2018-09-06 15:21:31 +08:00
|
|
|
|
protected override bool ShowCloseOnHover => false;
|
2018-04-14 19:32:48 +08:00
|
|
|
|
|
2018-09-06 15:21:31 +08:00
|
|
|
|
protected override void FadeActive()
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
2018-09-06 15:21:31 +08:00
|
|
|
|
base.FadeActive();
|
2018-04-14 19:32:48 +08:00
|
|
|
|
|
2018-09-06 16:22:51 +08:00
|
|
|
|
this.ResizeWidthTo(200, TRANSITION_LENGTH, Easing.OutQuint);
|
2018-09-06 15:21:31 +08:00
|
|
|
|
CloseButton.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
|
2018-04-14 19:32:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-06 15:21:31 +08:00
|
|
|
|
protected override void FadeInactive()
|
2018-04-14 19:32:48 +08:00
|
|
|
|
{
|
2018-09-06 15:21:31 +08:00
|
|
|
|
base.FadeInactive();
|
2018-04-14 19:32:48 +08:00
|
|
|
|
|
2018-09-06 15:21:31 +08:00
|
|
|
|
this.ResizeWidthTo(ChatOverlay.TAB_AREA_HEIGHT + 10, TRANSITION_LENGTH, Easing.OutQuint);
|
|
|
|
|
CloseButton.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
|
2018-04-14 19:32:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
2018-11-13 14:20:40 +08:00
|
|
|
|
var user = Value.Users.First();
|
2018-04-14 19:32:48 +08:00
|
|
|
|
|
2020-03-11 09:18:41 +08:00
|
|
|
|
BackgroundActive = user.Colour != null ? Color4Extensions.FromHex(user.Colour) : colours.BlueDark;
|
2018-09-06 15:21:31 +08:00
|
|
|
|
BackgroundInactive = BackgroundActive.Darken(0.5f);
|
2018-04-14 19:32:48 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|