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

Commit

Permalink
fix: fixed list actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 14, 2023
1 parent 9e09de7 commit cd79779
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
1 change: 1 addition & 0 deletions Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public virtual unsafe uint MPNeed
/// <summary>
/// Animation Lock Time.
/// </summary>
public float AnimationLockTime => OtherConfiguration.AnimationLockTime.TryGetValue(AdjustedID, out var time) ? time : 0.6f;
public float AnimationLockTime => OtherConfiguration.AnimationLockTime?.TryGetValue(AdjustedID, out var time) ?? false ? time : 0.6f;

/// <summary>
/// General Constructer.
Expand Down
60 changes: 32 additions & 28 deletions RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,38 @@ private static void DrawActionsList(string name, HashSet<uint> actions)
{
uint removeId = 0;

var popupId = "Rotation Solver Popup" + name;
var popupId = "Rotation Solver Action Popup" + name;

if (ImGui.BeginPopup(popupId))
{
ImGui.SetNextItemWidth(200 * _scale);
ImGui.InputTextWithHint("##Searching the action pop up", LocalizationManager.RightLang.ConfigWindow_List_ActionNameOrId, ref _actionSearching, 128);

ImGui.Spacing();

if (ImGui.BeginChild("Rotation Solver Add action", new Vector2(-1, 400 * _scale)))
{
foreach (var action in AllActions.OrderBy(s => Math.Min(StringComparer.Distance(s.Name, _actionSearching)
, StringComparer.Distance(s.RowId.ToString(), _actionSearching))))
{
ImGui.Selectable($"{action.Name} ({action.RowId})");
if (ImGui.IsItemHovered())
{
ImguiTooltips.ShowTooltip($"{action.Name} ({action.RowId})");
if(ImGui.IsMouseClicked(ImGuiMouseButton.Left))
{
actions.Add(action.RowId);
OtherConfiguration.Save();
ImGui.CloseCurrentPopup();
}
}
}
ImGui.EndChild();
}

ImGui.EndPopup();
}


if (ImGui.Button(LocalizationManager.RightLang.ConfigWindow_List_AddAction + "##" + name))
{
Expand All @@ -1529,33 +1560,6 @@ private static void DrawActionsList(string name, HashSet<uint> actions)
Searchable.ExecuteHotKeysPopup(key, string.Empty, string.Empty, false, (Reset, new Dalamud.Game.ClientState.Keys.VirtualKey[] { Dalamud.Game.ClientState.Keys.VirtualKey.DELETE }));
}


if (ImGui.BeginPopup(popupId))
{
ImGui.SetNextItemWidth(200 * _scale);
ImGui.InputTextWithHint("##Searching the action pop up", LocalizationManager.RightLang.ConfigWindow_List_ActionNameOrId, ref _actionSearching, 128);

ImGui.Spacing();

if (ImGui.BeginChild("Rotation Solver Add action", new Vector2(-1, 400 * _scale)))
{
foreach (var action in AllActions.OrderBy(s => Math.Min(StringComparer.Distance(s.Name, _actionSearching)
, StringComparer.Distance(s.RowId.ToString(), _actionSearching))))
{
ImGui.Selectable($"{action.Name} ({action.RowId})");
{
actions.Add(action.RowId);
OtherConfiguration.Save();
ImGui.CloseCurrentPopup();
}
ImguiTooltips.HoveredTooltip($"{action.Name} ({action.RowId})");
}
ImGui.EndChild();
}

ImGui.EndPopup();
}

if (removeId != 0)
{
actions.Remove(removeId);
Expand Down

0 comments on commit cd79779

Please sign in to comment.