コード例 #1
0
        // Anything about editing the regular meta information about the mod.
        private void EditRegularMeta()
        {
            if (Input.Text("Name", Input.Name, Input.None, _mod.Name, out var newName, 256, _window._inputTextWidth.X))
            {
                Penumbra.ModManager.ChangeModName(_mod.Index, newName);
            }

            if (Input.Text("Author", Input.Author, Input.None, _mod.Author, out var newAuthor, 256, _window._inputTextWidth.X))
            {
                Penumbra.ModManager.ChangeModAuthor(_mod.Index, newAuthor);
            }

            if (Input.Text("Version", Input.Version, Input.None, _mod.Version, out var newVersion, 32,
                           _window._inputTextWidth.X))
            {
                Penumbra.ModManager.ChangeModVersion(_mod.Index, newVersion);
            }

            if (Input.Text("Website", Input.Website, Input.None, _mod.Website, out var newWebsite, 256,
                           _window._inputTextWidth.X))
            {
                Penumbra.ModManager.ChangeModWebsite(_mod.Index, newWebsite);
            }

            var spacing = new Vector2(3 * ImGuiHelpers.GlobalScale);

            using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing);

            var reducedSize = new Vector2(_window._inputTextWidth.X - _window._iconButtonSize.X - spacing.X, 0);

            if (ImGui.Button("Edit Description", reducedSize))
            {
                _delayedActions.Enqueue(() => DescriptionEdit.OpenPopup(_mod, Input.Description));
            }

            ImGui.SameLine();
            var fileExists = File.Exists(_mod.MetaFile.FullName);
            var tt         = fileExists
                ? "Open the metadata json file in the text editor of your choice."
                : "The metadata json file does not exist.";

            if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.FileExport.ToIconString()}##metaFile", _window._iconButtonSize, tt,
                                             !fileExists, true))
            {
                Process.Start(new ProcessStartInfo(_mod.MetaFile.FullName)
                {
                    UseShellExecute = true
                });
            }
        }
コード例 #2
0
        private void EditGroup(int groupIdx)
        {
            var group = _mod.Groups[groupIdx];

            using var id    = ImRaii.PushId(groupIdx);
            using var frame = ImRaii.FramedGroup($"Group #{groupIdx + 1}");

            using var style = ImRaii.PushStyle(ImGuiStyleVar.CellPadding, _cellPadding)
                              .Push(ImGuiStyleVar.ItemSpacing, _itemSpacing);

            if (Input.Text("##Name", groupIdx, Input.None, group.Name, out var newGroupName, 256, _window._inputTextWidth.X))
            {
                Penumbra.ModManager.RenameModGroup(_mod, groupIdx, newGroupName);
            }

            ImGuiUtil.HoverTooltip("Group Name");
            ImGui.SameLine();
            if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), _window._iconButtonSize,
                                             "Delete this option group.\nHold Control while clicking to delete.", !ImGui.GetIO().KeyCtrl, true))
            {
                _delayedActions.Enqueue(() => Penumbra.ModManager.DeleteModGroup(_mod, groupIdx));
            }

            ImGui.SameLine();

            if (Input.Priority("##Priority", groupIdx, Input.None, group.Priority, out var priority, 50 * ImGuiHelpers.GlobalScale))
            {
                Penumbra.ModManager.ChangeGroupPriority(_mod, groupIdx, priority);
            }

            ImGuiUtil.HoverTooltip("Group Priority");

            DrawGroupCombo(group, groupIdx);
            ImGui.SameLine();

            var tt = groupIdx == 0 ? "Can not move this group further upwards." : $"Move this group up to group {groupIdx}.";

            if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.ArrowUp.ToIconString(), _window._iconButtonSize,
                                             tt, groupIdx == 0, true))
            {
                _delayedActions.Enqueue(() => Penumbra.ModManager.MoveModGroup(_mod, groupIdx, groupIdx - 1));
            }

            ImGui.SameLine();
            tt = groupIdx == _mod.Groups.Count - 1
                ? "Can not move this group further downwards."
                : $"Move this group down to group {groupIdx + 2}.";
            if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.ArrowDown.ToIconString(), _window._iconButtonSize,
                                             tt, groupIdx == _mod.Groups.Count - 1, true))
            {
                _delayedActions.Enqueue(() => Penumbra.ModManager.MoveModGroup(_mod, groupIdx, groupIdx + 1));
            }

            ImGui.SameLine();

            if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Edit.ToIconString(), _window._iconButtonSize,
                                             "Edit group description.", false, true))
            {
                _delayedActions.Enqueue(() => DescriptionEdit.OpenPopup(_mod, groupIdx));
            }

            ImGui.SameLine();
            var fileName   = group.FileName(_mod.ModPath, groupIdx);
            var fileExists = File.Exists(fileName);

            tt = fileExists
                ? $"Open the {group.Name} json file in the text editor of your choice."
                : $"The {group.Name} json file does not exist.";
            if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.FileExport.ToIconString(), _window._iconButtonSize, tt, !fileExists, true))
            {
                Process.Start(new ProcessStartInfo(fileName)
                {
                    UseShellExecute = true
                });
            }

            ImGui.Dummy(_window._defaultSpace);

            OptionTable.Draw(this, groupIdx);
        }