Skip to content

Commit

Permalink
UI changes, fallback profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Limiana committed Mar 13, 2024
1 parent c591ec1 commit 8bfe6ab
Show file tree
Hide file tree
Showing 13 changed files with 297 additions and 144 deletions.
2 changes: 1 addition & 1 deletion DynamicBridge/Configuration/Migrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void DoCustomizeMigration(object a)
{
if (C.EnableCustomize)
{
var entries = CustomizePlusManager.GetProfiles();
var entries = P.CustomizePlusManager.GetProfiles();
if (entries.Any())
{
PluginLog.Information($"Begin Customize+ name to guid migration");
Expand Down
24 changes: 24 additions & 0 deletions DynamicBridge/Configuration/PathInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DynamicBridge.Configuration;
public record struct PathInfo
{
public string Name;
public int Indentation;

public PathInfo(string name) : this()
{
this.Name = name;
this.Indentation = 0;
}

public PathInfo(string name, int indentation)
{
this.Name = name ?? throw new ArgumentNullException(nameof(name));
this.Indentation = indentation;
}
}
16 changes: 2 additions & 14 deletions DynamicBridge/Configuration/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,10 @@ public class Profile
public List<Preset> Presets = [];
public List<PresetFolder> PresetsFolders = [];
public string ForcedPreset = null;
public int Subprofile = -1;
public List<Profile> Subprofiles = [];
public HashSet<ulong> Characters = [];

internal void SetSuprofile(int i)
{
if(i < 0 || i >= Subprofiles.Count)
{
Subprofile = -1;
}
else
{
Subprofile = i;
}
P.ForceUpdate = true;
}
public List<string> Pathes = [];
public Preset FallbackPreset = new();

public bool IsGlobal => C.GlobalProfile == this;

Expand Down
2 changes: 2 additions & 0 deletions DynamicBridge/DynamicBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public unsafe class DynamicBridge : IDalamudPlugin
public List<uint> LastItems = [];

public GlamourerManager GlamourerManager;
public CustomizePlusManager CustomizePlusManager;

public DynamicBridge(DalamudPluginInterface pi)
{
Expand Down Expand Up @@ -83,6 +84,7 @@ public DynamicBridge(DalamudPluginInterface pi)
};
Migrator = new();
GlamourerManager = new();
CustomizePlusManager = new();
ProperOnLogin.RegisterInteractable(OnLogin, true);
Memory = new();
});
Expand Down
2 changes: 1 addition & 1 deletion DynamicBridge/Gui/ComplexGlamourer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static void Draw()
ImGui.SameLine();
if (ImGui.BeginCombo("##glamour", gEntry.Designs.Select(P.GlamourerManager.TransformName).PrintRange(out var fullList, "- None -"), C.ComboSize))
{
if (ImGui.IsWindowAppearing()) P.GlamourerManager.ResetNameCache();
if (ImGui.IsWindowAppearing()) Utils.ResetCaches();
FiltersSelection();
var designs = P.GlamourerManager.GetDesigns().OrderBy(x => x.Name);
foreach (var x in designs)
Expand Down
21 changes: 16 additions & 5 deletions DynamicBridge/Gui/Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ public static unsafe class Debug
static List<string> TestData = null;
public static void Draw()
{
if(ImGui.CollapsingHeader("Pathes"))
{
foreach(var x in Utils.GetCombinedPathes())
{
for (int i = 0; i < x.Indentation; i++)
{
ImGuiEx.Spacing();
}
ImGuiEx.TextV($"{x.Name}");
}
}
if (ImGui.CollapsingHeader("Items"))
{
ImGuiEx.Text($"Current: {Utils.GetCurrentGear().Print()}");
Expand Down Expand Up @@ -90,16 +101,16 @@ public static void Draw()

if (ImGui.CollapsingHeader("C+ test"))
{
ImGuiEx.Text($"Saved: {CustomizePlusManager.SavedProfileID}");
ImGuiEx.Text($"wasset: {CustomizePlusManager.WasSet}");
foreach (var d in CustomizePlusManager.GetProfiles())
ImGuiEx.Text($"Saved: {P.CustomizePlusManager.SavedProfileID}");
ImGuiEx.Text($"wasset: {P.CustomizePlusManager.WasSet}");
foreach (var d in P.CustomizePlusManager.GetProfiles())
{
if (ImGui.Selectable($"{d.Name} / {d.characterName} / {d.ID} / {d.IsEnabled}"))
{
CustomizePlusManager.SetProfile(d.Name, Player.Name);
P.CustomizePlusManager.SetProfile(d.Name, Player.Name);
}
}
if (ImGui.Button("Revert c+")) CustomizePlusManager.RestoreState();
if (ImGui.Button("Revert c+")) P.CustomizePlusManager.RestoreState();
}

if(ImGui.CollapsingHeader("C+ reflector"))
Expand Down
Loading

0 comments on commit 8bfe6ab

Please sign in to comment.