Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: fixed with ui bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 11, 2023
1 parent 49286d5 commit f3c9794
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 18 deletions.
5 changes: 3 additions & 2 deletions RotationSolver/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Dalamud.Plugin;
using FFXIVClientStructs.Interop;
using Lumina.Excel;
using Lumina.Excel.CustomSheets;
using System.Diagnostics;
using System.Runtime.Loader;
using System.Text;
Expand Down Expand Up @@ -32,7 +33,7 @@ static RotationLoadContext()
typeof(DalamudPluginInterface).Assembly,
typeof(DataCenter).Assembly,
typeof(SheetAttribute).Assembly,
typeof(ExcelRow).Assembly,
typeof(QuestDialogueText).Assembly,
};

_handledAssemblies = new Dictionary<string, Assembly>();
Expand Down Expand Up @@ -76,7 +77,7 @@ internal Assembly LoadFromFile(string filePath)
}
}

public static readonly SortedList<Assembly, AssemblyInfo> _assemblyInfos = new SortedList<Assembly, AssemblyInfo>();
public static readonly Dictionary<Assembly, AssemblyInfo> _assemblyInfos = new Dictionary<Assembly, AssemblyInfo>();

public static string[] _allowedAssembly { get; private set; } = new string[0];
public static AssemblyInfo GetInfo(this Assembly assembly)
Expand Down
65 changes: 53 additions & 12 deletions RotationSolver/UI/RotationConfigWindow_Rotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ private static void DrawRoleItems()

if (ImGui.BeginTabItem("Info"))
{
if (ImGui.BeginChild("Third-party Libs", new Vector2(0f, -1f), true))
{
//if (ImGui.BeginChild("Third-party Libs", new Vector2(0f, -1f)))
//{
DrawInfos();
ImGui.EndChild();
}
// ImGui.EndChild();
//}
ImGui.EndTabItem();
}
}
Expand Down Expand Up @@ -165,34 +165,75 @@ private static void DrawInfos()
.SelectMany(g => g.rotations)
.GroupBy(r => r.GetType().Assembly);

if (ImGui.BeginTable("AssemblyTable", 4))
if (ImGui.BeginTable("AssemblyTable", 5, ImGuiTableFlags.Borders | ImGuiTableFlags.ScrollY
| ImGuiTableFlags.Resizable
| ImGuiTableFlags.SizingStretchProp))
{
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableNextRow(ImGuiTableRowFlags.Headers);

ImGui.TableNextColumn();
ImGui.TableHeader("Name");

ImGui.TableNextColumn();
ImGui.TableHeader("Version");

ImGui.TableNextColumn();
ImGui.TableHeader("Author");

ImGui.TableNextColumn();
ImGui.TableHeader("Rotations");

ImGui.TableNextColumn();
ImGui.TableHeader("Links");

foreach (var grp in assemblyGrps)
{
ImGui.TableNextRow();


var assembly = grp.Key;
var isAllowed = assembly.IsAllowed();
if (isAllowed) ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DPSRed);
if (!isAllowed) ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudViolet);

var info = assembly.GetInfo();
ImGui.TableNextColumn();

if (ImGui.Button(info.Name))
{
Process.Start("explorer.exe", "/select, \"" + info.Path + "\"" );
}

if (ImGui.Button(info.Name + assembly.GetName().Version))
ImGui.TableNextColumn();

var version = assembly.GetName().Version;
if(version != null)
{
Process.Start("explorer.exe", info.Path);
ImGui.Text(version.ToString());
}

ImGui.TableNextColumn();

ImGui.Text(info.Author);

ImGui.TableNextColumn();

ImGui.Text(string.Join('\n', grp));
var lastRole = JobRole.None;
foreach (var jobs in grp.GroupBy(r => r.IconID))
{
var role = jobs.FirstOrDefault().Job.GetJobRole();
if(lastRole == role && lastRole != JobRole.None) ImGui.SameLine();
lastRole = role;

ImGui.Image(IconSet.GetTexture(IconSet.GetJobIcon(jobs.First(), IconType.Framed)).ImGuiHandle, new Vector2(30, 30));
if (ImGui.IsItemHovered())
{
ImGui.SetTooltip(string.Join('\n', jobs));
}
}

ImGui.TableNextColumn();

if(!string.IsNullOrEmpty(info.support))
if (!string.IsNullOrEmpty(info.support))
{
if (ImGui.Button("Support"))
{
Expand Down Expand Up @@ -222,7 +263,7 @@ private static void DrawInfos()
}
}

if (isAllowed) ImGui.PopStyleColor();
if (!isAllowed) ImGui.PopStyleColor();
}
ImGui.EndTable();
}
Expand Down
4 changes: 0 additions & 4 deletions RotationSolver/Updaters/PreviewUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ internal static unsafe void PulseActionBar(uint actionID)
{
LoopAllSlotBar((bar, hot, index) =>
{
//Pulse Check
#if DEBUG
return true;
#endif
return IsActionSlotRight(bar, hot, actionID);
});
}
Expand Down

0 comments on commit f3c9794

Please sign in to comment.