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