Skip to content

Commit

Permalink
Add modern options gump to customizble UI system
Browse files Browse the repository at this point in the history
  • Loading branch information
bittiez committed Jan 27, 2024
1 parent a82396a commit 4e0f37e
Showing 1 changed file with 48 additions and 20 deletions.
68 changes: 48 additions & 20 deletions src/ClassicUO.Client/Game/UI/Gumps/ModernOptionsGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace ClassicUO.Game.UI.Gumps
Expand All @@ -31,6 +32,27 @@ internal class ModernOptionsGump : Gump
private Profile profile;
private ModernOptionsGumpLanguage lang;

private static ThemeSettings _settings;
private static ThemeSettings Theme
{
get
{
if (_settings == null)
{
_settings = (ThemeSettings)UISettings.Load<ThemeSettings>(typeof(ModernOptionsGump).ToString());
if (_settings == null)
{
_settings = new ThemeSettings();
ThemeSettings.Save<ThemeSettings>(typeof(ModernOptionsGump).ToString(), _settings);
}
return _settings;
}
else
{
return _settings;
}
}
}

public ModernOptionsGump() : base(0, 0)
{
Expand Down Expand Up @@ -6241,33 +6263,39 @@ public SettingsOption(string optionLabel, Control control, int maxTotalWidth, PA
public Area FullControl { get; }
}

private static class Theme
private class ThemeSettings : UISettings
{
public const int SLIDER_WIDTH = 150;
public const int COMBO_BOX_WIDTH = 225;
public const int SCROLL_BAR_WIDTH = 15;
public const int INPUT_WIDTH = 200;
public const int TOP_PADDING = 5;
public const int INDENT_SPACE = 40;
public const int BLANK_LINE = 20;
public const int HORIZONTAL_SPACING_CONTROLS = 20;
public int SLIDER_WIDTH { get; set; } = 150;
public int COMBO_BOX_WIDTH { get; set; } = 225;
public int SCROLL_BAR_WIDTH { get; set; } = 15;
public int INPUT_WIDTH { get; set; } = 200;
public int TOP_PADDING { get; set; } = 5;
public int INDENT_SPACE { get; set; } = 40;
public int BLANK_LINE { get; set; } = 20;
public int HORIZONTAL_SPACING_CONTROLS { get; set; } = 20;

public int STANDARD_TEXT_SIZE { get; set; } = 20;

public const int STANDARD_TEXT_SIZE = 20;
public float NO_MATCH_SEARCH { get; set; } = 0.5f;

public const float NO_MATCH_SEARCH = 0.5f;
public ushort BACKGROUND { get; set; } = 897;
public ushort SEARCH_BACKGROUND { get; set; } = 899;
public ushort BLACK { get; set; } = 0;

public const ushort BACKGROUND = 897;
public const ushort SEARCH_BACKGROUND = 899;
public const ushort BLACK = 0;
[JsonConverter(typeof(ColorJsonConverter))]
public Color DROPDOWN_OPTION_NORMAL_HUE { get; set; } = Color.White;
[JsonConverter(typeof(ColorJsonConverter))]

public static Color DROPDOWN_OPTION_NORMAL_HUE = Color.White;
public static Color DROPDOWN_OPTION_HOVER_HUE = Color.AntiqueWhite;
public static Color DROPDOWN_OPTION_SELECTED_HUE = Color.CadetBlue;
public Color DROPDOWN_OPTION_HOVER_HUE { get; set; } = Color.AntiqueWhite;
[JsonConverter(typeof(ColorJsonConverter))]
public Color DROPDOWN_OPTION_SELECTED_HUE { get; set; } = Color.CadetBlue;

public static Color BUTTON_FONT_COLOR = Color.White;
public static Color TEXT_FONT_COLOR = Color.White;
[JsonConverter(typeof(ColorJsonConverter))]
public Color BUTTON_FONT_COLOR { get; set; } = Color.White;
[JsonConverter(typeof(ColorJsonConverter))]
public Color TEXT_FONT_COLOR { get; set; } = Color.White;

public static string FONT = TrueTypeLoader.EMBEDDED_FONT;
public string FONT { get; set; } = TrueTypeLoader.EMBEDDED_FONT;
}

private static class PositionHelper
Expand Down

0 comments on commit 4e0f37e

Please sign in to comment.