mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Use UpdateableAvatar
and remove redundant ControlItemAvatar
class
This commit is contained in:
parent
5373c3066f
commit
653bb47dd5
@ -4,6 +4,7 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -14,6 +15,8 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
|
using osu.Game.Users.Drawables;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Chat.ChannelControl
|
namespace osu.Game.Overlays.Chat.ChannelControl
|
||||||
{
|
{
|
||||||
@ -154,10 +157,14 @@ namespace osu.Game.Overlays.Chat.ChannelControl
|
|||||||
if (channel.Type != ChannelType.PM)
|
if (channel.Type != ChannelType.PM)
|
||||||
return Drawable.Empty();
|
return Drawable.Empty();
|
||||||
|
|
||||||
return new ControlItemAvatar(channel)
|
return new UpdateableAvatar(channel.Users.First(), false, false, true)
|
||||||
{
|
{
|
||||||
|
Size = new Vector2(20),
|
||||||
|
Margin = new MarginPadding { Right = 5 },
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
|
CornerRadius = 10,
|
||||||
|
Masking = true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
// 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.
|
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Online.Chat;
|
|
||||||
using osu.Game.Users.Drawables;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Chat.ChannelControl
|
|
||||||
{
|
|
||||||
public class ControlItemAvatar : CircularContainer
|
|
||||||
{
|
|
||||||
private readonly Channel channel;
|
|
||||||
|
|
||||||
private SpriteIcon? placeholder;
|
|
||||||
private DrawableAvatar? avatar;
|
|
||||||
|
|
||||||
public ControlItemAvatar(Channel channel)
|
|
||||||
{
|
|
||||||
this.channel = channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
Size = new Vector2(20);
|
|
||||||
Margin = new MarginPadding { Right = 5 };
|
|
||||||
Masking = true;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
placeholder = new SpriteIcon
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.Solid.At,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Colour = Colour4.White,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Alpha = 0.5f,
|
|
||||||
},
|
|
||||||
new DelayedLoadWrapper(avatar = new DrawableAvatar(channel.Users.First())
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
avatar!.OnLoadComplete += _ => placeholder!.FadeOut(250);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user