mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-22 07:27:44 +01:00
Remove GlamourerOld.
This commit is contained in:
parent
d621369094
commit
c505286220
75 changed files with 384 additions and 8734 deletions
|
|
@ -14,6 +14,8 @@ public enum ColorId
|
|||
FolderLine,
|
||||
EnabledAutoSet,
|
||||
DisabledAutoSet,
|
||||
AutomationActorAvailable,
|
||||
AutomationActorUnavailable,
|
||||
}
|
||||
|
||||
public static class Colors
|
||||
|
|
@ -22,17 +24,19 @@ public static class Colors
|
|||
=> color switch
|
||||
{
|
||||
// @formatter:off
|
||||
ColorId.CustomizationDesign => (0xFFC000C0, "Customization Design", "A design that only changes customizations on a character." ),
|
||||
ColorId.StateDesign => (0xFF00C0C0, "State Design", "A design that only changes meta state on a character." ),
|
||||
ColorId.EquipmentDesign => (0xFF00C000, "Equipment Design", "A design that only changes equipment on a character." ),
|
||||
ColorId.ActorAvailable => (0xFF18C018, "Actor Available", "The header in the Actor tab panel if the currently selected actor exists in the game world at least once." ),
|
||||
ColorId.ActorUnavailable => (0xFF1818C0, "Actor Unavailable", "The Header in the Actor tab panel if the currently selected actor does not exist in the game world." ),
|
||||
ColorId.FolderExpanded => (0xFFFFF0C0, "Expanded Design Folder", "A design folder that is currently expanded." ),
|
||||
ColorId.FolderCollapsed => (0xFFFFF0C0, "Collapsed Design Folder", "A design folder that is currently collapsed." ),
|
||||
ColorId.FolderLine => (0xFFFFF0C0, "Expanded Design Folder Line", "The line signifying which descendants belong to an expanded design folder." ),
|
||||
ColorId.EnabledAutoSet => (0xFFA0F0A0, "Enabled Automation Set", "An automation set that is currently enabled. Only one set can be enabled for each identifier at once." ),
|
||||
ColorId.DisabledAutoSet => (0xFF808080, "Disabled Automation Set", "An automation set that is currently disabled." ),
|
||||
_ => (0x00000000, string.Empty, string.Empty ),
|
||||
ColorId.CustomizationDesign => (0xFFC000C0, "Customization Design", "A design that only changes customizations on a character." ),
|
||||
ColorId.StateDesign => (0xFF00C0C0, "State Design", "A design that only changes meta state on a character." ),
|
||||
ColorId.EquipmentDesign => (0xFF00C000, "Equipment Design", "A design that only changes equipment on a character." ),
|
||||
ColorId.ActorAvailable => (0xFF18C018, "Actor Available", "The header in the Actor tab panel if the currently selected actor exists in the game world at least once." ),
|
||||
ColorId.ActorUnavailable => (0xFF1818C0, "Actor Unavailable", "The Header in the Actor tab panel if the currently selected actor does not exist in the game world." ),
|
||||
ColorId.FolderExpanded => (0xFFFFF0C0, "Expanded Design Folder", "A design folder that is currently expanded." ),
|
||||
ColorId.FolderCollapsed => (0xFFFFF0C0, "Collapsed Design Folder", "A design folder that is currently collapsed." ),
|
||||
ColorId.FolderLine => (0xFFFFF0C0, "Expanded Design Folder Line", "The line signifying which descendants belong to an expanded design folder." ),
|
||||
ColorId.EnabledAutoSet => (0xFFA0F0A0, "Enabled Automation Set", "An automation set that is currently enabled. Only one set can be enabled for each identifier at once." ),
|
||||
ColorId.DisabledAutoSet => (0xFF808080, "Disabled Automation Set", "An automation set that is currently disabled." ),
|
||||
ColorId.AutomationActorAvailable => (0xFFFFFFFF, "Automation Actor Available", "A character associated with the given automated design set is currently visible." ),
|
||||
ColorId.AutomationActorUnavailable => (0xFF808080, "Automation Actor Unavailable", "No character associated with the given automated design set is currently visible." ),
|
||||
_ => (0x00000000, string.Empty, string.Empty ),
|
||||
// @formatter:on
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,12 @@ using System.Numerics;
|
|||
using Dalamud.Interface;
|
||||
using Glamourer.Automation;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.Structs;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Widgets;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.AutomationTab;
|
||||
|
||||
|
|
@ -16,10 +19,20 @@ public class SetPanel
|
|||
private readonly AutoDesignManager _manager;
|
||||
private readonly SetSelector _selector;
|
||||
|
||||
public SetPanel(SetSelector selector, AutoDesignManager manager)
|
||||
private readonly DesignCombo _designCombo;
|
||||
private readonly JobGroupCombo _jobGroupCombo;
|
||||
|
||||
private string? _tempName;
|
||||
private int _dragIndex = -1;
|
||||
|
||||
private Action? _endAction;
|
||||
|
||||
public SetPanel(SetSelector selector, AutoDesignManager manager, DesignManager designs, JobService jobs)
|
||||
{
|
||||
_selector = selector;
|
||||
_manager = manager;
|
||||
_selector = selector;
|
||||
_manager = manager;
|
||||
_designCombo = new DesignCombo(_manager, designs);
|
||||
_jobGroupCombo = new JobGroupCombo(manager, jobs);
|
||||
}
|
||||
|
||||
private AutoDesignSet Selection
|
||||
|
|
@ -43,8 +56,6 @@ public class SetPanel
|
|||
ImGuiUtil.DrawTextButton(Selection.Name, -Vector2.UnitX, buttonColor);
|
||||
}
|
||||
|
||||
private string? _tempName;
|
||||
|
||||
private void DrawPanel()
|
||||
{
|
||||
using var child = ImRaii.Child("##SetPanel", -Vector2.One, true);
|
||||
|
|
@ -66,47 +77,84 @@ public class SetPanel
|
|||
if (ImGui.Checkbox("Enabled", ref enabled))
|
||||
_manager.SetState(_selector.SelectionIndex, enabled);
|
||||
|
||||
using var table = ImRaii.Table("SetTable", 4, ImGuiTableFlags.RowBg);
|
||||
DrawDesignTable();
|
||||
}
|
||||
|
||||
private void DrawDesignTable()
|
||||
{
|
||||
using var table = ImRaii.Table("SetTable", 5, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY);
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
ImGui.TableSetupColumn("##Index", ImGuiTableColumnFlags.WidthFixed, 40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TableSetupColumn("Design", ImGuiTableColumnFlags.WidthFixed, 200 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TableSetupColumn("##del", ImGuiTableColumnFlags.WidthFixed, ImGui.GetFrameHeight());
|
||||
ImGui.TableSetupColumn("##Index", ImGuiTableColumnFlags.WidthFixed, 30 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TableSetupColumn("Design", ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed, 5 * ImGui.GetFrameHeight() + 4 * 2 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TableSetupColumn("Job Restrictions", ImGuiTableColumnFlags.WidthStretch);
|
||||
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
foreach (var (design, idx) in Selection.Designs.WithIndex())
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn($"#{idx:D2}");
|
||||
using var id = ImRaii.PushId(idx);
|
||||
ImGui.TableNextColumn();
|
||||
DrawDesignCombo(Selection, design, idx);
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), new Vector2(ImGui.GetFrameHeight()),
|
||||
"Remove this design from the set.", false, true))
|
||||
_endAction = () => _manager.DeleteDesign(Selection, idx);
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
ImGui.Selectable($"#{idx + 1:D2}");
|
||||
DrawDragDrop(Selection, idx);
|
||||
ImGui.TableNextColumn();
|
||||
DrawJobGroupCombo(Selection, design, idx);
|
||||
_designCombo.Draw(Selection, design, idx);
|
||||
DrawDragDrop(Selection, idx);
|
||||
ImGui.TableNextColumn();
|
||||
DrawApplicationTypeBoxes(Selection, design, idx);
|
||||
ImGui.TableNextColumn();
|
||||
_jobGroupCombo.Draw(Selection, design, idx);
|
||||
}
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("New");
|
||||
ImGui.TableNextColumn();
|
||||
_designCombo.Draw(Selection, null, -1);
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
_endAction?.Invoke();
|
||||
_endAction = null;
|
||||
}
|
||||
|
||||
private void DrawDesignCombo(AutoDesignSet set, AutoDesign design, int autoDesignIndex)
|
||||
private void DrawDragDrop(AutoDesignSet set, int index)
|
||||
{
|
||||
ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale);
|
||||
using var combo = ImRaii.Combo("##design", design.Design.Name);
|
||||
if (!combo)
|
||||
return;
|
||||
}
|
||||
const string dragDropLabel = "DesignDragDrop";
|
||||
using (var target = ImRaii.DragDropTarget())
|
||||
{
|
||||
if (target.Success && ImGuiUtil.IsDropping(dragDropLabel))
|
||||
{
|
||||
if (_dragIndex >= 0)
|
||||
{
|
||||
var idx = _dragIndex;
|
||||
_endAction = () => _manager.MoveDesign(set, idx, index);
|
||||
}
|
||||
|
||||
private void DrawJobGroupCombo(AutoDesignSet set, AutoDesign design, int autoDesignIndex)
|
||||
{
|
||||
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X);
|
||||
using var combo = ImRaii.Combo("##JobGroups", design.Jobs.Name);
|
||||
if (!combo)
|
||||
return;
|
||||
_dragIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
using (var source = ImRaii.DragDropSource())
|
||||
{
|
||||
if (source.Success && ImGui.SetDragDropPayload(dragDropLabel, nint.Zero, 0))
|
||||
{
|
||||
_dragIndex = index;
|
||||
ImGui.TextUnformatted($"Moving design #{index + 1:D2}...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawApplicationTypeBoxes(AutoDesignSet set, AutoDesign design, int autoDesignIndex)
|
||||
{
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, 2 * ImGuiHelpers.GlobalScale);
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(2 * ImGuiHelpers.GlobalScale));
|
||||
var newType = design.ApplicationType;
|
||||
foreach (var (type, description) in Types)
|
||||
{
|
||||
|
|
@ -114,7 +162,10 @@ public class SetPanel
|
|||
if (ImGui.Checkbox($"##{(byte)type}", ref value))
|
||||
newType = value ? newType | type : newType & ~type;
|
||||
ImGuiUtil.HoverTooltip(description);
|
||||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
_manager.ChangeApplicationType(set, autoDesignIndex, newType);
|
||||
}
|
||||
|
||||
private static readonly IReadOnlyList<(AutoDesign.Type, string)> Types = new[]
|
||||
|
|
@ -126,4 +177,64 @@ public class SetPanel
|
|||
(AutoDesign.Type.Stains, "Apply all dye changes that are enabled in this design."),
|
||||
(AutoDesign.Type.Weapons, "Apply all weapon changes that are enabled in this design and that are valid with the current weapon worn."),
|
||||
};
|
||||
|
||||
private sealed class JobGroupCombo : FilterComboCache<JobGroup>
|
||||
{
|
||||
private readonly AutoDesignManager _manager;
|
||||
private readonly JobService _jobs;
|
||||
|
||||
public JobGroupCombo(AutoDesignManager manager, JobService jobs)
|
||||
: base(() => jobs.JobGroups.Values.ToList())
|
||||
{
|
||||
_manager = manager;
|
||||
_jobs = jobs;
|
||||
}
|
||||
|
||||
public void Draw(AutoDesignSet set, AutoDesign design, int autoDesignIndex)
|
||||
{
|
||||
CurrentSelection = design.Jobs;
|
||||
CurrentSelectionIdx = _jobs.JobGroups.Values.IndexOf(j => j.Id == design.Jobs.Id);
|
||||
if (Draw("##JobGroups", design.Jobs.Name,
|
||||
"Select for which job groups this design should be applied.\nControl + Right-Click to set to all classes.",
|
||||
ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight())
|
||||
&& CurrentSelectionIdx >= 0)
|
||||
_manager.ChangeJobCondition(set, autoDesignIndex, CurrentSelection);
|
||||
else if (ImGui.GetIO().KeyCtrl && ImGui.IsItemClicked(ImGuiMouseButton.Right))
|
||||
_manager.ChangeJobCondition(set, autoDesignIndex, _jobs.JobGroups[1]);
|
||||
}
|
||||
|
||||
protected override string ToString(JobGroup obj)
|
||||
=> obj.Name;
|
||||
}
|
||||
|
||||
private sealed class DesignCombo : FilterComboCache<Design>
|
||||
{
|
||||
private readonly AutoDesignManager _manager;
|
||||
private readonly DesignManager _designs;
|
||||
|
||||
public DesignCombo(AutoDesignManager manager, DesignManager designs)
|
||||
: base(() => designs.Designs.OrderBy(d => d.Name).ToList())
|
||||
{
|
||||
_designs = designs;
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
public void Draw(AutoDesignSet set, AutoDesign? design, int autoDesignIndex)
|
||||
{
|
||||
CurrentSelection = design?.Design ?? (Items.Count > 0 ? Items[0] : null);
|
||||
CurrentSelectionIdx = design?.Design.Index ?? (Items.Count > 0 ? 0 : -1);
|
||||
if (Draw("##design", CurrentSelection?.Name.Text ?? string.Empty, string.Empty, 220 * ImGuiHelpers.GlobalScale,
|
||||
ImGui.GetTextLineHeight())
|
||||
&& CurrentSelection != null)
|
||||
{
|
||||
if (autoDesignIndex >= 0)
|
||||
_manager.ChangeDesign(set, autoDesignIndex, CurrentSelection);
|
||||
else
|
||||
_manager.AddDesign(set, CurrentSelection);
|
||||
}
|
||||
}
|
||||
|
||||
protected override string ToString(Design obj)
|
||||
=> obj.Name.Text;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,44 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Automation;
|
||||
using Glamourer.Events;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.Services;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.String;
|
||||
using Vector2 = FFXIVClientStructs.FFXIV.Common.Math.Vector2;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.AutomationTab;
|
||||
|
||||
public class SetSelector : IDisposable
|
||||
{
|
||||
private readonly AutoDesignManager _manager;
|
||||
private readonly AutomationChanged _event;
|
||||
public AutoDesignSet? Selection { get; private set; }
|
||||
public int SelectionIndex = -1;
|
||||
|
||||
private bool IncognitoMode;
|
||||
private readonly Configuration _config;
|
||||
private readonly AutoDesignManager _manager;
|
||||
private readonly AutomationChanged _event;
|
||||
private readonly ActorService _actors;
|
||||
private readonly ObjectManager _objects;
|
||||
private readonly List<AutoDesignSet> _list = new();
|
||||
|
||||
public SetSelector(AutoDesignManager manager, AutomationChanged @event)
|
||||
public AutoDesignSet? Selection { get; private set; }
|
||||
public int SelectionIndex { get; private set; } = -1;
|
||||
|
||||
private bool IncognitoMode;
|
||||
private int _dragIndex = -1;
|
||||
private Action? _endAction;
|
||||
|
||||
public SetSelector(AutoDesignManager manager, AutomationChanged @event, Configuration config, ActorService actors, ObjectManager objects)
|
||||
{
|
||||
_manager = manager;
|
||||
_event = @event;
|
||||
_config = config;
|
||||
_actors = actors;
|
||||
_objects = objects;
|
||||
_event.Subscribe(OnAutomationChanged, AutomationChanged.Priority.SetSelector);
|
||||
}
|
||||
|
||||
|
|
@ -41,13 +54,17 @@ public class SetSelector : IDisposable
|
|||
case AutomationChanged.Type.DeletedSet:
|
||||
if (set == Selection)
|
||||
{
|
||||
Selection = null;
|
||||
SelectionIndex = -1;
|
||||
SelectionIndex = _manager.Count == 0 ? -1 : SelectionIndex == 0 ? 0 : SelectionIndex - 1;
|
||||
Selection = SelectionIndex >= 0 ? _manager[SelectionIndex] : null;
|
||||
}
|
||||
|
||||
_dirty = true;
|
||||
break;
|
||||
case AutomationChanged.Type.AddedSet:
|
||||
SelectionIndex = (((int, string))data!).Item1;
|
||||
Selection = set!;
|
||||
_dirty = true;
|
||||
break;
|
||||
case AutomationChanged.Type.RenamedSet:
|
||||
case AutomationChanged.Type.MovedSet:
|
||||
case AutomationChanged.Type.ChangeIdentifier:
|
||||
|
|
@ -109,6 +126,7 @@ public class SetSelector : IDisposable
|
|||
_dirty = true;
|
||||
ImGui.SameLine();
|
||||
var f = _enabledFilter;
|
||||
|
||||
if (ImGui.CheckboxFlags("##enabledFilter", ref f, 3))
|
||||
{
|
||||
_enabledFilter = _enabledFilter switch
|
||||
|
|
@ -120,6 +138,11 @@ public class SetSelector : IDisposable
|
|||
_dirty = true;
|
||||
}
|
||||
|
||||
var pos = ImGui.GetItemRectMin();
|
||||
pos.X -= ImGuiHelpers.GlobalScale;
|
||||
ImGui.GetWindowDrawList().AddLine(pos, pos with { Y = ImGui.GetItemRectMax().Y }, ImGui.GetColorU32(ImGuiCol.Border),
|
||||
ImGuiHelpers.GlobalScale);
|
||||
|
||||
ImGuiUtil.HoverTooltip("Filter to show only enabled or disabled sets.");
|
||||
|
||||
DrawSelector();
|
||||
|
|
@ -135,7 +158,10 @@ public class SetSelector : IDisposable
|
|||
UpdateList();
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _defaultItemSpacing);
|
||||
_selectableSize = new Vector2(0, 2 * ImGui.GetTextLineHeight() + ImGui.GetStyle().ItemSpacing.Y);
|
||||
_objects.Update();
|
||||
ImGuiClip.ClippedDraw(_list, DrawSetSelectable, _selectableSize.Y + 2 * ImGui.GetStyle().ItemSpacing.Y);
|
||||
_endAction?.Invoke();
|
||||
_endAction = null;
|
||||
}
|
||||
|
||||
private void DrawSetSelectable(AutoDesignSet set, int index)
|
||||
|
|
@ -150,22 +176,84 @@ public class SetSelector : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
DrawDragDrop(set, index);
|
||||
|
||||
var text = set.Identifier.ToString();
|
||||
if (IncognitoMode)
|
||||
text = set.Identifier.Incognito(text);
|
||||
var textSize = ImGui.CalcTextSize(text);
|
||||
var textSize = ImGui.CalcTextSize(text);
|
||||
var textColor = _objects.ContainsKey(set.Identifier) ? ColorId.AutomationActorAvailable : ColorId.AutomationActorUnavailable;
|
||||
ImGui.SetCursorPos(new Vector2(ImGui.GetContentRegionAvail().X - textSize.X,
|
||||
ImGui.GetCursorPosY() - ImGui.GetTextLineHeightWithSpacing()));
|
||||
ImGui.TextUnformatted(text);
|
||||
ImGuiUtil.TextColored(textColor.Value(), text);
|
||||
}
|
||||
|
||||
private void DrawSelectionButtons()
|
||||
{
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero)
|
||||
.Push(ImGuiStyleVar.FrameRounding, 0);
|
||||
var buttonWidth = new Vector2(_width / 1, 0);
|
||||
// TODO
|
||||
ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.UserCircle.ToIconString(), buttonWidth
|
||||
, "Select the local player character.", true, true);
|
||||
var buttonWidth = new Vector2(_width / 3, 0);
|
||||
NewSetButton(buttonWidth);
|
||||
ImGui.SameLine();
|
||||
DuplicateSetButton(buttonWidth);
|
||||
ImGui.SameLine();
|
||||
DeleteSetButton(buttonWidth);
|
||||
}
|
||||
|
||||
private void NewSetButton(Vector2 size)
|
||||
{
|
||||
var id = _actors.AwaitedService.GetCurrentPlayer();
|
||||
if (!id.IsValid)
|
||||
id = _actors.AwaitedService.CreatePlayer(ByteString.FromSpanUnsafe("New Design"u8, true, false, true), ushort.MaxValue);
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Plus.ToIconString(), size,
|
||||
$"Create a new Automatic Design Set for {id}. The associated player can be changed later.", !id.IsValid, true))
|
||||
_manager.AddDesignSet("New Design", id);
|
||||
}
|
||||
|
||||
private void DuplicateSetButton(Vector2 size)
|
||||
{
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Clone.ToIconString(), size, "Duplicate the current Automatic Design Set.",
|
||||
Selection == null, true))
|
||||
_manager.DuplicateDesignSet(Selection!);
|
||||
}
|
||||
|
||||
|
||||
private void DeleteSetButton(Vector2 size)
|
||||
{
|
||||
var keyValid = _config.DeleteDesignModifier.IsActive();
|
||||
var (disabled, tt) = HasSelection
|
||||
? keyValid
|
||||
? (false, "Delete the currently selected design set.")
|
||||
: (true, $"Delete the currently selected design set.\n{_config.DeleteDesignModifier.ToString()}")
|
||||
: (true, "No Automatic Design Set selected.");
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), size, tt, disabled, true))
|
||||
_manager.DeleteDesignSet(SelectionIndex);
|
||||
}
|
||||
|
||||
private void DrawDragDrop(AutoDesignSet set, int index)
|
||||
{
|
||||
const string dragDropLabel = "DesignSetDragDrop";
|
||||
using (var target = ImRaii.DragDropTarget())
|
||||
{
|
||||
if (target.Success && ImGuiUtil.IsDropping(dragDropLabel))
|
||||
{
|
||||
if (_dragIndex >= 0)
|
||||
{
|
||||
var idx = _dragIndex;
|
||||
_endAction = () => _manager.MoveSet(idx, index);
|
||||
}
|
||||
|
||||
_dragIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
using (var source = ImRaii.DragDropSource())
|
||||
{
|
||||
if (source.Success && ImGui.SetDragDropPayload(dragDropLabel, nint.Zero, 0))
|
||||
{
|
||||
_dragIndex = index;
|
||||
ImGui.TextUnformatted($"Moving design set {set.Name} from position {index + 1}...");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue