Ejemplo n.º 1
0
        // Draw a single group selector as a combo box.
        // If a description is provided, add a help marker besides it.
        private void DrawSingleGroup(IModGroup group, int groupIdx)
        {
            if (group.Type != SelectType.Single || !group.IsOption)
            {
                return;
            }

            using var id = ImRaii.PushId(groupIdx);
            var selectedOption = _emptySetting ? 0 : ( int )_settings.Settings[groupIdx];

            ImGui.SetNextItemWidth(_window._inputTextWidth.X * 3 / 4);
            using var combo = ImRaii.Combo(string.Empty, group[selectedOption].Name);
            if (combo)
            {
                for (var idx2 = 0; idx2 < group.Count; ++idx2)
                {
                    if (ImGui.Selectable(group[idx2].Name, idx2 == selectedOption))
                    {
                        Penumbra.CollectionManager.Current.SetModSetting(_mod.Index, groupIdx, ( uint )idx2);
                    }
                }
            }

            combo.Dispose();
            ImGui.SameLine();
            if (group.Description.Length > 0)
            {
                ImGuiUtil.LabeledHelpMarker(group.Name, group.Description);
            }
            else
            {
                ImGui.TextUnformatted(group.Name);
            }
        }
        // Different supported sort modes as a combo.
        private void DrawFolderSortType()
        {
            var sortMode = Penumbra.Config.SortMode;

            ImGui.SetNextItemWidth(_window._inputTextWidth.X);
            using var combo = ImRaii.Combo("##sortMode", sortMode.Data().Name);
            if (combo)
            {
                foreach (var val in Enum.GetValues <SortMode>())
                {
                    var(name, desc) = val.Data();
                    if (ImGui.Selectable(name, val == sortMode) && val != sortMode)
                    {
                        Penumbra.Config.SortMode = val;
                        _window._selector.SetFilterDirty();
                        Penumbra.Config.Save();
                    }

                    ImGuiUtil.HoverTooltip(desc);
                }
            }

            combo.Dispose();
            ImGuiUtil.LabeledHelpMarker("Sort Mode", "Choose the sort mode for the mod selector in the mods tab.");
        }
Ejemplo n.º 3
0
        private static void DrawRaceCodeCombo(Vector2 buttonSize)
        {
            ImGui.SetNextItemWidth(buttonSize.X);
            using var combo = ImRaii.Combo("##RaceCode", RaceCodeName(_raceCode));
            if (!combo)
            {
                return;
            }

            foreach (var raceCode in Enum.GetValues <GenderRace>())
            {
                if (ImGui.Selectable(RaceCodeName(raceCode), _raceCode == raceCode))
                {
                    _raceCode = raceCode;
                }
            }
        }