Added a channel picker to resolve #11
This commit is contained in:
parent
086e5d157c
commit
6f106dc49c
@ -5,8 +5,11 @@ using GraphicsManager.Enums;
|
|||||||
using GraphicsManager.Interfaces;
|
using GraphicsManager.Interfaces;
|
||||||
using GraphicsManager.Objects;
|
using GraphicsManager.Objects;
|
||||||
using GraphicsManager.Objects.Core;
|
using GraphicsManager.Objects.Core;
|
||||||
|
using Luski.GUI.MainScreen.Interfaces;
|
||||||
|
using Luski.GUI.MainScreen.UI;
|
||||||
using Luski.GUI.StartPage.UI;
|
using Luski.GUI.StartPage.UI;
|
||||||
using Luski.net;
|
using Luski.net;
|
||||||
|
using Luski.net.JsonTypes;
|
||||||
using OpenTK.Graphics.OpenGL4;
|
using OpenTK.Graphics.OpenGL4;
|
||||||
using OpenTK.Mathematics;
|
using OpenTK.Mathematics;
|
||||||
using OpenTK.Windowing.Desktop;
|
using OpenTK.Windowing.Desktop;
|
||||||
@ -24,6 +27,7 @@ public class MainScreen : Window
|
|||||||
StartFocused = true,
|
StartFocused = true,
|
||||||
Size = new OpenTK.Mathematics.Vector2i(481, 838),
|
Size = new OpenTK.Mathematics.Vector2i(481, 838),
|
||||||
};
|
};
|
||||||
|
FlowLayout? channelpicker;
|
||||||
|
|
||||||
public MainScreen() : base(Settings)
|
public MainScreen() : base(Settings)
|
||||||
{
|
{
|
||||||
@ -32,6 +36,35 @@ public class MainScreen : Window
|
|||||||
login.ChangeToApp += LoginOnChangeToApp;
|
login.ChangeToApp += LoginOnChangeToApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddGroup(SocketGroupChannel group)
|
||||||
|
{
|
||||||
|
Group friend = new(group);
|
||||||
|
friend.ClickCon += ChannelOnClickCon;
|
||||||
|
channelpicker!.Controls.Add(friend);
|
||||||
|
chans.Add(friend);
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly List<Friend> fr = new();
|
||||||
|
private List<IChannelPick> chans = new();
|
||||||
|
public void AddFriend(SocketRemoteUser user)
|
||||||
|
{
|
||||||
|
//add to friend pannel as well;
|
||||||
|
if (user.Channel is not null)
|
||||||
|
{
|
||||||
|
Friend friend = new(user);
|
||||||
|
friend.ClickCon += ChannelOnClickCon;
|
||||||
|
fr.Add(friend);
|
||||||
|
channelpicker!.Controls.Add(friend);
|
||||||
|
chans.Add(friend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task ChannelOnClickCon(IChannelPick arg)
|
||||||
|
{
|
||||||
|
//show their channel
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
private Task LoginOnChangeToApp()
|
private Task LoginOnChangeToApp()
|
||||||
{
|
{
|
||||||
Controls.Clear();
|
Controls.Clear();
|
||||||
@ -39,8 +72,24 @@ public class MainScreen : Window
|
|||||||
Size = new(2048, 1334);
|
Size = new(2048, 1334);
|
||||||
WindowBorder = WindowBorder.Resizable;
|
WindowBorder = WindowBorder.Resizable;
|
||||||
BackgroundColor = new Color4(34, 34, 34, 255);
|
BackgroundColor = new Color4(34, 34, 34, 255);
|
||||||
Controls.Add(new Rectangle(new Texture(Globals.Luski.CurrentUser.GetAvatar().Result)) { Size = new(70, 70), Location = new(14 + 132, 16 + 62 + 1170)});
|
Controls.Add(new Rectangle(new Texture(Globals.Luski.CurrentUser.GetAvatar().Result)) { Size = new(70, 70), Location = new(146, 78 + 1170)});
|
||||||
Controls.Add(new Label(){Location = new(132 + 92, 39 + 62+1170), Text = Globals.Luski.CurrentUser.Username});
|
Controls.Add(new Label(){Location = new(132 + 92, 39 + 62+1170), Text = Globals.Luski.CurrentUser.Username});
|
||||||
|
|
||||||
|
Controls.Add(channelpicker = new FlowLayout()
|
||||||
|
{
|
||||||
|
BackgroundColor = new(34,34,34,255),
|
||||||
|
Size = new(448, 1240),
|
||||||
|
Location = new(132, 0),
|
||||||
|
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom
|
||||||
|
});
|
||||||
|
foreach (SocketGroupChannel ch in Globals.Luski.CurrentUser.Channels.Where(s => s is SocketGroupChannel).Cast<SocketGroupChannel>())
|
||||||
|
{
|
||||||
|
AddGroup(ch);
|
||||||
|
}
|
||||||
|
foreach (SocketRemoteUser item in Globals.Luski.CurrentUser.Friends)
|
||||||
|
{
|
||||||
|
if (item.Channel is not null) AddFriend(item);
|
||||||
|
}
|
||||||
DrawFrame();
|
DrawFrame();
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ namespace Luski;
|
|||||||
|
|
||||||
public class Globals
|
public class Globals
|
||||||
{
|
{
|
||||||
public static Server Luski = null;
|
public static Server Luski = null!;
|
||||||
}
|
}
|
@ -8,7 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="GraphicsManager" Version="1.0.0-alpha999991" />
|
<PackageReference Include="GraphicsManager" Version="1.0.0-alpha999993" />
|
||||||
<PackageReference Include="Luski.net" Version="1.1.0-alpha" />
|
<PackageReference Include="Luski.net" Version="1.1.0-alpha" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user