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

Commit

Permalink
fix: add copy paste thing for status and actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Nov 8, 2023
1 parent c647d20 commit 53eca15
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1861,9 +1861,48 @@ private static void DrawActionsStatuses()
}
}

private static void FromClipBoardButton(HashSet<uint> items)
{
if (ImGui.Button(LocalizationManager.RightLang.ConfigWindow_Actions_Copy))
{
try
{
ImGui.SetClipboardText(JsonConvert.SerializeObject(items));
}
catch (Exception ex)
{
Svc.Log.Warning(ex, "Failed to copy the values to the clipboard.");
}
}

ImGui.SameLine();

if (ImGui.Button(LocalizationManager.RightLang.ActionSequencer_FromClipboard))
{
try
{
foreach (var aId in JsonConvert.DeserializeObject<uint[]>(ImGui.GetClipboardText()))
{
items.Add(aId);
}
}
catch (Exception ex)
{
Svc.Log.Warning(ex, "Failed to copy the values from the clipboard.");
}
finally
{
OtherConfiguration.Save();
ImGui.CloseCurrentPopup();
}
}
}

static string _statusSearching = string.Empty;
private static void DrawStatusList(string name, HashSet<uint> statuses, Status[] allStatus)
{
FromClipBoardButton(statuses);

uint removeId = 0;
uint notLoadId = 10100;

Expand Down Expand Up @@ -2009,6 +2048,9 @@ private static void DrawActionsList(string name, HashSet<uint> actions)
if (!ImGui.IsPopupOpen(popupId)) ImGui.OpenPopup(popupId);
}

ImGui.SameLine();
FromClipBoardButton(actions);

ImGui.Spacing();

foreach (var action in actions.Select(a => Service.GetSheet<GAction>().GetRow(a))
Expand Down Expand Up @@ -2052,7 +2094,8 @@ private static void DrawActionsList(string name, HashSet<uint> actions)
if (selected)
{
actions.Add(action.RowId);
OtherConfiguration.Save(); ImGui.CloseCurrentPopup();
OtherConfiguration.Save();
ImGui.CloseCurrentPopup();
}
}
}
Expand Down

0 comments on commit 53eca15

Please sign in to comment.