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

Commit

Permalink
fix: remove key binding feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 2, 2023
1 parent a678f29 commit 21f53d4
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 343 deletions.
2 changes: 1 addition & 1 deletion Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"141": 0.1,
"147": 0.1,
"149": 0.6,
"152": 0.1,
"152": 0.6,
"153": 0.1,
"154": 0.1,
"156": 0.6,
Expand Down
3 changes: 2 additions & 1 deletion Resources/HostileCastingArea.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,5 +347,6 @@
7581,
7377,
7474,
7185
7185,
9686
]
19 changes: 0 additions & 19 deletions RotationSolver.Basic/Configuration/OtherConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,8 @@
namespace RotationSolver.Basic.Configuration;

#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public class InputConfiguration
{
public Dictionary<StateCommandType, KeyRecord> KeyState { get; set; } = new Dictionary<StateCommandType, KeyRecord>();
public Dictionary<SpecialCommandType, KeyRecord> KeySpecial { get; set; } = new Dictionary<SpecialCommandType, KeyRecord>();
public KeyRecord KeyDoAction { get; set; } = null;
public Dictionary<StateCommandType, ButtonRecord> ButtonState { get; set; } = new Dictionary<StateCommandType, ButtonRecord>();
public Dictionary<SpecialCommandType, ButtonRecord> ButtonSpecial { get; set; } = new Dictionary<SpecialCommandType, ButtonRecord>();

public ButtonRecord ButtonDoAction { get; set; } = null;
}

public class OtherConfiguration
{
public static InputConfiguration InputConfig = new();
public static HashSet<uint> HostileCastingArea = new();
public static HashSet<uint> HostileCastingTank = new();

Expand Down Expand Up @@ -49,7 +37,6 @@ public static void Init()

Task.Run(() => InitOne(ref HostileCastingTank, nameof(HostileCastingTank)));

Task.Run(() => InitOne(ref InputConfig, nameof(InputConfig)));
}

public static void Save()
Expand All @@ -60,12 +47,6 @@ public static void Save()
SaveAnimationLockTime();
SaveHostileCastingArea();
SaveHostileCastingTank();
SaveInputConfig();
}

public static void SaveInputConfig()
{
Task.Run(() => Save(InputConfig, nameof(InputConfig)));
}

public static void SaveHostileCastingArea()
Expand Down
2 changes: 0 additions & 2 deletions RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ public class PluginConfiguration : IPluginConfiguration
public bool ShowNextActionWindow = true;
public bool IsInfoWindowNoInputs = false;
public bool IsInfoWindowNoMove = false;
public bool UseKeyboardCommand = false;
public bool UseGamepadCommand = false;
public bool ShowItemsCooldown = false;
public bool ShowGCDCooldown = false;
public bool UseOriginalCooldown = true;
Expand Down
3 changes: 0 additions & 3 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@
"ConfigWindow_Control_OnlyShowWithHostileOrInDuty": "Only shown if there are enemies in or in duty",
"ConfigWindow_Control_ShowNextActionWindow": "Show Next Action Window",
"ConfigWindow_Control_ShowControlWindow": "Show Control Window",
"ConfigWindow_Control_UseKeyboardCommand": "Use Keyboard Command",
"ConfigWindow_Control_UseGamepadCommand": "Use GamePad Command",
"ConfigWindow_Control_ShowCooldownWindow": "Show Cooldown Window",
"ConfigWindow_Control_IsInfoWindowNoInputs": "No Inputs",
"ConfigWindow_Control_IsInfoWindowNoMove": "No Move",
Expand All @@ -203,7 +201,6 @@
"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_NeedToEnable": " (Need to enable)",
"ConfigWindow_Control_ClickToUse": "Click to use it!",
"ConfigWindow_Rotation_BetaRotation": "Beta Rotation!",
"ConfigWindow_Rotation_DownloadRotations": "Download Rotations.",
Expand Down
3 changes: 0 additions & 3 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ internal partial class Strings
public string ConfigWindow_Control_ShowNextActionWindow { get; set; } = "Show Next Action Window";

public string ConfigWindow_Control_ShowControlWindow { get; set; } = "Show Control Window";
public string ConfigWindow_Control_UseKeyboardCommand { get; set; } = "Use Keyboard Command";
public string ConfigWindow_Control_UseGamepadCommand { get; set; } = "Use GamePad Command";
public string ConfigWindow_Control_ShowCooldownWindow { get; set; } = "Show Cooldown Window";
public string ConfigWindow_Control_IsInfoWindowNoInputs { get; set; } = "No Inputs";
public string ConfigWindow_Control_IsInfoWindowNoMove { get; set; } = "No Move";
Expand All @@ -284,7 +282,6 @@ internal partial class Strings
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_ResetButtonOrKeyCommand { get; set; } = "Right click to reset the gamepad button or key board key.\nHold Left Ctrl and middle click to clear the key setting.";
public string ConfigWindow_Control_NeedToEnable { get; set; } = " (Need to enable)";
public string ConfigWindow_Control_ClickToUse { get; set; } = "Click to use it!";
public string ConfigWindow_Rotation_BetaRotation { get; set; } = "Beta Rotation!";

Expand Down
110 changes: 1 addition & 109 deletions RotationSolver/UI/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,34 +344,14 @@ static void DrawCommandAction(uint iconId, StateCommandType command, Vector4 col
static string GetHelp(SpecialCommandType command)
{
var help = command.ToHelp() + "\n ";
if (OtherConfiguration.InputConfig.ButtonSpecial.TryGetValue(command, out var button))
{
help += "\n" + button.ToStr();
if (!Service.Config.UseGamepadCommand) help += LocalizationManager.RightLang.ConfigWindow_Control_NeedToEnable;

}
if (OtherConfiguration.InputConfig.KeySpecial.TryGetValue(command, out var key))
{
help += "\n" + key.ToStr();
if (!Service.Config.UseKeyboardCommand) help += LocalizationManager.RightLang.ConfigWindow_Control_NeedToEnable;
}
return help += "\n \n" + LocalizationManager.RightLang.ConfigWindow_Control_ResetButtonOrKeyCommand;
}

static string GetHelp(StateCommandType command)
{
var help = command.ToHelp() + "\n ";
if (OtherConfiguration.InputConfig.ButtonState.TryGetValue(command, out var button))
{
help += "\n" + button.ToStr();
if (!Service.Config.UseGamepadCommand) help += LocalizationManager.RightLang.ConfigWindow_Control_NeedToEnable;
}
if (OtherConfiguration.InputConfig.KeyState.TryGetValue(command, out var key))
{
help += "\n" + key.ToStr();
if (!Service.Config.UseKeyboardCommand) help += LocalizationManager.RightLang.ConfigWindow_Control_NeedToEnable;

}
return help += "\n \n" + LocalizationManager.RightLang.ConfigWindow_Control_ResetButtonOrKeyCommand;
}

Expand All @@ -387,31 +367,6 @@ static void DrawIAction(nint handle, string id, float width, SpecialCommandType
if (ImGui.IsItemHovered())
{
ImGuiHelper.ShowTooltip(help);
if (ImGui.IsMouseDown(ImGuiMouseButton.Right) && InputUpdater.RecordingSpecialType == SpecialCommandType.None)
{
InputUpdater.RecordingTime = DateTime.Now;
InputUpdater.RecordingSpecialType = command;
Svc.Toasts.ShowQuest($"Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
});
}

if (ImGui.IsKeyPressed(ImGuiKey.LeftCtrl) && ImGui.IsMouseDown(ImGuiMouseButton.Middle))
{
OtherConfiguration.InputConfig.KeySpecial.Remove(command);
OtherConfiguration.InputConfig.ButtonSpecial.Remove(command);
OtherConfiguration.SaveInputConfig();

Svc.Toasts.ShowQuest($"Clear Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
PlaySound = true,
DisplayCheckmark = true,
});
}
}
}

Expand All @@ -426,31 +381,6 @@ static void DrawIAction(nint handle, string id, float width, StateCommandType co
if (ImGui.IsItemHovered())
{
ImGuiHelper.ShowTooltip(help);
if (ImGui.IsMouseDown(ImGuiMouseButton.Right)&& InputUpdater.RecordingStateType == StateCommandType.None)
{
InputUpdater.RecordingTime = DateTime.Now;
InputUpdater.RecordingStateType = command;
Svc.Toasts.ShowQuest($"Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
});
}

if (ImGui.IsKeyPressed(ImGuiKey.LeftCtrl) && ImGui.IsMouseDown(ImGuiMouseButton.Middle))
{
OtherConfiguration.InputConfig.KeyState.Remove(command);
OtherConfiguration.InputConfig.ButtonState.Remove(command);
OtherConfiguration.SaveInputConfig();

Svc.Toasts.ShowQuest($"Clear Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
PlaySound = true,
DisplayCheckmark = true,
});
}
}
}

Expand Down Expand Up @@ -590,47 +520,9 @@ static unsafe void DrawNextAction(float gcd, float ability, float width)
DrawIAction(next, ability, -1);
if (ImGui.IsItemHovered())
{
var help = string.Empty;
if (OtherConfiguration.InputConfig.ButtonDoAction != null)
{
help += "\n" + OtherConfiguration.InputConfig.ButtonDoAction.ToStr();
if (!Service.Config.UseGamepadCommand) help += LocalizationManager.RightLang.ConfigWindow_Control_NeedToEnable;

}
if (OtherConfiguration.InputConfig.KeyDoAction != null)
{
help += "\n" + OtherConfiguration.InputConfig.KeyDoAction.ToStr();
if (!Service.Config.UseKeyboardCommand) help += LocalizationManager.RightLang.ConfigWindow_Control_NeedToEnable;
}
help += "\n \n" + LocalizationManager.RightLang.ConfigWindow_Control_ResetButtonOrKeyCommand;
var help = LocalizationManager.RightLang.ConfigWindow_Control_ResetButtonOrKeyCommand;

ImGuiHelper.ShowTooltip(help);

if (ImGui.IsMouseDown(ImGuiMouseButton.Right) && !InputUpdater.RecordingDoAction)
{
InputUpdater.RecordingTime = DateTime.Now;
InputUpdater.RecordingDoAction = true;
Svc.Toasts.ShowQuest($"Recording: Do Action",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
});
}

if (ImGui.IsKeyPressed(ImGuiKey.LeftCtrl) && ImGui.IsMouseDown(ImGuiMouseButton.Middle))
{
OtherConfiguration.InputConfig.KeyDoAction = null;
OtherConfiguration.InputConfig.ButtonDoAction = null;
OtherConfiguration.SaveInputConfig();

Svc.Toasts.ShowQuest($"Clear Recording: Do Action",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
PlaySound = true,
DisplayCheckmark = true,
});
}
}
}
}
15 changes: 5 additions & 10 deletions RotationSolver/UI/RotationConfigWindowNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
using RotationSolver.Localization;
using RotationSolver.Updaters;
using System.Diagnostics;
using System.Drawing;
using System.Reflection.Metadata;
using System.Windows.Forms;
using static FFXIVClientStructs.FFXIV.Client.UI.AddonAOZNotebook;
using static FFXIVClientStructs.FFXIV.Client.UI.Misc.RaptureMacroModule.Macro;

namespace RotationSolver.UI;

Expand Down Expand Up @@ -100,7 +95,7 @@ private void DrawSideBar()
DrawItemMiddle(() =>
{
var cursor = ImGui.GetCursorPos();
if (SilenceImageButton(icon.ImGuiHandle, Vector2.One * size, _activeTab == item))
if (NoPaddingNoColorImageButton(icon.ImGuiHandle, Vector2.One * size))
{
_activeTab = item;
}
Expand Down Expand Up @@ -241,7 +236,6 @@ private void DrawRotationIcon(ICustomRotation rotation, float iconSize)
var desc = rotation.Name + $" ({rotation.RotationName})";
if (!string.IsNullOrEmpty(rotation.Description)) desc += "\n \n" + rotation.Description;
ImguiTooltips.HoveredTooltip(desc);

}

private static void DrawRotationCombo(float comboSize, ICustomRotation[] rotations, ICustomRotation rotation, string gameVersion)
Expand Down Expand Up @@ -731,15 +725,14 @@ private static void DrawActions()
ImGui.SameLine();
}

var active = _activeAction == item;
var cursor = ImGui.GetCursorPos();
ImGui.BeginGroup();
if (SilenceImageButton(icon.ImGuiHandle, Vector2.One * size, active, item.Name))
if (NoPaddingNoColorImageButton(icon.ImGuiHandle, Vector2.One * size, item.Name))
{
_activeAction = item;
}
ImguiTooltips.HoveredTooltip(item.Name);
DrawActionOverlay(cursor, size, active ? 1 : 0);
DrawActionOverlay(cursor, size, _activeAction == item ? 1 : 0);

var texture = IconSet.GetTexture("https://raw.githubusercontent.com/goatcorp/DalamudAssets/master/UIRes/installedIcon.png");
if(texture != null && item.IsEnabled)
Expand Down Expand Up @@ -767,6 +760,7 @@ private static void DrawActions()
_activeAction.IsEnabled = enable;
}

ImGui.SameLine();
OtherCommandType.ToggleActions.DisplayCommandHelp(_activeAction.ToString());

enable = _activeAction.IsInCooldown;
Expand All @@ -775,6 +769,7 @@ private static void DrawActions()
_activeAction.IsInCooldown = enable;
}

ImGui.SameLine();
OtherCommandType.DoActions.DisplayCommandHelp($"{_activeAction}-{5}",
type => string.Format(LocalizationManager.RightLang.ConfigWindow_Actions_InsertCommand, _activeAction, 5), false);

Expand Down
8 changes: 0 additions & 8 deletions RotationSolver/UI/RotationConfigWindow_Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ private static void DrawControlTab()

if (ImGui.BeginChild("Action List", new Vector2(0f, -1f), true))
{
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_UseGamepadCommand,
ref Service.Config.UseGamepadCommand, Service.Default.UseGamepadCommand);

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_UseKeyboardCommand,
ref Service.Config.UseKeyboardCommand, Service.Default.UseKeyboardCommand);

ImGui.Separator();

if (Service.Config.ShowNextActionWindow || Service.Config.ShowCooldownWindow || Service.Config.ShowControlWindow)
{
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_OnlyShowWithHostileOrInDuty,
Expand Down
Loading

0 comments on commit 21f53d4

Please sign in to comment.