dev #21

Merged
JacobTech merged 3 commits from dev into main 2024-08-27 11:00:45 -04:00
6 changed files with 36 additions and 8 deletions
Showing only changes of commit 2dee38084e - Show all commits

View File

@ -9,23 +9,30 @@ public enum ConsoleLog : long
None = 0, None = 0,
[Shared.GlobalAttributes.DisplayName("OpenGL Errors")] [Shared.GlobalAttributes.DisplayName("OpenGL Errors")]
[Description("Show OpenGL Major Errors")] [Description("Show OpenGL Major Errors")]
[Category("Rendering")]
BigErrosForOpenGL = 1, BigErrosForOpenGL = 1,
[Shared.GlobalAttributes.DisplayName("OpenGL Medium Errors")] [Shared.GlobalAttributes.DisplayName("OpenGL Medium Errors")]
[Description("Show OpenGL Medium Errors")] [Description("Show OpenGL Medium Errors")]
[Category("Rendering")]
MediumErrosForOpenGL = 2, MediumErrosForOpenGL = 2,
[Shared.GlobalAttributes.DisplayName("OpenGL Small Errors")] [Shared.GlobalAttributes.DisplayName("OpenGL Small Errors")]
[Description("Show OpenGL Small Errors")] [Description("Show OpenGL Small Errors")]
[Category("Rendering")]
LowErrosForOpenGL = 4, LowErrosForOpenGL = 4,
[Shared.GlobalAttributes.DisplayName("OpenGL Info")] [Shared.GlobalAttributes.DisplayName("OpenGL Info")]
[Description("Show OpenGL Info")] [Description("Show OpenGL Info")]
[Category("Rendering")]
InfoForOpenGL = 8, InfoForOpenGL = 8,
[Shared.GlobalAttributes.DisplayName("Log Frames")] [Shared.GlobalAttributes.DisplayName("Log Frames")]
[Description("Shows draw fram message in the console")] [Description("Shows draw fram message in the console")]
[Category("Rendering")]
DrawFrames = 16, DrawFrames = 16,
[Shared.GlobalAttributes.DisplayName("Show Missing Charters")] [Shared.GlobalAttributes.DisplayName("Show Missing Charters")]
[Description("Show Missing Charters")] [Description("Show Missing Charters")]
[Category("Rendering")]
ShowMissingChar = 32, ShowMissingChar = 32,
[Shared.GlobalAttributes.DisplayName("GLFW Errors")] [Shared.GlobalAttributes.DisplayName("GLFW Errors")]
[Description("Show GLFW Errors")] [Description("Show GLFW Errors")]
[Category("Rendering")]
ShowErrorsForGLFW = 64 ShowErrorsForGLFW = 64
} }

View File

@ -48,7 +48,7 @@ public class AdvancedGradientLabel : LabelBase
base.LoadToParent(window, win); base.LoadToParent(window, win);
} }
public override void Draw(int x, int y, int ww, int hh) public override void Draw(int x, int y, int sx, int sy, int sw, int sh)
{ {
if (Visible && Loaded && this.Font is not null && Colors.Length > 1) if (Visible && Loaded && this.Font is not null && Colors.Length > 1)
{ {

View File

@ -550,7 +550,7 @@ public class LuskiLabel : LabelBase
private List<SubHitBox> Links = new(); private List<SubHitBox> Links = new();
public override void Draw(int x, int y, int ww, int hh) public override void Draw(int x, int y, int sx, int sy, int sw, int sh)
{ {
if (Visible && Loaded) if (Visible && Loaded)
{ {

View File

@ -143,6 +143,7 @@ public class ServerRoleOptions : UserControl
NeedMax.Clear(); NeedMax.Clear();
Type PropType = typeof(ServerPermission); Type PropType = typeof(ServerPermission);
IEnumerable<ServerPermission> values = Enum.GetValues(PropType).Cast<ServerPermission>(); IEnumerable<ServerPermission> values = Enum.GetValues(PropType).Cast<ServerPermission>();
Dictionary<string, UserControl> Cats = new();
foreach (var val in values) foreach (var val in values)
{ {
try try
@ -150,10 +151,27 @@ public class ServerRoleOptions : UserControl
MemberInfo? enumValueMemberInfo = Globals.GetMemberInfo(PropType, val); MemberInfo? enumValueMemberInfo = Globals.GetMemberInfo(PropType, val);
string description = Globals.GetAttribute<DescriptionAttribute, ServerPermission>(enumValueMemberInfo!, val).Description; string description = Globals.GetAttribute<DescriptionAttribute, ServerPermission>(enumValueMemberInfo!, val).Description;
string Name = Globals.GetAttribute<DisplayNameAttribute, ServerPermission>(enumValueMemberInfo!, val).DisplayName; string Name = Globals.GetAttribute<DisplayNameAttribute, ServerPermission>(enumValueMemberInfo!, val).DisplayName;
string cat = Globals.GetAttribute<CategoryAttribute, ServerPermission>(enumValueMemberInfo!, val).Category;
if (cat.ToLower() == "internal") continue;
if (!Cats.ContainsKey(cat))
{
UserControl c = new UserControl()
{
BackgroundColor = Page.BackgroundColor,
Size = new(Page.Size.X, 50.ScaleInt())
};
Label tmp = new(Globals.DefaultFont)
{
Text = cat + " Permissions"
};
tmp.SetLocation(2.ScaleInt(), (int)((c.Size.Y - tmp.Font.PixelHeight)/2));
c.Controls.Add(tmp);
Page.Controls.Add(c);
Cats.Add(cat, c);
}
if (Name.ToLower() == "view this") continue; UserControl tc = Globals.AddBool(Cats[cat], Name, description + " in the server.", r.ServerPermissions.HasFlag(val), _ =>
Globals.AddBool(Page, Name, description + " in the server.", r.ServerPermissions.HasFlag(val), _ =>
{ {
TempPermissions ^= val; TempPermissions ^= val;
if (TempPermissions != r.ServerPermissions) if (TempPermissions != r.ServerPermissions)
@ -165,6 +183,8 @@ public class ServerRoleOptions : UserControl
Warning.Visible = false; Warning.Visible = false;
} }
}, NeedMax); }, NeedMax);
tc.SetLocation(tc.Location.X, Cats[cat].Size.Y);
Cats[cat].SetSize(Cats[cat].Size.X, Cats[cat].Size.Y + tc.Size.Y);
} }
catch catch

View File

@ -260,7 +260,7 @@ public static class Globals
public static API Luski { get; } = new(); public static API Luski { get; } = new();
public static MainScreenWindow ms; public static MainScreenWindow ms;
public static void AddBool(IParent parent, string Name, string description, bool s, Action<bool> a, List<Label>? List = null) public static UserControl AddBool(IParent parent, string Name, string description, bool s, Action<bool> a, List<Label>? List = null)
{ {
ToggleSwitch ts = new() ToggleSwitch ts = new()
{ {
@ -309,6 +309,7 @@ public static class Globals
}; };
tc.ForceDistanceUpdate(parent); tc.ForceDistanceUpdate(parent);
parent.Controls.Add(tc); 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

View File

@ -22,8 +22,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GraphicsManager" Version="1.1.0-alpha35" /> <PackageReference Include="GraphicsManager" Version="1.1.0-alpha50" />
<PackageReference Include="Luski.net" Version="2.0.1-alpha14" /> <PackageReference Include="Luski.net" Version="2.0.1-alpha15" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>