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

Commit

Permalink
fix: fixed some showing up.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 16, 2023
1 parent ad4d9ed commit bb8f8f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
7 changes: 6 additions & 1 deletion RotationSolver/RotationHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using RotationSolver.Basic.Rotations;
using Dalamud.Interface.Colors;
using RotationSolver.Basic.Rotations;
using System.Diagnostics;
using System.Numerics;

namespace RotationSolver;

Expand All @@ -20,6 +22,9 @@ public static bool IsAllowed(this ICustomRotation rotation, out string name)
return _allowedAssembly.Contains(rotation.GetType().Assembly.GetName().Name);
}

public static Vector4 GetColor(this ICustomRotation rotation)
=> rotation.IsAllowed(out _) ? ImGuiColors.DalamudWhite : ImGuiColors.DalamudViolet;

public static string GetAuthor(this ICustomRotation rotation)
{
return FileVersionInfo.GetVersionInfo(rotation.GetType().Assembly.Location)?.CompanyName ?? "Unnamed";
Expand Down
14 changes: 6 additions & 8 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
{
foreach (var r in rotations)
{
ImGui.PushStyleColor(ImGuiCol.Text, r.GetColor());
if (ImGui.Selectable(r.RotationName))
{
Service.Config.RotationChoices[rotation.Job.RowId] = r.RotationName;
Expand All @@ -430,6 +431,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
{
showToolTip?.Invoke(r.Description);
}
ImGui.PopStyleColor();
}
ImGui.EndCombo();
}
Expand All @@ -441,18 +443,14 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
ImGui.SameLine();

var isAllowed = rotation.IsAllowed(out _);
ImGui.TextColored(isAllowed ? ImGuiColors.DalamudWhite : ImGuiColors.DalamudViolet,
ImGui.TextColored(rotation.GetColor(),
rotation.GetAuthor());
if (!isAllowed)
{
var allHighEnds = string.Join('\n', SocialUpdater.HighEndDuties.Select(x => x.PlaceName?.Value?.Name.ToString())
.Where(s => !string.IsNullOrEmpty(s)));
var showStr = "This rotation is not allowed to be used in High-end Duty!"
+ string.Join("", SocialUpdater.HighEndDuties.Select(x => x.PlaceName?.Value?.Name.ToString())
.Where(s => !string.IsNullOrEmpty(s)).Select(t => "\n - " + t));

var showStr = "This rotation is not allowed to be used in High-end Duty!";
if(!string.IsNullOrEmpty(allHighEnds))
{
showStr += "\n" + allHighEnds;
}
HoveredString(showStr);
}

Expand Down

0 comments on commit bb8f8f7

Please sign in to comment.