From bd5405866b0f1f028fc6209ba1e7335412387fcb Mon Sep 17 00:00:00 2001 From: JacobTech Date: Wed, 25 Sep 2024 12:45:20 -0400 Subject: [PATCH] I did a few things Text rendering and settings changes. --- .../Attribs/NumberSelectorAttribute.cs | 14 ++ .../Attribs/NumberSlider/NumberDefault.cs | 14 ++ .../Classes/Attribs/NumberSlider/NumberMax.cs | 14 ++ .../Classes/Attribs/NumberSlider/NumberMin.cs | 14 ++ Luski/Classes/Attribs/SettingInfoAttribute.cs | 23 ++ Luski/Classes/SettingPageStruct.cs | 9 + Luski/Classes/Settings.cs | 34 ++- Luski/Classes/UpdaterSettings.cs | 15 +- Luski/Enums/BlendType.cs | 7 + Luski/Enums/LockingMode.cs | 8 + Luski/Enums/Strings/SettingGroup.cs | 7 + Luski/Enums/Strings/SettingsPage.cs | 37 +++ .../MainScreen/UI/LuskiControls/LuskiLabel.cs | 53 +++- .../UI/LuskiControls/NumberSelector.cs | 227 ++++++++++++++++++ .../UI/LuskiControls/ProfileView.cs | 37 +-- .../SettingsMenuBase/Core/SettingsCategory.cs | 15 ++ .../SettingsMenuBase/SettingsMenu.cs | 2 +- .../MainScreen/UI/LuskiControls/UserView.cs | 38 +-- .../UI/LuskiSettings/GlobalSettingsMenu.cs | 57 +++-- .../Pages/AppSettings/General.cs | 4 +- .../UI/LuskiSettings/Pages/Generic.cs | 103 ++++++++ .../MainScreen/UI/PublicServers/Category.cs | 45 +--- .../MainScreen/UI/PublicServers/Channel.cs | 44 +--- .../UI/PublicServers/ChatMessage.cs | 37 ++- .../MainScreen/UI/PublicServers/PublicChat.cs | 31 +-- .../Pages/Server/Roles/RoleMember.cs | 6 +- Luski/GUI/MainScreen/UI/ServerLoginOverlay.cs | 23 +- Luski/GUI/MainScreenWindow.cs | 32 +-- Luski/Globals.cs | 188 ++++++++++++--- Luski/Luski.csproj | 8 +- Luski/Program.cs | 30 +-- 31 files changed, 869 insertions(+), 307 deletions(-) create mode 100644 Luski/Classes/Attribs/NumberSelectorAttribute.cs create mode 100644 Luski/Classes/Attribs/NumberSlider/NumberDefault.cs create mode 100644 Luski/Classes/Attribs/NumberSlider/NumberMax.cs create mode 100644 Luski/Classes/Attribs/NumberSlider/NumberMin.cs create mode 100644 Luski/Classes/Attribs/SettingInfoAttribute.cs create mode 100644 Luski/Classes/SettingPageStruct.cs create mode 100644 Luski/Enums/BlendType.cs create mode 100644 Luski/Enums/LockingMode.cs create mode 100644 Luski/Enums/Strings/SettingGroup.cs create mode 100644 Luski/Enums/Strings/SettingsPage.cs create mode 100644 Luski/GUI/MainScreen/UI/LuskiControls/NumberSelector.cs create mode 100644 Luski/GUI/MainScreen/UI/LuskiSettings/Pages/Generic.cs diff --git a/Luski/Classes/Attribs/NumberSelectorAttribute.cs b/Luski/Classes/Attribs/NumberSelectorAttribute.cs new file mode 100644 index 0000000..5509deb --- /dev/null +++ b/Luski/Classes/Attribs/NumberSelectorAttribute.cs @@ -0,0 +1,14 @@ +using System.Numerics; + +namespace Luski.Classes.Attribs; + +[AttributeUsage(AttributeTargets.Property)] +public class NumberSelectorAttribute : Attribute +{ + public NumberSelectorAttribute(Type propertyType) + { + Kind = propertyType; + } + + public Type Kind { get; init; } +} \ No newline at end of file diff --git a/Luski/Classes/Attribs/NumberSlider/NumberDefault.cs b/Luski/Classes/Attribs/NumberSlider/NumberDefault.cs new file mode 100644 index 0000000..7bdcfc2 --- /dev/null +++ b/Luski/Classes/Attribs/NumberSlider/NumberDefault.cs @@ -0,0 +1,14 @@ +using System.Numerics; + +namespace Luski.Classes.Attribs.NumberSlider; + +[AttributeUsage(AttributeTargets.Property)] +public class NumberDefault : Attribute where TNumber : INumber +{ + public NumberDefault(TNumber @default) + { + Default = @default; + } + + public TNumber Default { get; init; } +} \ No newline at end of file diff --git a/Luski/Classes/Attribs/NumberSlider/NumberMax.cs b/Luski/Classes/Attribs/NumberSlider/NumberMax.cs new file mode 100644 index 0000000..1a465d8 --- /dev/null +++ b/Luski/Classes/Attribs/NumberSlider/NumberMax.cs @@ -0,0 +1,14 @@ +using System.Numerics; + +namespace Luski.Classes.Attribs.NumberSlider; + +[AttributeUsage(AttributeTargets.Property)] +public class NumberMax : Attribute where TNumber : INumber +{ + public NumberMax(TNumber max) + { + Max = max; + } + + public TNumber Max { get; init; } +} \ No newline at end of file diff --git a/Luski/Classes/Attribs/NumberSlider/NumberMin.cs b/Luski/Classes/Attribs/NumberSlider/NumberMin.cs new file mode 100644 index 0000000..c6379ab --- /dev/null +++ b/Luski/Classes/Attribs/NumberSlider/NumberMin.cs @@ -0,0 +1,14 @@ +using System.Numerics; + +namespace Luski.Classes.Attribs.NumberSlider; + +[AttributeUsage(AttributeTargets.Property)] +public class NumberMin : Attribute where TNumber : INumber +{ + public NumberMin(TNumber min) + { + Min = min; + } + + public TNumber Min { get; init; } +} \ No newline at end of file diff --git a/Luski/Classes/Attribs/SettingInfoAttribute.cs b/Luski/Classes/Attribs/SettingInfoAttribute.cs new file mode 100644 index 0000000..6190eeb --- /dev/null +++ b/Luski/Classes/Attribs/SettingInfoAttribute.cs @@ -0,0 +1,23 @@ +using Luski.Enums; +using Luski.Enums.Strings; +using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core; + +namespace Luski.Classes.Attribs; + +[AttributeUsage(AttributeTargets.Property)] +public class SettingInfoAttribute : Attribute +{ + public SettingInfoAttribute(string group, byte Page) + { + Group = group; + this.Page = Page; + } + + public ISettingsPage CreatePage() + { + return SettingsPage.Pages[Page].Page; + } + + public byte Page { get; init; } + public string Group { get; init; } +} \ No newline at end of file diff --git a/Luski/Classes/SettingPageStruct.cs b/Luski/Classes/SettingPageStruct.cs new file mode 100644 index 0000000..caffd89 --- /dev/null +++ b/Luski/Classes/SettingPageStruct.cs @@ -0,0 +1,9 @@ +using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core; + +namespace Luski.Classes; + +public class SettingPageStruct +{ + public string Name; + public ISettingsPage Page; +} \ No newline at end of file diff --git a/Luski/Classes/Settings.cs b/Luski/Classes/Settings.cs index 4b16d68..5d4d066 100644 --- a/Luski/Classes/Settings.cs +++ b/Luski/Classes/Settings.cs @@ -1,6 +1,10 @@ using System.ComponentModel; using System.Text.Json.Serialization; using GraphicsManager.Objects; +using Luski.Classes.Attribs; +using Luski.Classes.Attribs.NumberSlider; +using Luski.Enums; +using Luski.Enums.Strings; namespace Luski.Classes; @@ -8,6 +12,7 @@ public class Settings { [JsonInclude] [JsonPropertyName("scale")] + [SettingInfo(SettingGroup.AppSettings, SettingsPage.General)] public double? Scale { get; set; } = null; [JsonInclude] [JsonPropertyName("perscrollpixels")] @@ -23,6 +28,7 @@ public class Settings public string Theme { get; set; } = "Dark"; [JsonInclude] [JsonPropertyName("experiments")] + [SettingInfo(SettingGroup.Advanced, SettingsPage.Experiments)] public List Experiments { get; set; } = Array.Empty().ToList(); [JsonInclude] [JsonPropertyName("default_display")] @@ -33,6 +39,7 @@ public class Settings [JsonInclude] [Shared.GlobalAttributes.DisplayName("Console Logs")] [Description("The Log values for the console")] + [SettingInfo(SettingGroup.AppSettings, SettingsPage.General)] [JsonPropertyName("log")] public ConsoleLog Logs { @@ -55,6 +62,7 @@ public class Settings [Shared.GlobalAttributes.DisplayName("Scale Fonts")] [Description("Scales fonts using the scale property")] [JsonPropertyName("scale_fonts")] + [SettingInfo(SettingGroup.AppSettings, SettingsPage.General)] public bool ScaleFonts { get @@ -89,9 +97,31 @@ public class Settings [JsonInclude] [JsonPropertyName("role_settings_font_px")] public uint RoleSettingsFontPX { get; set; } = 14; + [JsonInclude] [JsonPropertyName("message_font_px")] - public uint MessageFontPX { get; set; } = 17; + [SettingInfo(SettingGroup.AppSettings, SettingsPage.Appearance)] + [Shared.GlobalAttributes.DisplayName("Message Font Size")] + [Description("Sets the px value for the message font size")] + [NumberSelector(typeof(uint))] + [NumberMin(12)] + [NumberDefault(17)] + [NumberMax(24)] + public uint MessageFontPX + { + get + { + return mfpx; + } + set + { + mfpx = value; + if (Globals.MessageFont is not null) Globals.MessageFont.PixelHeight = value; + } + } + + [JsonIgnore] + private uint mfpx = 17; [JsonInclude] [JsonPropertyName("message_font_line_space_px")] public uint MessageFontLineSpacePX { get; set; } = 5; @@ -100,6 +130,7 @@ public class Settings [Shared.GlobalAttributes.DisplayName("24 Hour Time")] [Description("Shows time in the 24 hour format")] [JsonPropertyName("24hour_time")] + [SettingInfo(SettingGroup.AppSettings, SettingsPage.General)] public bool DayTime { get @@ -117,6 +148,7 @@ public class Settings [Shared.GlobalAttributes.DisplayName("Memory Fonts")] [Description("Stores fonts in memory for faster load times")] [JsonPropertyName("memory_fonts")] + [SettingInfo(SettingGroup.AppSettings, SettingsPage.General)] public bool StoreFontsInMemory { get diff --git a/Luski/Classes/UpdaterSettings.cs b/Luski/Classes/UpdaterSettings.cs index 959e9ae..b14865a 100644 --- a/Luski/Classes/UpdaterSettings.cs +++ b/Luski/Classes/UpdaterSettings.cs @@ -1,6 +1,8 @@ using System.ComponentModel; using System.Text.Json.Serialization; -using Luski.net.Enums; +using Luski.Classes.Attribs; +using Luski.Enums.Strings; +using Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AdvancedSettings; namespace Luski.Classes; @@ -10,31 +12,37 @@ public class UpdaterSettings [Shared.GlobalAttributes.DisplayName("Self Contained")] [Description("This tells the updater to download the self contained version of the app.")] [JsonPropertyName("self_contained")] + [SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)] public bool SelfContained { get; set; } = false; [JsonInclude] [JsonPropertyName("updater")] + [SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)] public string? Updater { get; set; } = null; [JsonInclude] [JsonPropertyName("platform")] + [SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)] public string Platform { get; set; } = "linux-x64"; [JsonInclude] [Shared.GlobalAttributes.DisplayName("Auto Launch")] [Description("Tells the updater to relaunch the app after the update is complete.")] [JsonPropertyName("auto_launch")] + [SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)] public bool AutoLaunch { get; set; } = true; [JsonInclude] [Description("If the app can check for updates and an update is available, then the app will start the update process automatically.")] [Shared.GlobalAttributes.DisplayName("Auto Update")] [JsonPropertyName("auto_update")] + [SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)] public bool AutoUpdate { get; set; } = false; [JsonInclude] [Description("This will allow the client to check for update during the launch process.")] [Shared.GlobalAttributes.DisplayName("Check For Updates")] [JsonPropertyName("update_check")] + [SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)] public bool AutoUpdateCheck { get; set; } = true; } @@ -44,7 +52,4 @@ public class UpdaterSettings PropertyNamingPolicy = JsonKnownNamingPolicy.Unspecified, WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.Never)] -internal partial class UpdaterSettingsContext : JsonSerializerContext -{ - -} +internal partial class UpdaterSettingsContext : JsonSerializerContext; diff --git a/Luski/Enums/BlendType.cs b/Luski/Enums/BlendType.cs new file mode 100644 index 0000000..7358956 --- /dev/null +++ b/Luski/Enums/BlendType.cs @@ -0,0 +1,7 @@ +namespace Luski.Enums; + +public enum BlendType +{ + None, + MultiplyAlpha, +} \ No newline at end of file diff --git a/Luski/Enums/LockingMode.cs b/Luski/Enums/LockingMode.cs new file mode 100644 index 0000000..7a200dc --- /dev/null +++ b/Luski/Enums/LockingMode.cs @@ -0,0 +1,8 @@ +namespace Luski.Enums; + +public enum LockingMode : byte +{ + Points, + Int, + Float +} \ No newline at end of file diff --git a/Luski/Enums/Strings/SettingGroup.cs b/Luski/Enums/Strings/SettingGroup.cs new file mode 100644 index 0000000..a854a0a --- /dev/null +++ b/Luski/Enums/Strings/SettingGroup.cs @@ -0,0 +1,7 @@ +namespace Luski.Enums.Strings; + +public static class SettingGroup +{ + public const string AppSettings = "App Settings"; + public const string Advanced = "Advanced Settings"; +} \ No newline at end of file diff --git a/Luski/Enums/Strings/SettingsPage.cs b/Luski/Enums/Strings/SettingsPage.cs new file mode 100644 index 0000000..9d92b06 --- /dev/null +++ b/Luski/Enums/Strings/SettingsPage.cs @@ -0,0 +1,37 @@ +using Luski.Classes; +using Luski.GUI.MainScreen.UI.LuskiSettings.Pages; +using Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AdvancedSettings; +using Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AppSettings; + +namespace Luski.Enums.Strings; + +public static class SettingsPage +{ + public static SettingPageStruct[] Pages = new[] + { + new SettingPageStruct() + { + Name = "Updater Config", + Page = new Updater() + }, + new SettingPageStruct() + { + Name = "Experiments", + Page = new ExperimentSettings() + }, + new SettingPageStruct() + { + Name = "General", + Page = new Generic("General", 2) + }, + new SettingPageStruct() + { + Name = "Appearance", + Page = new Generic("Appearance", 3) + } + }; + public const byte Updater = 0; + public const byte Experiments = 1; + public const byte General = 2; + public const byte Appearance = 3; +} \ No newline at end of file diff --git a/Luski/GUI/MainScreen/UI/LuskiControls/LuskiLabel.cs b/Luski/GUI/MainScreen/UI/LuskiControls/LuskiLabel.cs index 20699a9..445eb4b 100644 --- a/Luski/GUI/MainScreen/UI/LuskiControls/LuskiLabel.cs +++ b/Luski/GUI/MainScreen/UI/LuskiControls/LuskiLabel.cs @@ -25,6 +25,7 @@ public class LuskiLabel : LabelBase if (Shader is null) Shader = Globals.GradientShader[win.Context]; base.LoadToParent(window, win); } + float _alpha = 1; protected virtual (Color4,Color4) getGradcols(int Start, int charter, int End, int StartLine, int Line, int EndLine, GradType GT, Color4[] Colors) { Vector2i cl = GetCharLocation(charter); @@ -77,7 +78,6 @@ public class LuskiLabel : LabelBase } catch (Exception e) { - LeftColor = Color4.DarkRed; RightColor = Color4.DarkRed; } @@ -88,7 +88,7 @@ public class LuskiLabel : LabelBase float b = LeftColor.B + (RightColor.B - LeftColor.B) * t; float a = LeftColor.A + (RightColor.A - LeftColor.A) * t; - return new Color4(r, g, b, a); + return new Color4(r, g, b, a * _alpha); } List> Commands = new(); @@ -117,7 +117,7 @@ public class LuskiLabel : LabelBase Commands.Clear(); List<(GradType, int)> RainGrad = new(); List<(Color4[], GradType, int)> Grad = new(); - List ccccc = new(); + List<(Color4, BlendType)> ccccc = new(); List Itilacs = new(); List Fonts = new(); List Sizes = new(); @@ -197,7 +197,6 @@ public class LuskiLabel : LabelBase GradType gt = GradType.Line; for (int j = 1; j < args.Length-2; j+=3) { - Console.WriteLine(args[j]); switch (args[j]) { case "colors": @@ -218,7 +217,17 @@ public class LuskiLabel : LabelBase i = brack; Color_End.Add(sb.Length); Color col = new(args[2].Replace("#", "")); - ccccc.Add(col.ToColor4()); + BlendType bt = BlendType.None; + for (int j = 3; j < args.Length-2; j+=3) + { + switch (args[j]) + { + case "blend": + bt = (BlendType)byte.Parse(args[j + 2]); + break; + } + } + ccccc.Add(new(col.ToColor4(), bt)); i = brack; continue; case "fontsize": @@ -319,7 +328,7 @@ public class LuskiLabel : LabelBase i = brack; continue; } - Commands.Add(new(TextCode.Color, Color_End[Color_End.Count-1], sb.Length-1, ccccc[ccccc.Count-1])); + Commands.Add(new(TextCode.Color, Color_End[Color_End.Count-1], sb.Length-1, new Tuple(ccccc[ccccc.Count-1].Item1, ccccc[ccccc.Count-1].Item2) )); Color_End.RemoveAt(Color_End.Count-1); ccccc.RemoveAt(ccccc.Count-1); i = brack; @@ -495,8 +504,12 @@ public class LuskiLabel : LabelBase if ((xrel + w) >= lw) lw = (xrel + w); } } - MaxLineSizes.Add(new(new((int)lw,(int)lh), Largest)); - max_lh += (uint) ((double) lh * ((double) Largest.CurrentFonts[0].Face.Height / (double) Largest.CurrentFonts[0].Face.UnitsPerEM) * (double) this.Scale); + + if (Largest is not null) + { + MaxLineSizes.Add(new(new((int)lw,(int)lh), Largest)); + max_lh += (uint) ((double) lh * ((double) Largest.CurrentFonts[0].Face.Height / (double) Largest.CurrentFonts[0].Face.UnitsPerEM) * (double) this.Scale); + } Largest = null; PlainText = sb.ToString(); @@ -566,7 +579,7 @@ public class LuskiLabel : LabelBase float angle_rad = (float)Math.Atan2(DIR.Y, DIR.X); Matrix4 rotateM = Matrix4.CreateRotationZ(angle_rad); Matrix4 transOriginM = Matrix4.CreateTranslation(new Vector3(loc_.X + Parent!.IntToWindow(0), loc_.Y + (MaxLineSizes[0].Item1.Y * Scale) + Parent!.IntToWindow(0, true), 0f)); - float char_x = 0.0f; + float char_x = 0.0f; GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1); @@ -627,7 +640,18 @@ public class LuskiLabel : LabelBase } else if (com.Item1 == TextCode.Color) { - col = new((Color4)com.Item4!, (Color4)com.Item4!); + Tuple item4 = (Tuple)com.Item4!; + if (item4.Item2 == BlendType.MultiplyAlpha) + { + _alpha = item4.Item1.A; + col = getGradcols(com.Item2, i, com.Item3, 0, line, 0, GradType.Block, + new Color4[] { DefaultColor, DefaultColor }); + } + else + { + col = new(item4.Item1, item4.Item1); + } + } else if (com.Item1 == TextCode.url) { @@ -636,7 +660,7 @@ public class LuskiLabel : LabelBase else { Tuple item4 = (Tuple)com.Item4!; - col = getGradcols(com.Item2, i, com.Item3, item4.Item3, line, item4.Item4, item4.Item2, item4.Item1); + col = getGradcols(com.Item2, i, com.Item3, item4.Item4, line, item4.Item4, item4.Item2, item4.Item1); } GL.Uniform4(Shader.GetUniformLocation("textColor"), col.Item1); GL.Uniform4(Shader.GetUniformLocation("rightColor"), col.Item2); @@ -684,6 +708,13 @@ public class LuskiLabel : LabelBase Active_Links.RemoveAt(Active_Links.Count-1); } + + Tuple com2 = Commands[Active_Grads[Active_Grads.Count - 1]]; + if (com2.Item1 == TextCode.Color) + { + Tuple item4 = (Tuple)com.Item4!; + if (item4.Item2 == BlendType.MultiplyAlpha) _alpha = 1; + } Active_Grads.RemoveAt(Active_Grads.Count-1); } } diff --git a/Luski/GUI/MainScreen/UI/LuskiControls/NumberSelector.cs b/Luski/GUI/MainScreen/UI/LuskiControls/NumberSelector.cs new file mode 100644 index 0000000..d79b950 --- /dev/null +++ b/Luski/GUI/MainScreen/UI/LuskiControls/NumberSelector.cs @@ -0,0 +1,227 @@ +using System.Numerics; +using GraphicsManager.Enums; +using GraphicsManager.Interfaces; +using GraphicsManager.Objects; +using Luski.Enums; +using OpenTK.Mathematics; +using OpenTK.Windowing.Common; + +namespace Luski.GUI.MainScreen.UI.LuskiControls; + +public class NumberSelector : UserControl where TNumber : INumber +{ + public event Func, Task>? ValueChanged; + + public int Space + { + get + { + return space; + } + set + { + space = value; + progressBar.Location = new(value, progressBar.Location.Y, 0); + progressBar.Size = new(base.Size.X - value - value, progressBar.Size.Y); + //progressBar.SetLocation(value, progressBar.Location.Y); + //progressBar.SetSize(base.Size.X - value - value, progressBar.Size.Y); + progressBar.UpdateProgress(); + Min = Min; + } + } + + public TNumber Min + { + get + { + return _Min; + } + set + { + _Min = value; + L1.Text = value.ToString() + Suffix; + int x = GetX(value); + L1.SetLocation(x - (L1.Size.X/2) + space, L1.Location.Y); + L1.ForceDistanceUpdate(this); + MinLine.SetLocation(x + space, MinLine.Location.Y); + Max = Max; + Value = Value; + } + } + + public TNumber Max + { + get + { + return progressBar.MaxProgressValue + Min; + } + set + { + progressBar.MaxProgressValue = value - Min; + L3.Text = value.ToString() + Suffix; + int x = GetX(value); + L3.SetLocation(x - (L3.Size.X/2) + space, L3.Location.Y); + MaxLine.SetLocation(x + space, MaxLine.Location.Y); + progressBar.UpdateProgress(); + } + } + + private int GetX(TNumber number) + { + return progressBar.GetParentLocation(number - Min, IgnoreEnd: true); + } + + public TNumber Default { get; set; } = TNumber.Zero; + public TNumber Value + { + get + { + return progressBar.ProgressValue + Min; + } + set + { + int i = 0; + TNumber tmp = value - Min; + if (progressBar.ProgressValue == tmp) return; + BlockDraw = true; + progressBar.ProgressValue = tmp; + Type tt = typeof(TNumber); + if (tt == typeof(double)) + L2Cursor.Text = Math.Round((double)(object)value, 2) + Suffix; + else if (tt == typeof(float)) + L2Cursor.Text = Math.Round((float)(object)value, 2) + Suffix; + else + L2Cursor.Text = value.ToString() + Suffix; + int x = GetX(value); + L2Cursor.SetLocation(x - (L2Cursor.Size.X/2) + space, L2Cursor.Location.Y); + Cursor.SetLocation(x - (Cursor.Size.X/2) + space, MaxLine.Location.Y); + Cursor.ForceDistanceUpdate(this); + BlockDraw = false; + progressBar.UpdateProgress(); + if (Loaded && ValueChanged is not null) ValueChanged.Invoke(this); + } + } + public bool LockToPoints { get; set; } = false; + public string Suffix = ""; + + + private ProgressBar progressBar = new(); + private Rectangle Cursor = new(), MinLine = new(), MaxLine = new(); + private List ExtraPoints = new(); + private int space = 5; + private TNumber _Min = TNumber.Zero, _Default = TNumber.Zero; + public Label + L1 = new(Globals.DefaultFont), + L2Default = new(Globals.DefaultFont), + L2Cursor = new(Globals.DefaultFont), + L3 = new(Globals.DefaultFont); + + public NumberSelector() + { + base.SetSize(300.ScaleInt()); + progressBar.SetSize(base.Size.X, 8.ScaleInt()); + progressBar.Anchor = ObjectAnchor.Left | ObjectAnchor.Top | ObjectAnchor.Right; + progressBar.DisallowAboveMax = false; + progressBar.DrawingGap.X = 1.ScaleInt(); + progressBar.UpdateProgress(); + progressBar.DrawingGap.X = 0; + progressBar.DrawingGap.Y = progressBar.DrawingGap.X; + progressBar.DrawingGap.Z = progressBar.DrawingGap.X; + progressBar.DrawingGap.W = progressBar.DrawingGap.X; + progressBar.ProgressGap.X = 4.ScaleInt(); + progressBar.ProgressGap.Y = progressBar.ProgressGap.X; + progressBar.BackgroundColor = Color4.DarkRed; + progressBar.ProgressColor = Globals.DodgerBlue; + progressBar.UpdateOnDraw = false; + progressBar.Anchor = ObjectAnchor.Left | ObjectAnchor.Right; + progressBar.UpdateProgress(); + progressBar.SetLocation(progressBar.Location.X, base.Size.Y-progressBar.Size.Y-progressBar.Size.Y); + progressBar.Clicked += ProgressBarOnClicked; + Cursor.SetSize(10.ScaleInt(),24.ScaleInt()); + Cursor.SetLocation(0, base.Size.Y-Cursor.Size.Y); + Cursor.BackgroundColor = Color4.White; + Cursor.Anchor = ObjectAnchor.PreventWidthChange; + MinLine.SetSize(2.ScaleInt(), Cursor.Size.Y); + MinLine.SetLocation(0, Cursor.Location.Y); + MaxLine.SetSize(MinLine.Size.X, Cursor.Size.Y); + MaxLine.SetLocation(0, Cursor.Location.Y); + L1.Text = Min.ToString() + Suffix; + L1.Anchor = ObjectAnchor.Top | ObjectAnchor.Left; + L2Default.Text = Default.ToString() + Suffix; + L2Cursor.Text = Value.ToString() + Suffix; + L3.Text = Max.ToString() + Suffix; + L3.Anchor = ObjectAnchor.Top | ObjectAnchor.Right; + MaxLine.Anchor = L3.Anchor; + Controls.Add(progressBar); + MaxLine.BackgroundColor = Color4.Cyan; + MinLine.BackgroundColor = MaxLine.BackgroundColor; + Controls.Add(MinLine); + Controls.Add(L1); + Controls.Add(L3); + Controls.Add(L2Cursor); + Controls.Add(MaxLine); + Controls.Add(Cursor); + Cursor.ForceDistanceUpdate(this); + real_x = Cursor.Location.X; + //Controls.Add(L2Cursor); + progressBar.ForceDistanceUpdate(this); + AllowHoverFromBehind = true; + } + + private Task ProgressBarOnClicked(IRenderObject arg) + { + Value = progressBar.GetValueFromX((int)Window!.MousePosition.X - progressBar.GetWindowLocation().X) + Min; + return Task.CompletedTask; + } + + public void AddPoint(TNumber value) + { + if (value < _Min || value > Max) return; + ExtraPoints.Add(value); + } + + public override void SetSize(int w, int h) + { + base.SetSize(w, 50.ScaleInt()); + progressBar.SetSize(w, 8.ScaleInt()); + progressBar.UpdateProgress(); + progressBar.ForceDistanceUpdate(this); + Min = Min; + Value--; + Value++; + progressBar.UpdateProgress(); + } + + public override void LoadToParent(IParent p, IWindow w) + { + base.LoadToParent(p, w); + w.MouseUp += WindowOnMouseUp; + w.MouseMove += WindowOnMouseMove; + Cursor.Clicked += CursorOnClicked; + } + + public bool Draging; + + private int real_x, real_dif; + + private Task CursorOnClicked(IRenderObject arg) + { + Draging = true; + real_dif = ((int)Window!.MousePosition.X - Cursor.GetWindowLocation().X); + real_x = Cursor.Location.X + real_dif; + return Task.CompletedTask; + } + + private void WindowOnMouseMove(MouseMoveEventArgs obj) + { + if (!Draging) return; + real_x += (int)obj.DeltaX; + Value = progressBar.GetValueFromX(real_x) + Min; + } + + private void WindowOnMouseUp(MouseButtonEventArgs obj) + { + if (!Draging) return; + Draging = false; + } +} \ No newline at end of file diff --git a/Luski/GUI/MainScreen/UI/LuskiControls/ProfileView.cs b/Luski/GUI/MainScreen/UI/LuskiControls/ProfileView.cs index 3cc0da2..306747e 100644 --- a/Luski/GUI/MainScreen/UI/LuskiControls/ProfileView.cs +++ b/Luski/GUI/MainScreen/UI/LuskiControls/ProfileView.cs @@ -11,7 +11,7 @@ public class ProfileView : UserControl { public SocketUser User { get; set; } - private ProfileView(IRenderObject user, SocketUser u, ServerProfile p, Role r, Color[] c, ColorType ct) + private ProfileView(IRenderObject user, SocketUser u, ServerProfile p, Role r) { this.User = u; base.Size = new(244.ScaleInt(), 44.ScaleInt()); @@ -20,26 +20,20 @@ public class ProfileView : UserControl user.ForceDistanceUpdate(this); user.IgnoreHover = true; - LabelBase uname; - if (ct == ColorType.Full) + string name = p.DisplayName; + if (r.ColorType == ColorType.Full) { - uname = new Label(Globals.DefaultFont) - { - Text = p.DisplayName, - Color = c[0].ToColor4(), - IgnoreHover = true - }; + name = $"[color=\"{r.Colors[0].ToDatabaseStr()}\"]{name}[/color]"; } else { - uname = new AdvancedGradientLabel(Globals.DefaultFont) - { - Text = p.DisplayName, - Colors = c.ToColor4Array(), - IgnoreHover = true - }; + name = $"[gradient colors=\"{r.Colors.ToDB()}\"]{name}[/gradient]"; } - + LuskiLabel uname = new(Globals.DefaultFont) + { + Text = name, + IgnoreHover = true + }; uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(), (user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0); Controls.Add(uname); @@ -48,16 +42,7 @@ public class ProfileView : UserControl public static async Task Make(SocketUser u, ServerProfile p, Role r) { - ColorType ct = await u.GetColorType(); - Color[] c = await u.GetColors(); - ColorType? cct = await p.GetColorType(); - Color[]? cc = await p.GetColors(); - if (cc is not null) - { - c = cc; - ct = cct!.Value; - } - ProfileView m = new(await p.MakeRct(u, new(32.ScaleInt())), u, p, r, c, ct); + ProfileView m = new(await p.MakeRct(u, new(32.ScaleInt())), u, p, r); return m; } } \ No newline at end of file diff --git a/Luski/GUI/MainScreen/UI/LuskiControls/SettingsMenuBase/Core/SettingsCategory.cs b/Luski/GUI/MainScreen/UI/LuskiControls/SettingsMenuBase/Core/SettingsCategory.cs index 8f1ab87..627d471 100644 --- a/Luski/GUI/MainScreen/UI/LuskiControls/SettingsMenuBase/Core/SettingsCategory.cs +++ b/Luski/GUI/MainScreen/UI/LuskiControls/SettingsMenuBase/Core/SettingsCategory.cs @@ -51,6 +51,8 @@ public class SettingsCategory : UserControl where TSettingsMenu : Page.AllowHoverFromBehind = true; Page.Anchor = ObjectAnchor.All; Page.BackgroundColor = ss.BackgroundColor; + pagest.Add(typeof(TPage)); + pages.Add(Page.PageName); ss.Controls.Add(Page); if (Page is PageFlow pbf) pbf.HScrollPixels = Globals.Settings.PerScrollPixels; PageTab cb = new(Page.PageName, ss) @@ -65,6 +67,19 @@ public class SettingsCategory : UserControl where TSettingsMenu : Page.Tag = cb; return cb; } + + private List pages = new(); + private List pagest = new(); + + public bool HasPage(string name) + { + return pages.Contains(name); + } + + public bool HasPage(Type name) + { + return pagest.Contains(name); + } public void RemovePage(TPage Page) where TPage : ISettingsPage { diff --git a/Luski/GUI/MainScreen/UI/LuskiControls/SettingsMenuBase/SettingsMenu.cs b/Luski/GUI/MainScreen/UI/LuskiControls/SettingsMenuBase/SettingsMenu.cs index 0118ea9..8335eb7 100644 --- a/Luski/GUI/MainScreen/UI/LuskiControls/SettingsMenuBase/SettingsMenu.cs +++ b/Luski/GUI/MainScreen/UI/LuskiControls/SettingsMenuBase/SettingsMenu.cs @@ -51,7 +51,7 @@ public class SettingsMenu : UserControl private Task ClosebtnOnClicked(IRenderObject arg) { - Globals.ms.Controls.Remove(this); + Globals.ms.Controls.Remove(this, false); Globals.ms.Title = BehindName; Globals.ms.DrawFrame(); return Task.CompletedTask; diff --git a/Luski/GUI/MainScreen/UI/LuskiControls/UserView.cs b/Luski/GUI/MainScreen/UI/LuskiControls/UserView.cs index 8ed66a3..c53a7a4 100644 --- a/Luski/GUI/MainScreen/UI/LuskiControls/UserView.cs +++ b/Luski/GUI/MainScreen/UI/LuskiControls/UserView.cs @@ -1,6 +1,7 @@ using GraphicsManager.Interfaces; using GraphicsManager.Objects; using GraphicsManager.Objects.Core; +using Luski.Enums; using Luski.net.Structures.Public; using Luski.Shared.PublicServers.V1.Enums; using OpenTK.Mathematics; @@ -18,37 +19,24 @@ public class UserView : UserControl base.BackgroundColor = new(34, 34, 34, 255); user.Location = new(8.ScaleInt(), 6.ScaleInt(), 0); user.ForceDistanceUpdate(this); + string name = p.DisplayName; if (r.ColorType == ColorType.Full) { - Label uname = new(Globals.DefaultFont) - { - Text = p.DisplayName, - Color = r.Colors[0].ToColor4() - }; - if (offline) uname.Color = new(uname.Color.R, uname.Color.G, uname.Color.B, uname.Color.A * 0.6f); - uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(), - (user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0); - Controls.Add(uname); + name = $"[color=\"{r.Colors[0].ToDatabaseStr()}\"]{name}[/color]"; } else { - AdvancedGradientLabel uname = new(Globals.DefaultFont) - { - Text = p.DisplayName, - Colors = r.Colors.ToColor4Array() - }; - if (offline) - { - for (int i = 0; i < uname.Colors.Length; i++) - { - uname.Colors[i] = new(uname.Colors[i].R, uname.Colors[i].G, uname.Colors[i].B, - uname.Colors[i].A * 0.6f); - } - } - uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(), - (user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0); - Controls.Add(uname); + name = $"[gradient colors=\"{r.Colors.ToDB()}\"]{name}[/gradient]"; } + Console.WriteLine(name); + + LuskiLabel uname = new(Globals.DefaultFont) + { + Text = (offline ? $"[color=\"#00000099\" blend=\"{(int)BlendType.MultiplyAlpha}\"]{name}[/color]" : name) + }; + uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(), + (user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0); + Controls.Add(uname); Controls.Add(user); } diff --git a/Luski/GUI/MainScreen/UI/LuskiSettings/GlobalSettingsMenu.cs b/Luski/GUI/MainScreen/UI/LuskiSettings/GlobalSettingsMenu.cs index 9a050a9..57f3424 100644 --- a/Luski/GUI/MainScreen/UI/LuskiSettings/GlobalSettingsMenu.cs +++ b/Luski/GUI/MainScreen/UI/LuskiSettings/GlobalSettingsMenu.cs @@ -1,37 +1,54 @@ +using System.Reflection; using GraphicsManager.Enums; +using Luski.Classes; +using Luski.Classes.Attribs; +using Luski.Enums.Strings; using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase; using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core; -using Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AdvancedSettings; using Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AppSettings; +using Luski.Shared.GlobalAttributes; namespace Luski.GUI.MainScreen.UI.LuskiSettings; public class GlobalSettingsMenu : SettingsMenu { - private Appearance a; + private Dictionary> categories = new(); + private PageTab? First; public GlobalSettingsMenu() :base("Settings - Luski") { - SettingsCategory AppSettings = new("App Settings", this); - SettingsCategory AdvancedSettings = new("Advanced Settings", this); - PageTab cb = AppSettings.AddPage(new General()); - if (LuskiExperiments.Settings.Theme.IsEnabled()) _ = AppSettings.AddPage(a=new Appearance()); - LuskiExperiments.Settings.Theme.EventToggled += b => + LoadPages(); + LoadPages(); + + for (int i = 1; i < fl.Controls.Length; i++) // Fix the pos because why not and better than redrawing window { - if (b) - { - _ = AppSettings.AddPage(a=new Appearance()); - Globals.ms.ForceUpdate(); - } - else AppSettings.RemovePage(a!); - return Task.CompletedTask; - }; - _ = AdvancedSettings.AddPage(new ExperimentSettings()); - _ = AdvancedSettings.AddPage(new Updater()); - fl.Controls.Add(AppSettings); - fl.Controls.Add(AdvancedSettings); - cb.ToggleSelected().Wait(); + fl.Controls[i].SetLocation(fl.Controls[i].Location.X, fl.Controls[i-1].Size.Y + fl.Controls[i-1].Location.Y); + } + + First!.ToggleSelected().Wait(); Anchor = ObjectAnchor.All; } + + private void LoadPages() + { + foreach (PropertyInfo prop in typeof(TFile).GetProperties()) + { + if (!prop.TryGetAnyAttribute(out SettingInfoAttribute? p)) continue; + if (!categories.ContainsKey(p.Group)) + { + categories.Add(p.Group, new SettingsCategory(p.Group, this)); + fl.Controls.Add(categories[p.Group]); + } + + if (!categories[p.Group].HasPage(SettingsPage.Pages[p.Page].Name)) + { + PageTab tab = categories[p.Group].AddPage(p.CreatePage()); + if (First is null) + { + First = tab; + } + } + } + } } \ No newline at end of file diff --git a/Luski/GUI/MainScreen/UI/LuskiSettings/Pages/AppSettings/General.cs b/Luski/GUI/MainScreen/UI/LuskiSettings/Pages/AppSettings/General.cs index 63ad698..9915e57 100644 --- a/Luski/GUI/MainScreen/UI/LuskiSettings/Pages/AppSettings/General.cs +++ b/Luski/GUI/MainScreen/UI/LuskiSettings/Pages/AppSettings/General.cs @@ -1,5 +1,7 @@ using System.Reflection; using Luski.Classes; +using Luski.Classes.Attribs; +using Luski.Enums.Strings; using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core; namespace Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AppSettings; @@ -8,9 +10,9 @@ public class General : PageFlow { public General() { - PageName = "General"; foreach (PropertyInfo prop in typeof(Settings).GetProperties()) { + object PropVal = prop.GetValue(Globals.Settings)!; Type PropType = prop.PropertyType; if (PropType.IsEnum) diff --git a/Luski/GUI/MainScreen/UI/LuskiSettings/Pages/Generic.cs b/Luski/GUI/MainScreen/UI/LuskiSettings/Pages/Generic.cs new file mode 100644 index 0000000..c0c6b52 --- /dev/null +++ b/Luski/GUI/MainScreen/UI/LuskiSettings/Pages/Generic.cs @@ -0,0 +1,103 @@ +using System.Numerics; +using System.Reflection; +using GraphicsManager.Enums; +using GraphicsManager.Objects; +using Luski.Classes; +using Luski.Classes.Attribs; +using Luski.Classes.Attribs.NumberSlider; +using Luski.Enums.Strings; +using Luski.GUI.MainScreen.UI.LuskiControls; +using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core; +using OpenTK.Mathematics; + +namespace Luski.GUI.MainScreen.UI.LuskiSettings.Pages; + +public class Generic : PageFlow +{ + public Generic(string Name, byte code, bool LoadEnums = true, bool LoadBools = true, bool LoadNumberSelectors = true) + { + PageName = Name; + foreach (PropertyInfo prop in typeof(Settings).GetProperties()) + { + if (!prop.TryGetAnyAttribute(out SettingInfoAttribute? p)) continue; + if (p.Page != code) continue; + object PropVal = prop.GetValue(Globals.Settings)!; + Type PropType = prop.PropertyType; + + if (LoadEnums && PropType.IsEnum) + { + IEnumerable values = Enum.GetValues(PropType).Cast(); + foreach (var val in values) + { + try + { + Globals.AddBool(this, PropType, val, ((Enum)PropVal).HasFlag(val), bb => + { + long va = Convert.ToInt64(val); + long v = Convert.ToInt64(PropVal); + object e; + if (bb) e = Enum.Parse(PropType, (v + va).ToString()); + else e = Enum.Parse(PropType, (v - va).ToString()); + PropVal = e; + prop.SetValue(Globals.Settings, e); + Globals.Settings.SaveSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings); + }); + } + catch + { + //ignore + } + } + continue; + } + + if (LoadBools && PropType.FullName == typeof(bool).FullName) + { + try + { + Globals.AddBool(this, prop, (bool)PropVal, b => + { + prop.SetValue(Globals.Settings, b); + Globals.Settings.SaveSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings); + }); + } + catch + { + // ignored + } + continue; + } + + if (LoadNumberSelectors && prop.TryGetAnyAttribute(out NumberSelectorAttribute? typeinfo)) + { + if (typeinfo.Kind.FullName == typeof(uint).FullName) + { + Globals.AddNumberSlider(this, prop, (uint)PropVal, b => + { + prop.SetValue(Globals.Settings, b); + Globals.Settings.SaveSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings); + }); + //AddSelector(prop, (uint)PropVal); + } + } + } + } + + private void AddSelector(PropertyInfo prop , TNumber val) where TNumber : INumber + { + UserControl space = new(); + space.BackgroundColor = Color4.Blue; + NumberSelector selector = new(); + selector.BackgroundColor = this.BackgroundColor; + space.SetSize(Size.X, selector.Size.Y + 40.ScaleInt()); + selector.SetSize(this.Size.X, 0); + selector.SetLocation(0,40.ScaleInt()); + selector.Min = prop.GetAnyAttribute>().Min; + selector.Max = prop.GetAnyAttribute>().Max; + selector.Default = prop.GetAnyAttribute>().Default; + selector.Value = val; + selector.Anchor = ObjectAnchor.All; + space.Controls.Add(selector); + Controls.Add(space); + } +} \ No newline at end of file diff --git a/Luski/GUI/MainScreen/UI/PublicServers/Category.cs b/Luski/GUI/MainScreen/UI/PublicServers/Category.cs index eadd40f..952ff4b 100644 --- a/Luski/GUI/MainScreen/UI/PublicServers/Category.cs +++ b/Luski/GUI/MainScreen/UI/PublicServers/Category.cs @@ -21,7 +21,7 @@ public class Category : UserControl, IChannelAdder public event Func? AddY; - private LabelBase Name; + private LuskiLabel Name; public UserControl tmp; public static Task MakeCat(SocketCategory cat, ChannelSelector cs) @@ -40,40 +40,19 @@ public class Category : UserControl, IChannelAdder c.tmp.Clicked += c.TmpOnClicked; c.tmp.HoverMouse = MouseCursor.Hand; c.Controls.Add(c.tmp); - if (cat.ColorType == ColorType.Full) + c.tmp.Controls.Add(c.ee = new AdvancedGradientLabel(Globals.DefaultFont) { - c.tmp.Controls.Add(c.ee = new Label(Globals.DefaultFont) - { - Text = ">", - Location = new(5.ScaleInt()), - Color = cat.Colors[0].ToColor4(), - DIR = new(1,0), - IgnoreHover = true - }); - c.tmp.Controls.Add(c.Name = new Label(Globals.DefaultFont) - { - Text = cat.Name, - Color = cat.Colors[0].ToColor4(), - IgnoreHover = true - }); - } - else + Text = ">", + Location = new(5.ScaleInt()), + DIR = new(1,0), + IgnoreHover = true + }); + + c.tmp.Controls.Add(c.Name = new(Globals.DefaultFont) { - c.tmp.Controls.Add(c.ee = new AdvancedGradientLabel(Globals.DefaultFont) - { - Text = ">", - Location = new(5.ScaleInt()), - Colors = cat.Colors.ToColor4Array(), - DIR = new(1,0), - IgnoreHover = true - }); - c.tmp.Controls.Add(c.Name = new AdvancedGradientLabel(Globals.DefaultFont) - { - Text = cat.Name, - Colors = cat.Colors.ToColor4Array(), - IgnoreHover = true - }); - } + Text = cat.Name, + IgnoreHover = true + }); c.Clicked += c.AllOnClicked; c.Name.Location = new(26.ScaleInt(), (((c.Size.Y - c.Name.Size.Y)/2)), 0); diff --git a/Luski/GUI/MainScreen/UI/PublicServers/Channel.cs b/Luski/GUI/MainScreen/UI/PublicServers/Channel.cs index 3d5a0a9..c000115 100644 --- a/Luski/GUI/MainScreen/UI/PublicServers/Channel.cs +++ b/Luski/GUI/MainScreen/UI/PublicServers/Channel.cs @@ -42,24 +42,11 @@ public class Channel : UserControl r.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context]; Controls.Add(r); - if (chan.ColorType == ColorType.Full) + ChannelName = new(Globals.DefaultFont) { - ChannelName = new Label(Globals.DefaultFont) - { - Text = chan.Name, - Color = chan.Colors[0].ToColor4(), - IgnoreHover = true - }; - } - else - { - ChannelName = new AdvancedGradientLabel(Globals.DefaultFont) - { - Text = chan.Name, - Colors = chan.Colors.ToColor4Array(), - IgnoreHover = true - }; - } + Text = chan.Name, + IgnoreHover = true + }; Controls.Add(ChannelName); Clicked += AllOnClicked; @@ -80,24 +67,11 @@ public class Channel : UserControl Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context]; int i = 4.ScaleInt(); GC.Collect(); - if (chan.ColorType == ColorType.Full) + ChannelName = new(Globals.DefaultFont) { - ChannelName = new Label(Globals.DefaultFont) - { - Text = chan.Name, - Color = chan.Colors[0].ToColor4(), - IgnoreHover = true - }; - } - else - { - ChannelName = new AdvancedGradientLabel(Globals.DefaultFont) - { - Text = chan.Name, - Colors = chan.Colors.ToColor4Array(), - IgnoreHover = true - }; - } + Text = chan.Name, + IgnoreHover = true + }; Controls.Add(ChannelName); Clicked += AllOnClicked; ChannelName.Location = new(i, @@ -155,7 +129,7 @@ public class Channel : UserControl Console.WriteLine(e); } } - public LabelBase ChannelName; + public LuskiLabel ChannelName; public Rectangle r; public static async Task MakeChannel(SocketChannel chan, ChannelSelector cs) diff --git a/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs b/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs index beb5a96..c70f1ab 100644 --- a/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs +++ b/Luski/GUI/MainScreen/UI/PublicServers/ChatMessage.cs @@ -34,22 +34,15 @@ public class ChatMessage : UserControl { SocketUser auth = (SocketUser)(await message.GetAuthor(CancellationToken.None)); ServerProfile prof = await message.GetProfile(CancellationToken.None); - Color[]? c = await prof.GetColors(); - ColorType? ct = await prof.GetColorType(); - if (c is null) - { - c = await auth.GetColors(); - ct = await auth.GetColorType(); - } - Color4[] c4 = (ct!.Value == ColorType.Full ? new Color4[]{c[0].ToColor4()} : new Color4[]{c[0].ToColor4(), c[1].ToColor4()}); - return new ChatMessage(p, message, await message.GetParent(CancellationToken.None), prof, await prof.MakeRct(auth, new(40.ScaleInt())), ct.Value, c4); + Role r = (await ((SocketUser)await message.GetAuthor(CancellationToken.None)).GetRoles())[0]; + return new ChatMessage(p, message, await message.GetParent(CancellationToken.None), prof, await prof.MakeRct(auth, new(40.ScaleInt())), r); } - private ChatMessage(PublicChat p, SocketMessage message, SocketChannel chan, ServerProfile Author, IRenderObject UserIcon, ColorType ct, Color4[] UserNameColor) + private ChatMessage(PublicChat p, SocketMessage message, SocketChannel chan, ServerProfile Author, IRenderObject UserIcon, Role r) { pc = p; - LabelBase label1; + LuskiLabel label1; base.SetSize(723.5.ScaleInt(), 37.ScaleInt()); ch = chan; base.BackgroundColor = new(40, 40, 40, 255); @@ -92,8 +85,16 @@ public class ChatMessage : UserControl UserIcon.Location = new(10.ScaleInt(), 2.ScaleInt(), 0); Controls.Add(UserIcon); - if (ct == ColorType.Full) Controls.Add(label1 = new Label(Globals.DefaultFont) { Color = UserNameColor[0], Text = Author.DisplayName }); - else Controls.Add(label1 = new AdvancedGradientLabel(Globals.DefaultFont) { Colors = UserNameColor, Text = Author.DisplayName }); + string name = Author.DisplayName; + if (r.ColorType == ColorType.Full) + { + name = $"[color=\"{r.Colors[0].ToDatabaseStr()}\"]{name}[/color]"; + } + else + { + name = $"[gradient colors=\"{r.Colors.ToDB()}\"]{name}[/gradient]"; + } + Controls.Add(label1 = new (Globals.DefaultFont) { Text = name }); label1.Location = new( 54.ScaleInt(), UserIcon.Location.Y, @@ -101,11 +102,11 @@ public class ChatMessage : UserControl Label label2; LastObject = label1; FirstL = label1; - Controls.Add(label2 = new Label(Globals.TopTimeFont) { Location = new(label1.Location.X + label1.Size.X + 8.ScaleInt(), (int)(label1.Location.Y + label1.Font.PixelHeight - Globals.TopTimeFont.PixelHeight), 0), Text = time_str}); + Controls.Add(label2 = new(Globals.TopTimeFont) { Location = new(label1.Location.X + label1.Size.X + 8.ScaleInt(), (int)(label1.Location.Y + label1.Font.PixelHeight - Globals.TopTimeFont.PixelHeight), 0), Text = time_str}); if (!string.IsNullOrWhiteSpace(Msg.Context)) { - 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}); + LuskiLabel l; + Controls.Add(l = new(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"); @@ -118,10 +119,6 @@ public class ChatMessage : UserControl }; } l.ContextMenu = lcm; - if (Msg.Context == "test message with picture") - { - //Console.WriteLine(Msg.FileIDs.Length); - } MessageObjs.Add(l); } Globals.Settings.DayTimeChanged += () => diff --git a/Luski/GUI/MainScreen/UI/PublicServers/PublicChat.cs b/Luski/GUI/MainScreen/UI/PublicServers/PublicChat.cs index 0cb71ad..014c8e3 100644 --- a/Luski/GUI/MainScreen/UI/PublicServers/PublicChat.cs +++ b/Luski/GUI/MainScreen/UI/PublicServers/PublicChat.cs @@ -20,7 +20,8 @@ public class PublicChat : UserControl { public FlowLayout MessageFlow; - private LabelBase title, desc; + private Label desc; + private LuskiLabel title; private TextBox tb; private SocketChannel? Channel; UserControl titlecon; @@ -73,11 +74,11 @@ public class PublicChat : UserControl titlecon.ForceDistanceUpdate(this); - titlecon.Controls.Add(title = new Label(Globals.DefaultFont) + titlecon.Controls.Add(title = new(Globals.DefaultFont) { //Location = new( }); - titlecon.Controls.Add(desc = new Label(Globals.DefaultFont) + titlecon.Controls.Add(desc = new(Globals.DefaultFont) { Color = new(161,161,161,255), Location = new(title.Location.X + title.Size.X + 5, title.Location.Y, 0) @@ -426,30 +427,6 @@ public class PublicChat : UserControl memberflow.Controls.Clear(); await UserConOnClicked(UserCon!); } - - if (channel.ColorType == ColorType.Full) - { - titlecon.Controls.Remove(title, false); - if (title is not Label) title = new Label(title.Font) - { - Location = title.Location - }; - ((Label)title).Color = channel.Colors[0].ToColor4(); - titlecon.Controls.Add(title); - } - else - { - if (title is not AdvancedGradientLabel) - { - titlecon.Controls.Remove(title, false); - title = new AdvancedGradientLabel(title.Font) - { - Location = title.Location - }; - titlecon.Controls.Add(title); - } - ((AdvancedGradientLabel)title).Colors = channel.Colors.ToColor4Array(); - } title.Text = channel.Name; var five = 5.ScaleInt(); diff --git a/Luski/GUI/MainScreen/UI/PublicServers/ServerSettings/Pages/Server/Roles/RoleMember.cs b/Luski/GUI/MainScreen/UI/PublicServers/ServerSettings/Pages/Server/Roles/RoleMember.cs index 815cfeb..fafe72c 100644 --- a/Luski/GUI/MainScreen/UI/PublicServers/ServerSettings/Pages/Server/Roles/RoleMember.cs +++ b/Luski/GUI/MainScreen/UI/PublicServers/ServerSettings/Pages/Server/Roles/RoleMember.cs @@ -1,6 +1,8 @@ using GraphicsManager.Interfaces; using GraphicsManager.Objects; +using Luski.GUI.MainScreen.UI.LuskiControls; using Luski.net.Structures.Public; +using Luski.Shared.PublicServers.V1.Enums; using OpenTK.Mathematics; namespace Luski.GUI.MainScreen.UI.PublicServers.ServerSettings.Pages.Server.Roles; @@ -15,9 +17,9 @@ public class RoleMember : UserControl int val = 8.ScaleInt(); icon.Result.Location = new(val, val, 0); Controls.Add(icon.Result); - Label dn = new(Globals.DefaultFont) + LuskiLabel dn = new(Globals.DefaultFont) { - Text = p.DisplayName + Text = u.ToDisplayString(p) }; Controls.Add(dn); diff --git a/Luski/GUI/MainScreen/UI/ServerLoginOverlay.cs b/Luski/GUI/MainScreen/UI/ServerLoginOverlay.cs index 51e1896..0492883 100644 --- a/Luski/GUI/MainScreen/UI/ServerLoginOverlay.cs +++ b/Luski/GUI/MainScreen/UI/ServerLoginOverlay.cs @@ -29,15 +29,14 @@ public class ServerLoginOverlay : UserControl, IServerOverlay base.Size = Globals.ms.ClientSize; base.BackgroundColor = new(0, 0, 0, 130); Anchor = ObjectAnchor.All; - - Form = new(Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png")) { Size = new(350.ScaleInt(), 347.ScaleInt()), BackgroundColor = new(32,32,32,255), Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context], - TextureDisplay = TextureDisplay.Center + TextureDisplay = TextureDisplay.Center, + Anchor = ObjectAnchor.Prevent }; Label t; Form.Controls.Add(t=new Label(Globals.DefaultFont) { Scale = 1.6f, Text = "Server Login", Color = Globals.DodgerBlue }); @@ -200,7 +199,8 @@ public class ServerLoginOverlay : UserControl, IServerOverlay Size = new(page.Size.X, 30.ScaleInt()), WatermarkText = "Username", TextLocation = TextLocation.LineCenter, - AllowMultiLine = false + AllowMultiLine = false, + Anchor = ObjectAnchor.Left | ObjectAnchor.Right }); UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"); UserName.KeyPress += args => @@ -360,7 +360,8 @@ public class ServerLoginOverlay : UserControl, IServerOverlay Size = new(page.Size.X, 31.ScaleInt()), WatermarkText = "Username", TextLocation = TextLocation.LineCenter, - AllowMultiLine = false + AllowMultiLine = false, + Anchor = ObjectAnchor.Left | ObjectAnchor.Right }); UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"); UserName.KeyPress += args => @@ -405,7 +406,8 @@ public class ServerLoginOverlay : UserControl, IServerOverlay WatermarkText = "Password", TextLocation = TextLocation.LineCenter, AllowMultiLine = false, - PasswordChar = '●' + PasswordChar = '●', + Anchor = ObjectAnchor.Left | ObjectAnchor.Right }); Password.Textures[0] = UserName.Textures[0]; Password.KeyPress += args => @@ -463,7 +465,8 @@ public class ServerLoginOverlay : UserControl, IServerOverlay page = new() { Location = new(tb.Location.X, ca.Location.Y + ca.Size.Y + tb.Location.X, 0), - BackgroundColor = Form.BackgroundColor + BackgroundColor = Form.BackgroundColor, + Anchor = ObjectAnchor.All }; page.Size = new(Form.Size.X - tb.Location.X - tb.Location.X, Form.Size.Y - tb.Location.X - page.Location.Y - ca.Size.Y - tb.Location.X); Form.Controls.Add(page); @@ -472,13 +475,15 @@ public class ServerLoginOverlay : UserControl, IServerOverlay { Location = new(page.Location.X, page.Location.Y + page.Size.Y + tb.Location.X, 0), Size = new(page.Size.X, ca.Size.Y), - TextureDisplay = TextureDisplay.Center + TextureDisplay = TextureDisplay.Center, + Anchor = ObjectAnchor.All }; _ = lo.ToggleSelected(); Label sub = new(Globals.DefaultFont) { Text = "Submit", - IgnoreHover = true + IgnoreHover = true, + Anchor = ObjectAnchor.All }; sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2), ((btn.Size.Y - sub.Size.Y) / 2) diff --git a/Luski/GUI/MainScreenWindow.cs b/Luski/GUI/MainScreenWindow.cs index 99a8c5b..b389660 100644 --- a/Luski/GUI/MainScreenWindow.cs +++ b/Luski/GUI/MainScreenWindow.cs @@ -314,15 +314,6 @@ public class MainScreenWindow : Window #region User Icon ServerProfile DefaultProfile = await Server.GetProfile(Server.User.ServerProfile, CancellationToken.None); - ColorType ct = await Server.User.GetColorType(); - Color[] c = await Server.User.GetColors(); - ColorType? cct = await DefaultProfile.GetColorType(); - Color[]? cc = await DefaultProfile.GetColors(); - if (cc is not null) - { - c = cc; - ct = cct!.Value; - } IRenderObject u = await DefaultProfile.MakeRct(Server.User, new(46.ScaleInt())); int ii = 4.ScaleInt(); u.Location = new(ii, cs.Location.Y + cs.Size.Y + ii, 0); @@ -330,25 +321,20 @@ public class MainScreenWindow : Window SerBox.Controls.Add(u); u.LoadToParent(SerBox, this); u.ForceDistanceUpdate(); - LabelBase ul; - if (ct == ColorType.Full) + string name = DefaultProfile.DisplayName; + Role r = (await Server.User.GetRoles())[0];if (r.ColorType == ColorType.Full) { - ul = new Label(Globals.DefaultFont) - { - Anchor = u.Anchor, - Text = DefaultProfile.DisplayName, - Color = c[0].ToColor4() - }; + name = $"[color=\"{r.Colors[0].ToDatabaseStr()}\"]{name}[/color]"; } else { - ul = new AdvancedGradientLabel(Globals.DefaultFont) - { - Anchor = u.Anchor, - Text = DefaultProfile.DisplayName, - Colors = c.ToColor4Array() - }; + name = $"[gradient colors=\"{r.Colors.ToDB()}\"]{name}[/gradient]"; } + LuskiLabel ul = new(Globals.DefaultFont) + { + Anchor = u.Anchor, + Text = name, + }; ul.Location = new(u.Location.X + u.Size.X + 5.ScaleInt(), (u.Location.Y + ((u.Size.Y - ul.Size.Y) / 2)), 0); diff --git a/Luski/Globals.cs b/Luski/Globals.cs index aa83890..027aa34 100644 --- a/Luski/Globals.cs +++ b/Luski/Globals.cs @@ -1,5 +1,8 @@ using System.CodeDom.Compiler; using System.ComponentModel; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Numerics; using System.Reflection; using System.Runtime.InteropServices; using System.Text; @@ -11,6 +14,7 @@ using GraphicsManager.Interfaces; using GraphicsManager.Objects; using GraphicsManager.Objects.Core; using Luski.Classes; +using Luski.Classes.Attribs.NumberSlider; using Luski.Classes.ThemeSub; using Luski.GUI; using Luski.GUI.MainScreen.UI.LuskiControls; @@ -269,7 +273,8 @@ public static class Globals }; UserControl tc = new() { - BackgroundColor = new(0,0,0,0) + BackgroundColor = new(0,0,0,0), + Anchor = ObjectAnchor.Left | ObjectAnchor.Top | ObjectAnchor.Right }; Label l, ll; int space = 5.ScaleInt(); @@ -301,7 +306,65 @@ public static class Globals tc.SetSize(parent.Size.X, TempLine.Location.Y + TempLine.Size.Y); TempLine.ForceDistanceUpdate(tc); tc.Controls.Add(TempLine); - //ts.ForceDistanceUpdate(tc); + ts.ForceDistanceUpdate(tc); + ts.ValueChanged += @switch => + { + a.Invoke(@switch.Value); + return Task.CompletedTask; + }; + tc.ForceDistanceUpdate(parent); + parent.Controls.Add(tc); + return tc; + } + + public static UserControl AddNumberSlider(IParent parent, string Name, string description, TNumber defaul, TNumber min, TNumber val, TNumber max, Action a) where TNumber : INumber + { + NumberSelector ts = new() + { + Default = defaul, + Min = min, + Max = max, + Value = val, + Anchor = ObjectAnchor.Top | ObjectAnchor.Right | ObjectAnchor.Left, + BackgroundColor = new(0,0,0,0), + Space = 10.ScaleInt() + }; + UserControl tc = new() + { + BackgroundColor = new(0,0,0,0) + }; + Label l, ll; + int space = 5.ScaleInt(); + tc.Controls.Add(ll =new Label(Globals.DefaultFont) + { + Location = new(0, space + space, 0), + Text = Name + }); + tc.Controls.Add(l =new Label(Globals.DefaultFont) + { + Location = new(ll.Location.X, ll.Size.Y + space, 0), + Color = Color4.Gray, + MaxSize = parent.Size, + Text = description + }); + tc.Size = l.Size; + tc.Controls.Add(ts); + ts.Location = new(5.ScaleInt(), l.Location.Y + l.Size.Y + space, 0); + + Rectangle TempLine = new() + { + Location = new(0, ts.Location.Y + ts.Size.Y + space, 0), + BackgroundColor = Color4.White, + Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Top + }; + l.Tag = TempLine; + TempLine.Size = new(parent.Size.X - space - space, 2.ScaleInt()); + tc.SetSize(parent.Size.X, TempLine.Location.Y + TempLine.Size.Y); + ts.SetSize(TempLine.Size.X - 10.ScaleInt(), 0); + ts.SetLocation(TempLine.Location.X, ts.Location.Y); + ts.ForceDistanceUpdate(tc); + TempLine.ForceDistanceUpdate(tc); + tc.Controls.Add(TempLine); ts.ValueChanged += @switch => { a.Invoke(@switch.Value); @@ -338,8 +401,42 @@ public static class Globals string Name = ((Luski.Shared.GlobalAttributes.DisplayNameAttribute)namevalueAttributes[0]).DisplayName; AddBool(parent, Name, description,s,a,List); } + + public static void AddNumberSlider(IParent parent, PropertyInfo t, TNumber s, Action a) where TNumber : INumber + { + object[] valueAttributes = + t.GetCustomAttributes(typeof(DescriptionAttribute), false); + if (valueAttributes.Length == 0) return; + string description = ((DescriptionAttribute)valueAttributes[0]).Description; + object[] namevalueAttributes = + t.GetCustomAttributes(typeof(Luski.Shared.GlobalAttributes.DisplayNameAttribute), false); + if (namevalueAttributes.Length == 0) return; + string Name = ((Luski.Shared.GlobalAttributes.DisplayNameAttribute)namevalueAttributes[0]).DisplayName; + AddNumberSlider(parent, Name, description, t.GetAnyAttribute>().Default, t.GetAnyAttribute>().Min, s, t.GetAnyAttribute>().Max,a); + } - public static TAttribute GetAttribute(Type t, TEnum e) where TAttribute : Attribute where TEnum : Enum + public static TAttribute GetAnyAttribute(this PropertyInfo t) + { + object[] valueAttributes = + t.GetCustomAttributes(typeof(TAttribute), false); + if (valueAttributes.Length == 0) throw new MissingMemberException("No attribute found"); + return (TAttribute)valueAttributes[0]; + } + + public static bool TryGetAnyAttribute(this PropertyInfo t, [NotNullWhen(true)]out TAttribute? attribute) + { + object[] valueAttributes = + t.GetCustomAttributes(typeof(TAttribute), false); + if (valueAttributes.Length == 0) + { + attribute = default; + return false; + } + attribute = (TAttribute)valueAttributes[0]!; + return true; + } + + public static TAttribute GetEnumAttribute(this Type t, TEnum e) where TAttribute : Attribute where TEnum : Enum { MemberInfo? enumValueMemberInfo = GetMemberInfo(t, e); object[] valueAttributes = @@ -347,6 +444,14 @@ public static class Globals return (TAttribute)valueAttributes[0]; } + public static TAttribute GetEnumAttribute(this TEnum e) where TAttribute : Attribute where TEnum : Enum + { + MemberInfo? enumValueMemberInfo = GetMemberInfo(typeof(TAttribute), e); + object[] valueAttributes = + enumValueMemberInfo!.GetCustomAttributes(typeof(TAttribute), false); + return (TAttribute)valueAttributes[0]; + } + public static TAttribute GetAttribute(MemberInfo enumValueMemberInfo, TEnum e) where TAttribute : Attribute where TEnum : Enum { object[] valueAttributes = @@ -384,7 +489,7 @@ public static class Globals StringBuilder sb = new(); foreach (Color c in col) { - sb.Append(Convert.ToHexString(new byte[] { c.R, c.G, c.B, c.A })); + sb.Append(c.ToDatabaseStr()); } return sb.ToString(); } @@ -418,6 +523,36 @@ public static class Globals public static readonly Dictionary GradientShader = new Dictionary(); public static ServerProfile? ServerProfile = null; + + public static string ToDisplayString(this ServerProfile profile) + { + return profile.DisplayName; + } + + public static string ToDisplayString(this SocketUser user) + { + Task profile = user.Server.GetProfile(user.ServerProfile, CancellationToken.None); + profile.Wait(); + return user.ToDisplayString(profile.Result); + } + + public static string ToDisplayString(this SocketUser user, ServerProfile profile) + { + string name = profile.DisplayName; + Task roles = user.GetRoles(); + roles.Wait(); + Role r = roles.Result[0]; + if (r.ColorType == ColorType.Full) + { + name = $"[color=\"{r.Colors[0].ToDatabaseStr()}\"]{name}[/color]"; + } + else + { + name = $"[gradient colors=\"{r.Colors.ToDB()}\"]{name}[/gradient]"; + } + + return name; + } public static async Task MakeRct(this ServerProfile Profile, TUser User, Vector2i Size) where TUser : SocketUser { @@ -427,44 +562,17 @@ public static class Globals UserControl r = new(t); r.Size = Size; r.Shader = Rectangle.DefaultAlphaShader[ms.Context]; - ColorType ct = await User.GetColorType(); - Color[] c = await User.GetColors(); - ColorType? cct = await Profile.GetColorType(); - Color[]? cc = await Profile.GetColors(); - if (cc is not null) - { - c = cc; - ct = cct!.Value; - } r.BackgroundColor = new(25, 25, 25, 255); - if (ct == ColorType.Full) + LuskiLabel l = new(DefaultFont) { - Label l = new(DefaultFont) - { - Color = c[0].ToColor4() - }; - l.Text = Profile.DisplayName[0].ToString(); - Vector2i y = l.GetSizeOfChar(0), - yy = l.GetBearingOfChar(0); - l.Location = new((r.Size.X - l.Size.X)/2, - (int)(r.Size.Y - l.Font.PixelHeight + yy.Y - (r.Size.Y / 2) - (y.Y/2)), - 0); - r.Controls.Add(l); - } - else - { - AdvancedGradientLabel l = new(DefaultFont) - { - Colors = c.ToColor4Array() - }; - l.Text = Profile.DisplayName[0].ToString(); - Vector2i y = l.GetSizeOfChar(0), - yy = l.GetBearingOfChar(0); - l.Location = new((r.Size.X - l.Size.X)/2, - (int)(r.Size.Y - l.Font.PixelHeight + yy.Y - (r.Size.Y / 2) - (y.Y/2)), - 0); - r.Controls.Add(l); - } + Text = Profile.DisplayName[0].ToString(), + }; + Vector2i y = l.GetSizeOfChar(0), + yy = l.GetBearingOfChar(0); + l.Location = new((r.Size.X - l.Size.X)/2, + (int)(r.Size.Y - l.Font.PixelHeight + yy.Y - (r.Size.Y / 2) - (y.Y/2)), + 0); + r.Controls.Add(l); return r; } else diff --git a/Luski/Luski.csproj b/Luski/Luski.csproj index 361834b..8dd1e58 100644 --- a/Luski/Luski.csproj +++ b/Luski/Luski.csproj @@ -22,8 +22,8 @@ - - + + @@ -47,5 +47,9 @@ Luski.ico + + + true + diff --git a/Luski/Program.cs b/Luski/Program.cs index d9ad1ef..0e753a0 100644 --- a/Luski/Program.cs +++ b/Luski/Program.cs @@ -1,7 +1,11 @@ using System.Diagnostics; +using GraphicsManager; +using GraphicsManager.Enums; +using GraphicsManager.Objects.Core; using Luski; using Luski.Classes; using Luski.GUI; +using Luski.GUI.MainScreen.UI.LuskiControls; using OpenTK.Mathematics; using OpenTK.Windowing.Common.Input; using SixLabors.ImageSharp; @@ -10,23 +14,6 @@ using Image = OpenTK.Windowing.Common.Input.Image; try { - unsafe - { - int * a1; - - int * a2; - - int b1; - - b1 = 20; - - a1 = &b1; - - a2 = a1; - - *a1 = 25; - Console.WriteLine(*a2); - } Globals.Settings = Globals.GetSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings); foreach (ExperimentInfo le in LuskiExperiments.LuskiExperimentsList) { @@ -90,15 +77,6 @@ try Globals.Icon = new WindowIcon(new Image(Logo.Width, Logo.Height, pixels)); Logo.Dispose(); - Console.WriteLine(new Color4[]{ - Color4.Red, - Color4.Orange, - Color4.Yellow, - Color4.Green, - Color4.Blue, - Color4.Indigo, - Color4.Violet, - }.ToDB()); MainScreenWindow.Settings.Icon = Globals.Icon; Globals.ms = new MainScreenWindow();