Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
76ec58a595 | |||
842282d2a8 |
@ -1,14 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System.Numerics;
|
|
||||||
|
|
||||||
namespace Luski.Classes.Attribs.NumberSlider;
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Property)]
|
|
||||||
public class NumberDefault<TNumber> : Attribute where TNumber : INumber<TNumber>
|
|
||||||
{
|
|
||||||
public NumberDefault(TNumber @default)
|
|
||||||
{
|
|
||||||
Default = @default;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TNumber Default { get; init; }
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System.Numerics;
|
|
||||||
|
|
||||||
namespace Luski.Classes.Attribs.NumberSlider;
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Property)]
|
|
||||||
public class NumberMax<TNumber> : Attribute where TNumber : INumber<TNumber>
|
|
||||||
{
|
|
||||||
public NumberMax(TNumber max)
|
|
||||||
{
|
|
||||||
Max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TNumber Max { get; init; }
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System.Numerics;
|
|
||||||
|
|
||||||
namespace Luski.Classes.Attribs.NumberSlider;
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Property)]
|
|
||||||
public class NumberMin<TNumber> : Attribute where TNumber : INumber<TNumber>
|
|
||||||
{
|
|
||||||
public NumberMin(TNumber min)
|
|
||||||
{
|
|
||||||
Min = min;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TNumber Min { get; init; }
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
|
|
||||||
|
|
||||||
namespace Luski.Classes;
|
|
||||||
|
|
||||||
public class SettingPageStruct
|
|
||||||
{
|
|
||||||
public string Name;
|
|
||||||
public ISettingsPage Page;
|
|
||||||
}
|
|
@ -1,10 +1,6 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using GraphicsManager.Objects;
|
using GraphicsManager.Objects;
|
||||||
using Luski.Classes.Attribs;
|
|
||||||
using Luski.Classes.Attribs.NumberSlider;
|
|
||||||
using Luski.Enums;
|
|
||||||
using Luski.Enums.Strings;
|
|
||||||
|
|
||||||
namespace Luski.Classes;
|
namespace Luski.Classes;
|
||||||
|
|
||||||
@ -12,13 +8,6 @@ public class Settings
|
|||||||
{
|
{
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("scale")]
|
[JsonPropertyName("scale")]
|
||||||
[SettingInfo(SettingGroup.AppSettings, SettingsPage.Appearance)]
|
|
||||||
[Shared.GlobalAttributes.DisplayName("Message Font Size")]
|
|
||||||
[Description("Sets the px value for the message font size")]
|
|
||||||
[NumberSelector(typeof(double?))]
|
|
||||||
[NumberMin<double>(0.25)]
|
|
||||||
[NumberDefault<double>(1)]
|
|
||||||
[NumberMax<double>(2)]
|
|
||||||
public double? Scale { get; set; } = null;
|
public double? Scale { get; set; } = null;
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("perscrollpixels")]
|
[JsonPropertyName("perscrollpixels")]
|
||||||
@ -34,7 +23,6 @@ public class Settings
|
|||||||
public string Theme { get; set; } = "Dark";
|
public string Theme { get; set; } = "Dark";
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("experiments")]
|
[JsonPropertyName("experiments")]
|
||||||
[SettingInfo(SettingGroup.Advanced, SettingsPage.Experiments)]
|
|
||||||
public List<ExperimentJson> Experiments { get; set; } = Array.Empty<ExperimentJson>().ToList();
|
public List<ExperimentJson> Experiments { get; set; } = Array.Empty<ExperimentJson>().ToList();
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("default_display")]
|
[JsonPropertyName("default_display")]
|
||||||
@ -45,7 +33,6 @@ public class Settings
|
|||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[Shared.GlobalAttributes.DisplayName("Console Logs")]
|
[Shared.GlobalAttributes.DisplayName("Console Logs")]
|
||||||
[Description("The Log values for the console")]
|
[Description("The Log values for the console")]
|
||||||
[SettingInfo(SettingGroup.AppSettings, SettingsPage.General)]
|
|
||||||
[JsonPropertyName("log")]
|
[JsonPropertyName("log")]
|
||||||
public ConsoleLog Logs
|
public ConsoleLog Logs
|
||||||
{
|
{
|
||||||
@ -68,7 +55,6 @@ public class Settings
|
|||||||
[Shared.GlobalAttributes.DisplayName("Scale Fonts")]
|
[Shared.GlobalAttributes.DisplayName("Scale Fonts")]
|
||||||
[Description("Scales fonts using the scale property")]
|
[Description("Scales fonts using the scale property")]
|
||||||
[JsonPropertyName("scale_fonts")]
|
[JsonPropertyName("scale_fonts")]
|
||||||
[SettingInfo(SettingGroup.AppSettings, SettingsPage.General)]
|
|
||||||
public bool ScaleFonts
|
public bool ScaleFonts
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -99,42 +85,13 @@ public class Settings
|
|||||||
public uint DefaultFontPX { get; set; } = 20;
|
public uint DefaultFontPX { get; set; } = 20;
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("top_time_font_px")]
|
[JsonPropertyName("top_time_font_px")]
|
||||||
[SettingInfo(SettingGroup.AppSettings, SettingsPage.Appearance)]
|
|
||||||
[Shared.GlobalAttributes.DisplayName("Top Time Font Size")]
|
|
||||||
[Description("Sets the px value for the top time font size")]
|
|
||||||
[NumberSelector(typeof(uint))]
|
|
||||||
[NumberMin<uint>(8)]
|
|
||||||
[NumberDefault<uint>(12)]
|
|
||||||
[NumberMax<uint>(20)]
|
|
||||||
public uint TopTimeFontPX { get; set; } = 12;
|
public uint TopTimeFontPX { get; set; } = 12;
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("role_settings_font_px")]
|
[JsonPropertyName("role_settings_font_px")]
|
||||||
public uint RoleSettingsFontPX { get; set; } = 14;
|
public uint RoleSettingsFontPX { get; set; } = 14;
|
||||||
|
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("message_font_px")]
|
[JsonPropertyName("message_font_px")]
|
||||||
[SettingInfo(SettingGroup.AppSettings, SettingsPage.Appearance)]
|
public uint MessageFontPX { get; set; } = 17;
|
||||||
[Shared.GlobalAttributes.DisplayName("Message Font Size")]
|
|
||||||
[Description("Sets the px value for the message font size")]
|
|
||||||
[NumberSelector(typeof(uint))]
|
|
||||||
[NumberMin<uint>(12)]
|
|
||||||
[NumberDefault<uint>(17)]
|
|
||||||
[NumberMax<uint>(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]
|
[JsonInclude]
|
||||||
[JsonPropertyName("message_font_line_space_px")]
|
[JsonPropertyName("message_font_line_space_px")]
|
||||||
public uint MessageFontLineSpacePX { get; set; } = 5;
|
public uint MessageFontLineSpacePX { get; set; } = 5;
|
||||||
@ -143,7 +100,6 @@ public class Settings
|
|||||||
[Shared.GlobalAttributes.DisplayName("24 Hour Time")]
|
[Shared.GlobalAttributes.DisplayName("24 Hour Time")]
|
||||||
[Description("Shows time in the 24 hour format")]
|
[Description("Shows time in the 24 hour format")]
|
||||||
[JsonPropertyName("24hour_time")]
|
[JsonPropertyName("24hour_time")]
|
||||||
[SettingInfo(SettingGroup.AppSettings, SettingsPage.General)]
|
|
||||||
public bool DayTime
|
public bool DayTime
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -161,7 +117,6 @@ public class Settings
|
|||||||
[Shared.GlobalAttributes.DisplayName("Memory Fonts")]
|
[Shared.GlobalAttributes.DisplayName("Memory Fonts")]
|
||||||
[Description("Stores fonts in memory for faster load times")]
|
[Description("Stores fonts in memory for faster load times")]
|
||||||
[JsonPropertyName("memory_fonts")]
|
[JsonPropertyName("memory_fonts")]
|
||||||
[SettingInfo(SettingGroup.AppSettings, SettingsPage.General)]
|
|
||||||
public bool StoreFontsInMemory
|
public bool StoreFontsInMemory
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Luski.Classes.Attribs;
|
using Luski.net.Enums;
|
||||||
using Luski.Enums.Strings;
|
|
||||||
using Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AdvancedSettings;
|
|
||||||
|
|
||||||
namespace Luski.Classes;
|
namespace Luski.Classes;
|
||||||
|
|
||||||
@ -12,37 +10,31 @@ public class UpdaterSettings
|
|||||||
[Shared.GlobalAttributes.DisplayName("Self Contained")]
|
[Shared.GlobalAttributes.DisplayName("Self Contained")]
|
||||||
[Description("This tells the updater to download the self contained version of the app.")]
|
[Description("This tells the updater to download the self contained version of the app.")]
|
||||||
[JsonPropertyName("self_contained")]
|
[JsonPropertyName("self_contained")]
|
||||||
[SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)]
|
|
||||||
public bool SelfContained { get; set; } = false;
|
public bool SelfContained { get; set; } = false;
|
||||||
|
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("updater")]
|
[JsonPropertyName("updater")]
|
||||||
[SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)]
|
|
||||||
public string? Updater { get; set; } = null;
|
public string? Updater { get; set; } = null;
|
||||||
|
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("platform")]
|
[JsonPropertyName("platform")]
|
||||||
[SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)]
|
|
||||||
public string Platform { get; set; } = "linux-x64";
|
public string Platform { get; set; } = "linux-x64";
|
||||||
|
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[Shared.GlobalAttributes.DisplayName("Auto Launch")]
|
[Shared.GlobalAttributes.DisplayName("Auto Launch")]
|
||||||
[Description("Tells the updater to relaunch the app after the update is complete.")]
|
[Description("Tells the updater to relaunch the app after the update is complete.")]
|
||||||
[JsonPropertyName("auto_launch")]
|
[JsonPropertyName("auto_launch")]
|
||||||
[SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)]
|
|
||||||
public bool AutoLaunch { get; set; } = true;
|
public bool AutoLaunch { get; set; } = true;
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[Description("If the app can check for updates and an update is available, then the app will start the update process automatically.")]
|
[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")]
|
[Shared.GlobalAttributes.DisplayName("Auto Update")]
|
||||||
[JsonPropertyName("auto_update")]
|
[JsonPropertyName("auto_update")]
|
||||||
[SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)]
|
|
||||||
public bool AutoUpdate { get; set; } = false;
|
public bool AutoUpdate { get; set; } = false;
|
||||||
|
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[Description("This will allow the client to check for update during the launch process.")]
|
[Description("This will allow the client to check for update during the launch process.")]
|
||||||
[Shared.GlobalAttributes.DisplayName("Check For Updates")]
|
[Shared.GlobalAttributes.DisplayName("Check For Updates")]
|
||||||
[JsonPropertyName("update_check")]
|
[JsonPropertyName("update_check")]
|
||||||
[SettingInfo(SettingGroup.Advanced, SettingsPage.Updater)]
|
|
||||||
public bool AutoUpdateCheck { get; set; } = true;
|
public bool AutoUpdateCheck { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,4 +44,7 @@ public class UpdaterSettings
|
|||||||
PropertyNamingPolicy = JsonKnownNamingPolicy.Unspecified,
|
PropertyNamingPolicy = JsonKnownNamingPolicy.Unspecified,
|
||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
DefaultIgnoreCondition = JsonIgnoreCondition.Never)]
|
DefaultIgnoreCondition = JsonIgnoreCondition.Never)]
|
||||||
internal partial class UpdaterSettingsContext : JsonSerializerContext;
|
internal partial class UpdaterSettingsContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
namespace Luski.Enums;
|
|
||||||
|
|
||||||
public enum BlendType
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
MultiplyAlpha,
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace Luski.Enums;
|
|
||||||
|
|
||||||
public enum LockingMode : byte
|
|
||||||
{
|
|
||||||
Points,
|
|
||||||
Int,
|
|
||||||
Float
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
namespace Luski.Enums.Strings;
|
|
||||||
|
|
||||||
public static class SettingGroup
|
|
||||||
{
|
|
||||||
public const string AppSettings = "App Settings";
|
|
||||||
public const string Advanced = "Advanced Settings";
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
using Luski.GUI.MainScreen.UI.Generic;
|
using Luski.GUI.MainScreen.UI.PublicServers;
|
||||||
using Luski.net.Structures.Public;
|
using Luski.net.Structures.Public;
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.Interfaces;
|
namespace Luski.GUI.MainScreen.Interfaces;
|
||||||
|
@ -13,7 +13,7 @@ using Rectangle = GraphicsManager.Objects.Rectangle;
|
|||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI;
|
namespace Luski.GUI.MainScreen.UI;
|
||||||
|
|
||||||
public class AddServerOverlayld : UserControl, IServerOverlay
|
public class AddServerOverlay : UserControl, IServerOverlay
|
||||||
{
|
{
|
||||||
private UserControl Form, btn;
|
private UserControl Form, btn;
|
||||||
private DropDown<VersionDropButton> version;
|
private DropDown<VersionDropButton> version;
|
||||||
@ -24,7 +24,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
|||||||
|
|
||||||
private Rectangle? rec;
|
private Rectangle? rec;
|
||||||
|
|
||||||
public AddServerOverlayld()
|
public AddServerOverlay()
|
||||||
{
|
{
|
||||||
base.Size = Globals.ms.ClientSize;
|
base.Size = Globals.ms.ClientSize;
|
||||||
base.BackgroundColor = new(0, 0, 0, 130);
|
base.BackgroundColor = new(0, 0, 0, 130);
|
||||||
@ -582,7 +582,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
|||||||
Globals.ServerList.Servers = l.ToArray();
|
Globals.ServerList.Servers = l.ToArray();
|
||||||
Globals.ServerList.SaveSettings(Path.Combine(Globals.LuskiPath, "Servers.json"), ServerListContext.Default.ServerList);
|
Globals.ServerList.SaveSettings(Path.Combine(Globals.LuskiPath, "Servers.json"), ServerListContext.Default.ServerList);
|
||||||
ServerIcon<PublicServer> ss = new ServerIcon<PublicServer>(ps);
|
ServerIcon<PublicServer> ss = new ServerIcon<PublicServer>(ps);
|
||||||
Globals.ms.ServerFlow.Controls.Insert(Globals.ms.ServerFlow.Controls.Length - 1, ss);
|
Globals.ms.ser.Controls.Insert(Globals.ms.ser.Controls.Length - 1, ss);
|
||||||
await ss.LoadServer();
|
await ss.LoadServer();
|
||||||
Globals.ms.Controls.Remove(this);
|
Globals.ms.Controls.Remove(this);
|
||||||
Globals.ms.TryDraw();
|
Globals.ms.TryDraw();
|
@ -1,285 +0,0 @@
|
|||||||
using GraphicsManager.Enums;
|
|
||||||
using GraphicsManager.Interfaces;
|
|
||||||
using GraphicsManager.Objects;
|
|
||||||
using GraphicsManager.Objects.Core;
|
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls.ServerForms;
|
|
||||||
using OpenTK.Mathematics;
|
|
||||||
using OpenTK.Windowing.GraphicsLibraryFramework;
|
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI;
|
|
||||||
|
|
||||||
public class AddServerOverlayForm : UserControl
|
|
||||||
{
|
|
||||||
private TextBox tb;
|
|
||||||
private CreateAccountUI caUI = new();
|
|
||||||
private DropDown<VersionDropButton> version;
|
|
||||||
private LoginUI lUI = new()
|
|
||||||
{
|
|
||||||
Visible = false
|
|
||||||
};
|
|
||||||
|
|
||||||
private UserControl btn;
|
|
||||||
|
|
||||||
private TextBox UsernameTB
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (lUI.Visible) return lUI.Username;
|
|
||||||
return caUI.Username;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private TextBox PasswordTB
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (lUI.Visible) return lUI.Password;
|
|
||||||
return caUI.Password;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AddServerOverlayForm()
|
|
||||||
:base(Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png"))
|
|
||||||
{
|
|
||||||
base.Size = new(350.ScaleInt(), 347.ScaleInt());
|
|
||||||
base.BackgroundColor = new(32, 32, 32, 255);
|
|
||||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
|
||||||
TextureDisplay = TextureDisplay.Center;
|
|
||||||
Label t;
|
|
||||||
Controls.Add(t=new Label(Globals.DefaultFont) { Scale = 1.6f, Text = "Add Server", Color = Globals.DodgerBlue });
|
|
||||||
t.Location = new((base.Size.X / 2) - (t.Size.X / 2), t.Location.Y, 0);
|
|
||||||
|
|
||||||
Label? ll = new Label(Globals.DefaultFont)
|
|
||||||
{
|
|
||||||
Text = net.API.DefaultVersion,
|
|
||||||
Color = Color4.DarkGray,
|
|
||||||
IgnoreHover = true
|
|
||||||
};
|
|
||||||
Vector2i s =new((int)(ll.Size.X * 1.6f),27.ScaleInt());
|
|
||||||
ll = null;
|
|
||||||
|
|
||||||
Rectangle line = new Rectangle()
|
|
||||||
{
|
|
||||||
Size = new Vector2i(1.ScaleInt()),
|
|
||||||
BackgroundColor = Globals.DodgerBlue
|
|
||||||
};
|
|
||||||
|
|
||||||
int ten = 10.ScaleInt();
|
|
||||||
|
|
||||||
tb = new("BadTextbox.png")
|
|
||||||
{
|
|
||||||
Location = new(ten,50.ScaleInt(), 0),
|
|
||||||
Size = (base.Size.X - ten - ten - ten - s.X, s.Y),
|
|
||||||
WatermarkText = "Server Address",
|
|
||||||
TextLocation = TextLocation.LineCenter,
|
|
||||||
AllowMultiLine = false
|
|
||||||
};
|
|
||||||
tb.LetterPress += () =>
|
|
||||||
{
|
|
||||||
Texture good = Globals.ms.TextureManager.GetTextureResource("Textbox.png");
|
|
||||||
|
|
||||||
if (tb.Textures[0].handel != good.handel)
|
|
||||||
{
|
|
||||||
tb.Textures[0] = good;
|
|
||||||
if (UsernameTB.Textures[0].handel == good.handel &&
|
|
||||||
PasswordTB.Textures[0].handel == good.handel &&
|
|
||||||
(lUI.Visible || caUI.Avatar.Textures.Count > 1) &&
|
|
||||||
btn!.Textures[0].handel != good.handel &&
|
|
||||||
tb.Textures[0].handel == good.handel)
|
|
||||||
{
|
|
||||||
btn.Textures[0] = good;
|
|
||||||
}
|
|
||||||
Globals.ms.TryDraw();
|
|
||||||
}
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
tb.LetterRemoved += () =>
|
|
||||||
{
|
|
||||||
Texture bad = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
|
|
||||||
|
|
||||||
if (tb.Text.Length == 0 && tb.Textures[0].handel != bad.handel)
|
|
||||||
{
|
|
||||||
tb.Textures[0] = bad;
|
|
||||||
btn!.Textures[0] = bad;
|
|
||||||
Globals.ms.TryDraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
tb.KeyPress += args =>
|
|
||||||
{
|
|
||||||
if (args.Key == Keys.Tab && !args.Shift)
|
|
||||||
{
|
|
||||||
UsernameTB.Focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
|
|
||||||
Controls.Add(tb);
|
|
||||||
|
|
||||||
version = new DropDown<VersionDropButton>(Textures[0], line)
|
|
||||||
{
|
|
||||||
DropDownParentOverride = this,
|
|
||||||
Size = s,
|
|
||||||
BackgroundColor = new(255,20,20,255),
|
|
||||||
TextureDisplay = TextureDisplay.HorizontalCenter,
|
|
||||||
Shader = Shader,
|
|
||||||
Location = new(tb.Location.X + tb.Size.X + tb.Location.X, tb.Location.Y, 0)
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (string v in Globals.Luski.SupportedVersions)
|
|
||||||
{
|
|
||||||
VersionDropButton option = new VersionDropButton(s, v)
|
|
||||||
{
|
|
||||||
LoadDisplay = () =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Label ll2 = new Label(Globals.DefaultFont)
|
|
||||||
{
|
|
||||||
Text = v,
|
|
||||||
Color = Color4.DarkGray,
|
|
||||||
IgnoreHover = true,
|
|
||||||
|
|
||||||
};
|
|
||||||
ll2.Location = new((version.Size.X / 2) - (ll2.Size.X / 2),
|
|
||||||
((version.Size.Y - ll2.Size.Y) / 2)
|
|
||||||
, 0);
|
|
||||||
version.Controls.Add(ll2);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
version.AddOption(option);
|
|
||||||
if (v == net.API.DefaultVersion)
|
|
||||||
{
|
|
||||||
version.SetSelected(option);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
version.OpenStatusChanged += VersionOnOpenStatusChanged;
|
|
||||||
version.OptionSelected += VersionOnOptionSelected;
|
|
||||||
|
|
||||||
|
|
||||||
version.DropDownContainer.Textures.Add(Globals.ms.TextureManager.GetTextureResource("RoundedRectangleBottom.png"));
|
|
||||||
version.DropDownContainer.TextureDisplay = TextureDisplay.Center;
|
|
||||||
version.DropDownContainer.Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
|
||||||
version.DropDownContainer.BackgroundColor = version.BackgroundColor;
|
|
||||||
version.OpenStatusChanged += b =>
|
|
||||||
{
|
|
||||||
BlockDraw = true;
|
|
||||||
if (b)
|
|
||||||
{
|
|
||||||
version.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangleTop.png");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
version.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockDraw = false;
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
btn = new(Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"))
|
|
||||||
{
|
|
||||||
Location = new(tb.Location.X, tb.Location.Y + tb.Size.Y + tb.Location.X, 0),
|
|
||||||
Size = new(tb.Size.X, tb.Size.Y),
|
|
||||||
TextureDisplay = TextureDisplay.Center
|
|
||||||
};
|
|
||||||
Label sub = new(Globals.DefaultFont)
|
|
||||||
{
|
|
||||||
Text = "Submit",
|
|
||||||
IgnoreHover = true
|
|
||||||
};
|
|
||||||
sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2),
|
|
||||||
((btn.Size.Y - sub.Size.Y) / 2)
|
|
||||||
, 0);
|
|
||||||
sub.ForceDistanceUpdate(btn);
|
|
||||||
btn.Controls.Add(sub);
|
|
||||||
Controls.Add(btn);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task VersionOnOpenStatusChanged(bool arg)
|
|
||||||
{
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task VersionOnOptionSelected(VersionDropButton arg)
|
|
||||||
{
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void ParentResize()
|
|
||||||
{
|
|
||||||
BlockDraw = true;
|
|
||||||
for (int i = 0; i < Controls.Length; i++)
|
|
||||||
{
|
|
||||||
if (!Controls[i].Loaded) continue;
|
|
||||||
bool top = (Controls[i].Anchor & ObjectAnchor.Top) == ObjectAnchor.Top;
|
|
||||||
bool left = (Controls[i].Anchor & ObjectAnchor.Left) == ObjectAnchor.Left;
|
|
||||||
bool right = (Controls[i].Anchor & ObjectAnchor.Right) == ObjectAnchor.Right;
|
|
||||||
bool bottom = (Controls[i].Anchor & ObjectAnchor.Bottom) == ObjectAnchor.Bottom;
|
|
||||||
if (!top && !bottom) { Controls[i].Anchor |= ObjectAnchor.Top; top = true; }
|
|
||||||
if (!left && !right) { Controls[i].Anchor |= ObjectAnchor.Left; left = true; }
|
|
||||||
|
|
||||||
int lx, ly, sy, sx;
|
|
||||||
bool UpdateDistance = false;
|
|
||||||
if ((Controls[i].Anchor & ObjectAnchor.PreventWidthChange) == ObjectAnchor.PreventWidthChange)
|
|
||||||
{
|
|
||||||
UpdateDistance = true;
|
|
||||||
lx = Controls[i].Location.X + ((Size.X - Controls[i].Distance.X - Controls[i].Size.X - Controls[i].Location.X) / 2);
|
|
||||||
sx = Controls[i].Size.X;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lx = (left ? Controls[i].Location.X : Size.X - Controls[i].Distance.X - Controls[i].Size.X);
|
|
||||||
sx = (right ? Size.X - Controls[i].Distance.X - lx : Controls[i].Size.X);
|
|
||||||
}
|
|
||||||
if ((Controls[i].Anchor & ObjectAnchor.PreventHeightChange) == ObjectAnchor.PreventHeightChange)
|
|
||||||
{
|
|
||||||
UpdateDistance = true;
|
|
||||||
ly = Controls[i].Location.Y + ((Size.Y - Controls[i].Distance.Y - Controls[i].Size.Y - Controls[i].Location.Y) / 2);
|
|
||||||
sy = Controls[i].Size.Y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ly = (top ? Controls[i].Location.Y : Size.Y - Controls[i].Distance.Y - Controls[i].Size.Y);
|
|
||||||
sy = (bottom ? Size.Y - Controls[i].Distance.Y - ly : Controls[i].Size.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool mooved = false;
|
|
||||||
Console.WriteLine(Controls[i].Location);
|
|
||||||
Console.WriteLine(Controls[i].Size);
|
|
||||||
Console.WriteLine("New X:{0} Y:{1} W:{2} H:{3}", lx, ly, sx, sy);
|
|
||||||
if (sx != Controls[i].Size.X || sy != Controls[i].Size.Y)
|
|
||||||
{
|
|
||||||
mooved = true;
|
|
||||||
Controls[i].SetSize(sx, sy);
|
|
||||||
}
|
|
||||||
if (lx != Controls[i].Location.X || ly != Controls[i].Location.Y)
|
|
||||||
{
|
|
||||||
mooved = true;
|
|
||||||
Controls[i].SetLocation(lx, ly);
|
|
||||||
}
|
|
||||||
if (UpdateDistance)
|
|
||||||
{
|
|
||||||
Controls[i].ForceDistanceUpdate(this);
|
|
||||||
}
|
|
||||||
Console.WriteLine(mooved);
|
|
||||||
if (Controls[i] is IParent parent)
|
|
||||||
{
|
|
||||||
Console.WriteLine(Controls[i]);
|
|
||||||
parent.ParentResize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Parent is not null) Parent.TryDraw();
|
|
||||||
BlockDraw = false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
using GraphicsManager.Enums;
|
|
||||||
using GraphicsManager.Interfaces;
|
|
||||||
using GraphicsManager.Objects;
|
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
|
||||||
|
|
||||||
public class CenterFullScreenBase : UserControl
|
|
||||||
{
|
|
||||||
private IRenderObject centerobj;
|
|
||||||
public CenterFullScreenBase(IRenderObject obj, bool Streach = false)
|
|
||||||
{
|
|
||||||
centerobj = obj;
|
|
||||||
if (!Streach) obj.Anchor = ObjectAnchor.Prevent;
|
|
||||||
else obj.Anchor = ObjectAnchor.All;
|
|
||||||
Controls.Add(obj);
|
|
||||||
base.BackgroundColor = new(0, 0, 0, 130);
|
|
||||||
Anchor = ObjectAnchor.All;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void LoadToParent(IParent p, IWindow w)
|
|
||||||
{
|
|
||||||
base.SetSize(w.CS.X, w.CS.Y);
|
|
||||||
centerobj.SetLocation((w.CS.X - centerobj.Size.X)/2, (w.CS.Y - centerobj.Size.Y)/2);
|
|
||||||
centerobj.ForceDistanceUpdate(this);
|
|
||||||
base.LoadToParent(p, w);
|
|
||||||
}
|
|
||||||
}
|
|
@ -25,7 +25,6 @@ public class LuskiLabel : LabelBase
|
|||||||
if (Shader is null) Shader = Globals.GradientShader[win.Context];
|
if (Shader is null) Shader = Globals.GradientShader[win.Context];
|
||||||
base.LoadToParent(window, win);
|
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)
|
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);
|
Vector2i cl = GetCharLocation(charter);
|
||||||
@ -78,6 +77,7 @@ public class LuskiLabel : LabelBase
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
||||||
LeftColor = Color4.DarkRed;
|
LeftColor = Color4.DarkRed;
|
||||||
RightColor = Color4.DarkRed;
|
RightColor = Color4.DarkRed;
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ public class LuskiLabel : LabelBase
|
|||||||
float b = LeftColor.B + (RightColor.B - LeftColor.B) * t;
|
float b = LeftColor.B + (RightColor.B - LeftColor.B) * t;
|
||||||
float a = LeftColor.A + (RightColor.A - LeftColor.A) * t;
|
float a = LeftColor.A + (RightColor.A - LeftColor.A) * t;
|
||||||
|
|
||||||
return new Color4(r, g, b, a * _alpha);
|
return new Color4(r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Tuple<TextCode, int, int, object?>> Commands = new();
|
List<Tuple<TextCode, int, int, object?>> Commands = new();
|
||||||
@ -117,7 +117,7 @@ public class LuskiLabel : LabelBase
|
|||||||
Commands.Clear();
|
Commands.Clear();
|
||||||
List<(GradType, int)> RainGrad = new();
|
List<(GradType, int)> RainGrad = new();
|
||||||
List<(Color4[], GradType, int)> Grad = new();
|
List<(Color4[], GradType, int)> Grad = new();
|
||||||
List<(Color4, BlendType)> ccccc = new();
|
List<Color4> ccccc = new();
|
||||||
List<bool> Itilacs = new();
|
List<bool> Itilacs = new();
|
||||||
List<FontSize> Fonts = new();
|
List<FontSize> Fonts = new();
|
||||||
List<uint> Sizes = new();
|
List<uint> Sizes = new();
|
||||||
@ -197,6 +197,7 @@ public class LuskiLabel : LabelBase
|
|||||||
GradType gt = GradType.Line;
|
GradType gt = GradType.Line;
|
||||||
for (int j = 1; j < args.Length-2; j+=3)
|
for (int j = 1; j < args.Length-2; j+=3)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(args[j]);
|
||||||
switch (args[j])
|
switch (args[j])
|
||||||
{
|
{
|
||||||
case "colors":
|
case "colors":
|
||||||
@ -217,17 +218,7 @@ public class LuskiLabel : LabelBase
|
|||||||
i = brack;
|
i = brack;
|
||||||
Color_End.Add(sb.Length);
|
Color_End.Add(sb.Length);
|
||||||
Color col = new(args[2].Replace("#", ""));
|
Color col = new(args[2].Replace("#", ""));
|
||||||
BlendType bt = BlendType.None;
|
ccccc.Add(col.ToColor4());
|
||||||
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;
|
i = brack;
|
||||||
continue;
|
continue;
|
||||||
case "fontsize":
|
case "fontsize":
|
||||||
@ -328,7 +319,7 @@ public class LuskiLabel : LabelBase
|
|||||||
i = brack;
|
i = brack;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Commands.Add(new(TextCode.Color, Color_End[Color_End.Count-1], sb.Length-1, new Tuple<Color4, BlendType>(ccccc[ccccc.Count-1].Item1, ccccc[ccccc.Count-1].Item2) ));
|
Commands.Add(new(TextCode.Color, Color_End[Color_End.Count-1], sb.Length-1, ccccc[ccccc.Count-1]));
|
||||||
Color_End.RemoveAt(Color_End.Count-1);
|
Color_End.RemoveAt(Color_End.Count-1);
|
||||||
ccccc.RemoveAt(ccccc.Count-1);
|
ccccc.RemoveAt(ccccc.Count-1);
|
||||||
i = brack;
|
i = brack;
|
||||||
@ -504,12 +495,8 @@ public class LuskiLabel : LabelBase
|
|||||||
if ((xrel + w) >= lw) lw = (xrel + w);
|
if ((xrel + w) >= lw) lw = (xrel + w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Largest is not null)
|
|
||||||
{
|
|
||||||
MaxLineSizes.Add(new(new((int)lw,(int)lh), Largest));
|
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);
|
max_lh += (uint) ((double) lh * ((double) Largest.CurrentFonts[0].Face.Height / (double) Largest.CurrentFonts[0].Face.UnitsPerEM) * (double) this.Scale);
|
||||||
}
|
|
||||||
Largest = null;
|
Largest = null;
|
||||||
|
|
||||||
PlainText = sb.ToString();
|
PlainText = sb.ToString();
|
||||||
@ -640,18 +627,7 @@ public class LuskiLabel : LabelBase
|
|||||||
}
|
}
|
||||||
else if (com.Item1 == TextCode.Color)
|
else if (com.Item1 == TextCode.Color)
|
||||||
{
|
{
|
||||||
Tuple<Color4, BlendType> item4 = (Tuple<Color4, BlendType>)com.Item4!;
|
col = new((Color4)com.Item4!, (Color4)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)
|
else if (com.Item1 == TextCode.url)
|
||||||
{
|
{
|
||||||
@ -660,7 +636,7 @@ public class LuskiLabel : LabelBase
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Tuple<Color4[], GradType, int, int> item4 = (Tuple<Color4[], GradType, int, int>)com.Item4!;
|
Tuple<Color4[], GradType, int, int> item4 = (Tuple<Color4[], GradType, int, int>)com.Item4!;
|
||||||
col = getGradcols(com.Item2, i, com.Item3, item4.Item4, line, item4.Item4, item4.Item2, item4.Item1);
|
col = getGradcols(com.Item2, i, com.Item3, item4.Item3, line, item4.Item4, item4.Item2, item4.Item1);
|
||||||
}
|
}
|
||||||
GL.Uniform4(Shader.GetUniformLocation("textColor"), col.Item1);
|
GL.Uniform4(Shader.GetUniformLocation("textColor"), col.Item1);
|
||||||
GL.Uniform4(Shader.GetUniformLocation("rightColor"), col.Item2);
|
GL.Uniform4(Shader.GetUniformLocation("rightColor"), col.Item2);
|
||||||
@ -708,13 +684,6 @@ public class LuskiLabel : LabelBase
|
|||||||
|
|
||||||
Active_Links.RemoveAt(Active_Links.Count-1);
|
Active_Links.RemoveAt(Active_Links.Count-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tuple<TextCode, int, int, object?> com2 = Commands[Active_Grads[Active_Grads.Count - 1]];
|
|
||||||
if (com2.Item1 == TextCode.Color)
|
|
||||||
{
|
|
||||||
Tuple<Color4, BlendType> item4 = (Tuple<Color4, BlendType>)com.Item4!;
|
|
||||||
if (item4.Item2 == BlendType.MultiplyAlpha) _alpha = 1;
|
|
||||||
}
|
|
||||||
Active_Grads.RemoveAt(Active_Grads.Count-1);
|
Active_Grads.RemoveAt(Active_Grads.Count-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,227 +0,0 @@
|
|||||||
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<TNumber> : UserControl where TNumber : INumber<TNumber>
|
|
||||||
{
|
|
||||||
public event Func<NumberSelector<TNumber>, 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<TNumber> progressBar = new();
|
|
||||||
private Rectangle Cursor = new(), MinLine = new(), MaxLine = new();
|
|
||||||
private List<TNumber> 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 - space - space, 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,7 +11,7 @@ public class ProfileView : UserControl
|
|||||||
{
|
{
|
||||||
public SocketUser User { get; set; }
|
public SocketUser User { get; set; }
|
||||||
|
|
||||||
private ProfileView(IRenderObject user, SocketUser u, ServerProfile p, Role r)
|
private ProfileView(IRenderObject user, SocketUser u, ServerProfile p, Role r, Color[] c, ColorType ct)
|
||||||
{
|
{
|
||||||
this.User = u;
|
this.User = u;
|
||||||
base.Size = new(244.ScaleInt(), 44.ScaleInt());
|
base.Size = new(244.ScaleInt(), 44.ScaleInt());
|
||||||
@ -20,20 +20,26 @@ public class ProfileView : UserControl
|
|||||||
user.ForceDistanceUpdate(this);
|
user.ForceDistanceUpdate(this);
|
||||||
user.IgnoreHover = true;
|
user.IgnoreHover = true;
|
||||||
|
|
||||||
string name = p.DisplayName;
|
LabelBase uname;
|
||||||
if (r.ColorType == ColorType.Full)
|
if (ct == ColorType.Full)
|
||||||
{
|
{
|
||||||
name = $"[color=\"{r.Colors[0].ToDatabaseStr()}\"]{name}[/color]";
|
uname = new Label(Globals.DefaultFont)
|
||||||
|
{
|
||||||
|
Text = p.DisplayName,
|
||||||
|
Color = c[0].ToColor4(),
|
||||||
|
IgnoreHover = true
|
||||||
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = $"[gradient colors=\"{r.Colors.ToDB()}\"]{name}[/gradient]";
|
uname = new AdvancedGradientLabel(Globals.DefaultFont)
|
||||||
}
|
|
||||||
LuskiLabel uname = new(Globals.DefaultFont)
|
|
||||||
{
|
{
|
||||||
Text = name,
|
Text = p.DisplayName,
|
||||||
|
Colors = c.ToColor4Array(),
|
||||||
IgnoreHover = true
|
IgnoreHover = true
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(),
|
uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(),
|
||||||
(user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0);
|
(user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0);
|
||||||
Controls.Add(uname);
|
Controls.Add(uname);
|
||||||
@ -42,7 +48,16 @@ public class ProfileView : UserControl
|
|||||||
|
|
||||||
public static async Task<ProfileView> Make(SocketUser u, ServerProfile p, Role r)
|
public static async Task<ProfileView> Make(SocketUser u, ServerProfile p, Role r)
|
||||||
{
|
{
|
||||||
ProfileView m = new(await p.MakeRct(u, new(32.ScaleInt())), u, p, 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);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +0,0 @@
|
|||||||
using GraphicsManager.Objects;
|
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.LuskiControls.ServerForms;
|
|
||||||
|
|
||||||
public class CreateAccountUI : UserControl
|
|
||||||
{
|
|
||||||
public Rectangle Avatar = new();
|
|
||||||
public TextBox Username = new(), Password = new(), DisplayName = new();
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using GraphicsManager.Objects;
|
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.LuskiControls.ServerForms;
|
|
||||||
|
|
||||||
public class LoginUI : UserControl
|
|
||||||
{
|
|
||||||
public TextBox Username = new(), Password = new();
|
|
||||||
|
|
||||||
public LoginUI()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -51,8 +51,6 @@ public class SettingsCategory<TSettingsMenu> : UserControl where TSettingsMenu :
|
|||||||
Page.AllowHoverFromBehind = true;
|
Page.AllowHoverFromBehind = true;
|
||||||
Page.Anchor = ObjectAnchor.All;
|
Page.Anchor = ObjectAnchor.All;
|
||||||
Page.BackgroundColor = ss.BackgroundColor;
|
Page.BackgroundColor = ss.BackgroundColor;
|
||||||
pagest.Add(typeof(TPage));
|
|
||||||
pages.Add(Page.PageName);
|
|
||||||
ss.Controls.Add(Page);
|
ss.Controls.Add(Page);
|
||||||
if (Page is PageFlow pbf) pbf.HScrollPixels = Globals.Settings.PerScrollPixels;
|
if (Page is PageFlow pbf) pbf.HScrollPixels = Globals.Settings.PerScrollPixels;
|
||||||
PageTab cb = new(Page.PageName, ss)
|
PageTab cb = new(Page.PageName, ss)
|
||||||
@ -68,19 +66,6 @@ public class SettingsCategory<TSettingsMenu> : UserControl where TSettingsMenu :
|
|||||||
return cb;
|
return cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<string> pages = new();
|
|
||||||
private List<Type> pagest = new();
|
|
||||||
|
|
||||||
public bool HasPage(string name)
|
|
||||||
{
|
|
||||||
return pages.Contains(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool HasPage(Type name)
|
|
||||||
{
|
|
||||||
return pagest.Contains(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemovePage<TPage>(TPage Page) where TPage : ISettingsPage
|
public void RemovePage<TPage>(TPage Page) where TPage : ISettingsPage
|
||||||
{
|
{
|
||||||
if (Page.Tag is PageTab cb)
|
if (Page.Tag is PageTab cb)
|
||||||
|
@ -41,13 +41,7 @@ public class SettingsMenu : UserControl
|
|||||||
};
|
};
|
||||||
closebtn.MouseLeave += _ =>
|
closebtn.MouseLeave += _ =>
|
||||||
{
|
{
|
||||||
if (bl) BlockDraw = true;
|
|
||||||
closebtn.BackgroundColor = Color4.Gray;
|
closebtn.BackgroundColor = Color4.Gray;
|
||||||
if (bl)
|
|
||||||
{
|
|
||||||
BlockDraw = false;
|
|
||||||
bl = false;
|
|
||||||
}
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
};
|
};
|
||||||
closebtn.Clicked += ClosebtnOnClicked;
|
closebtn.Clicked += ClosebtnOnClicked;
|
||||||
@ -55,12 +49,9 @@ public class SettingsMenu : UserControl
|
|||||||
Controls.Add(closebtn);
|
Controls.Add(closebtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool bl;
|
|
||||||
|
|
||||||
private Task ClosebtnOnClicked(IRenderObject arg)
|
private Task ClosebtnOnClicked(IRenderObject arg)
|
||||||
{
|
{
|
||||||
bl = true;
|
Globals.ms.Controls.Remove(this);
|
||||||
Globals.ms.Controls.Remove(this, false);
|
|
||||||
Globals.ms.Title = BehindName;
|
Globals.ms.Title = BehindName;
|
||||||
Globals.ms.DrawFrame();
|
Globals.ms.DrawFrame();
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
@ -20,8 +20,8 @@ public class TextBox : UserControl
|
|||||||
|
|
||||||
public int CursorLocation { get; set; }
|
public int CursorLocation { get; set; }
|
||||||
|
|
||||||
public TextBox(string defaul = "Textbox.png")
|
public TextBox()
|
||||||
:base(Globals.ms.TextureManager.GetTextureResource(defaul))
|
:base(Globals.ms.TextureManager.GetTextureResource("Textbox.png"))
|
||||||
{
|
{
|
||||||
t = new(500);
|
t = new(500);
|
||||||
t.Elapsed += TOnElapsed;
|
t.Elapsed += TOnElapsed;
|
||||||
@ -44,10 +44,8 @@ public class TextBox : UserControl
|
|||||||
(int)_label.LineHeight ),
|
(int)_label.LineHeight ),
|
||||||
Location = _watermark.Location,
|
Location = _watermark.Location,
|
||||||
BackgroundColor = Color4.White,
|
BackgroundColor = Color4.White,
|
||||||
Visible = false,
|
Visible = false
|
||||||
IgnoreHover = true
|
|
||||||
};
|
};
|
||||||
IgnoreVisForChildren = true;
|
|
||||||
Controls.Add(Pointer);
|
Controls.Add(Pointer);
|
||||||
|
|
||||||
Controls.Add(_label);
|
Controls.Add(_label);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using GraphicsManager.Interfaces;
|
using GraphicsManager.Interfaces;
|
||||||
using GraphicsManager.Objects;
|
using GraphicsManager.Objects;
|
||||||
using GraphicsManager.Objects.Core;
|
using GraphicsManager.Objects.Core;
|
||||||
using Luski.Enums;
|
|
||||||
using Luski.net.Structures.Public;
|
using Luski.net.Structures.Public;
|
||||||
using Luski.Shared.PublicServers.V1.Enums;
|
using Luski.Shared.PublicServers.V1.Enums;
|
||||||
using OpenTK.Mathematics;
|
using OpenTK.Mathematics;
|
||||||
@ -19,23 +18,37 @@ public class UserView : UserControl
|
|||||||
base.BackgroundColor = new(34, 34, 34, 255);
|
base.BackgroundColor = new(34, 34, 34, 255);
|
||||||
user.Location = new(8.ScaleInt(), 6.ScaleInt(), 0);
|
user.Location = new(8.ScaleInt(), 6.ScaleInt(), 0);
|
||||||
user.ForceDistanceUpdate(this);
|
user.ForceDistanceUpdate(this);
|
||||||
string name = p.DisplayName;
|
|
||||||
if (r.ColorType == ColorType.Full)
|
if (r.ColorType == ColorType.Full)
|
||||||
{
|
{
|
||||||
name = $"[color=\"{r.Colors[0].ToDatabaseStr()}\"]{name}[/color]";
|
Label uname = new(Globals.DefaultFont)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
name = $"[gradient colors=\"{r.Colors.ToDB()}\"]{name}[/gradient]";
|
Text = p.DisplayName,
|
||||||
}
|
Color = r.Colors[0].ToColor4()
|
||||||
|
|
||||||
LuskiLabel uname = new(Globals.DefaultFont)
|
|
||||||
{
|
|
||||||
Text = (offline ? $"[color=\"#00000099\" blend=\"{(int)BlendType.MultiplyAlpha}\"]{name}[/color]" : name)
|
|
||||||
};
|
};
|
||||||
|
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(),
|
uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(),
|
||||||
(user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0);
|
(user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0);
|
||||||
Controls.Add(uname);
|
Controls.Add(uname);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
Controls.Add(user);
|
Controls.Add(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,54 +1,37 @@
|
|||||||
using System.Reflection;
|
|
||||||
using GraphicsManager.Enums;
|
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;
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
|
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.GUI.MainScreen.UI.LuskiSettings.Pages.AppSettings;
|
||||||
using Luski.Shared.GlobalAttributes;
|
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.LuskiSettings;
|
namespace Luski.GUI.MainScreen.UI.LuskiSettings;
|
||||||
|
|
||||||
public class GlobalSettingsMenu : SettingsMenu
|
public class GlobalSettingsMenu : SettingsMenu
|
||||||
{
|
{
|
||||||
private Dictionary<string, SettingsCategory<GlobalSettingsMenu>> categories = new();
|
private Appearance a;
|
||||||
private PageTab? First;
|
|
||||||
|
|
||||||
public GlobalSettingsMenu()
|
public GlobalSettingsMenu()
|
||||||
:base("Settings - Luski")
|
:base("Settings - Luski")
|
||||||
{
|
{
|
||||||
LoadPages<Settings>();
|
SettingsCategory<GlobalSettingsMenu> AppSettings = new("App Settings", this);
|
||||||
LoadPages<UpdaterSettings>();
|
SettingsCategory<GlobalSettingsMenu> AdvancedSettings = new("Advanced Settings", this);
|
||||||
|
PageTab cb = AppSettings.AddPage(new General());
|
||||||
for (int i = 1; i < fl.Controls.Length; i++) // Fix the pos because why not and better than redrawing window
|
if (LuskiExperiments.Settings.Theme.IsEnabled()) _ = AppSettings.AddPage(a=new Appearance());
|
||||||
|
LuskiExperiments.Settings.Theme.EventToggled += b =>
|
||||||
{
|
{
|
||||||
fl.Controls[i].SetLocation(fl.Controls[i].Location.X, fl.Controls[i-1].Size.Y + fl.Controls[i-1].Location.Y);
|
if (b)
|
||||||
|
{
|
||||||
|
_ = AppSettings.AddPage(a=new Appearance());
|
||||||
|
Globals.ms.ForceUpdate();
|
||||||
}
|
}
|
||||||
|
else AppSettings.RemovePage(a!);
|
||||||
First!.ToggleSelected().Wait();
|
return Task.CompletedTask;
|
||||||
|
};
|
||||||
|
_ = AdvancedSettings.AddPage(new ExperimentSettings());
|
||||||
|
_ = AdvancedSettings.AddPage(new Updater());
|
||||||
|
fl.Controls.Add(AppSettings);
|
||||||
|
fl.Controls.Add(AdvancedSettings);
|
||||||
|
cb.ToggleSelected().Wait();
|
||||||
Anchor = ObjectAnchor.All;
|
Anchor = ObjectAnchor.All;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadPages<TFile>()
|
|
||||||
{
|
|
||||||
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<GlobalSettingsMenu>(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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,7 +1,5 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Luski.Classes;
|
using Luski.Classes;
|
||||||
using Luski.Classes.Attribs;
|
|
||||||
using Luski.Enums.Strings;
|
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
|
using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AppSettings;
|
namespace Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AppSettings;
|
||||||
@ -10,9 +8,9 @@ public class General : PageFlow
|
|||||||
{
|
{
|
||||||
public General()
|
public General()
|
||||||
{
|
{
|
||||||
|
PageName = "General";
|
||||||
foreach (PropertyInfo prop in typeof(Settings).GetProperties())
|
foreach (PropertyInfo prop in typeof(Settings).GetProperties())
|
||||||
{
|
{
|
||||||
|
|
||||||
object PropVal = prop.GetValue(Globals.Settings)!;
|
object PropVal = prop.GetValue(Globals.Settings)!;
|
||||||
Type PropType = prop.PropertyType;
|
Type PropType = prop.PropertyType;
|
||||||
if (PropType.IsEnum)
|
if (PropType.IsEnum)
|
||||||
|
@ -1,94 +0,0 @@
|
|||||||
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<Enum> values = Enum.GetValues(PropType).Cast<Enum>();
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeinfo.Kind.FullName == typeof(double?).FullName)
|
|
||||||
{
|
|
||||||
double? pv = (double?)PropVal;
|
|
||||||
Globals.AddNullNumberSlider(this, prop, pv, b =>
|
|
||||||
{
|
|
||||||
prop.SetValue(Globals.Settings, b);
|
|
||||||
Globals.Settings.SaveSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,9 +5,10 @@ using GraphicsManager.Objects.Core;
|
|||||||
using Luski.GUI.MainScreen.Interfaces;
|
using Luski.GUI.MainScreen.Interfaces;
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||||
using Luski.net.Structures.Public;
|
using Luski.net.Structures.Public;
|
||||||
|
using Luski.Shared.PublicServers.V1.Enums;
|
||||||
using OpenTK.Windowing.Common.Input;
|
using OpenTK.Windowing.Common.Input;
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.Generic;
|
namespace Luski.GUI.MainScreen.UI.PublicServers;
|
||||||
|
|
||||||
public class Category : UserControl, IChannelAdder
|
public class Category : UserControl, IChannelAdder
|
||||||
{
|
{
|
||||||
@ -20,7 +21,7 @@ public class Category : UserControl, IChannelAdder
|
|||||||
|
|
||||||
public event Func<int, Task>? AddY;
|
public event Func<int, Task>? AddY;
|
||||||
|
|
||||||
private LuskiLabel Name;
|
private LabelBase Name;
|
||||||
public UserControl tmp;
|
public UserControl tmp;
|
||||||
|
|
||||||
public static Task<Category> MakeCat(SocketCategory cat, ChannelSelector cs)
|
public static Task<Category> MakeCat(SocketCategory cat, ChannelSelector cs)
|
||||||
@ -39,19 +40,40 @@ public class Category : UserControl, IChannelAdder
|
|||||||
c.tmp.Clicked += c.TmpOnClicked;
|
c.tmp.Clicked += c.TmpOnClicked;
|
||||||
c.tmp.HoverMouse = MouseCursor.Hand;
|
c.tmp.HoverMouse = MouseCursor.Hand;
|
||||||
c.Controls.Add(c.tmp);
|
c.Controls.Add(c.tmp);
|
||||||
|
if (cat.ColorType == ColorType.Full)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
c.tmp.Controls.Add(c.ee = new AdvancedGradientLabel(Globals.DefaultFont)
|
c.tmp.Controls.Add(c.ee = new AdvancedGradientLabel(Globals.DefaultFont)
|
||||||
{
|
{
|
||||||
Text = ">",
|
Text = ">",
|
||||||
Location = new(5.ScaleInt()),
|
Location = new(5.ScaleInt()),
|
||||||
|
Colors = cat.Colors.ToColor4Array(),
|
||||||
DIR = new(1,0),
|
DIR = new(1,0),
|
||||||
IgnoreHover = true
|
IgnoreHover = true
|
||||||
});
|
});
|
||||||
|
c.tmp.Controls.Add(c.Name = new AdvancedGradientLabel(Globals.DefaultFont)
|
||||||
c.tmp.Controls.Add(c.Name = new(Globals.DefaultFont)
|
|
||||||
{
|
{
|
||||||
Text = cat.Name,
|
Text = cat.Name,
|
||||||
|
Colors = cat.Colors.ToColor4Array(),
|
||||||
IgnoreHover = true
|
IgnoreHover = true
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
c.Clicked += c.AllOnClicked;
|
c.Clicked += c.AllOnClicked;
|
||||||
c.Name.Location = new(26.ScaleInt(), (((c.Size.Y - c.Name.Size.Y)/2)), 0);
|
c.Name.Location = new(26.ScaleInt(), (((c.Size.Y - c.Name.Size.Y)/2)), 0);
|
@ -3,13 +3,14 @@ using GraphicsManager.Interfaces;
|
|||||||
using GraphicsManager.Objects;
|
using GraphicsManager.Objects;
|
||||||
using GraphicsManager.Objects.Core;
|
using GraphicsManager.Objects.Core;
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||||
|
using Luski.net.Enums;
|
||||||
using Luski.net.Structures.Public;
|
using Luski.net.Structures.Public;
|
||||||
using Luski.Shared.PublicServers.V1.Enums;
|
using Luski.Shared.PublicServers.V1.Enums;
|
||||||
using OpenTK.Graphics.OpenGL4;
|
using OpenTK.Graphics.OpenGL4;
|
||||||
using OpenTK.Mathematics;
|
using OpenTK.Mathematics;
|
||||||
using OpenTK.Windowing.Common.Input;
|
using OpenTK.Windowing.Common.Input;
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.Generic;
|
namespace Luski.GUI.MainScreen.UI.PublicServers;
|
||||||
|
|
||||||
public class Channel : UserControl
|
public class Channel : UserControl
|
||||||
{
|
{
|
||||||
@ -41,11 +42,24 @@ public class Channel : UserControl
|
|||||||
r.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context];
|
r.Shader = Rectangle.DefaultAlphaTextureShader[Globals.ms.Context];
|
||||||
Controls.Add(r);
|
Controls.Add(r);
|
||||||
|
|
||||||
ChannelName = new(Globals.DefaultFont)
|
if (chan.ColorType == ColorType.Full)
|
||||||
|
{
|
||||||
|
ChannelName = new Label(Globals.DefaultFont)
|
||||||
{
|
{
|
||||||
Text = chan.Name,
|
Text = chan.Name,
|
||||||
|
Color = chan.Colors[0].ToColor4(),
|
||||||
IgnoreHover = true
|
IgnoreHover = true
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChannelName = new AdvancedGradientLabel(Globals.DefaultFont)
|
||||||
|
{
|
||||||
|
Text = chan.Name,
|
||||||
|
Colors = chan.Colors.ToColor4Array(),
|
||||||
|
IgnoreHover = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Controls.Add(ChannelName);
|
Controls.Add(ChannelName);
|
||||||
Clicked += AllOnClicked;
|
Clicked += AllOnClicked;
|
||||||
@ -66,11 +80,24 @@ public class Channel : UserControl
|
|||||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
||||||
int i = 4.ScaleInt();
|
int i = 4.ScaleInt();
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
ChannelName = new(Globals.DefaultFont)
|
if (chan.ColorType == ColorType.Full)
|
||||||
|
{
|
||||||
|
ChannelName = new Label(Globals.DefaultFont)
|
||||||
{
|
{
|
||||||
Text = chan.Name,
|
Text = chan.Name,
|
||||||
|
Color = chan.Colors[0].ToColor4(),
|
||||||
IgnoreHover = true
|
IgnoreHover = true
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChannelName = new AdvancedGradientLabel(Globals.DefaultFont)
|
||||||
|
{
|
||||||
|
Text = chan.Name,
|
||||||
|
Colors = chan.Colors.ToColor4Array(),
|
||||||
|
IgnoreHover = true
|
||||||
|
};
|
||||||
|
}
|
||||||
Controls.Add(ChannelName);
|
Controls.Add(ChannelName);
|
||||||
Clicked += AllOnClicked;
|
Clicked += AllOnClicked;
|
||||||
ChannelName.Location = new(i,
|
ChannelName.Location = new(i,
|
||||||
@ -105,19 +132,19 @@ public class Channel : UserControl
|
|||||||
CS.Selected = this;
|
CS.Selected = this;
|
||||||
IReadOnlyList<SocketMessage> m;
|
IReadOnlyList<SocketMessage> m;
|
||||||
m = await CurrentChannel.GetMessages(CancellationToken.None, Globals.Settings.LoadPerChannel);
|
m = await CurrentChannel.GetMessages(CancellationToken.None, Globals.Settings.LoadPerChannel);
|
||||||
Globals.ms.ChatBoxArea.ClearChat();
|
Globals.ms.pc.ClearChat();
|
||||||
await Globals.ms.ChatBoxArea.LoadChannel(CurrentChannel);
|
await Globals.ms.pc.LoadChannel(CurrentChannel);
|
||||||
mm = Globals.ms.ChatBoxArea.AddMessages(m);
|
mm = Globals.ms.pc.AddMessages(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mm is not null)
|
if (mm is not null)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Waiting");
|
Console.WriteLine("Waiting");
|
||||||
Task.WaitAll(mm);
|
Task.WaitAll(mm);
|
||||||
Globals.ms.ChatBoxArea.MessageFlow.ForceScrollUpdate();
|
Globals.ms.pc.MessageFlow.ForceScrollUpdate();
|
||||||
if (Globals.ms.ChatBoxArea.MessageFlow.Controls.Length > 1 && Globals.ms.ChatBoxArea.MessageFlow.Controls[Globals.ms.ChatBoxArea.MessageFlow.Controls.Length - 1].Location.Y + Globals.ms.ChatBoxArea.MessageFlow.Controls[Globals.ms.ChatBoxArea.MessageFlow.Controls.Length - 1].Size.Y > Globals.ms.ChatBoxArea.MessageFlow.Size.Y)
|
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.ChatBoxArea.MessageFlow.ScrollToBottom();
|
Globals.ms.pc.MessageFlow.ScrollToBottom();
|
||||||
else Globals.ms.ChatBoxArea.MessageFlow.ScrollToTop();
|
else Globals.ms.pc.MessageFlow.ScrollToTop();
|
||||||
Console.WriteLine("Done");
|
Console.WriteLine("Done");
|
||||||
}
|
}
|
||||||
BlockDraw = false;
|
BlockDraw = false;
|
||||||
@ -128,7 +155,7 @@ public class Channel : UserControl
|
|||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public LuskiLabel ChannelName;
|
public LabelBase ChannelName;
|
||||||
public Rectangle r;
|
public Rectangle r;
|
||||||
|
|
||||||
public static async Task<Channel> MakeChannel(SocketChannel chan, ChannelSelector cs)
|
public static async Task<Channel> MakeChannel(SocketChannel chan, ChannelSelector cs)
|
@ -1,25 +1,32 @@
|
|||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using GraphicsManager.Enums;
|
||||||
using GraphicsManager.Interfaces;
|
using GraphicsManager.Interfaces;
|
||||||
using GraphicsManager.Objects;
|
using GraphicsManager.Objects;
|
||||||
using Luski.GUI.MainScreen.Interfaces;
|
using Luski.GUI.MainScreen.Interfaces;
|
||||||
using Luski.GUI.MainScreen.UI.PublicServers;
|
|
||||||
using Luski.net.Structures.Public;
|
using Luski.net.Structures.Public;
|
||||||
using Luski.Shared.PublicServers.V1.Enums;
|
using Luski.Shared.PublicServers.V1.Enums;
|
||||||
|
using OpenTK.Mathematics;
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.Generic;
|
namespace Luski.GUI.MainScreen.UI.PublicServers;
|
||||||
|
|
||||||
public class ChannelSelector : FlowLayout, IChannelAdder
|
public class ChannelSelector : FlowLayout, IChannelAdder
|
||||||
{
|
{
|
||||||
public SocketCategory CurrentCategory { get; private set; }
|
public SocketCategory CurrentCategory { get; }
|
||||||
private readonly List<Category> cc = new();
|
private readonly List<Category> cc = new();
|
||||||
private readonly List<Channel> LoadedChannels = new();
|
private readonly List<Channel> LoadedChannels = new();
|
||||||
public Dictionary<long, IChannelAdder> ChannelAdders = new();
|
public Dictionary<long, IChannelAdder> ChannelAdders = new();
|
||||||
public Channel? Selected;
|
public Channel? Selected;
|
||||||
|
|
||||||
public async Task LoadSelectorRoot(SocketCategory Cat)
|
private ChannelSelector(SocketCategory Cat)
|
||||||
{
|
{
|
||||||
CurrentCategory = Cat;
|
CurrentCategory = Cat;
|
||||||
ChannelAdders.Add(Cat.ID, this);
|
ChannelAdders.Add(Cat.ID, this);
|
||||||
Cat.Server.MessageReceived += ServerOnMessageReceived;
|
Cat.Server.MessageReceived += ServerOnMessageReceived;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<ChannelSelector> MakeSelector(SocketCategory Cat)
|
||||||
|
{
|
||||||
|
ChannelSelector cs = new(Cat);
|
||||||
bool MakeChannels = await Cat.Server.User.HasAccessToCategory(Cat, ServerPermission.CreateChannels);
|
bool MakeChannels = await Cat.Server.User.HasAccessToCategory(Cat, ServerPermission.CreateChannels);
|
||||||
bool MakeRoles = await Cat.Server.User.HasPermissions(ServerPermission.ManageRoles);
|
bool MakeRoles = await Cat.Server.User.HasPermissions(ServerPermission.ManageRoles);
|
||||||
if (MakeChannels || MakeRoles)
|
if (MakeChannels || MakeRoles)
|
||||||
@ -28,15 +35,17 @@ public class ChannelSelector : FlowLayout, IChannelAdder
|
|||||||
if (MakeChannels)
|
if (MakeChannels)
|
||||||
{
|
{
|
||||||
Label l = lcm.AddLabel("Create Channel");
|
Label l = lcm.AddLabel("Create Channel");
|
||||||
l.Clicked += LOnClicked;
|
l.Clicked += cs.LOnClicked;
|
||||||
}
|
}
|
||||||
if (MakeRoles)
|
if (MakeRoles)
|
||||||
{
|
{
|
||||||
Label l = lcm.AddLabel("Create Role");
|
Label l = lcm.AddLabel("Create Role");
|
||||||
l.Clicked += RLOnClicked;
|
l.Clicked += cs.RLOnClicked;
|
||||||
}
|
}
|
||||||
ContextMenu = lcm;
|
cs.ContextMenu = lcm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RLOnClicked(IRenderObject arg)
|
private async Task RLOnClicked(IRenderObject arg)
|
||||||
@ -54,8 +63,8 @@ public class ChannelSelector : FlowLayout, IChannelAdder
|
|||||||
private async Task ServerOnMessageReceived(SocketMessage arg)
|
private async Task ServerOnMessageReceived(SocketMessage arg)
|
||||||
{
|
{
|
||||||
if (Selected is null || arg.ChannelID != Selected.CurrentChannel.ID) return;
|
if (Selected is null || arg.ChannelID != Selected.CurrentChannel.ID) return;
|
||||||
bool u = Globals.ms.ChatBoxArea.MessageFlow.MaxScrollValue == Globals.ms.ChatBoxArea.MessageFlow.ScrollValue;
|
bool u = Globals.ms.pc.MessageFlow.MaxScrollValue == Globals.ms.pc.MessageFlow.ScrollValue;
|
||||||
await Globals.ms.ChatBoxArea.AddMessage(arg, u);
|
await Globals.ms.pc.AddMessage(arg, u);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -34,15 +34,22 @@ public class ChatMessage : UserControl
|
|||||||
{
|
{
|
||||||
SocketUser auth = (SocketUser)(await message.GetAuthor(CancellationToken.None));
|
SocketUser auth = (SocketUser)(await message.GetAuthor(CancellationToken.None));
|
||||||
ServerProfile prof = await message.GetProfile(CancellationToken.None);
|
ServerProfile prof = await message.GetProfile(CancellationToken.None);
|
||||||
Role r = (await ((SocketUser)await message.GetAuthor(CancellationToken.None)).GetRoles())[0];
|
Color[]? c = await prof.GetColors();
|
||||||
return new ChatMessage(p, message, await message.GetParent(CancellationToken.None), prof, await prof.MakeRct(auth, new(40.ScaleInt())), r);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ChatMessage(PublicChat p, SocketMessage message, SocketChannel chan, ServerProfile Author, IRenderObject UserIcon, Role r)
|
private ChatMessage(PublicChat p, SocketMessage message, SocketChannel chan, ServerProfile Author, IRenderObject UserIcon, ColorType ct, Color4[] UserNameColor)
|
||||||
{
|
{
|
||||||
pc = p;
|
pc = p;
|
||||||
LuskiLabel label1;
|
LabelBase label1;
|
||||||
base.SetSize(723.5.ScaleInt(), 37.ScaleInt());
|
base.SetSize(723.5.ScaleInt(), 37.ScaleInt());
|
||||||
ch = chan;
|
ch = chan;
|
||||||
base.BackgroundColor = new(40, 40, 40, 255);
|
base.BackgroundColor = new(40, 40, 40, 255);
|
||||||
@ -85,16 +92,8 @@ public class ChatMessage : UserControl
|
|||||||
|
|
||||||
UserIcon.Location = new(10.ScaleInt(), 2.ScaleInt(), 0);
|
UserIcon.Location = new(10.ScaleInt(), 2.ScaleInt(), 0);
|
||||||
Controls.Add(UserIcon);
|
Controls.Add(UserIcon);
|
||||||
string name = Author.DisplayName;
|
if (ct == ColorType.Full) Controls.Add(label1 = new Label(Globals.DefaultFont) { Color = UserNameColor[0], Text = Author.DisplayName });
|
||||||
if (r.ColorType == ColorType.Full)
|
else Controls.Add(label1 = new AdvancedGradientLabel(Globals.DefaultFont) { Colors = UserNameColor, Text = Author.DisplayName });
|
||||||
{
|
|
||||||
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(
|
label1.Location = new(
|
||||||
54.ScaleInt(),
|
54.ScaleInt(),
|
||||||
UserIcon.Location.Y,
|
UserIcon.Location.Y,
|
||||||
@ -102,11 +101,11 @@ public class ChatMessage : UserControl
|
|||||||
Label label2;
|
Label label2;
|
||||||
LastObject = label1;
|
LastObject = label1;
|
||||||
FirstL = label1;
|
FirstL = label1;
|
||||||
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});
|
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});
|
||||||
if (!string.IsNullOrWhiteSpace(Msg.Context))
|
if (!string.IsNullOrWhiteSpace(Msg.Context))
|
||||||
{
|
{
|
||||||
LuskiLabel l;
|
Label 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});
|
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;
|
LastObject = l;
|
||||||
LuskiContextMenu lcm = new();
|
LuskiContextMenu lcm = new();
|
||||||
Label llllll = lcm.AddLabel("Copy Text");
|
Label llllll = lcm.AddLabel("Copy Text");
|
||||||
@ -119,6 +118,10 @@ public class ChatMessage : UserControl
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
l.ContextMenu = lcm;
|
l.ContextMenu = lcm;
|
||||||
|
if (Msg.Context == "test message with picture")
|
||||||
|
{
|
||||||
|
//Console.WriteLine(Msg.FileIDs.Length);
|
||||||
|
}
|
||||||
MessageObjs.Add(l);
|
MessageObjs.Add(l);
|
||||||
}
|
}
|
||||||
Globals.Settings.DayTimeChanged += () =>
|
Globals.Settings.DayTimeChanged += () =>
|
||||||
|
@ -20,8 +20,7 @@ public class PublicChat : UserControl
|
|||||||
{
|
{
|
||||||
|
|
||||||
public FlowLayout MessageFlow;
|
public FlowLayout MessageFlow;
|
||||||
private Label desc;
|
private LabelBase title, desc;
|
||||||
private LuskiLabel title;
|
|
||||||
private TextBox tb;
|
private TextBox tb;
|
||||||
private SocketChannel? Channel;
|
private SocketChannel? Channel;
|
||||||
UserControl titlecon;
|
UserControl titlecon;
|
||||||
@ -74,11 +73,11 @@ public class PublicChat : UserControl
|
|||||||
|
|
||||||
|
|
||||||
titlecon.ForceDistanceUpdate(this);
|
titlecon.ForceDistanceUpdate(this);
|
||||||
titlecon.Controls.Add(title = new(Globals.DefaultFont)
|
titlecon.Controls.Add(title = new Label(Globals.DefaultFont)
|
||||||
{
|
{
|
||||||
//Location = new(
|
//Location = new(
|
||||||
});
|
});
|
||||||
titlecon.Controls.Add(desc = new(Globals.DefaultFont)
|
titlecon.Controls.Add(desc = new Label(Globals.DefaultFont)
|
||||||
{
|
{
|
||||||
Color = new(161,161,161,255),
|
Color = new(161,161,161,255),
|
||||||
Location = new(title.Location.X + title.Size.X + 5, title.Location.Y, 0)
|
Location = new(title.Location.X + title.Size.X + 5, title.Location.Y, 0)
|
||||||
@ -428,6 +427,30 @@ public class PublicChat : UserControl
|
|||||||
await UserConOnClicked(UserCon!);
|
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;
|
title.Text = channel.Name;
|
||||||
var five = 5.ScaleInt();
|
var five = 5.ScaleInt();
|
||||||
title.Location = new(five + five,
|
title.Location = new(five + five,
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using GraphicsManager.Interfaces;
|
using GraphicsManager.Interfaces;
|
||||||
using GraphicsManager.Objects;
|
using GraphicsManager.Objects;
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
|
||||||
using Luski.net.Structures.Public;
|
using Luski.net.Structures.Public;
|
||||||
using Luski.Shared.PublicServers.V1.Enums;
|
|
||||||
using OpenTK.Mathematics;
|
using OpenTK.Mathematics;
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.PublicServers.ServerSettings.Pages.Server.Roles;
|
namespace Luski.GUI.MainScreen.UI.PublicServers.ServerSettings.Pages.Server.Roles;
|
||||||
@ -17,9 +15,9 @@ public class RoleMember : UserControl
|
|||||||
int val = 8.ScaleInt();
|
int val = 8.ScaleInt();
|
||||||
icon.Result.Location = new(val, val, 0);
|
icon.Result.Location = new(val, val, 0);
|
||||||
Controls.Add(icon.Result);
|
Controls.Add(icon.Result);
|
||||||
LuskiLabel dn = new(Globals.DefaultFont)
|
Label dn = new(Globals.DefaultFont)
|
||||||
{
|
{
|
||||||
Text = u.ToDisplayString(p)
|
Text = p.DisplayName
|
||||||
};
|
};
|
||||||
Controls.Add(dn);
|
Controls.Add(dn);
|
||||||
|
|
||||||
|
@ -30,13 +30,14 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
|||||||
base.BackgroundColor = new(0, 0, 0, 130);
|
base.BackgroundColor = new(0, 0, 0, 130);
|
||||||
Anchor = ObjectAnchor.All;
|
Anchor = ObjectAnchor.All;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Form = new(Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png"))
|
Form = new(Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png"))
|
||||||
{
|
{
|
||||||
Size = new(350.ScaleInt(), 347.ScaleInt()),
|
Size = new(350.ScaleInt(), 347.ScaleInt()),
|
||||||
BackgroundColor = new(32,32,32,255),
|
BackgroundColor = new(32,32,32,255),
|
||||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||||
TextureDisplay = TextureDisplay.Center,
|
TextureDisplay = TextureDisplay.Center
|
||||||
Anchor = ObjectAnchor.Prevent
|
|
||||||
};
|
};
|
||||||
Label t;
|
Label t;
|
||||||
Form.Controls.Add(t=new Label(Globals.DefaultFont) { Scale = 1.6f, Text = "Server Login", Color = Globals.DodgerBlue });
|
Form.Controls.Add(t=new Label(Globals.DefaultFont) { Scale = 1.6f, Text = "Server Login", Color = Globals.DodgerBlue });
|
||||||
@ -199,8 +200,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
|||||||
Size = new(page.Size.X, 30.ScaleInt()),
|
Size = new(page.Size.X, 30.ScaleInt()),
|
||||||
WatermarkText = "Username",
|
WatermarkText = "Username",
|
||||||
TextLocation = TextLocation.LineCenter,
|
TextLocation = TextLocation.LineCenter,
|
||||||
AllowMultiLine = false,
|
AllowMultiLine = false
|
||||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Right
|
|
||||||
});
|
});
|
||||||
UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
|
UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
|
||||||
UserName.KeyPress += args =>
|
UserName.KeyPress += args =>
|
||||||
@ -360,8 +360,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
|||||||
Size = new(page.Size.X, 31.ScaleInt()),
|
Size = new(page.Size.X, 31.ScaleInt()),
|
||||||
WatermarkText = "Username",
|
WatermarkText = "Username",
|
||||||
TextLocation = TextLocation.LineCenter,
|
TextLocation = TextLocation.LineCenter,
|
||||||
AllowMultiLine = false,
|
AllowMultiLine = false
|
||||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Right
|
|
||||||
});
|
});
|
||||||
UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
|
UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
|
||||||
UserName.KeyPress += args =>
|
UserName.KeyPress += args =>
|
||||||
@ -406,8 +405,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
|||||||
WatermarkText = "Password",
|
WatermarkText = "Password",
|
||||||
TextLocation = TextLocation.LineCenter,
|
TextLocation = TextLocation.LineCenter,
|
||||||
AllowMultiLine = false,
|
AllowMultiLine = false,
|
||||||
PasswordChar = '●',
|
PasswordChar = '●'
|
||||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Right
|
|
||||||
});
|
});
|
||||||
Password.Textures[0] = UserName.Textures[0];
|
Password.Textures[0] = UserName.Textures[0];
|
||||||
Password.KeyPress += args =>
|
Password.KeyPress += args =>
|
||||||
@ -465,8 +463,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
|||||||
page = new()
|
page = new()
|
||||||
{
|
{
|
||||||
Location = new(tb.Location.X, ca.Location.Y + ca.Size.Y + tb.Location.X, 0),
|
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);
|
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);
|
Form.Controls.Add(page);
|
||||||
@ -475,15 +472,13 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
|||||||
{
|
{
|
||||||
Location = new(page.Location.X, page.Location.Y + page.Size.Y + tb.Location.X, 0),
|
Location = new(page.Location.X, page.Location.Y + page.Size.Y + tb.Location.X, 0),
|
||||||
Size = new(page.Size.X, ca.Size.Y),
|
Size = new(page.Size.X, ca.Size.Y),
|
||||||
TextureDisplay = TextureDisplay.Center,
|
TextureDisplay = TextureDisplay.Center
|
||||||
Anchor = ObjectAnchor.All
|
|
||||||
};
|
};
|
||||||
_ = lo.ToggleSelected();
|
_ = lo.ToggleSelected();
|
||||||
Label sub = new(Globals.DefaultFont)
|
Label sub = new(Globals.DefaultFont)
|
||||||
{
|
{
|
||||||
Text = "Submit",
|
Text = "Submit",
|
||||||
IgnoreHover = true,
|
IgnoreHover = true
|
||||||
Anchor = ObjectAnchor.All
|
|
||||||
};
|
};
|
||||||
sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2),
|
sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2),
|
||||||
((btn.Size.Y - sub.Size.Y) / 2)
|
((btn.Size.Y - sub.Size.Y) / 2)
|
||||||
|
@ -6,7 +6,6 @@ using GraphicsManager.Interfaces;
|
|||||||
using GraphicsManager.Objects;
|
using GraphicsManager.Objects;
|
||||||
using GraphicsManager.Objects.Core;
|
using GraphicsManager.Objects.Core;
|
||||||
using Luski.GUI.MainScreen.UI;
|
using Luski.GUI.MainScreen.UI;
|
||||||
using Luski.GUI.MainScreen.UI.Generic;
|
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||||
using Luski.GUI.MainScreen.UI.LuskiSettings;
|
using Luski.GUI.MainScreen.UI.LuskiSettings;
|
||||||
using Luski.GUI.MainScreen.UI.PublicServers;
|
using Luski.GUI.MainScreen.UI.PublicServers;
|
||||||
@ -37,7 +36,7 @@ public class MainScreenWindow : Window
|
|||||||
APIVersion = new Version(3, 2),
|
APIVersion = new Version(3, 2),
|
||||||
API = ContextAPI.OpenGL,
|
API = ContextAPI.OpenGL,
|
||||||
StartFocused = true,
|
StartFocused = true,
|
||||||
ClientSize = new Vector2i(624, 1090),
|
Size = new Vector2i(624, 1090),
|
||||||
Icon = Globals.Icon,
|
Icon = Globals.Icon,
|
||||||
SharedContext = null,
|
SharedContext = null,
|
||||||
};
|
};
|
||||||
@ -121,6 +120,7 @@ public class MainScreenWindow : Window
|
|||||||
ShowMissingChar = true;
|
ShowMissingChar = true;
|
||||||
LogFrames = ((Globals.Settings.Logs & ConsoleLog.DrawFrames) == ConsoleLog.DrawFrames);
|
LogFrames = ((Globals.Settings.Logs & ConsoleLog.DrawFrames) == ConsoleLog.DrawFrames);
|
||||||
VSync = VSyncMode.On;
|
VSync = VSyncMode.On;
|
||||||
|
|
||||||
GL.DebugMessageCallback(DebugMessageDelegate, IntPtr.Zero);
|
GL.DebugMessageCallback(DebugMessageDelegate, IntPtr.Zero);
|
||||||
GL.Enable(EnableCap.DebugOutput);
|
GL.Enable(EnableCap.DebugOutput);
|
||||||
GLFW.SetErrorCallback(GLFW_Error);
|
GLFW.SetErrorCallback(GLFW_Error);
|
||||||
@ -150,6 +150,7 @@ public class MainScreenWindow : Window
|
|||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Globals.DefaultFont.PixelHeight = Globals.Settings.DefaultFontPX.ScaleFont();
|
Globals.DefaultFont.PixelHeight = Globals.Settings.DefaultFontPX.ScaleFont();
|
||||||
Globals.DefaultFont.FontSize = FontSize.Regular;
|
Globals.DefaultFont.FontSize = FontSize.Regular;
|
||||||
Globals.TopTimeFont = Globals.DefaultFont.Clone();
|
Globals.TopTimeFont = Globals.DefaultFont.Clone();
|
||||||
@ -174,13 +175,10 @@ public class MainScreenWindow : Window
|
|||||||
CenterWindow();
|
CenterWindow();
|
||||||
}
|
}
|
||||||
WindowLoaded += OnWindowLoaded;
|
WindowLoaded += OnWindowLoaded;
|
||||||
BlockDraw = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnWindowLoaded(Window arg)
|
private async Task OnWindowLoaded(Window arg)
|
||||||
{
|
{
|
||||||
BlockDraw = false;
|
|
||||||
Console.WriteLine("start");
|
|
||||||
if (Globals.UpdaterSettings.AutoUpdateCheck && new HttpClient()
|
if (Globals.UpdaterSettings.AutoUpdateCheck && new HttpClient()
|
||||||
.GetAsync(
|
.GetAsync(
|
||||||
$"https://www.jacobtech.com/Updater/GetProgramVersion?directory=Luski&branch=main&selfcontained={Globals.UpdaterSettings.SelfContained.ToString().ToLower()}&platform={Globals.UpdaterSettings.Platform}")
|
$"https://www.jacobtech.com/Updater/GetProgramVersion?directory=Luski&branch=main&selfcontained={Globals.UpdaterSettings.SelfContained.ToString().ToLower()}&platform={Globals.UpdaterSettings.Platform}")
|
||||||
@ -198,10 +196,9 @@ public class MainScreenWindow : Window
|
|||||||
await LoginOnChangeToApp();
|
await LoginOnChangeToApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlowLayout ServerFlow;
|
public FlowLayout ser;
|
||||||
private UserControl SerBox, ServerTitle;
|
private UserControl? SerBox;
|
||||||
public PublicChat ChatBoxArea;
|
public PublicChat pc;
|
||||||
public ChannelSelector ChannelSelector;
|
|
||||||
|
|
||||||
public async Task LoadPublicServer(PublicServer? Server)
|
public async Task LoadPublicServer(PublicServer? Server)
|
||||||
{
|
{
|
||||||
@ -214,25 +211,38 @@ public class MainScreenWindow : Window
|
|||||||
ServerLoginOverlay SLO = new(Server.Domain);
|
ServerLoginOverlay SLO = new(Server.Domain);
|
||||||
Controls.Add(SLO);
|
Controls.Add(SLO);
|
||||||
ForceUpdate();
|
ForceUpdate();
|
||||||
|
Globals.PrintParent(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BlockDraw = true;
|
BlockDraw = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#region Control Removing
|
#region Box Init
|
||||||
|
|
||||||
|
if (SerBox is null)
|
||||||
|
{
|
||||||
|
SerBox = new()
|
||||||
|
{
|
||||||
|
Location = new(ser.Size.X, 0, 0),
|
||||||
|
Size = new(Size.X - ser.Size.X, CS.Y),
|
||||||
|
Anchor = ObjectAnchor.All,
|
||||||
|
BackgroundColor = new(20, 20, 20, 255)
|
||||||
|
};
|
||||||
|
Controls.Add(SerBox);
|
||||||
|
SerBox.LoadToParent(this, this);
|
||||||
|
}
|
||||||
|
|
||||||
ServerTitle.Controls.Clear();
|
|
||||||
ChannelSelector.Controls.Clear();
|
|
||||||
SerBox.Controls.Remove(ServerTitle, false);
|
|
||||||
SerBox.Controls.Remove(ChannelSelector, false);
|
|
||||||
SerBox.Controls.Clear();
|
SerBox.Controls.Clear();
|
||||||
SerBox.Controls.Add(ServerTitle);
|
|
||||||
SerBox.Controls.Add(ChannelSelector);
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Server Title
|
#region Server Title
|
||||||
|
|
||||||
|
UserControl ServerTitle = new()
|
||||||
|
{
|
||||||
|
Size = new(307.ScaleInt(), 46.ScaleInt()),
|
||||||
|
BackgroundColor = new(30, 30, 30, 255)
|
||||||
|
};
|
||||||
Label title = new(Globals.DefaultFont)
|
Label title = new(Globals.DefaultFont)
|
||||||
{
|
{
|
||||||
Text = Server.Name,
|
Text = Server.Name,
|
||||||
@ -270,55 +280,75 @@ public class MainScreenWindow : Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
parents.Reverse();
|
parents.Reverse();
|
||||||
await ChannelSelector.LoadSelectorRoot(parents[0]);
|
ChannelSelector cs = await ChannelSelector.MakeSelector(parents[0]);
|
||||||
|
cs.BackgroundColor = new(34, 34, 34, 255);
|
||||||
|
cs.Location = new(0, ServerTitle.Size.Y +2.ScaleInt(), 0);
|
||||||
|
cs.Size = new(ServerTitle.Size.X, SerBox.Size.Y - 54.ScaleInt() - cs.Location.Y);
|
||||||
|
cs.Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom;
|
||||||
|
|
||||||
parents.RemoveAt(0);
|
parents.RemoveAt(0);
|
||||||
|
SerBox.Controls.Add(cs);
|
||||||
|
cs.ForceDistanceUpdate(SerBox);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Chat Init
|
#region Chat Init
|
||||||
|
|
||||||
ChatBoxArea = new()
|
pc = new()
|
||||||
{
|
{
|
||||||
Anchor = ObjectAnchor.All,
|
Anchor = ObjectAnchor.All,
|
||||||
Location = new(ChannelSelector.Size.X, 0, 0),
|
Location = new(cs.Size.X, 0, 0),
|
||||||
Size = new(SerBox.Size.X - ChannelSelector.Size.X, SerBox.Size.Y),
|
Size = new(SerBox.Size.X - cs.Size.X, SerBox.Size.Y),
|
||||||
};
|
};
|
||||||
SerBox.Controls.Add(ChatBoxArea);
|
SerBox.Controls.Add(pc);
|
||||||
ChatBoxArea.LoadToParent(SerBox, this);
|
pc.LoadToParent(SerBox, this);
|
||||||
ChatBoxArea.ForceDistanceUpdate();
|
pc.ForceDistanceUpdate();
|
||||||
ChatBoxArea.MessageFlow.ForceDistanceUpdate(ChatBoxArea);
|
pc.MessageFlow.ForceDistanceUpdate(pc);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Channel Selector Loader
|
#region Channel Selector Loader
|
||||||
|
|
||||||
_ = ChannelSelector.Load(current_channel, parents);
|
_ = cs.Load(current_channel, parents);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region User Icon
|
#region User Icon
|
||||||
ServerProfile DefaultProfile = await Server.GetProfile(Server.User.ServerProfile, CancellationToken.None);
|
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()));
|
IRenderObject u = await DefaultProfile.MakeRct(Server.User, new(46.ScaleInt()));
|
||||||
int ii = 4.ScaleInt();
|
int ii = 4.ScaleInt();
|
||||||
u.Location = new(ii, ChannelSelector.Location.Y + ChannelSelector.Size.Y + ii, 0);
|
u.Location = new(ii, cs.Location.Y + cs.Size.Y + ii, 0);
|
||||||
u.Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left;
|
u.Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left;
|
||||||
SerBox.Controls.Add(u);
|
SerBox.Controls.Add(u);
|
||||||
u.LoadToParent(SerBox, this);
|
u.LoadToParent(SerBox, this);
|
||||||
u.ForceDistanceUpdate();
|
u.ForceDistanceUpdate();
|
||||||
string name = DefaultProfile.DisplayName;
|
LabelBase ul;
|
||||||
Role r = (await Server.User.GetRoles())[0];if (r.ColorType == ColorType.Full)
|
if (ct == ColorType.Full)
|
||||||
{
|
{
|
||||||
name = $"[color=\"{r.Colors[0].ToDatabaseStr()}\"]{name}[/color]";
|
ul = new Label(Globals.DefaultFont)
|
||||||
|
{
|
||||||
|
Anchor = u.Anchor,
|
||||||
|
Text = DefaultProfile.DisplayName,
|
||||||
|
Color = c[0].ToColor4()
|
||||||
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = $"[gradient colors=\"{r.Colors.ToDB()}\"]{name}[/gradient]";
|
ul = new AdvancedGradientLabel(Globals.DefaultFont)
|
||||||
}
|
|
||||||
LuskiLabel ul = new(Globals.DefaultFont)
|
|
||||||
{
|
{
|
||||||
Anchor = u.Anchor,
|
Anchor = u.Anchor,
|
||||||
Text = name,
|
Text = DefaultProfile.DisplayName,
|
||||||
|
Colors = c.ToColor4Array()
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
ul.Location = new(u.Location.X + u.Size.X + 5.ScaleInt(),
|
ul.Location = new(u.Location.X + u.Size.X + 5.ScaleInt(),
|
||||||
(u.Location.Y + ((u.Size.Y - ul.Size.Y) / 2)), 0);
|
(u.Location.Y + ((u.Size.Y - ul.Size.Y) / 2)), 0);
|
||||||
@ -348,12 +378,11 @@ public class MainScreenWindow : Window
|
|||||||
SerBox.Controls.Add(ul);
|
SerBox.Controls.Add(ul);
|
||||||
Rectangle setting = new(TextureManager.GetTextureResource("settings.png"))
|
Rectangle setting = new(TextureManager.GetTextureResource("settings.png"))
|
||||||
{
|
{
|
||||||
Location = new(ChannelSelector.Size.X - 40.ScaleInt(), ChannelSelector.Location.Y + ChannelSelector.Size.Y + 11.ScaleInt(),0),
|
Location = new(cs.Size.X - 40.ScaleInt(), cs.Location.Y + cs.Size.Y + 11.ScaleInt(),0),
|
||||||
Size = new(32.ScaleInt()),
|
Size = new(32.ScaleInt()),
|
||||||
Shader = Rectangle.DefaultAlphaShader[Context],
|
Shader = Rectangle.DefaultAlphaShader[Context],
|
||||||
BackgroundColor = Color4.Gray,
|
BackgroundColor = Color4.Gray,
|
||||||
Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left,
|
Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left
|
||||||
BlendOverride = true
|
|
||||||
};
|
};
|
||||||
setting.MouseEnter += _ =>
|
setting.MouseEnter += _ =>
|
||||||
{
|
{
|
||||||
@ -416,7 +445,7 @@ public class MainScreenWindow : Window
|
|||||||
ProfileFlow.Size = new((int)arg.SizeAsFloat.X, ProfileFlow.Size.Y + con.Size.Y);
|
ProfileFlow.Size = new((int)arg.SizeAsFloat.X, ProfileFlow.Size.Y + con.Size.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileFlow.Location = new(ServerFlow.Size.X + 5.ScaleInt(),
|
ProfileFlow.Location = new(ser.Size.X + 5.ScaleInt(),
|
||||||
CS.Y - 54.ScaleInt() - ProfileFlow.Size.Y,
|
CS.Y - 54.ScaleInt() - ProfileFlow.Size.Y,
|
||||||
0);
|
0);
|
||||||
Controls.Add(ProfileFlow);
|
Controls.Add(ProfileFlow);
|
||||||
@ -434,15 +463,10 @@ public class MainScreenWindow : Window
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private GlobalSettingsMenu? gsm;
|
|
||||||
|
|
||||||
private Task SettingOnClicked(IRenderObject arg)
|
private Task SettingOnClicked(IRenderObject arg)
|
||||||
{
|
{
|
||||||
if (gsm is null)
|
GlobalSettingsMenu sm = new();
|
||||||
{
|
Controls.Add(sm);
|
||||||
gsm = new GlobalSettingsMenu();
|
|
||||||
}
|
|
||||||
Controls.Add(gsm);
|
|
||||||
Globals.ms.DrawFrame();
|
Globals.ms.DrawFrame();
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@ -452,8 +476,8 @@ public class MainScreenWindow : Window
|
|||||||
if (SerBox is null)
|
if (SerBox is null)
|
||||||
SerBox = new()
|
SerBox = new()
|
||||||
{
|
{
|
||||||
Location = new(ServerFlow.Size.X, 0, 0),
|
Location = new(ser.Size.X, 0, 0),
|
||||||
Size = new(Size.X - ServerFlow.Size.X, Size.Y),
|
Size = new(Size.X - ser.Size.X, Size.Y),
|
||||||
Anchor = ObjectAnchor.All
|
Anchor = ObjectAnchor.All
|
||||||
};
|
};
|
||||||
Controls.Add(SerBox);
|
Controls.Add(SerBox);
|
||||||
@ -461,54 +485,10 @@ public class MainScreenWindow : Window
|
|||||||
SerBox.Controls.Clear();
|
SerBox.Controls.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnKeyDown(KeyboardKeyEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnKeyDown(e);
|
|
||||||
if (e.Key == Keys.F9)
|
|
||||||
{
|
|
||||||
Globals.PrintParent(this);
|
|
||||||
}
|
|
||||||
else if (e.Key == Keys.F10)
|
|
||||||
{
|
|
||||||
CheckParent(this);
|
|
||||||
}
|
|
||||||
else if (e.Key == Keys.F12)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Update Time: " + UpdateAdverage);
|
|
||||||
Console.WriteLine("Draw Time: " + DrawAdverage);
|
|
||||||
Console.WriteLine("Total Time: " + TotalAdverage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void CheckParent(IParent p, IRenderObject c, int xx, Vector3i di)
|
|
||||||
{
|
|
||||||
if (p.IgnoreVisForChildren || p.Controls.Length <= 1 || xx >= p.Controls.Length || !c.Visible || c is ILabel) return;
|
|
||||||
for (int i = xx; i > 0; i--)
|
|
||||||
{
|
|
||||||
if (!p.Controls[i].IsVisible ||
|
|
||||||
((p.Controls[i].Location.X + di.X >= c.Location.X && p.Controls[i].Location.X + p.Controls[i].Size.X + di.X - c.Size.X <= c.Location.X) &&
|
|
||||||
(p.Controls[i].Location.Y + di.Y >= c.Location.Y && p.Controls[i].Location.Y + p.Controls[i].Size.Y + di.X - c.Size.Y <= c.Location.Y)))
|
|
||||||
{
|
|
||||||
p.Controls[i].NotifiNotVisible();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (p.Controls[i] is IParent pp) CheckParent(pp, c, pp.Controls.Length-1, di + p.Controls[i].Location);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void CheckParent(IParent p)
|
|
||||||
{
|
|
||||||
for (int i = p.Controls.Length - 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
CheckParent(p, p.Controls[i], i-1, new());
|
|
||||||
if (p.Controls[i] is IParent pp) CheckParent(pp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<Task> LoginOnChangeToApp()
|
private async Task<Task> LoginOnChangeToApp()
|
||||||
{
|
{
|
||||||
Controls.Clear();
|
Controls.Clear();
|
||||||
//ForceUpdate();
|
ForceUpdate();
|
||||||
BlockDraw = true;
|
BlockDraw = true;
|
||||||
Title = "Luski";
|
Title = "Luski";
|
||||||
unsafe
|
unsafe
|
||||||
@ -527,162 +507,55 @@ public class MainScreenWindow : Window
|
|||||||
WindowBorder = WindowBorder.Resizable;
|
WindowBorder = WindowBorder.Resizable;
|
||||||
BackgroundColor = new Color4(20, 20, 20, 255);
|
BackgroundColor = new Color4(20, 20, 20, 255);
|
||||||
|
|
||||||
Controls.Add(ServerFlow = new FlowLayout()
|
Controls.Add(ser = new FlowLayout()
|
||||||
{
|
{
|
||||||
BackgroundColor = new(26, 26, 26, 255),
|
BackgroundColor = new(26, 26, 26, 255),
|
||||||
Size = new(68.ScaleInt(), CS.Y),
|
Size = new(68.ScaleInt(), CS.Y),
|
||||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom,
|
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom,
|
||||||
Location = new(0,0,0)
|
Location = new(0,0,0)
|
||||||
});
|
});
|
||||||
ServerFlow.ForceDistanceUpdate(this);
|
ser.ForceDistanceUpdate(this);
|
||||||
ServerFlow.LoadToParent(this,this);
|
ser.LoadToParent(this,this);
|
||||||
DrawFrame();
|
DrawFrame();
|
||||||
|
DateTime utcNow = DateTime.UtcNow;
|
||||||
SerBox = new()
|
|
||||||
{
|
|
||||||
Location = new(ServerFlow.Size.X, 0, 0),
|
|
||||||
Size = new(Size.X - ServerFlow.Size.X, CS.Y),
|
|
||||||
Anchor = ObjectAnchor.All,
|
|
||||||
BackgroundColor = new(20, 20, 20, 255)
|
|
||||||
};
|
|
||||||
Controls.Add(SerBox);
|
|
||||||
SerBox.LoadToParent(this, this);
|
|
||||||
|
|
||||||
ServerTitle = new()
|
|
||||||
{
|
|
||||||
Size = new(307.ScaleInt(), 46.ScaleInt()),
|
|
||||||
BackgroundColor = new(30, 30, 30, 255)
|
|
||||||
};
|
|
||||||
SerBox.Controls.Add(ServerTitle);
|
|
||||||
|
|
||||||
|
|
||||||
ChannelSelector = new()
|
|
||||||
{
|
|
||||||
BackgroundColor = new(34, 34, 34, 255),
|
|
||||||
Location = new(0, ServerTitle.Size.Y +2.ScaleInt(), 0),
|
|
||||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom
|
|
||||||
};
|
|
||||||
ChannelSelector.Size = new(ServerTitle.Size.X, SerBox.Size.Y - 54.ScaleInt() - ChannelSelector.Location.Y);
|
|
||||||
SerBox.Controls.Add(ChannelSelector);
|
|
||||||
ChannelSelector.ForceDistanceUpdate(SerBox);
|
|
||||||
|
|
||||||
Console.WriteLine("Waiting");
|
|
||||||
Task.WhenAll(Globals.ServersLoading.ToArray()).Wait();
|
Task.WhenAll(Globals.ServersLoading.ToArray()).Wait();
|
||||||
Console.WriteLine("Done waiting");
|
|
||||||
foreach (PublicServer pser in Globals.Luski.LoadedServers)
|
foreach (PublicServer pser in Globals.Luski.LoadedServers)
|
||||||
{
|
{
|
||||||
ServerIcon<PublicServer> si = new ServerIcon<PublicServer>(pser);
|
ServerIcon<PublicServer> si = new ServerIcon<PublicServer>(pser);
|
||||||
ServerFlow.Controls.Add(si);
|
ser.Controls.Add(si);
|
||||||
si.LoadToParent(ServerFlow, this);
|
si.LoadToParent(ser, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (PublicServer pser in Globals.Luski.FailedServers)
|
foreach (PublicServer pser in Globals.Luski.FailedServers)
|
||||||
{
|
{
|
||||||
Console.WriteLine(pser.Name);
|
Console.WriteLine(pser.Name);
|
||||||
ServerIcon<PublicServer> si = new ServerIcon<PublicServer>(pser, true);
|
ServerIcon<PublicServer> si = new ServerIcon<PublicServer>(pser, true);
|
||||||
ServerFlow.Controls.Add(si);
|
ser.Controls.Add(si);
|
||||||
si.LoadToParent(ServerFlow, this);
|
si.LoadToParent(ser, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddServerIcon asi = new();
|
AddServerIcon asi = new();
|
||||||
asi.Clicked += AddButtonClicked;
|
asi.Clicked += AddButtonClicked;
|
||||||
ServerFlow.Controls.Add(asi);
|
ser.Controls.Add(asi);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ServerFlow.Controls.Length > 1) (ServerFlow.Controls[0] as ServerIcon<PublicServer>)!.LoadServer().Start();
|
if (ser.Controls.Length > 1) (ser.Controls[0] as ServerIcon<PublicServer>)!.LoadServer().Start();
|
||||||
DrawFrame();
|
DrawFrame();
|
||||||
MainShow += OnMainShow;
|
MainShow += OnMainShow;
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ForceUpdate()
|
|
||||||
{
|
|
||||||
DateTime dt = DateTime.Now;
|
|
||||||
BlockDraw = true;
|
|
||||||
for (int i = 0; i < Controls.Length; i++)
|
|
||||||
{
|
|
||||||
if (!Controls[i].Loaded) continue;
|
|
||||||
bool top = (Controls[i].Anchor & ObjectAnchor.Top) == ObjectAnchor.Top;
|
|
||||||
bool left = (Controls[i].Anchor & ObjectAnchor.Left) == ObjectAnchor.Left;
|
|
||||||
bool right = (Controls[i].Anchor & ObjectAnchor.Right) == ObjectAnchor.Right;
|
|
||||||
bool bottom = (Controls[i].Anchor & ObjectAnchor.Bottom) == ObjectAnchor.Bottom;
|
|
||||||
if (!top && !bottom) { Controls[i].Anchor |= ObjectAnchor.Top; top = true; }
|
|
||||||
if (!left && !right) { Controls[i].Anchor |= ObjectAnchor.Left; left = true; }
|
|
||||||
|
|
||||||
int lx, ly, sy, sx;
|
|
||||||
bool UpdateDistance = false;
|
|
||||||
if ((Controls[i].Anchor & ObjectAnchor.PreventWidthChange) == ObjectAnchor.PreventWidthChange)
|
|
||||||
{
|
|
||||||
UpdateDistance = true;
|
|
||||||
lx = Controls[i].Location.X + ((CS.X - Controls[i].Distance.X - Controls[i].Size.X - Controls[i].Location.X) / 2);
|
|
||||||
sx = Controls[i].Size.X;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lx = (left ? Controls[i].Location.X : CS.X - Controls[i].Distance.X - Controls[i].Size.X);
|
|
||||||
sx = (right ? CS.X - Controls[i].Distance.X - lx : Controls[i].Size.X);
|
|
||||||
}
|
|
||||||
if ((Controls[i].Anchor & ObjectAnchor.PreventHeightChange) == ObjectAnchor.PreventHeightChange)
|
|
||||||
{
|
|
||||||
UpdateDistance = true;
|
|
||||||
ly = Controls[i].Location.Y + ((CS.Y - Controls[i].Distance.Y - Controls[i].Size.Y - Controls[i].Location.Y) / 2);
|
|
||||||
sy = Controls[i].Size.Y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ly = (top ? Controls[i].Location.Y : CS.Y - Controls[i].Distance.Y - Controls[i].Size.Y);
|
|
||||||
sy = (bottom ? CS.Y - Controls[i].Distance.Y - ly : Controls[i].Size.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
Controls[i].SetSize(sx, sy);
|
|
||||||
Controls[i].SetLocation(lx, ly);
|
|
||||||
if (UpdateDistance)
|
|
||||||
{
|
|
||||||
Controls[i].ForceDistanceUpdate(this);
|
|
||||||
}
|
|
||||||
if (Controls[i] is IParent parent)
|
|
||||||
{
|
|
||||||
parent.ParentResize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (UpdateAdverage is null) UpdateAdverage = DateTime.Now - dt;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateAdverage = new((UpdateAdverage.Value.Ticks + (DateTime.Now - dt).Ticks)/2);
|
|
||||||
}
|
|
||||||
DateTime dtt = DateTime.Now;
|
|
||||||
DrawFrame();
|
|
||||||
if (DrawAdverage is null || TotalAdverage is null)
|
|
||||||
{
|
|
||||||
DrawAdverage = DateTime.Now - dtt;
|
|
||||||
TotalAdverage = DateTime.Now - dt;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DrawAdverage = new((DrawAdverage.Value.Ticks + (DateTime.Now - dtt).Ticks)/2);
|
|
||||||
TotalAdverage = new((TotalAdverage.Value.Ticks + (DateTime.Now - dt).Ticks)/2);
|
|
||||||
}
|
|
||||||
BlockDraw = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private TimeSpan? UpdateAdverage, DrawAdverage, TotalAdverage;
|
|
||||||
|
|
||||||
|
|
||||||
private Task AddButtonClicked(IRenderObject arg)
|
private Task AddButtonClicked(IRenderObject arg)
|
||||||
{
|
{
|
||||||
CenterFullScreenBase aso = new(new AddServerOverlayForm())
|
AddServerOverlay aso = new();
|
||||||
{
|
|
||||||
AllowHoverFromBehind = false
|
|
||||||
};
|
|
||||||
//AddServerOverlayld aso = new();
|
|
||||||
aso.Clicked += AsoOnClicked;
|
aso.Clicked += AsoOnClicked;
|
||||||
Controls.Add(aso);
|
Controls.Add(aso);
|
||||||
|
|
||||||
aso.LoadToParent(this, this);
|
TryDraw();
|
||||||
GL.Scissor(0,0, CS.X, CS.Y);
|
OnResize(new(CS));
|
||||||
aso.Draw(0,0,0,0, CS.X, CS.Y);
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -691,8 +564,7 @@ public class MainScreenWindow : Window
|
|||||||
{
|
{
|
||||||
Globals.ms.Controls.Remove(arg);
|
Globals.ms.Controls.Remove(arg);
|
||||||
Globals.ms.DrawFrame();
|
Globals.ms.DrawFrame();
|
||||||
CenterFullScreenBase aso = (arg as CenterFullScreenBase)!;
|
AddServerOverlay aso = (arg as AddServerOverlay)!;
|
||||||
//AddServerOverlayld aso = (arg as AddServerOverlayld)!;
|
|
||||||
aso.Clicked -= AsoOnClicked;
|
aso.Clicked -= AsoOnClicked;
|
||||||
aso.Clean();
|
aso.Clean();
|
||||||
aso = null!;
|
aso = null!;
|
||||||
|
272
Luski/Globals.cs
272
Luski/Globals.cs
@ -1,8 +1,5 @@
|
|||||||
using System.CodeDom.Compiler;
|
using System.CodeDom.Compiler;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Numerics;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -14,7 +11,6 @@ using GraphicsManager.Interfaces;
|
|||||||
using GraphicsManager.Objects;
|
using GraphicsManager.Objects;
|
||||||
using GraphicsManager.Objects.Core;
|
using GraphicsManager.Objects.Core;
|
||||||
using Luski.Classes;
|
using Luski.Classes;
|
||||||
using Luski.Classes.Attribs.NumberSlider;
|
|
||||||
using Luski.Classes.ThemeSub;
|
using Luski.Classes.ThemeSub;
|
||||||
using Luski.GUI;
|
using Luski.GUI;
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||||
@ -110,7 +106,7 @@ public static class Globals
|
|||||||
for (int i = 0; i < p.Controls.Length; i++)
|
for (int i = 0; i < p.Controls.Length; i++)
|
||||||
{
|
{
|
||||||
if (p.Controls[i].IgnoreHover) continue;
|
if (p.Controls[i].IgnoreHover) continue;
|
||||||
Console.WriteLine(sp + p.Controls[i] + ": " + p.Controls[i].IsVisible + " " + p.Controls[i].Location + " " + (p.Controls[i].Location + l) + " "+ p.Controls[i].Size);
|
Console.WriteLine(sp + p.Controls[i] + ": " + p.Controls[i].Location + " " + (p.Controls[i].Location + l) + " "+ p.Controls[i].Size);
|
||||||
if (p.Controls[i] is IParent pp) PrintP(index + 1, pp, l + pp.Position);
|
if (p.Controls[i] is IParent pp) PrintP(index + 1, pp, l + pp.Position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,8 +269,7 @@ public static class Globals
|
|||||||
};
|
};
|
||||||
UserControl tc = new()
|
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;
|
Label l, ll;
|
||||||
int space = 5.ScaleInt();
|
int space = 5.ScaleInt();
|
||||||
@ -306,7 +301,7 @@ public static class Globals
|
|||||||
tc.SetSize(parent.Size.X, TempLine.Location.Y + TempLine.Size.Y);
|
tc.SetSize(parent.Size.X, TempLine.Location.Y + TempLine.Size.Y);
|
||||||
TempLine.ForceDistanceUpdate(tc);
|
TempLine.ForceDistanceUpdate(tc);
|
||||||
tc.Controls.Add(TempLine);
|
tc.Controls.Add(TempLine);
|
||||||
ts.ForceDistanceUpdate(tc);
|
//ts.ForceDistanceUpdate(tc);
|
||||||
ts.ValueChanged += @switch =>
|
ts.ValueChanged += @switch =>
|
||||||
{
|
{
|
||||||
a.Invoke(@switch.Value);
|
a.Invoke(@switch.Value);
|
||||||
@ -317,145 +312,6 @@ public static class Globals
|
|||||||
return tc;
|
return tc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UserControl AddNumberSlider<TNumber>(IParent parent, string Name, string description, TNumber defaul, TNumber min, TNumber val, TNumber max, Action<TNumber> a) where TNumber : INumber<TNumber>
|
|
||||||
{
|
|
||||||
NumberSelector<TNumber> NumberSelector = 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(NumberSelector);
|
|
||||||
NumberSelector.Location = new(5.ScaleInt(), l.Location.Y + l.Size.Y + space, 0);
|
|
||||||
|
|
||||||
Rectangle TempLine = new()
|
|
||||||
{
|
|
||||||
Location = new(0, NumberSelector.Location.Y + NumberSelector.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);
|
|
||||||
NumberSelector.SetSize(TempLine.Size.X, 0);
|
|
||||||
NumberSelector.SetLocation(TempLine.Location.X, NumberSelector.Location.Y);
|
|
||||||
NumberSelector.ForceDistanceUpdate(tc);
|
|
||||||
TempLine.ForceDistanceUpdate(tc);
|
|
||||||
tc.Controls.Add(TempLine);
|
|
||||||
NumberSelector.ValueChanged += @switch =>
|
|
||||||
{
|
|
||||||
a.Invoke(@switch.Value);
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
tc.ForceDistanceUpdate(parent);
|
|
||||||
parent.Controls.Add(tc);
|
|
||||||
return tc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UserControl AddNullNumberSlider<TNumber>(IParent parent, string Name, string description, TNumber defaul, TNumber min, TNumber? val, TNumber max, Action<TNumber?> a) where TNumber : struct, INumber<TNumber>
|
|
||||||
{
|
|
||||||
TNumber v = defaul;
|
|
||||||
if (val is not null) v = val.Value;
|
|
||||||
ToggleSwitch ts = new()
|
|
||||||
{
|
|
||||||
Value = val is not null,
|
|
||||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Right
|
|
||||||
};
|
|
||||||
NumberSelector<TNumber> NumberSelector = new()
|
|
||||||
{
|
|
||||||
Default = defaul,
|
|
||||||
Min = min,
|
|
||||||
Max = max,
|
|
||||||
Value = v,
|
|
||||||
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(parent.Size.X - ts.Size.X - 5.ScaleInt(), ll.Location.Y, 0);
|
|
||||||
tc.Controls.Add(NumberSelector);
|
|
||||||
NumberSelector.Location = new(5.ScaleInt(), l.Location.Y + l.Size.Y + space, 0);
|
|
||||||
|
|
||||||
Rectangle TempLine = new()
|
|
||||||
{
|
|
||||||
Location = new(0, NumberSelector.Location.Y + NumberSelector.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);
|
|
||||||
NumberSelector.SetSize(TempLine.Size.X, 0);
|
|
||||||
NumberSelector.SetLocation(TempLine.Location.X, NumberSelector.Location.Y);
|
|
||||||
NumberSelector.ForceDistanceUpdate(tc);
|
|
||||||
TempLine.ForceDistanceUpdate(tc);
|
|
||||||
tc.Controls.Add(TempLine);
|
|
||||||
ts.ForceDistanceUpdate(tc);
|
|
||||||
ts.ValueChanged += @switch =>
|
|
||||||
{
|
|
||||||
if (@switch.Value)
|
|
||||||
{
|
|
||||||
a.Invoke(defaul);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NumberSelector.Value = defaul;
|
|
||||||
a.Invoke(null);
|
|
||||||
}
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
NumberSelector.ValueChanged += @switch =>
|
|
||||||
{
|
|
||||||
a.Invoke(@switch.Value);
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
tc.ForceDistanceUpdate(parent);
|
|
||||||
parent.Controls.Add(tc);
|
|
||||||
return tc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddBool<TEnum>(IParent parent, Type t, TEnum e, bool s, Action<bool> a, List<Label>? List = null) where TEnum : Enum
|
public static void AddBool<TEnum>(IParent parent, Type t, TEnum e, bool s, Action<bool> a, List<Label>? List = null) where TEnum : Enum
|
||||||
{
|
{
|
||||||
MemberInfo? enumValueMemberInfo = GetMemberInfo(t, e);
|
MemberInfo? enumValueMemberInfo = GetMemberInfo(t, e);
|
||||||
@ -483,54 +339,7 @@ public static class Globals
|
|||||||
AddBool(parent, Name, description,s,a,List);
|
AddBool(parent, Name, description,s,a,List);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddNumberSlider<TNumber>(IParent parent, PropertyInfo t, TNumber s, Action<TNumber> a) where TNumber : INumber<TNumber>
|
public static TAttribute GetAttribute<TAttribute, TEnum>(Type t, TEnum e) where TAttribute : Attribute where TEnum : Enum
|
||||||
{
|
|
||||||
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<NumberDefault<TNumber>>().Default, t.GetAnyAttribute<NumberMin<TNumber>>().Min, s, t.GetAnyAttribute<NumberMax<TNumber>>().Max,a);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddNullNumberSlider<TNumber>(IParent parent, PropertyInfo t, TNumber? s, Action<TNumber?> a) where TNumber : struct, INumber<TNumber>
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
_ = AddNullNumberSlider(parent, Name, description, t.GetAnyAttribute<NumberDefault<TNumber>>().Default, t.GetAnyAttribute<NumberMin<TNumber>>().Min, s, t.GetAnyAttribute<NumberMax<TNumber>>().Max,a);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TAttribute GetAnyAttribute<TAttribute>(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<TAttribute>(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<TAttribute, TEnum>(this Type t, TEnum e) where TAttribute : Attribute where TEnum : Enum
|
|
||||||
{
|
{
|
||||||
MemberInfo? enumValueMemberInfo = GetMemberInfo(t, e);
|
MemberInfo? enumValueMemberInfo = GetMemberInfo(t, e);
|
||||||
object[] valueAttributes =
|
object[] valueAttributes =
|
||||||
@ -538,14 +347,6 @@ public static class Globals
|
|||||||
return (TAttribute)valueAttributes[0];
|
return (TAttribute)valueAttributes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TAttribute GetEnumAttribute<TAttribute, TEnum>(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<TAttribute, TEnum>(MemberInfo enumValueMemberInfo, TEnum e) where TAttribute : Attribute where TEnum : Enum
|
public static TAttribute GetAttribute<TAttribute, TEnum>(MemberInfo enumValueMemberInfo, TEnum e) where TAttribute : Attribute where TEnum : Enum
|
||||||
{
|
{
|
||||||
object[] valueAttributes =
|
object[] valueAttributes =
|
||||||
@ -583,7 +384,7 @@ public static class Globals
|
|||||||
StringBuilder sb = new();
|
StringBuilder sb = new();
|
||||||
foreach (Color c in col)
|
foreach (Color c in col)
|
||||||
{
|
{
|
||||||
sb.Append(c.ToDatabaseStr());
|
sb.Append(Convert.ToHexString(new byte[] { c.R, c.G, c.B, c.A }));
|
||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -618,36 +419,6 @@ public static class Globals
|
|||||||
|
|
||||||
public static ServerProfile? ServerProfile = null;
|
public static ServerProfile? ServerProfile = null;
|
||||||
|
|
||||||
public static string ToDisplayString(this ServerProfile profile)
|
|
||||||
{
|
|
||||||
return profile.DisplayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string ToDisplayString(this SocketUser user)
|
|
||||||
{
|
|
||||||
Task<ServerProfile> 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<Role[]> 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<IRenderObject> MakeRct<TUser>(this ServerProfile Profile, TUser User, Vector2i Size) where TUser : SocketUser
|
public static async Task<IRenderObject> MakeRct<TUser>(this ServerProfile Profile, TUser User, Vector2i Size) where TUser : SocketUser
|
||||||
{
|
{
|
||||||
Texture t = ms.TextureManager.GetTextureResource("Status.png");
|
Texture t = ms.TextureManager.GetTextureResource("Status.png");
|
||||||
@ -656,17 +427,44 @@ public static class Globals
|
|||||||
UserControl r = new(t);
|
UserControl r = new(t);
|
||||||
r.Size = Size;
|
r.Size = Size;
|
||||||
r.Shader = Rectangle.DefaultAlphaShader[ms.Context];
|
r.Shader = Rectangle.DefaultAlphaShader[ms.Context];
|
||||||
r.BackgroundColor = new(25, 25, 25, 255);
|
ColorType ct = await User.GetColorType();
|
||||||
LuskiLabel l = new(DefaultFont)
|
Color[] c = await User.GetColors();
|
||||||
|
ColorType? cct = await Profile.GetColorType();
|
||||||
|
Color[]? cc = await Profile.GetColors();
|
||||||
|
if (cc is not null)
|
||||||
{
|
{
|
||||||
Text = Profile.DisplayName[0].ToString(),
|
c = cc;
|
||||||
|
ct = cct!.Value;
|
||||||
|
}
|
||||||
|
r.BackgroundColor = new(25, 25, 25, 255);
|
||||||
|
if (ct == ColorType.Full)
|
||||||
|
{
|
||||||
|
Label l = new(DefaultFont)
|
||||||
|
{
|
||||||
|
Color = c[0].ToColor4()
|
||||||
};
|
};
|
||||||
|
l.Text = Profile.DisplayName[0].ToString();
|
||||||
Vector2i y = l.GetSizeOfChar(0),
|
Vector2i y = l.GetSizeOfChar(0),
|
||||||
yy = l.GetBearingOfChar(0);
|
yy = l.GetBearingOfChar(0);
|
||||||
l.Location = new((r.Size.X - l.Size.X)/2,
|
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)),
|
(int)(r.Size.Y - l.Font.PixelHeight + yy.Y - (r.Size.Y / 2) - (y.Y/2)),
|
||||||
0);
|
0);
|
||||||
r.Controls.Add(l);
|
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);
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="GraphicsManager" Version="1.1.0-alpha98" />
|
<PackageReference Include="GraphicsManager" Version="1.1.0-alpha50" />
|
||||||
<PackageReference Include="Luski.net" Version="2.0.1-alpha18" />
|
<PackageReference Include="Luski.net" Version="2.0.1-alpha15" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -48,8 +48,4 @@
|
|||||||
<ApplicationIcon>Luski.ico</ApplicationIcon>
|
<ApplicationIcon>Luski.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<InvariantGlobalization>true</InvariantGlobalization>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using Luski;
|
using Luski;
|
||||||
using Luski.Classes;
|
using Luski.Classes;
|
||||||
using Luski.GUI;
|
using Luski.GUI;
|
||||||
|
using OpenTK.Mathematics;
|
||||||
using OpenTK.Windowing.Common.Input;
|
using OpenTK.Windowing.Common.Input;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using SixLabors.ImageSharp.PixelFormats;
|
using SixLabors.ImageSharp.PixelFormats;
|
||||||
@ -9,6 +10,23 @@ using Image = OpenTK.Windowing.Common.Input.Image;
|
|||||||
|
|
||||||
try
|
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);
|
Globals.Settings = Globals.GetSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings);
|
||||||
foreach (ExperimentInfo le in LuskiExperiments.LuskiExperimentsList)
|
foreach (ExperimentInfo le in LuskiExperiments.LuskiExperimentsList)
|
||||||
{
|
{
|
||||||
@ -50,7 +68,6 @@ try
|
|||||||
switch (server.Main)
|
switch (server.Main)
|
||||||
{
|
{
|
||||||
case false:
|
case false:
|
||||||
// if (server.Domain == "jt.luskiserver.jacobtech.com") continue;
|
|
||||||
Globals.ServersLoading.Add(Task.Run(async () =>
|
Globals.ServersLoading.Add(Task.Run(async () =>
|
||||||
{
|
{
|
||||||
return await Globals.Luski.TryGetPublicServer(out _, server.Domain, server.Version,
|
return await Globals.Luski.TryGetPublicServer(out _, server.Domain, server.Version,
|
||||||
@ -73,11 +90,20 @@ try
|
|||||||
Globals.Icon = new WindowIcon(new Image(Logo.Width, Logo.Height, pixels));
|
Globals.Icon = new WindowIcon(new Image(Logo.Width, Logo.Height, pixels));
|
||||||
|
|
||||||
Logo.Dispose();
|
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;
|
MainScreenWindow.Settings.Icon = Globals.Icon;
|
||||||
Globals.ms = new MainScreenWindow();
|
Globals.ms = new MainScreenWindow();
|
||||||
Globals.ms.CustomF11 = false;
|
Globals.ms.CustomF11 = false;
|
||||||
//Globals.ms.DrawFrame();
|
Globals.ms.DrawFrame();
|
||||||
pixels = Array.Empty<byte>();
|
pixels = Array.Empty<byte>();
|
||||||
Globals.ms.StartRender();
|
Globals.ms.StartRender();
|
||||||
Globals.ms.Dispose();
|
Globals.ms.Dispose();
|
||||||
|
Loading…
Reference in New Issue
Block a user