Beispiel #1
0
            private static void Target(ModPanel panel, IModGroup group, int groupIdx, int optionIdx)
            {
                // TODO drag options to other groups without options.
                using var target = ImRaii.DragDropTarget();
                if (!target.Success || !ImGuiUtil.IsDropping(DragDropLabel))
                {
                    return;
                }

                if (_dragDropGroupIdx >= 0 && _dragDropOptionIdx >= 0)
                {
                    if (_dragDropGroupIdx == groupIdx)
                    {
                        var sourceOption = _dragDropOptionIdx;
                        panel._delayedActions.Enqueue(() => Penumbra.ModManager.MoveOption(panel._mod, groupIdx, sourceOption, optionIdx));
                    }
                    else
                    {
                        // Move from one group to another by deleting, then adding the option.
                        var sourceGroup  = _dragDropGroupIdx;
                        var sourceOption = _dragDropOptionIdx;
                        var option       = @group[_dragDropOptionIdx];
                        var priority     = @group.OptionPriority(_dragDropGroupIdx);
                        panel._delayedActions.Enqueue(() =>
                        {
                            Penumbra.ModManager.DeleteOption(panel._mod, sourceGroup, sourceOption);
                            Penumbra.ModManager.AddOption(panel._mod, groupIdx, option, priority);
                        });
                    }
                }

                _dragDropGroupIdx  = -1;
                _dragDropOptionIdx = -1;
            }