Friend control to resolve #8
This commit is contained in:
parent
3389495a98
commit
086e5d157c
43
Luski/GUI/MainScreen/UI/Friend.cs
Normal file
43
Luski/GUI/MainScreen/UI/Friend.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using GraphicsManager.Interfaces;
|
||||||
|
using GraphicsManager.Objects;
|
||||||
|
using GraphicsManager.Objects.Core;
|
||||||
|
using Luski.GUI.MainScreen.Interfaces;
|
||||||
|
using Luski.net.JsonTypes;
|
||||||
|
|
||||||
|
namespace Luski.GUI.MainScreen.UI;
|
||||||
|
|
||||||
|
public class Friend : UserControl, IChannelPick
|
||||||
|
{
|
||||||
|
public SocketRemoteUser User;
|
||||||
|
|
||||||
|
public SocketTextChannel Channel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return User.Channel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private Rectangle r;
|
||||||
|
private Label Username, Status;
|
||||||
|
public Friend(SocketRemoteUser person)
|
||||||
|
{
|
||||||
|
User = person;
|
||||||
|
Size = new(370, 96);
|
||||||
|
BackgroundColor = new(34, 34, 34, 255);
|
||||||
|
Controls.Add( r = new Rectangle(new Texture(person.GetAvatar().Result)) { Location = new(15,17), Size = new(58,58)});
|
||||||
|
Controls.Add(Username = new Label() { Text = person.Username, Location = new(77,20)});
|
||||||
|
Controls.Add(Status = new Label() { Text = person.Status.ToString(), Location = new(77,48)});
|
||||||
|
//r.Clicked += AllOnClicked;
|
||||||
|
//Username.Clicked += AllOnClicked;
|
||||||
|
//Status.Clicked += AllOnClicked;
|
||||||
|
this.Clicked += AllOnClicked;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task AllOnClicked(IRenderObject arg)
|
||||||
|
{
|
||||||
|
if (ClickCon is not null) _ = ClickCon.Invoke(this);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public event Func<IChannelPick, Task>? ClickCon;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user