Beispiel #1
0
            private void DrawFileListTab()
            {
                if (!ImGui.BeginTabItem(LabelFileListTab))
                {
                    return;
                }

                using var raii = ImGuiRaii.DeferredEnd(ImGui.EndTabItem);
                ImGuiCustom.HoverTooltip(TooltipFilesTab);

                ImGui.SetNextItemWidth(-1);
                if (ImGui.BeginListBox(LabelFileListHeader, AutoFillSize))
                {
                    raii.Push(ImGui.EndListBox);
                    UpdateFilenameList();
                    using var colorRaii = new ImGuiRaii.Color();
                    foreach (var(name, _, color, _) in _fullFilenameList !)
                    {
                        colorRaii.Push(ImGuiCol.Text, color);
                        ImGui.Selectable(name.FullName);
                        colorRaii.Pop();
                    }
                }
                else
                {
                    _fullFilenameList = null;
                }
            }
Beispiel #2
0
            private void DrawAboutTab()
            {
                if (!_editMode && Meta.Description.Length == 0)
                {
                    return;
                }

                if (!ImGui.BeginTabItem(LabelAboutTab))
                {
                    return;
                }

                using var raii = ImGuiRaii.DeferredEnd(ImGui.EndTabItem);

                var desc  = Meta.Description;
                var flags = _editMode
                    ? ImGuiInputTextFlags.EnterReturnsTrue | ImGuiInputTextFlags.CtrlEnterForNewLine
                    : ImGuiInputTextFlags.ReadOnly;

                if (_editMode)
                {
                    if (ImGui.InputTextMultiline(LabelDescEdit, ref desc, 1 << 16,
                                                 AutoFillSize, flags))
                    {
                        Meta.Description = desc;
                        _selector.SaveCurrentMod();
                    }

                    ImGuiCustom.HoverTooltip(TooltipAboutEdit);
                }
                else
                {
                    ImGui.TextWrapped(desc);
                }
            }
Beispiel #3
0
            private void DrawCleanCollectionButton()
            {
                if (ImGui.Button("Clean Settings"))
                {
                    var changes = ModFunctions.CleanUpCollection(_manager.Collections.CurrentCollection.Settings,
                                                                 _manager.BasePath.EnumerateDirectories());
                    _manager.Collections.CurrentCollection.UpdateSettings(changes);
                }

                ImGuiCustom.HoverTooltip(
                    "Remove all stored settings for mods not currently available and fix invalid settings.\nUse at own risk.");
            }
Beispiel #4
0
            private void DrawWebsite()
            {
                ImGui.BeginGroup();
                using var raii = ImGuiRaii.DeferredEnd(ImGui.EndGroup);
                if (_editMode)
                {
                    ImGui.TextColored(GreyColor, "from");
                    ImGui.SameLine();
                    var website = Meta !.Website;
                    if (ImGuiCustom.ResizingTextInput(LabelEditWebsite, ref website, 512) &&
                        website != Meta.Website)
                    {
                        Meta.Website = website;
                        _selector.SaveCurrentMod();
                    }
                }
                else if (Meta !.Website.Length > 0)
                {
                    if (_currentWebsite != Meta.Website)
                    {
                        _currentWebsite = Meta.Website;
                        _validWebsite   = Uri.TryCreate(Meta.Website, UriKind.Absolute, out var uriResult) &&
                                          (uriResult.Scheme == Uri.UriSchemeHttps || uriResult.Scheme == Uri.UriSchemeHttp);
                    }

                    if (_validWebsite)
                    {
                        if (ImGui.SmallButton(ButtonOpenWebsite))
                        {
                            try
                            {
                                var process = new ProcessStartInfo(Meta.Website)
                                {
                                    UseShellExecute = true,
                                };
                                Process.Start(process);
                            }
                            catch (System.ComponentModel.Win32Exception)
                            {
                                // Do nothing.
                            }
                        }

                        ImGuiCustom.HoverTooltip(Meta.Website);
                    }
                    else
                    {
                        ImGui.TextColored(GreyColor, "from");
                        ImGui.SameLine();
                        ImGui.Text(Meta.Website);
                    }
                }
            }
Beispiel #5
0
            public void DrawCurrentCollectionSelector(bool tooltip)
            {
                var index = _currentCollectionIndex;
                var combo = ImGui.Combo(LabelCurrentCollection, ref index, _collectionNames);

                ImGuiCustom.HoverTooltip(
                    "This collection will be modified when using the Installed Mods tab and making changes. It does not apply to anything by itself.");

                if (combo)
                {
                    SetCurrentCollection(index, false);
                }
            }
Beispiel #6
0
            private void DrawNewCharacterCollection()
            {
                ImGui.InputTextWithHint("##New Character", "New Character Name", ref _newCharacterName, 32);

                ImGui.SameLine();
                if (ImGuiCustom.DisableButton("Create New Character Collection", _newCharacterName.Length > 0))
                {
                    _manager.Collections.CreateCharacterCollection(_newCharacterName);
                    _currentCharacterIndices[_newCharacterName] = 0;
                    _newCharacterName = string.Empty;
                }

                ImGuiCustom.HoverTooltip(
                    "A character collection will be used whenever you manually redraw a character with the Name you have set up.\n"
                    + "If you enable automatic character redraws in the Settings tab, penumbra will try to use Character collections for corresponding characters automatically.\n");
            }
Beispiel #7
0
            private void DrawPriority()
            {
                var priority = Mod !.Settings.Priority;

                ImGui.SetNextItemWidth(50 * ImGuiHelpers.GlobalScale);
                if (ImGui.InputInt("Priority", ref priority, 0) && priority != Mod !.Settings.Priority)
                {
                    Mod.Settings.Priority = priority;
                    _base.SaveCurrentCollection(Mod.Data.Resources.MetaManipulations.Count > 0);
                    _selector.Cache.TriggerFilterReset();
                }

                ImGuiCustom.HoverTooltip(
                    "Higher priority mods take precedence over other mods in the case of file conflicts.\n"
                    + "In case of identical priority, the alphabetically first mod takes precedence.");
            }
Beispiel #8
0
            private void DrawForcedCollectionSelector()
            {
                var index = _currentForcedIndex;

                if (ImGui.Combo("##Forced Collection", ref index, _collectionNamesWithNone) && index != _currentForcedIndex)
                {
                    _manager.Collections.SetForcedCollection(_collections[index]);
                    _currentForcedIndex = index;
                }

                ImGuiCustom.HoverTooltip(
                    "Mods in the forced collection are always loaded if not overwritten by anything in the current or character-based collection.\n"
                    + "Please avoid mixing meta-manipulating mods in Forced and other collections, as this will probably not work correctly.");

                ImGui.SameLine();
                ImGuiHelpers.ScaledDummy(24, 0);
                ImGui.SameLine();
                ImGui.Text("Forced Collection");
            }
Beispiel #9
0
            private void DrawDefaultCollectionSelector()
            {
                var index = _currentDefaultIndex;

                if (ImGui.Combo("##Default Collection", ref index, _collectionNamesWithNone) && index != _currentDefaultIndex)
                {
                    _manager.Collections.SetDefaultCollection(_collections[index]);
                    _currentDefaultIndex = index;
                }

                ImGuiCustom.HoverTooltip(
                    "Mods in the default collection are loaded for any character that is not explicitly named in the character collections below.\n"
                    + "They also take precedence before the forced collection.");

                ImGui.SameLine();
                ImGuiHelpers.ScaledDummy(24, 0);
                ImGui.SameLine();
                ImGui.Text("Default Collection");
            }