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

Commit

Permalink
fix: changed the hot key for changing command.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 21, 2023
1 parent 2f3de8f commit b453d72
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 71 deletions.
8 changes: 3 additions & 5 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.Generic;

namespace RotationSolver.Localization;
namespace RotationSolver.Localization;

internal partial class Strings
{
Expand Down Expand Up @@ -226,7 +224,7 @@ internal partial class Strings
public string ConfigWindow_Param_MoveTowardsScreenDesc { get; set; } = "Using movement actions towards the object in the center of the screen, otherwise toward the facing object.";
public string ConfigWindow_Param_RaiseAll { get; set; } = "Raise all (include passerby)";
public string ConfigWindow_Param_TargetFriendly { get; set; } = "Target all for friendly actions(include passerby)";
public string ConfigWindow_Param_RaiseBrinkofDeath { get; set; } = "Raise player even has Brink of Death";
public string ConfigWindow_Param_RaiseBrinkOfDeath { get; set; } = "Raise player even has Brink of Death";
public string ConfigWindow_Param_MoveAreaActionFarthest { get; set; } = "Moving Area Ability to farthest";
public string ConfigWindow_Param_MoveAreaActionFarthestDesc { get; set; } = "Move to the furthest position from character's face direction.";
public string ConfigWindow_Param_Hostile { get; set; } = "Hostile";
Expand All @@ -248,7 +246,7 @@ internal partial class Strings
public string ConfigWindow_Control_ControlWindowGCDSize { get; set; } = "GCD icon size";
public string ConfigWindow_Control_ControlWindow0GCDSize { get; set; } = "0GCD 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 right click to clear the key setting.";
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)";

#endregion
Expand Down
96 changes: 46 additions & 50 deletions RotationSolver/UI/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,32 +337,30 @@ static void DrawIAction(nint handle, string id, float width, SpecialCommandType
if (ImGui.IsItemHovered())
{
if (!string.IsNullOrEmpty(help)) ImGui.SetTooltip(help);
if (ImGui.IsMouseDown(ImGuiMouseButton.Right))
if (ImGui.IsMouseDown(ImGuiMouseButton.Right) && InputUpdater.RecordingSpecialType == SpecialCommandType.None)
{
if(ImGui.IsKeyPressed(ImGuiKey.LeftCtrl))
{
Service.Config.KeySpecial.Remove(command);
Service.Config.ButtonSpecial.Remove(command);
Service.Config.Save();

Service.ToastGui.ShowQuest($"Clear Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
PlaySound = true,
DisplayCheckmark = true,
});
}
else if(InputUpdater.RecordingSpecialType == SpecialCommandType.None)
{
InputUpdater.RecordingTime = DateTime.Now;
InputUpdater.RecordingSpecialType = command;
Service.ToastGui.ShowQuest($"Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
});
}
InputUpdater.RecordingTime = DateTime.Now;
InputUpdater.RecordingSpecialType = command;
Service.ToastGui.ShowQuest($"Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
});
}

if (ImGui.IsKeyPressed(ImGuiKey.LeftCtrl) && ImGui.IsMouseDown(ImGuiMouseButton.Middle))
{
Service.Config.KeySpecial.Remove(command);
Service.Config.ButtonSpecial.Remove(command);
Service.Config.Save();

Service.ToastGui.ShowQuest($"Clear Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
PlaySound = true,
DisplayCheckmark = true,
});
}
}
}
Expand All @@ -378,32 +376,30 @@ static void DrawIAction(nint handle, string id, float width, StateCommandType co
if (ImGui.IsItemHovered())
{
if (!string.IsNullOrEmpty(help)) ImGui.SetTooltip(help);
if (ImGui.IsMouseDown(ImGuiMouseButton.Right))
if (ImGui.IsMouseDown(ImGuiMouseButton.Right)&& InputUpdater.RecordingStateType == StateCommandType.None)
{
if (ImGui.IsKeyPressed(ImGuiKey.LeftCtrl))
{
Service.Config.KeyState.Remove(command);
Service.Config.ButtonState.Remove(command);
Service.Config.Save();

Service.ToastGui.ShowQuest($"Clear Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
PlaySound = true,
DisplayCheckmark = true,
});
}
else if (InputUpdater.RecordingStateType == StateCommandType.None)
{
InputUpdater.RecordingTime = DateTime.Now;
InputUpdater.RecordingStateType = command;
Service.ToastGui.ShowQuest($"Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
});
}
InputUpdater.RecordingTime = DateTime.Now;
InputUpdater.RecordingStateType = command;
Service.ToastGui.ShowQuest($"Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
});
}

if (ImGui.IsKeyPressed(ImGuiKey.LeftCtrl) && ImGui.IsMouseDown(ImGuiMouseButton.Middle))
{
Service.Config.KeyState.Remove(command);
Service.Config.ButtonState.Remove(command);
Service.Config.Save();

Service.ToastGui.ShowQuest($"Clear Recording: {command}",
new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
IconId = 101,
PlaySound = true,
DisplayCheckmark = true,
});
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/UI/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ private void DrawParamTarget()
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_RaiseAll,
ref Service.Config.RaiseAll);

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_RaiseBrinkofDeath,
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_RaiseBrinkOfDeath,
ref Service.Config.RaiseBrinkOfDeath);
}

Expand Down
22 changes: 7 additions & 15 deletions RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Lumina.Excel.GeneratedSheets;
using Dalamud.Logging;
using Lumina.Excel.GeneratedSheets;
using RotationSolver.Basic;
using RotationSolver.Basic.Actions;
using RotationSolver.Basic.Attributes;
Expand All @@ -21,9 +22,7 @@ public record CustomRotationGroup(ClassJobID jobId, ClassJobID[] classJobIds, IC

static readonly string[] _locs = new string[] { "RotationSolver.dll", "RotationSolver.Basic.dll" };

#if DEBUG
internal static string[] Plugins;
#endif

public static void GetAllCustomRotations()
{
var directories = Service.Config.OtherLibs
Expand All @@ -34,9 +33,9 @@ where Directory.Exists(dir)
from l in Directory.GetFiles(dir, "*.dll")
where !_locs.Any(l.Contains)
select RotationLoadContext.LoadFrom(l);
#if DEBUG
Plugins = assemblies.Select(a => a.GetName().Name + " : " + Convert.ToBase64String(a.GetName().GetPublicKeyToken())).ToArray();
#endif

PluginLog.Log("Try to load rotations from these assemblies.", assemblies.Select(a => a.FullName));

AuthorHashes = (from a in assemblies
select a.GetCustomAttribute<AuthorHashAttribute>() into author
where author != null
Expand Down Expand Up @@ -65,7 +64,7 @@ private static ICustomRotation GetRotation(Type t)
}
catch
{
Dalamud.Logging.PluginLog.LogError($"Failed to load the rotation: {t.Name}");
PluginLog.LogError($"Failed to load the rotation: {t.Name}");
return null;
}
}
Expand Down Expand Up @@ -123,18 +122,11 @@ public static IEnumerable<IGrouping<string, IAction>> AllGroupedActions

public static IBaseAction[] RightRotationBaseActions { get; private set; } = new IBaseAction[0];

//static ClassJobID _job;
//static string _rotationName;
public static void UpdateRotation()
{
var nowJob = (ClassJobID)Service.Player.ClassJob.Id;
Service.Config.RotationChoices.TryGetValue((uint)nowJob, out var newName);

//if (_job == nowJob && _rotationName == newName) return;

//_job = nowJob;
//_rotationName = newName;

foreach (var group in _customRotations)
{
if (!group.classJobIds.Contains(nowJob)) continue;
Expand Down

0 comments on commit b453d72

Please sign in to comment.