Added The ability to override the plugin style
This commit is contained in:
@@ -50,6 +50,9 @@ internal class Configuration : IPluginConfiguration {
|
||||
public Dictionary<ChatType, uint> ChatColours = new();
|
||||
public List<Tab> Tabs = new();
|
||||
|
||||
public bool OverrideStyle = false;
|
||||
public string ChosenStyle = "";
|
||||
|
||||
public uint DatabaseMigration = LatestDbVersion;
|
||||
|
||||
internal void UpdateFrom(Configuration other) {
|
||||
@@ -88,6 +91,8 @@ internal class Configuration : IPluginConfiguration {
|
||||
ChatColours = other.ChatColours.ToDictionary(entry => entry.Key, entry => entry.Value);
|
||||
Tabs = other.Tabs.Select(t => t.Clone()).ToList();
|
||||
DatabaseMigration = other.DatabaseMigration;
|
||||
OverrideStyle = other.OverrideStyle;
|
||||
ChosenStyle = other.ChosenStyle;
|
||||
}
|
||||
|
||||
public void Migrate() {
|
||||
|
||||
@@ -6,6 +6,7 @@ using ChatTwo.Resources;
|
||||
using ChatTwo.Ui;
|
||||
using ChatTwo.Util;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Interface.Style;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
@@ -133,6 +134,12 @@ public sealed class Plugin : IDalamudPlugin {
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
if (Config.OverrideStyle)
|
||||
{
|
||||
var styles = StyleModel.GetConfiguredStyles();
|
||||
styles?.First(style => style.Name.Equals(Config.ChosenStyle)).Push();
|
||||
}
|
||||
|
||||
Interface.UiBuilder.DisableUserUiHide = !Config.HideWhenUiHidden;
|
||||
ChatLogWindow.DefaultText = ImGui.GetStyle().Colors[(int) ImGuiCol.Text];
|
||||
|
||||
@@ -140,6 +147,12 @@ public sealed class Plugin : IDalamudPlugin {
|
||||
{
|
||||
WindowSystem.Draw();
|
||||
}
|
||||
|
||||
if (Config.OverrideStyle)
|
||||
{
|
||||
var styles = StyleModel.GetConfiguredStyles();
|
||||
styles?.First(style => style.Name.Equals(Config.ChosenStyle)).Pop();
|
||||
}
|
||||
}
|
||||
|
||||
internal void SaveConfig() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using ChatTwo.Resources;
|
||||
using ChatTwo.Util;
|
||||
using Dalamud.Interface.Style;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
@@ -89,6 +90,24 @@ internal sealed class Display : ISettingsTab {
|
||||
ImGuiUtil.OptionCheckbox(ref Mutable.ShowPopOutTitleBar, Language.Options_ShowPopOutTitleBar_Name);
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGui.Checkbox("Override Style", ref Mutable.OverrideStyle);
|
||||
ImGui.Spacing();
|
||||
|
||||
if (Mutable.OverrideStyle)
|
||||
{
|
||||
var currentStyle = Mutable.ChosenStyle.Equals("") ? StyleModel.GetConfiguredStyle().Name : Mutable.ChosenStyle;
|
||||
if (ImGui.BeginCombo("REMOVEME Styles", currentStyle)) {
|
||||
foreach (var style in StyleModel.GetConfiguredStyles()) {
|
||||
if (ImGui.Selectable(style.Name, this.Mutable.ChosenStyle == style.Name)) {
|
||||
Mutable.ChosenStyle = style.Name;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndCombo();
|
||||
}
|
||||
}
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGui.PopTextWrapPos();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user