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

Commit

Permalink
fix: add the pve and pvp icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Nov 8, 2023
1 parent 8c24a85 commit 97490fa
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 20 deletions.
11 changes: 11 additions & 0 deletions RotationSolver.Basic/Data/CombatType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@ public enum CombatType : byte
/// </summary>
Both = PvP | PvE,
}

internal static class ConbatTypeExtension
{
public static uint GetIcon(this CombatType type) => type switch
{
CombatType.Both => 61540u,
CombatType.PvE => 61542u,
CombatType.PvP => 61544u,
_ => 61523u,
};
}
1 change: 0 additions & 1 deletion RotationSolver.Basic/Rotations/Basic/MCH_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ protected static bool OverheatedEndAfterGCD(uint gctCount = 0, float offset = 0)
#endregion

#region PvP

/// <summary>
///
/// </summary>
Expand Down
20 changes: 20 additions & 0 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dalamud.Game.ClientState.Keys;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
Expand Down Expand Up @@ -436,4 +437,23 @@ public static bool IsInRect(Vector2 leftTop, Vector2 size)
ConfigUnitType.Percent => LocalizationManager.RightLang.ConfigUnitType_Ratio,
_ => string.Empty,
};

public static void Draw(this CombatType type)
{
if (type.HasFlag(CombatType.PvE))
{
ImGui.SameLine();
ImGui.TextColored(ImGuiColors.DalamudYellow, " PvE");
}
if (type.HasFlag(CombatType.PvP))
{
ImGui.SameLine();
ImGui.TextColored(ImGuiColors.TankBlue, " PvP");
}
if(type == CombatType.None)
{
ImGui.SameLine();
ImGui.TextColored(ImGuiColors.DalamudRed, " None of PvE or PvP!");
}
}
}
42 changes: 23 additions & 19 deletions RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,28 +430,20 @@ private void DrawRotationIcon(ICustomRotation rotation, float iconSize)
_activeTab = RotationConfigWindowTab.Rotation;
_searchResults = Array.Empty<ISearchable>();
}
var desc = rotation.Name + $" ({rotation.RotationName})";
var type = rotation.Type;
if (type.HasFlag(CombatType.PvE))
if (ImGui.IsItemHovered())
{
desc += " PvE";
}
if (type.HasFlag(CombatType.PvP))
{
desc += " PvP";
ImguiTooltips.ShowTooltip(() =>
{
ImGui.Text(rotation.Name + $" ({rotation.RotationName})");
rotation.Type.Draw();
if (!string.IsNullOrEmpty(rotation.Description))
{
ImGui.Text(rotation.Description);
}
});
}
if (!string.IsNullOrEmpty(rotation.Description)) desc += "\n \n" + rotation.Description;
ImguiTooltips.HoveredTooltip(desc);

var icon = type switch
{
CombatType.Both => 61540u,
CombatType.PvE => 61542u,
CombatType.PvP => 61544u,
_ => 61523u,
};

if (IconSet.GetTexture(icon, out var texture))
if (IconSet.GetTexture(rotation.Type.GetIcon(), out var texture))
{
ImGui.SetCursorPos(cursor + Vector2.One * iconSize / 2);

Expand All @@ -478,6 +470,18 @@ private static void DrawRotationCombo(float comboSize, ICustomRotation[] rotatio
{
foreach (var r in rotations)
{
if (IconSet.GetTexture(r.Type.GetIcon(), out var texture))
{
ImGui.Image(texture.ImGuiHandle, Vector2.One * 20 * Scale);
if (ImGui.IsItemHovered())
{
ImguiTooltips.ShowTooltip(() =>
{
rotation.Type.Draw();
});
}
}
ImGui.SameLine();
ImGui.PushStyleColor(ImGuiCol.Text, r.GetColor());
if (ImGui.Selectable(r.RotationName))
{
Expand Down

0 comments on commit 97490fa

Please sign in to comment.