From a11bc8d89bfc3319b1657f7a1213e01ac45f1835 Mon Sep 17 00:00:00 2001 From: JacobTech Date: Thu, 11 Apr 2024 19:42:06 -0400 Subject: [PATCH 1/5] Message Text Copy --- .../UI/PublicServers/ChatMessage.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs b/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs index 405f9c8..dff0c4d 100644 --- a/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs +++ b/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Runtime.CompilerServices; using GraphicsManager.Enums; using GraphicsManager.Interfaces; using GraphicsManager.Objects; @@ -7,6 +8,7 @@ using Luski.net.Structures.Main; using Luski.net.Structures.Public; using OpenTK.Mathematics; using OpenTK.Windowing.Common.Input; +using OpenTK.Windowing.GraphicsLibraryFramework; using Label = GraphicsManager.Objects.Label; namespace Luski.GUI.MainScreen.UI.PublicServers; @@ -97,6 +99,17 @@ public class ChatMessage : UserControl Label l; Controls.Add(l = new Label(Globals.MessageFont) { Location = new(LastObject.Location.X, (int)(UserIcon.Location.Y + UserIcon.Size.Y - Globals.MessageFont.PixelHeight), 0), Text = message.Context}); LastObject = l; + LuskiContextMenu lcm = new(); + Label llllll = lcm.AddLabel("Copy Text"); + unsafe + { + llllll.Clicked += (o) => + { + GLFW.SetClipboardString(Globals.ms.WindowPtr, message.Context); + return Task.CompletedTask; + }; + } + l.ContextMenu = lcm; MessageObjs.Add(l); } Globals.Settings.DayTimeChanged += () => @@ -196,6 +209,17 @@ public class ChatMessage : UserControl Controls.Add(newLabel); MessageObjs.Add(newLabel); LastObject = newLabel; + LuskiContextMenu lcm = new(); + Label llllll = lcm.AddLabel("Copy Text"); + unsafe + { + llllll.Clicked += (o) => + { + GLFW.SetClipboardString(Globals.ms.WindowPtr, msg.Context); + return Task.CompletedTask; + }; + } + newLabel.ContextMenu = lcm; } -- 2.44.0 From 3c0a1cfe628b2920317f165ffcaa595abda1913a Mon Sep 17 00:00:00 2001 From: JacobTech Date: Thu, 11 Apr 2024 19:57:45 -0400 Subject: [PATCH 2/5] Fixed Add Server Overlay --- Luski/GUI/MainScreen/UI/AccountButton.cs | 1 + Luski/GUI/MainScreen/UI/AddServerOverlay.cs | 11 ++++++----- Luski/GUI/MainScreenWindow.cs | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Luski/GUI/MainScreen/UI/AccountButton.cs b/Luski/GUI/MainScreen/UI/AccountButton.cs index 1723302..934917e 100644 --- a/Luski/GUI/MainScreen/UI/AccountButton.cs +++ b/Luski/GUI/MainScreen/UI/AccountButton.cs @@ -82,6 +82,7 @@ public class AccountButton : UserControl SM.Selected = this; SM.page.Controls.Clear(); OnPageLoad.Invoke(); + Globals.ms.ForceUpdate(new(Globals.ms.CS)); } BlockDraw = false; diff --git a/Luski/GUI/MainScreen/UI/AddServerOverlay.cs b/Luski/GUI/MainScreen/UI/AddServerOverlay.cs index 05967f3..869effb 100644 --- a/Luski/GUI/MainScreen/UI/AddServerOverlay.cs +++ b/Luski/GUI/MainScreen/UI/AddServerOverlay.cs @@ -27,10 +27,8 @@ public class AddServerOverlay : UserControl, IServerOverlay public AddServerOverlay() { base.Size = Globals.ms.ClientSize; - BackgroundColor = new(0, 0, 0, 130); + base.BackgroundColor = new(0, 0, 0, 130); Anchor = ObjectAnchor.All; - - Form = new(Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png")) { @@ -337,7 +335,6 @@ public class AddServerOverlay : UserControl, IServerOverlay DisplayName.Textures[0] = UserName.Textures[0]; rec.ForceDistanceUpdate(page); Globals.ms.TryDraw(); - Globals.ms.ForceUpdate(new(Size)); } }; ca.Size = new((Form.Size.X - tb.Location.X - tb.Location.X - (tb.Location.X / 2)) / 2, ca.Size.Y); @@ -396,6 +393,7 @@ public class AddServerOverlay : UserControl, IServerOverlay return Task.CompletedTask; }; + UserName.Size = UserName.Size; page.Controls.Add(Password = new() { @@ -443,8 +441,12 @@ public class AddServerOverlay : UserControl, IServerOverlay return Task.CompletedTask; }; + Password.Size = Password.Size; + Password.ForceDistanceUpdate(page); DisplayName = null!; rec = null!; + Globals.ms.ForceUpdate(new(Globals.ms.CS)); + TryDraw(); } }; lo.Size = ca.Size; @@ -554,7 +556,6 @@ public class AddServerOverlay : UserControl, IServerOverlay Globals.ms.ser.Controls.Insert(Globals.ms.ser.Controls.Length - 1, ss); await ss.LoadServer(); Globals.ms.Controls.Remove(this); - Globals.ms.ForceUpdate(new(Size)); Globals.ms.TryDraw(); } diff --git a/Luski/GUI/MainScreenWindow.cs b/Luski/GUI/MainScreenWindow.cs index 3fa297b..1fa5ac4 100644 --- a/Luski/GUI/MainScreenWindow.cs +++ b/Luski/GUI/MainScreenWindow.cs @@ -396,7 +396,7 @@ public class MainScreenWindow : Window Controls.Add(aso); TryDraw(); - OnResize(new(Size)); + OnResize(new(CS)); return Task.CompletedTask; } -- 2.44.0 From 78c94e17ca6ab7c1e49a3ddc0ac21e9d89a69c4a Mon Sep 17 00:00:00 2001 From: JacobTech Date: Thu, 11 Apr 2024 20:05:11 -0400 Subject: [PATCH 3/5] Prevent Server Loading The app now stops the user from loading the server if it has already been loaded. --- Luski/GUI/MainScreen/UI/ServerIcon.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Luski/GUI/MainScreen/UI/ServerIcon.cs b/Luski/GUI/MainScreen/UI/ServerIcon.cs index f041960..5f9f773 100644 --- a/Luski/GUI/MainScreen/UI/ServerIcon.cs +++ b/Luski/GUI/MainScreen/UI/ServerIcon.cs @@ -13,17 +13,21 @@ public class ServerIcon : UserControl where TServer : Server private Rectangle SelectedRect; private static ServerIcon? ser1; private static ServerIcon? ser2; - + private bool Selected = false; + public async Task LoadServer() { + Selected = true; if (ser1 is not null) { ser1.SelectedRect.BackgroundColor = new(26, 26, 26, 255); + ser1.Selected = false; ser1 = null; } if (ser2 is not null) { ser2.SelectedRect.BackgroundColor = new(26, 26, 26, 255); + ser2.Selected = false; ser2 = null; } @@ -80,6 +84,7 @@ public class ServerIcon : UserControl where TServer : Server private async Task OnClicked(IRenderObject arg) { + if (Selected) return; await LoadServer(); } -- 2.44.0 From dc1c028d5a98b63101f3d840f78cca50e0e111f0 Mon Sep 17 00:00:00 2001 From: JacobTech Date: Thu, 11 Apr 2024 20:22:40 -0400 Subject: [PATCH 4/5] Fixed Messages Not Showing --- Luski/GUI/MainScreen/UI/PublicServers/Channel.cs | 4 +++- Luski/GUI/MainScreen/UI/PublicServers/PublicChat.cs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Luski/GUI/MainScreen/UI/PublicServers/Channel.cs b/Luski/GUI/MainScreen/UI/PublicServers/Channel.cs index e8528a2..9388fb7 100644 --- a/Luski/GUI/MainScreen/UI/PublicServers/Channel.cs +++ b/Luski/GUI/MainScreen/UI/PublicServers/Channel.cs @@ -115,7 +115,9 @@ public class Channel : UserControl Console.WriteLine("Waiting"); Task.WaitAll(mm); Globals.ms.pc.MessageFlow.ForceScrollUpdate(); - Globals.ms.pc.MessageFlow.ScrollToBottom(); + if (Globals.ms.pc.MessageFlow.Controls.Length > 1 && Globals.ms.pc.MessageFlow.Controls[Globals.ms.pc.MessageFlow.Controls.Length - 1].Location.Y + Globals.ms.pc.MessageFlow.Controls[Globals.ms.pc.MessageFlow.Controls.Length - 1].Size.Y > Globals.ms.pc.MessageFlow.Size.Y) + Globals.ms.pc.MessageFlow.ScrollToBottom(); + else Globals.ms.pc.MessageFlow.ScrollToTop(); Console.WriteLine("Done"); } BlockDraw = false; diff --git a/Luski/GUI/MainScreen/UI/PublicServers/PublicChat.cs b/Luski/GUI/MainScreen/UI/PublicServers/PublicChat.cs index 3b2b64f..14d1da8 100644 --- a/Luski/GUI/MainScreen/UI/PublicServers/PublicChat.cs +++ b/Luski/GUI/MainScreen/UI/PublicServers/PublicChat.cs @@ -402,6 +402,7 @@ public class PublicChat : UserControl public void ClearChat() { MessageFlow.Controls.Clear(); + MessageFlow.ScrollValue = 0; MessageFlow.ScrollUpdatesInterval = 33; lastm = null; lastUser = null; -- 2.44.0 From 0999d997cb07e047e9d3d032059cf8f67717fe2c Mon Sep 17 00:00:00 2001 From: JacobTech Date: Thu, 11 Apr 2024 20:31:55 -0400 Subject: [PATCH 5/5] Fixed Updater Settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Fixed changing a setting would not save to the file. • Fixed the updater file textbox looking weird. --- Luski/GUI/MainScreen/UI/SettingsMenu.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Luski/GUI/MainScreen/UI/SettingsMenu.cs b/Luski/GUI/MainScreen/UI/SettingsMenu.cs index 23e7057..438e155 100644 --- a/Luski/GUI/MainScreen/UI/SettingsMenu.cs +++ b/Luski/GUI/MainScreen/UI/SettingsMenu.cs @@ -298,8 +298,6 @@ public class SettingsMenu : UserControl }); - - TextBox t; page!.Controls.Add(t =new TextBox() { @@ -344,7 +342,7 @@ public class SettingsMenu : UserControl { var e = Enum.Parse(PropType, (v - va).ToString()); PropVal = e; - prop.SetValue(Globals.Settings, e); + prop.SetValue(Globals.UpdaterSettings, e); } Globals.UpdaterSettings.SaveSettings(Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"), UpdaterSettingsContext.Default.UpdaterSettings); }); @@ -364,7 +362,7 @@ public class SettingsMenu : UserControl string description = ((DescriptionAttribute)valueAttributes[0]).Description; AddBool(description, (bool)PropVal, b => { - prop.SetValue(Globals.Settings, b); + prop.SetValue(Globals.UpdaterSettings, b); Globals.UpdaterSettings.SaveSettings(Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"), UpdaterSettingsContext.Default.UpdaterSettings); }); } @@ -373,6 +371,7 @@ public class SettingsMenu : UserControl // ignored } } + } t.ForceDistanceUpdate(page); @@ -382,7 +381,8 @@ public class SettingsMenu : UserControl Globals.UpdaterSettings.SaveSettings(Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"), UpdaterSettingsContext.Default.UpdaterSettings); return Task.CompletedTask; }; - Globals.ms.ForceUpdate(new(Globals.ms.ClientSize)); + TryDraw(); + Globals.ms.ForceUpdate(new(Globals.ms.CS)); } }; As.AddButton(cb); -- 2.44.0