dev #17

Merged
JacobTech merged 29 commits from dev into main 2024-04-11 15:50:14 -04:00
6 changed files with 26 additions and 18 deletions
Showing only changes of commit bdb1e350f6 - Show all commits

View File

@ -105,16 +105,12 @@ public class MainScreen : Window
}); });
t.Start(); t.Start();
WindowLoaded += OnWindowLoadedd; WindowLoaded += OnWindowLoaded;
}
private Task OnWindowLoadedd(Window arg)
{
return Task.CompletedTask;
} }
private Task OnWindowLoaded(Window arg) private Task OnWindowLoaded(Window arg)
{ {
if (Globals.UpdaterSettings.AutoUpdateCheck && new HttpClient().GetAsync($"https://www.jacobtech.com/Updater/GetProgramVersion?directory=Luski&branch={Globals.UpdaterSettings.Branch}&selfcontained={Globals.UpdaterSettings.SelfContained.ToString().ToLower()}&platform={Globals.UpdaterSettings.Platform}").Result.Content.ReadAsStringAsync().Result != FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion) if (Globals.UpdaterSettings.AutoUpdateCheck && new HttpClient().GetAsync($"https://www.jacobtech.com/Updater/GetProgramVersion?directory=Luski&branch={Globals.UpdaterSettings.Branch.ToString()}&selfcontained={Globals.UpdaterSettings.SelfContained.ToString().ToLower()}&platform={Globals.UpdaterSettings.Platform}").Result.Content.ReadAsStringAsync().Result != FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion)
{ {
var update = new UpdateWindow(); var update = new UpdateWindow();
var result = update.ShowDialogue(this); var result = update.ShowDialogue(this);
@ -206,13 +202,15 @@ public class MainScreen : Window
channelCancellationToken.Cancel(false); channelCancellationToken.Cancel(false);
} }
channelCancellationToken = new CancellationTokenSource(); channelCancellationToken = new CancellationTokenSource();
Globals.Luski.ChangeChannel(arg.Channel.Id, channelCancellationToken.Token).Wait(); Globals.Luski.ChangeChannel(arg.Channel.Id, channelCancellationToken.Token, Globals.Luski.CurrentUser.Servers.First()).Wait();
Invoke(new Action(() => Invoke(new Action(() =>
{ {
chat!.Clear(); chat!.Clear();
})); }));
IReadOnlyList<SocketMessage> messages = arg.Channel.GetMessages(channelCancellationToken.Token, Globals.Settings.LoadPerChannel).Result; IReadOnlyList<SocketMessage> messages = arg.Channel.GetMessages(channelCancellationToken.Token, Globals.Settings.LoadPerChannel).Result;
foreach (SocketMessage message in messages.Reverse()) foreach (SocketMessage message in messages.Reverse())
{ {
if (channelCancellationToken is null || channelCancellationToken.Token.IsCancellationRequested) return; if (channelCancellationToken is null || channelCancellationToken.Token.IsCancellationRequested) return;
@ -260,11 +258,17 @@ public class MainScreen : Window
BackgroundColor = new Color4(34, 34, 34, 255); BackgroundColor = new Color4(34, 34, 34, 255);
Rectangle u=new Rectangle(TextureManager.AddTexture(Tools.GetResourceBytes(Assembly.GetExecutingAssembly(), Rectangle u=new Rectangle(TextureManager.AddTexture(Tools.GetResourceBytes(Assembly.GetExecutingAssembly(),
"Luski.Resources.Textures.Status.png"))) { Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left, Size = new((int)(46 * Globals.Settings.Scale)), Location = new((int)(62 * Globals.Settings.Scale), (int)(812 * Globals.Settings.Scale))}; "Luski.Resources.Textures.Status.png"))) { Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left, Size = new((int)(46 * Globals.Settings.Scale)), Location = new((int)(62 * Globals.Settings.Scale), (int)(812 * Globals.Settings.Scale))};
Texture uut = TextureManager.AddTexture(Globals.Luski.CurrentUser.GetAvatar(CancellationToken.None).Result); Texture uut = TextureManager.AddTexture(Globals.Luski.CurrentUser.GetAvatar(CancellationToken.None, Globals.Luski.CurrentUser.Servers.First()).Result);
uut.Unit = TextureUnit.Texture1; uut.Unit = TextureUnit.Texture1;
u.Shader = Rectangle.DefaultAlphaTextureShader[Context]; u.Shader = Rectangle.DefaultAlphaTextureShader[Context];
u.Textures.Add(uut); u.Textures.Add(uut);
Controls.Add(u); Controls.Add(u);
Globals.Luski.CurrentUser.AddServer(SocketServer.GetServer("TCLL.LuskiServers.JacobTech.com"));
foreach (SocketServer Server in Globals.Luski.CurrentUser.Servers)
{
Console.WriteLine("Loading Server: {0}", Server.Domain);
//add server to UI
}
Label ul = new Label(){ Font = Globals.DefaultFont, Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left, Location = new(0, (int)(826 * Globals.Settings.Scale)), Text = Globals.Luski.CurrentUser.Username}; Label ul = new Label(){ Font = Globals.DefaultFont, Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left, Location = new(0, (int)(826 * Globals.Settings.Scale)), Text = Globals.Luski.CurrentUser.Username};
FlowLayout ser; FlowLayout ser;
ul.Location = new((int)(112 * Globals.Settings.Scale), ul.Location = new((int)(112 * Globals.Settings.Scale),
@ -322,7 +326,7 @@ public class MainScreen : Window
} }
Console.WriteLine("Channels done in " + (DateTime.Now - start).TotalSeconds + " seconds"); Console.WriteLine("Channels done in " + (DateTime.Now - start).TotalSeconds + " seconds");
SocketTextChannel chan = Globals.Luski.GetChannel<SocketTextChannel>(Globals.Luski.CurrentUser.SelectedChannel, CancellationToken.None).Result; SocketTextChannel chan = Globals.Luski.GetChannel<SocketTextChannel>(Globals.Luski.CurrentUser.SelectedChannel, CancellationToken.None, Globals.Luski.CurrentUser.Servers.First()).Result;
chat.UpdateTitle(chans.First(s => s.Channel.Id == chan.Id)); chat.UpdateTitle(chans.First(s => s.Channel.Id == chan.Id));
chat.MessageFlow.BlockDraw = true; chat.MessageFlow.BlockDraw = true;
try try

View File

@ -3,6 +3,7 @@ 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.Interfaces;
using Luski.net;
using Luski.net.Enums; using Luski.net.Enums;
using Luski.net.JsonTypes; using Luski.net.JsonTypes;
using OpenTK.Mathematics; using OpenTK.Mathematics;
@ -46,7 +47,7 @@ public class Chat : UserControl
BorderColor = Color4.DarkCyan, BorderColor = Color4.DarkCyan,
Location = new((int)(10 * Globals.Settings.Scale), (int)(824 * Globals.Settings.Scale)), Location = new((int)(10 * Globals.Settings.Scale), (int)(824 * Globals.Settings.Scale)),
Size = new((int)(960 * Globals.Settings.Scale), (int)(34 * Globals.Settings.Scale)), Size = new((int)(960 * Globals.Settings.Scale), (int)(34 * Globals.Settings.Scale)),
Anchor = ObjectAnchor.All Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left | ObjectAnchor.Right
}); });
tb.KeyPress += TbOnKeyPress; tb.KeyPress += TbOnKeyPress;
Globals.Luski.MessageReceived += LuskiOnMessageReceived; Globals.Luski.MessageReceived += LuskiOnMessageReceived;
@ -62,7 +63,7 @@ public class Chat : UserControl
private void Thr() private void Thr()
{ {
Globals.Luski.SendMessage(tb.Text, Channel!.Id, CancellationToken.None); Globals.Luski.SendMessage(tb.Text, Channel!.Id, Globals.Luski.CurrentUser.Servers.First(), CancellationToken.None);
Window!.Invoke(() => { tb.Text = string.Empty; }); Window!.Invoke(() => { tb.Text = string.Empty; });
} }

View File

@ -4,6 +4,7 @@ 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.net;
using Luski.net.Enums; using Luski.net.Enums;
using Luski.net.Interfaces; using Luski.net.Interfaces;
using Luski.net.JsonTypes; using Luski.net.JsonTypes;
@ -52,7 +53,7 @@ public class ChatMessage : UserControl
Controls.Add(new Label() { Scale = 0.8f, Font = Globals.DefaultFont, Location = new(label1.Location.X + label1.Size.X + 4, label1.Location.Y), Text = timestr}); Controls.Add(new Label() { Scale = 0.8f, Font = Globals.DefaultFont, Location = new(label1.Location.X + label1.Size.X + 4, label1.Location.Y), Text = timestr});
Rectangle r = new Rectangle(tm.AddTexture(Tools.GetResourceBytes(Assembly.GetExecutingAssembly(), Rectangle r = new Rectangle(tm.AddTexture(Tools.GetResourceBytes(Assembly.GetExecutingAssembly(),
"Luski.Resources.Textures.Status.png"))) { Location = new((int)(10 * Globals.Settings.Scale), (int)(2 * Globals.Settings.Scale)), Size = new((int)(38 * Globals.Settings.Scale)) }; "Luski.Resources.Textures.Status.png"))) { Location = new((int)(10 * Globals.Settings.Scale), (int)(2 * Globals.Settings.Scale)), Size = new((int)(38 * Globals.Settings.Scale)) };
Texture tex = tm.AddTexture(user.GetAvatar(CancellationToken.None).Result); Texture tex = tm.AddTexture(user.GetAvatar(CancellationToken.None, Globals.Luski.CurrentUser.Servers.First()).Result);
tex.Unit = TextureUnit.Texture1; tex.Unit = TextureUnit.Texture1;
r.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context]; r.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context];
r.Textures.Add(tex); r.Textures.Add(tex);

View File

@ -5,6 +5,7 @@ using GraphicsManager.Objects;
using GraphicsManager.Objects.Core; using GraphicsManager.Objects.Core;
using Luski.GUI.MainScreen.Interfaces; using Luski.GUI.MainScreen.Interfaces;
using Luski.GUI.Windows; using Luski.GUI.Windows;
using Luski.net;
using Luski.net.Enums; using Luski.net.Enums;
using Luski.net.JsonTypes; using Luski.net.JsonTypes;
using OpenTK.Graphics.OpenGL4; using OpenTK.Graphics.OpenGL4;
@ -54,7 +55,7 @@ public class Friend : UserControl, IChannelPick
UserStatus.Offline or UserStatus.Invisible or _ => Color4.LightGray UserStatus.Offline or UserStatus.Invisible or _ => Color4.LightGray
}; };
r = new Rectangle(this.rr.Textures.First()) { Location = new(this.rr.Location.X + 4,this.rr.Location.Y + 4), Size = new(this.rr.Size.X - 8)}; r = new Rectangle(this.rr.Textures.First()) { Location = new(this.rr.Location.X + 4,this.rr.Location.Y + 4), Size = new(this.rr.Size.X - 8)};
Texture t = Globals.ms.TextureManager.AddTexture(person.GetAvatar(CancellationToken.None).Result); Texture t = Globals.ms.TextureManager.AddTexture(person.GetAvatar(CancellationToken.None, Globals.Luski.CurrentUser.Servers.First()).Result);
t.Unit = TextureUnit.Texture1; t.Unit = TextureUnit.Texture1;
r.Textures.Add(t); r.Textures.Add(t);
r.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context]; r.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context];

View File

@ -4,6 +4,7 @@ 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.net;
using Luski.net.Enums; using Luski.net.Enums;
using Luski.net.JsonTypes; using Luski.net.JsonTypes;
using OpenTK.Graphics.OpenGL4; using OpenTK.Graphics.OpenGL4;
@ -31,7 +32,7 @@ public class FriendRequest : UserControl
Size = new ((int)(42 * Globals.Settings.Scale)) Size = new ((int)(42 * Globals.Settings.Scale))
}); });
rr.BackgroundColor = BackgroundColor; rr.BackgroundColor = BackgroundColor;
Texture t = Globals.ms.TextureManager.AddTexture(User.GetAvatar(CancellationToken.None).Result); Texture t = Globals.ms.TextureManager.AddTexture(User.GetAvatar(CancellationToken.None, Globals.Luski.CurrentUser.Servers.First()).Result);
t.Unit = TextureUnit.Texture1; t.Unit = TextureUnit.Texture1;
rr.Textures.Add(t); rr.Textures.Add(t);
rr.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context]; rr.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context];

View File

@ -5,7 +5,7 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<FileVersion>1.1.0.0</FileVersion> <FileVersion>1.1.0.1</FileVersion>
<Company>JacobTech, LLC</Company> <Company>JacobTech, LLC</Company>
</PropertyGroup> </PropertyGroup>
@ -20,7 +20,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="GraphicsManager" Version="1.0.5-alpha74" /> <PackageReference Include="GraphicsManager" Version="1.0.5-alpha74" />
<PackageReference Include="Luski.net" Version="1.1.2-beta05" /> <PackageReference Include="Luski.net" Version="1.1.3-alpha23" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>