Esempio n. 1
0
    // Draw the header line that can quick switch between collections.
    private void DrawHeaderLine()
    {
        using var style = ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 0).Push(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
        var buttonSize = new Vector2(ImGui.GetContentRegionAvail().X / 8f, 0);

        DrawDefaultCollectionButton(3 * buttonSize);
        ImGui.SameLine();
        DrawInheritedCollectionButton(3 * buttonSize);
        ImGui.SameLine();
        DrawCollectionSelector("##collectionSelector", 2 * buttonSize.X, ModCollection.Type.Current, false, null);
        if (!Penumbra.CollectionManager.CurrentCollectionInUse)
        {
            ImGuiUtil.DrawTextButton("The currently selected collection is not used in any way.", -Vector2.UnitX, Colors.PressEnterWarningBg);
        }
    }
        // Draw the mod name in the game font with a 2px border, centered,
        // with at least the width of the version space to each side.
        private float DrawModName()
        {
            var decidingWidth = Math.Max(_secondRowWidth, ImGui.GetWindowWidth());
            var offsetWidth   = (decidingWidth - _modNameWidth) / 2;
            var offsetVersion = _modVersion.Length > 0
                ? _modVersionWidth + ImGui.GetStyle().ItemSpacing.X + ImGui.GetStyle().WindowPadding.X
                : 0;
            var offset = Math.Max(offsetWidth, offsetVersion);

            if (offset > 0)
            {
                ImGui.SetCursorPosX(offset);
            }

            using var color = ImRaii.PushColor(ImGuiCol.Border, Colors.MetaInfoText);
            using var style = ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, 2 * ImGuiHelpers.GlobalScale);
            using var font  = ImRaii.PushFont(_nameFont.ImFont, _nameFont.Available);
            ImGuiUtil.DrawTextButton(_modName, Vector2.Zero, 0);
            return(offset);
        }