36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using GraphicsManager.Interfaces;
|
|
using GraphicsManager.Objects;
|
|
using Luski.net.Structures.Public;
|
|
using OpenTK.Mathematics;
|
|
|
|
namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
|
|
|
public class UserView : UserControl
|
|
{
|
|
public SocketUser User { get; set; }
|
|
|
|
private UserView(IRenderObject user, SocketUser u, Role r, bool offline)
|
|
{
|
|
this.User = u;
|
|
base.Size = new(244.ScaleInt(), 44.ScaleInt());
|
|
base.BackgroundColor = new(34, 34, 34, 255);
|
|
user.Location = new(8.ScaleInt(), 6.ScaleInt(), 0);
|
|
user.ForceDistanceUpdate(this);
|
|
Label uname = new(Globals.DefaultFont)
|
|
{
|
|
Text = u.DisplayName,
|
|
Color = r.Color.ToColor4()
|
|
};
|
|
if (offline) uname.Color = new(uname.Color.R, uname.Color.G, uname.Color.B, uname.Color.A * 0.6f);
|
|
uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(),
|
|
(user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0);
|
|
Controls.Add(uname);
|
|
Controls.Add(user);
|
|
}
|
|
|
|
public static async Task<UserView> Make(SocketUser u, Role r, bool offline)
|
|
{
|
|
UserView m = new(await u.MakeRct(new(32.ScaleInt()), true), u, r, offline);
|
|
return m;
|
|
}
|
|
} |