diff --git a/Luski/Classes/Settings.cs b/Luski/Classes/Settings.cs index 5121b60..69049ef 100644 --- a/Luski/Classes/Settings.cs +++ b/Luski/Classes/Settings.cs @@ -46,6 +46,9 @@ public class Settings [JsonInclude] [JsonPropertyName("message_font_line_space_px")] public uint MessageFontLineSpacePX { get; set; } = 5; + [JsonInclude] + [JsonPropertyName("24hour_time")] + public bool DayTime { get; set; } = false; } diff --git a/Luski/GUI/MainScreen/UI/LuskiControls/RoleView.cs b/Luski/GUI/MainScreen/UI/LuskiControls/RoleView.cs index 5534e41..e5505f0 100644 --- a/Luski/GUI/MainScreen/UI/LuskiControls/RoleView.cs +++ b/Luski/GUI/MainScreen/UI/LuskiControls/RoleView.cs @@ -1,6 +1,6 @@ using GraphicsManager.Objects; using Luski.net.Structures.Public; -using Luski.Shared.PublicServers.V1.Enums; +using OpenTK.Mathematics; namespace Luski.GUI.MainScreen.UI.LuskiControls; @@ -55,7 +55,7 @@ public class RoleView : FlowLayout public void RemoveUser(long id) { - Size = new(Size.X, Size.Y - uuu[id].Size.Y); + Vector2i Sizes = new(Size.X, Size.Y - uuu[id].Size.Y); i--; l.Text = " " + n + " — " + i; Users.Remove(uuu[id].User); @@ -63,7 +63,8 @@ public class RoleView : FlowLayout uuu.Remove(id); for (int j = 0; j < Controls.Length; j++) { - ReportSizeUpdate(Controls[i]); + ReportSizeUpdate(Controls[j]); } + Size = Sizes; } } \ No newline at end of file diff --git a/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs b/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs index e6c7809..e940880 100644 --- a/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs +++ b/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs @@ -38,8 +38,6 @@ public class ChatMessage : UserControl private ChatMessage(PublicChat p, SocketMessage message, SocketChannel chan, IUser Author, IRenderObject UserIcon, Color4 UserNameColor) { - - pc = p; Label label1; base.Size = new(723.5.ScaleInt(), 37.ScaleInt()); @@ -48,20 +46,38 @@ public class ChatMessage : UserControl Msg = message; Anchor = ObjectAnchor.Left | ObjectAnchor.Right; - DateTime time = chan.Epoch.AddMilliseconds(Msg.ID >> 20).ToLocalTime(); + DateTime time = chan.Epoch.AddMilliseconds(Msg.TimeStamp).ToLocalTime(); string time_str; - if (time.Date == DateTime.Now.ToLocalTime().Date) + if (Globals.Settings.DayTime) { - time_str = $"Today at {time.ToShortTimeString()}"; - } - else if (time.Date == DateTime.Now.ToLocalTime().AddDays(-1).Date) - { - time_str = $"Yesterday at {time.ToShortTimeString()}"; + if (time.Date == DateTime.Now.ToLocalTime().Date) + { + time_str = $"Today at {time:HH:mm}"; + } + else if (time.Date == DateTime.Now.ToLocalTime().AddDays(-1).Date) + { + time_str = $"Yesterday at {time:HH:mm}"; + } + else + { + time_str = $"{time:M/dd/yyyy HH:mm}"; + } } else { - time_str = $"{time:M/dd/yyyy h:mm tt}"; + if (time.Date == DateTime.Now.ToLocalTime().Date) + { + time_str = $"Today at {time.ToShortTimeString().Replace('\u202f', ' ')}"; + } + else if (time.Date == DateTime.Now.ToLocalTime().AddDays(-1).Date) + { + time_str = $"Yesterday at {time.ToShortTimeString().Replace('\u202f', ' ')}"; + } + else + { + time_str = $"{time:M/dd/yyyy h:mm tt}"; + } } UserIcon.Location = new(10.ScaleInt(), 2.ScaleInt(), 0); @@ -195,12 +211,14 @@ public class ChatMessage : UserControl } readonly List