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

Commit

Permalink
fix: fixed for major ui.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 17, 2023
1 parent 468ca1c commit 9735526
Show file tree
Hide file tree
Showing 13 changed files with 221 additions and 199 deletions.
1 change: 0 additions & 1 deletion RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ public static float DPSTaken
var time = recs.Last().ReceiveTime - recs.First().ReceiveTime + TimeSpan.FromMilliseconds(2.5f);

return damages / (float)time.TotalSeconds;

}
catch
{
Expand Down
4 changes: 1 addition & 3 deletions RotationSolver/ActionSequencer/ConditionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ public static bool DrawCheckBox(string name, ref int value, string desc = "")

internal static void SearchItemsReflection<T>(string popId, string name, ref string searchTxt, T[] actions, Action<T> selectAction) where T : MemberInfo
{
ImGui.SetNextItemWidth(Math.Max(80 * ImGuiHelpers.GlobalScale, ImGui.CalcTextSize(name).X));

if (ImGui.Selectable(name + "##" + popId))
if (ImGuiHelper.SelectableButton(name + "##" + popId))
{
if (!ImGui.IsPopupOpen(popId)) ImGui.OpenPopup(popId);
}
Expand Down
13 changes: 8 additions & 5 deletions RotationSolver/ActionSequencer/ConditionSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Drawing;
using System.Security.Policy;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar;

namespace RotationSolver.ActionSequencer;

Expand All @@ -26,10 +27,12 @@ public void Draw(ICustomRotation rotation)

ImGui.SameLine();

if(ImGui.Selectable((IsAnd ? "&&" : " | | ") + $"##Rule{GetHashCode()}"))
var index = IsAnd ? 0 : 1;
ImGuiHelper.SelectableCombo($"##Rule{GetHashCode()}", new string[]
{
IsAnd = !IsAnd;
}
"&&" , " | | ",
}, ref index);
IsAnd = index == 0;

ImGui.Spacing();

Expand All @@ -55,14 +58,14 @@ void Down()

var key = $"Condition Pop Up: {condition.GetHashCode()}";

Searchable.DrawHotKeysPopup(key, string.Empty,
ImGuiHelper.DrawHotKeysPopup(key, string.Empty,
(LocalizationManager.RightLang.ConfigWindow_List_Remove, Delete, new string[] { "Delete" }),
(LocalizationManager.RightLang.ConfigWindow_Actions_MoveUp, Up, new string[] { "↑" }),
(LocalizationManager.RightLang.ConfigWindow_Actions_MoveDown, Down, new string[] { "↓" }));

DrawCondition(condition.IsTrue(rotation));

Searchable.ExecuteHotKeysPopup(key, string.Empty, string.Empty, true,
ImGuiHelper.ExecuteHotKeysPopup(key, string.Empty, string.Empty, true,
(Delete, new VirtualKey[] { VirtualKey.DELETE }),
(Up, new VirtualKey[] { VirtualKey.UP }),
(Down, new VirtualKey[] { VirtualKey.DOWN }));
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/ActionSequencer/RotationCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public void Draw(ICustomRotation rotation)
nameof(CustomRotation.IsLastAction),
nameof(CustomRotation.IsLastAbility),
};
var index = Array.IndexOf(names, MethodName);
var index = Math.Max(0, Array.IndexOf(names, MethodName));
ImGuiHelper.SelectableCombo($"##Last{GetHashCode()}", names, ref index);
MethodName = names[index];

Expand Down
27 changes: 11 additions & 16 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"ConfigWindow_Param_HealthTankRatio": "Heal tank first if its HP%% is lower than this.",
"ConfigWindow_Param_DistanceForMoving": "Use gapcloser as a damage ability if the distance to your target is less then this.",
"ConfigWindow_Param_HealWhenNothingTodoBelow": "Healing the members with GCD if there is nothing to do in combat and their min HP%% is lower than this.",
"ConfigWindow_Param_HealthForDyingTank": "Set the HP%% for tank to use invincibility",
"ConfigWindow_Param_HealthForDyingTank": "Set the HP%% for tank to use invulnerability",
"ConfigWindow_Param_MeleeRangeOffset": "Melee Range action using offset",
"ConfigWindow_Param_RightNowTargetToHostileType": "Engage settings",
"ConfigWindow_Param_TargetToHostileType1": "All targets can attack",
Expand Down Expand Up @@ -168,7 +168,6 @@
"ConfigWindow_Control_ShowItemsCooldown": "Show Items' Cooldown",
"ConfigWindow_Control_ShowGCDCooldown": "Show GCD' Cooldown",
"ConfigWindow_Control_UseOriginalCooldown": "Show Original Cooldown",
"ConfigWindow_Control_CooldownActionOneLine": "The count of cooldown actions in one line.",
"ConfigWindow_Control_CooldownFontSize": "Change the cooldown font size.",
"ConfigWindow_Control_UnlockBackgroundColor": "Unlocked Control Window's Background",
"ConfigWindow_Control_LockBackgroundColor": "Locked Control Window's Background",
Expand All @@ -177,8 +176,6 @@
"ConfigWindow_Control_ControlWindow0GCDSize": "0GCD icon size",
"ConfigWindow_Control_CooldownWindowIconSize": "Cooldown icon size",
"ConfigWindow_Control_ControlWindowNextSizeRatio": "Next Action Size Ratio",
"ConfigWindow_Control_ResetButtonOrKeyCommand": "Right click to reset the gamepad button or key board key.\nHold Left Ctrl and middle click to clear the key setting.",
"ConfigWindow_Control_ClickToUse": "Click to use it!",
"ConfigWindow_Rotation_BetaRotation": "Beta Rotation!",
"ConfigWindow_Rotation_DownloadRotations": "Auto Download Rotations",
"ConfigWindow_Rotation_AutoUpdateRotations": "Auto Update Rotations",
Expand All @@ -195,19 +192,14 @@
"ConfigWindow_List_HostileCastingAreaDesc": "If the target is casting the action like this, it'll defense area.",
"ConfigWindow_List_NoHostile": "No Hostile",
"ConfigWindow_List_NoHostileDesc": "Add a name of target that never be the hostile for you.",
"ActionSequencer_DragdropDescription": "Drag&drop to move,Ctrl+Alt+RightClick to delete.",
"ActionSequencer_SearchBar": "Search Bar",
"ActionSequencer_MustUse": "MustUse",
"ActionSequencer_MustUseDesc": "Skip AOE and Buff.",
"ActionSequencer_Empty": "UseUp",
"ActionSequencer_EmptyDesc": "UseUp or Skip Combo",
"ActionSequencer_Can": "Can",
"ActionSequencer_Cannot": "Cannot",
"ActionSequencer_Is": "Is",
"ActionSequencer_Isnot": "Isnot",
"ActionSequencer_Have": "Have",
"ActionSequencer_HaveNot": "Have not",
"ActionSequencer_Has": "Has",
"ActionSequencer_HasNot": "Has not",
"ActionSequencer_TimeOffset": "Time Offset",
"ActionSequencer_AOECount": "AOE Count",
"ActionSequencer_Charges": "Charges",
"ActionSequencer_ConditionSet": "ConditionSet",
"ActionSequencer_ActionCondition": "ActionCondition",
Expand All @@ -216,8 +208,10 @@
"ActionSequencer_ActionTarget": "{0}'s target",
"ActionSequencer_Target": "Target",
"ActionSequencer_Player": "Player",
"ActionSequencer_StatusSelf": "StatusSelf",
"ActionSequencer_StatusSelfDesc": "StatusSelf",
"ActionSequencer_Original": "Original",
"ActionSequencer_Adjusted": "Adjusted",
"ActionSequencer_StatusSelf": "From Self",
"ActionSequencer_StatusAll": "From All",
"Action_Friendly": "Support",
"Action_Ability": "0GCD",
"Action_Attack": "Attack",
Expand Down Expand Up @@ -256,7 +250,7 @@
"ActionConditionType_IsCoolDown": "IsCoolDown",
"ActionConditionType_CurrentCharges": "CurrentCharges",
"ActionConditionType_MaxCharges": "MaxCharges",
"TargetConditionType_HaveStatus": "Have Status",
"TargetConditionType_HasStatus": "Has Status",
"TargetConditionType_IsDying": "Is Dying",
"TargetConditionType_IsBoss": "Is Boss",
"TargetConditionType_Distance": "Distance",
Expand Down Expand Up @@ -420,7 +414,8 @@
"ConfigWindow_About_Macros": "Macros",
"ConfigWindow_About_Links": "Links",
"ConfigWindow_About_Compatibility": "Compatibility",
"ConfigWindow_About_Compatibility_Description": "literally, Rotation Solver helps you to choose the target and then click the action. So any plugin that changes these will affect its decision.\n\nHere is a list of known incompatible plugins:",
"ConfigWindow_About_Compatibility_Description": "Literally, Rotation Solver helps you to choose the target and then click the action. So any plugin that changes these will affect its decision.\n\nHere is a list of known incompatible plugins:",
"ConfigWindow_About_Compatibility_Others": "Please don't relogin without closing the game. It may occur crash.",
"ConfigWindow_About_Compatibility_Mistake": "Can't properly execute the behavior that RS is going to do.",
"ConfigWindow_About_Compatibility_Mislead": "Misleading RS to make the right decision.",
"ConfigWindow_About_Compatibility_Crash": "Cause the game to crash.",
Expand Down
11 changes: 6 additions & 5 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ internal partial class Strings

public string ConfigWindow_Param_HealWhenNothingTodoBelow { get; set; } = "Healing the members with GCD if there is nothing to do in combat and their min HP%% is lower than this.";

public string ConfigWindow_Param_HealthForDyingTank { get; set; } = "Set the HP%% for tank to use invincibility";
public string ConfigWindow_Param_HealthForDyingTank { get; set; } = "Set the HP%% for tank to use invulnerability";

public string ConfigWindow_Param_MeleeRangeOffset { get; set; } = "Melee Range action using offset";
public string ConfigWindow_Param_RightNowTargetToHostileType { get; set; } = "Engage settings";
Expand Down Expand Up @@ -258,7 +258,6 @@ internal partial class Strings
public string ConfigWindow_Control_ControlWindow0GCDSize { get; set; } = "0GCD icon size";
public string ConfigWindow_Control_CooldownWindowIconSize { get; set; } = "Cooldown icon size";
public string ConfigWindow_Control_ControlWindowNextSizeRatio { get; set; } = "Next Action Size Ratio";
public string ConfigWindow_Control_ClickToUse { get; set; } = "Click to use it!";
public string ConfigWindow_Rotation_BetaRotation { get; set; } = "Beta Rotation!";

public string ConfigWindow_Rotation_DownloadRotations { get; set; } = "Auto Download Rotations";
Expand Down Expand Up @@ -289,10 +288,11 @@ internal partial class Strings
#endregion

#region ScriptWindow
public string ActionSequencer_Load { get; set; } = "Load From folder.";
public string ActionSequencer_Can { get; set; } = "Can";
public string ActionSequencer_Cannot { get; set; } = "Cannot";
public string ActionSequencer_Cannot { get; set; } = "Can Not";
public string ActionSequencer_Is { get; set; } = "Is";
public string ActionSequencer_Isnot { get; set; } = "Isnot";
public string ActionSequencer_Isnot { get; set; } = "Is Not";
public string ActionSequencer_Has { get; set; } = "Has";
public string ActionSequencer_HasNot { get; set; } = "Has not";
public string ActionSequencer_TimeOffset { get; set; } = "Time Offset";
Expand Down Expand Up @@ -616,7 +616,8 @@ internal partial class Strings
public string ConfigWindow_About_Macros { get; set; } = "Macros";
public string ConfigWindow_About_Links { get; set; } = "Links";
public string ConfigWindow_About_Compatibility { get; set; } = "Compatibility";
public string ConfigWindow_About_Compatibility_Description { get; set; } = "literally, Rotation Solver helps you to choose the target and then click the action. So any plugin that changes these will affect its decision.\n\nHere is a list of known incompatible plugins:";
public string ConfigWindow_About_Compatibility_Description { get; set; } = "Literally, Rotation Solver helps you to choose the target and then click the action. So any plugin that changes these will affect its decision.\n\nHere is a list of known incompatible plugins:";
public string ConfigWindow_About_Compatibility_Others { get; set; } = "Please don't relogin without closing the game. It may occur crash.";

public string ConfigWindow_About_Compatibility_Mistake { get; set; } = "Can't properly execute the behavior that RS is going to do.";
public string ConfigWindow_About_Compatibility_Mislead { get; set; } = "Misleading RS to make the right decision.";
Expand Down
10 changes: 7 additions & 3 deletions RotationSolver/UI/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static void DrawIAction(nint handle, string id, float width, SpecialCommandType
{
Svc.Commands.ProcessCommand(command.GetCommandStr());
}
ImGuiHelper.DrawActionOverlay(cursor, width, IconSet.GetTexture(0u, out var text) && text.ImGuiHandle == handle ? 0 : 1);
ImGuiHelper.DrawActionOverlay(cursor, width, IconSet.GetTexture(0u, out var text) && text.ImGuiHandle == handle ? -1 : 1);
ImguiTooltips.HoveredTooltip(help);
}

Expand All @@ -340,7 +340,9 @@ internal static (Vector2, Vector2) DrawIAction(IAction action, float width, floa
if (!action.GetTexture(out var texture, isAdjust)) return (default, default);

var cursor = ImGui.GetCursorPos();
if (ImGuiHelper.NoPaddingNoColorImageButton(texture.ImGuiHandle, Vector2.One * width, action.Name))

var desc = action?.Name ?? string.Empty;
if (ImGuiHelper.NoPaddingNoColorImageButton(texture.ImGuiHandle, Vector2.One * width, desc))
{
if (!DataCenter.State)
{
Expand All @@ -364,13 +366,14 @@ internal static (Vector2, Vector2) DrawIAction(IAction action, float width, floa
}
var size = ImGui.GetItemRectSize();
ImGuiHelper.DrawActionOverlay(cursor, width, action == null ? -1 : percent);
ImguiTooltips.HoveredTooltip(action.Name);
ImguiTooltips.HoveredTooltip(desc);

return (cursor, size);
}

static unsafe void DrawNextAction(float gcd, float ability, float width)
{
ImGui.BeginGroup();
var str = "Next Action";
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + width / 2 - ImGui.CalcTextSize(str).X / 2);
ImGui.TextColored(ImGuiColors.DalamudYellow, str);
Expand All @@ -384,5 +387,6 @@ static unsafe void DrawNextAction(float gcd, float ability, float width)
ImGui.SameLine();

DrawIAction(next, ability, -1);
ImGui.EndGroup();
}
}
7 changes: 2 additions & 5 deletions RotationSolver/UI/CooldownWindow.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using Dalamud.Interface.Windowing;
using RotationSolver.Basic.Configuration;
using RotationSolver.Basic.Configuration;
using RotationSolver.Localization;
using RotationSolver.Updaters;
using System.Drawing;

namespace RotationSolver.UI;

internal class CooldownWindow : Window
internal class CooldownWindow : CtrlWindow
{
public CooldownWindow()
:base(nameof(CooldownWindow))
Expand Down Expand Up @@ -63,7 +61,6 @@ private static void DrawActionCooldown(IAction act, float width)
var pair = ControlWindow.DrawIAction(act, width, r, false);
var pos = pair.Item1;
var size = pair.Item2;
ImguiTooltips.HoveredTooltip(act.Name + "\n" + LocalizationManager.RightLang.ConfigWindow_Control_ClickToUse);

if (!act.EnoughLevel)
{
Expand Down
Loading

0 comments on commit 9735526

Please sign in to comment.