JacobTech 42b612bbc2 I did too much.
I was going to add a new munu to manage roles, but I got a bit carried away updating existing ones.
2024-05-13 11:47:29 -04:00

102 lines
4.1 KiB
C#

using GraphicsManager.Enums;
using GraphicsManager.Objects;
using Luski.Classes;
using Luski.GUI.MainScreen.UI.LuskiControls;
using Luski.GUI.MainScreen.UI.LuskiSettings.Core;
using Luski.GUI.MainScreen.UI.SettingsPanel;
using OpenTK.Mathematics;
namespace Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AppSettings;
public class Appearance : PageFlow
{
private DropDown<ThemeDropButton> ThemeDrop;
public Appearance()
{
PageName = "Appearance";
ThemeDropButton LightDD;
ThemeDrop = new(Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png"),new Rectangle()
{
Size = new(base.Size.X - 2, 1.ScaleInt()),
BackgroundColor = Color4.Gray,
Location = new(1, base.Size.Y - 1.ScaleInt(), 0),
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Bottom
}, LightDD = new(LuskiThemes.Light)
{
LoadDisplay = () =>
{
Label ll = new Label(Globals.DefaultFont)
{
Text = LuskiThemes.Light.Name,
Color = Color4.DarkGray,
IgnoreHover = true
};
ll.Location = new(10.ScaleInt(),
((ThemeDrop.Size.Y - ll.Size.Y) / 2)
, 0);
ThemeDrop.Controls.Add(ll);
},
Size = new(297.ScaleInt(), 40.ScaleInt()),
})
{
DropDownParentOverride = Globals.ms,
Size = new(40.ScaleInt()),
Location = new(5.ScaleInt(), 5.ScaleInt(), 0),
BackgroundColor = new(40, 40, 40, 255),
Anchor = ObjectAnchor.Right | ObjectAnchor.Left,};
foreach (ThemeStart themeStart in LuskiThemes.LuskiThemeList)
{
if (themeStart.Name == LuskiThemes.Light.Name) continue;
ThemeDropButton tdb;
ThemeDrop.AddOption(tdb = new(themeStart)
{
LoadDisplay = () =>
{
Label ll = new Label(Globals.DefaultFont)
{
Text = themeStart.Name,
Color = Color4.DarkGray,
IgnoreHover = true
};
ll.Location = new(10.ScaleInt(),
((ThemeDrop.Size.Y - ll.Size.Y) / 2)
, 0);
ThemeDrop.Controls.Add(ll);
},
Size = new(297.ScaleInt(), 40.ScaleInt()),
});
if (themeStart.Name == Globals.Settings.Theme) ThemeDrop.SetSelected(tdb);
}
ThemeDrop.DropDownContainer.Textures.Add(Globals.ms.TextureManager.GetTextureResource("RoundedRectangleBottom.png"));
ThemeDrop.DropDownContainer.TextureDisplay = TextureDisplay.Center;
ThemeDrop.DropDownContainer.Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
ThemeDrop.DropDownContainer.BackgroundColor = ThemeDrop.BackgroundColor;
Rectangle line = new()
{
Size = new(base.Size.X - 2, 1.ScaleInt()),
BackgroundColor = Color4.Gray,
Location = new(1, base.Size.Y - 1.ScaleInt(), 0),
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Bottom
};
ThemeDrop.OpenStatusChanged += b =>
{
BlockDraw = true;
Size = new(base.Size.X, base.Size.Y + ( b ? ThemeDrop.DropDownContainer.Size.Y : -1 * ThemeDrop.DropDownContainer.Size.Y));
line!.Location = new(line.Location.X,
line.Location.Y + (b ? ThemeDrop.DropDownContainer.Size.Y : -1 * ThemeDrop.DropDownContainer.Size.Y), 0);
if (b)
{
ThemeDrop.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangleTop.png");
}
else
{
ThemeDrop.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png");
}
BlockDraw = false;
return Task.CompletedTask;
};
Controls.Add(ThemeDrop);
}
}