dev #17

Merged
JacobTech merged 29 commits from dev into main 2024-04-11 15:50:14 -04:00
4 changed files with 46 additions and 28 deletions
Showing only changes of commit 04ccaec3bb - Show all commits

View File

@ -12,10 +12,10 @@ using Luski.net;
using Luski.net.Enums;
using Luski.net.Interfaces;
using Luski.net.JsonTypes;
using OpenTK.Graphics.OpenGL4;
using OpenTK.Mathematics;
using OpenTK.Windowing.Desktop;
using OpenTK.Windowing.Common;
using Window = GraphicsManager.Window;
namespace Luski.GUI.MainScreen;
@ -29,7 +29,9 @@ public class MainScreen : Window
StartFocused = true,
Size = new OpenTK.Mathematics.Vector2i(481, 838),
};
FlowLayout? channelpicker;
private TabControl tc;
private FlowLayout? channelpicker, friends;
private RoundedButton? FriendManagerBtn;
private Chat? chat;
@ -54,7 +56,9 @@ public class MainScreen : Window
private List<IChannelPick> chans = new();
public void AddFriend(SocketRemoteUser user)
{
//add to friend pannel as well;
Friend friend2 = new(user);
friend2.ClickCon += ChannelOnClickCon;
friends.Controls.Add(friend2);
if (user.Channel is not null)
{
Friend friend = new(user);
@ -87,16 +91,37 @@ public class MainScreen : Window
Controls.Add(new Rectangle(new Texture(Globals.Luski.CurrentUser.GetAvatar().Result)) { Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left, Size = new(70, 70), Location = new(94, 1248)});
Controls.Add(new Label(){ Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left, Location = new(172, 1271), Text = Globals.Luski.CurrentUser.Username});
FlowLayout ser;
Controls.Add(chat = new() {Location = new(528,0)});
Controls.Add(ser = new FlowLayout()
{
BackgroundColor = new(26, 26, 26, 255),
Size = new(80,1334),
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom,
});
Controls.Add(tc = new()// this is here to showcase my good friend TCLL
{
Location = chat.Location,
Size = chat.Size,
BackgroundColor = chat.BackgroundColor,
Anchor = ObjectAnchor.All,
Visible = false
});
UserControl f;
tc.AddPage("Frineds", f= new UserControl());
tc.AddPage("Friend Request", new UserControl());
tc.AddPage("Add Friend", new UserControl());
f.Controls.Add(friends = new FlowLayout()
{
Size = f.Size,
BackgroundColor = new(45,45,45,255),
Anchor = ObjectAnchor.All
});
ser.Controls.Add(new Rectangle(Globals.LuskiTexture)
{
Size = new(80,80)
Size = new(80,80),
});
Controls.Add(channelpicker = new FlowLayout()
{
BackgroundColor = new(34,34,34,255),
@ -114,7 +139,7 @@ public class MainScreen : Window
{
if (item.Channel is not null) AddFriend(item);
}
Controls.Add(chat = new() {Location = new(528,0)});
SocketTextChannel chan = Globals.Luski.GetChannel<SocketTextChannel>(Globals.Luski.CurrentUser.SelectedChannel).Result;
chat.UpdateTitle(chans.First(s => s.Channel.Id == chan.Id));
IReadOnlyList<SocketMessage> messages = chan.GetMessages(200).Result;
@ -137,10 +162,19 @@ public class MainScreen : Window
}));
return Task.CompletedTask;
}
private Task FriendManagerBtnOnClicked(IRenderObject arg)
{
//open the friend UI
if (chat.Visible)
{
chat.Visible = false;
tc.Visible = true;
}
else
{
chat.Visible = true;
tc.Visible = false;
}
return Task.CompletedTask;
}
}

View File

@ -1,10 +1,8 @@
using GraphicsManager.Enums;
using GraphicsManager.Interfaces;
using GraphicsManager.Objects;
using Luski.GUI.MainScreen.Interfaces;
using Luski.net.Enums;
using Luski.net.JsonTypes;
using OpenTK.Graphics.ES20;
using OpenTK.Mathematics;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.GraphicsLibraryFramework;
@ -30,8 +28,8 @@ public class Chat : UserControl
BackgroundColor = new(40,40,40,255),
Anchor = ObjectAnchor.All
});
Controls.Add(titlecon = new UserControl(){Size = new(1520, 80), BackgroundColor = BackgroundColor});
Controls.Add(typecon = new UserControl(){Location = new(0, 1252), Size = new(1520, 82), BackgroundColor = BackgroundColor});
Controls.Add(titlecon = new UserControl(){Anchor = ObjectAnchor.Left | ObjectAnchor.Top | ObjectAnchor.Right, Size = new(1520, 80), BackgroundColor = BackgroundColor});
Controls.Add(typecon = new UserControl(){Anchor = ObjectAnchor.Left | ObjectAnchor.Bottom | ObjectAnchor.Right, Location = new(0, 1252), Size = new(1520, 82), BackgroundColor = BackgroundColor});
titlecon.Controls.Add(title = new Label(){Location = new(27, 40)});
titlecon.Controls.Add(desc = new Label(){Color = new(161,161,161,255), Location = new(title.Location.X + title.Size.X + 5, title.Location.Y)});
Globals.Luski.MessageReceived += LuskiOnMessageReceived;
@ -40,7 +38,8 @@ public class Chat : UserControl
InsideColor = new(28, 28, 28, 255),
BorderColor = Color4.DarkCyan,
Location = new(15, 15),
Size = new(1490, 52)
Size = new(1490, 52),
Anchor = ObjectAnchor.All
});
tb.KeyPress += TbOnKeyPress;
}

View File

@ -38,8 +38,6 @@ public class ContentEmbed : UserControl
Controls.Add(fileSizeLabel = new Label() {Text = fst, Location = new(64, 39)});
Controls.Add(fileNameLabel = new Label() { Color = new(102/(float)255,227/(float)255,170/(float)255, 1), Text = file.Name, Location = new(64, 6)});
fileNameLabel.Clicked += FileNameLabelOnClicked;
fileNameLabel.MouseEnter += FileNameLabelOnMouseEnter;
fileNameLabel.MouseLeave += FileNameLabelOnMouseLeave;
byte[] tempp = Tools.GetResourceBytes(Assembly.GetExecutingAssembly(), "Luski.Resources.Textures.Download.png");
Controls.Add(new Rectangle(new Texture(tempp)) { Location = new(8, 6), Size = new(50, 50)});
int temp = fileNameLabel.Size.X + fileNameLabel.Location.X;
@ -48,21 +46,8 @@ public class ContentEmbed : UserControl
else Size = new(temp2 + 4, Size.Y);
}
private Task FileNameLabelOnMouseLeave(IRenderObject arg)
{
Console.WriteLine("leave");
return Task.CompletedTask;
}
private Task FileNameLabelOnMouseEnter(IRenderObject arg)
{
Console.WriteLine("enter");
return Task.CompletedTask;
}
private Task FileNameLabelOnClicked(IRenderObject arg)
{
Console.WriteLine("Click");
string dir = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Downloads", "LuskiDownloads");
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
Thread t = new(() => file.DownloadBytes(Path.Join(dir, file.Name), channel));

View File

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GraphicsManager" Version="1.0.0-alpha99999999994" />
<PackageReference Include="GraphicsManager" Version="1.0.0-alpha99999999999999996" />
<PackageReference Include="Luski.net" Version="1.0.0-alpha5" />
</ItemGroup>