void SetupDialog()
        {
            int cnt = Math.Max(1, skillItems.Count);

            int cols = Math.Min(cnt, 7);

            int rows = (int)Math.Ceiling(cnt / (float)cols);

            double        size            = GuiElementPassiveItemSlot.unscaledSlotSize + GuiElementItemSlotGrid.unscaledSlotPadding;
            double        innerWidth      = Math.Max(300, cols * size);
            ElementBounds skillGridBounds = ElementBounds.Fixed(0, 30, innerWidth, rows * size);

            ElementBounds textBounds = ElementBounds.Fixed(0, rows * size + 50, innerWidth, 33);

            ElementBounds bgBounds = ElementBounds.Fill.WithFixedPadding(GuiStyle.ElementToDialogPadding);

            bgBounds.BothSizing = ElementSizing.FitToChildren;


            SingleComposer =
                capi.Gui
                .CreateCompo("toolmodeselect" + blockEntityPos, ElementStdBounds.AutosizedMainDialog)
                .AddShadedDialogBG(bgBounds, true)
                .AddDialogTitleBar(Lang.Get("Select Recipe"), OnTitleBarClose)
                .BeginChildElements(bgBounds)
                .AddSkillItemGrid(skillItems, cols, rows, OnSlotClick, skillGridBounds, "skillitemgrid")
                .AddDynamicText("", CairoFont.WhiteSmallishText(), textBounds, "name")
                .AddDynamicText("", CairoFont.WhiteDetailText(), textBounds.BelowCopy(0, 10, 0, 0), "desc")
                .EndChildElements()
                .Compose()
            ;

            SingleComposer.GetSkillItemGrid("skillitemgrid").OnSlotOver = OnSlotOver;
        }
Beispiel #2
0
        void SetupDialog()
        {
            int           rows            = (int)Math.Ceiling(skillItems.Count / 5f);
            int           cols            = Math.Min(skillItems.Count, 5);
            double        size            = GuiElementPassiveItemSlot.unscaledSlotSize + GuiElementItemSlotGrid.unscaledSlotPadding;
            double        innerWidth      = Math.Max(300, cols * size);
            ElementBounds skillGridBounds = ElementBounds.Fixed(0, 30, innerWidth, rows * size);

            ElementBounds textBounds = ElementBounds.Fixed(0, rows * size + 50, innerWidth, 33);

            SingleComposer =
                capi.Gui
                .CreateCompo("toolmodeselect", ElementStdBounds.AutosizedMainDialog, false)
                .AddDialogTitleBar("Select Recipe", OnTitleBarClose)
                .AddDialogBG(ElementStdBounds.DialogBackground(), false, ElementGeometrics.TitleBarHeight - 1)
                .BeginChildElements()
                .AddSkillItemGrid(skillItems, cols, rows, OnSlotClick, skillGridBounds, "skillitemgrid")
                .AddDynamicText("", CairoFont.WhiteSmallishText(), EnumTextOrientation.Left, textBounds, 1, "name")
                .AddDynamicText("", CairoFont.WhiteDetailText(), EnumTextOrientation.Left, textBounds.BelowCopy(0, 10, 0, 0), 1, "desc")
                .EndChildElements()
                .Compose()
            ;

            SingleComposer.GetSkillItemGrid("skillitemgrid").OnSlotOver = OnSlotOver;
        }
Beispiel #3
0
        private void ComposeDialog()
        {
            int height        = 200;
            int tableWidth    = 150;
            int textAreaWidth = 200;
            int headerHeight  = 20;
            int labelWidth    = 60;

            var spacer = ElementStdBounds
                         .TitleBar();

            var tableBounds = Fixed(0, 0, tableWidth, height);

            var labelBounds = Fixed(0, 0, labelWidth, headerHeight);

            var nameInputBounds = Fixed(labelWidth, 0, textAreaWidth - labelWidth, headerHeight);

            var headerBounds = Fixed(0, 0, textAreaWidth, headerHeight)
                               .WithChildren(labelBounds, nameInputBounds);

            var textAreaBounds = Fixed(0, 0, textAreaWidth, height)
                                 .FixedUnder(headerBounds, HalfPadding);

            var textContainerBounds = Fill
                                      .WithSizing(ElementSizing.FitToChildren)
                                      .FixedRightOf(tableBounds, HalfPadding)
                                      .WithChildren(textAreaBounds, headerBounds);

            var bodyBounds = Fill
                             .WithSizing(ElementSizing.FitToChildren)
                             .FixedUnder(spacer)
                             .WithChildren(textContainerBounds, tableBounds);

            var bgBounds = Fill
                           .WithFixedPadding(ElementToDialogPadding)
                           .WithChildren(bodyBounds)
                           .WithSizing(ElementSizing.FitToChildren);

            var dialogBounds = ElementStdBounds
                               .AutosizedMainDialog
                               .WithAlignment(EnumDialogArea.CenterMiddle);

            SingleComposer = capi.Gui.CreateCompo("aliaseditor", dialogBounds)
                             .AddShadedDialogBG(bgBounds)
                             .AddDialogTitleBar("Alias Editor", () => TryClose())
                             .AddStaticText("Alias:", CairoFont.WhiteSmallishText(), labelBounds)
                             .AddTextInput(nameInputBounds, OnAliasNameChanged, CairoFont.TextInput(), "aliastextinput")
                             .AddTextArea(textAreaBounds, OnAliasTextChanged, CairoFont.TextInput(), "aliastextarea")
                             .AddCellList(tableBounds,
                                          (cell, elBounds) => new GuiElementCell(capi, cell, elBounds)
            {
                ShowModifyIcons = false
            },
                                          OnMouseDownOnCell, OnMouseDownOnCell,
                                          cellList, "aliascellarea")
                             .Compose();
            textArea         = SingleComposer.GetTextArea("aliastextarea");
            textArea.Enabled = false;
            textInput        = SingleComposer.GetTextInput("aliastextinput");
        }
        private void ComposeDialog()
        {
            ElementBounds leftColumn  = ElementBounds.Fixed(0, 28, 120, 25);
            ElementBounds rightColumn = leftColumn.RightCopy();

            ElementBounds buttonRow = ElementBounds.Fixed(0, 28, 360, 25);

            ElementBounds bgBounds = ElementBounds.Fill.WithFixedPadding(GuiStyle.ElementToDialogPadding);

            bgBounds.BothSizing = ElementSizing.FitToChildren;
            bgBounds.WithChildren(leftColumn, rightColumn);

            ElementBounds dialogBounds =
                ElementStdBounds.AutosizedMainDialog
                .WithAlignment(EnumDialogArea.CenterMiddle)
                .WithFixedAlignmentOffset(-GuiStyle.DialogToScreenPadding, 0);


            if (SingleComposer != null)
            {
                SingleComposer.Dispose();
            }

            SingleComposer = capi.Gui
                             .CreateCompo("worldmap-addwp", dialogBounds)
                             .AddShadedDialogBG(bgBounds, false)
                             .AddDialogTitleBar(Lang.Get("Add waypoint"), () => TryClose())
                             .BeginChildElements(bgBounds)
                             .AddStaticText(Lang.Get("Name"), CairoFont.WhiteSmallText(), leftColumn = leftColumn.FlatCopy())
                             .AddTextInput(rightColumn = rightColumn.FlatCopy().WithFixedWidth(200), onNameChanged, CairoFont.TextInput(), "nameInput")

                             .AddRichtext(Lang.Get("waypoint-color"), CairoFont.WhiteSmallText(), leftColumn = leftColumn.BelowCopy(0, 5))
                             .AddTextInput(rightColumn = rightColumn.BelowCopy(0, 5).WithFixedWidth(150), onColorChanged, CairoFont.TextInput(), "colorInput")
                             .AddDynamicCustomDraw(rightColumn.FlatCopy().WithFixedWidth(30).WithFixedOffset(160, 0), onDrawColorRect, "colorRect")

                             .AddStaticText(Lang.Get("Icon"), CairoFont.WhiteSmallText(), leftColumn = leftColumn.BelowCopy(0, 9))
                             .AddDropDown(
                new string[] { "circle", "bee", "cave", "home", "ladder", "pick", "rocks", "ruins", "spiral", "star1", "star2", "trader", "vessel" },
                new string[] { "<icon name=\"wpCircle\">", "<icon name=\"wpBee\">", "<icon name=\"wpCave\">", "<icon name=\"wpHome\">", "<icon name=\"wpLadder\">", "<icon name=\"wpPick\">", "<icon name=\"wpRocks\">", "<icon name=\"wpRuins\">", "<icon name=\"wpSpiral\">", "<icon name=\"wpStar1\">", "<icon name=\"wpStar2\">", "<icon name=\"wpTrader\">", "<icon name=\"wpVessel\">" },
                0,
                onIconSelectionChanged,
                rightColumn = rightColumn.BelowCopy(0, 5).WithFixedWidth(60),
                CairoFont.WhiteSmallishText(),
                "iconInput"
                )

                             .AddStaticText(Lang.Get("Pinned"), CairoFont.WhiteSmallText(), leftColumn = leftColumn.BelowCopy(0, 9))
                             .AddSwitch(onPinnedToggled, rightColumn = rightColumn.BelowCopy(0, 5).WithFixedWidth(200), "pinnedSwitch")

                             .AddSmallButton(Lang.Get("Cancel"), onCancel, buttonRow.FlatCopy().FixedUnder(leftColumn, 0).WithFixedWidth(100), EnumButtonStyle.Normal)
                             .AddSmallButton(Lang.Get("Save"), onSave, buttonRow.FlatCopy().FixedUnder(leftColumn, 0).WithFixedWidth(100).WithAlignment(EnumDialogArea.RightFixed), EnumButtonStyle.Normal, key: "saveButton")
                             .EndChildElements()
                             .Compose()
            ;

            SingleComposer.GetButton("saveButton").Enabled = false;
        }
Beispiel #5
0
 private void LoadAliases()
 {
     cellList.Clear();
     foreach (var alias in AliasMan)
     {
         cellList.Add(new ListCellEntry()
         {
             Data      = alias,
             Title     = alias.trigger,
             TitleFont = CairoFont.WhiteSmallishText()
         });
     }
 }
Beispiel #6
0
        internal void ComposeWindow()
        {
            ClearComposers();

            var         rows  = new[] { 0f, 1f, 1.5f, 2.5f, 3.0f };
            const float width = 500f;

            var guiComposer = Api.AsClientMain().GetField <GuiComposerManager>("GuiComposers")
                              .Create("wpex-settings", ElementStdBounds.AutosizedMainDialog)
                              .AddShadedDialogBG(ElementStdBounds.DialogBackground()
                                                 .WithFixedPadding(GuiStyle.ElementToDialogPadding, GuiStyle.ElementToDialogPadding), false)
                              .BeginChildElements();

            // Title.
            guiComposer.AddStaticText(LangEx.UI("SettingsWindow.Headers.Wpex"),
                                      CairoFont.WhiteSmallishText().WithFontSize(25f),
                                      EnumTextOrientation.Center,
                                      ElementStdBounds.MenuButton(rows[0])
                                      .WithFixedWidth(width));

            // Auto Translocator.
            guiComposer.AddStaticText(LangEx.UI("SettingsWindow.Labels.AutoTranslocator"), CairoFont.WhiteSmallishText(),
                                      ElementStdBounds.MenuButton(rows[1], EnumDialogArea.LeftTop).WithFixedWidth(330))
            .AddHoverText(LangEx.UI("SettingsWindow.Tooltips.AutoTranslocator"), CairoFont.WhiteSmallText(), 250,
                          ElementStdBounds.MenuButton(rows[1], EnumDialogArea.LeftTop).WithFixedWidth(250))
            .AddSwitch(AutoTranslocatorChanged,
                       ElementStdBounds.MenuButton(rows[1], EnumDialogArea.LeftTop).WithFixedOffset(350.0, 0), "AutoTranslocatorWaypoints");

            // Auto Trader
            guiComposer.AddStaticText(LangEx.UI("SettingsWindow.Labels.AutoTrader"), CairoFont.WhiteSmallishText(),
                                      ElementStdBounds.MenuButton(rows[2], EnumDialogArea.LeftTop).WithFixedWidth(330))
            .AddHoverText(LangEx.UI("SettingsWindow.Tooltips.AutoTrader"), CairoFont.WhiteSmallText(), 250,
                          ElementStdBounds.MenuButton(rows[2], EnumDialogArea.LeftTop).WithFixedWidth(250))
            .AddSwitch(AutoTraderChanged,
                       ElementStdBounds.MenuButton(rows[2], EnumDialogArea.LeftTop).WithFixedOffset(350.0, 0), "AutoTraderWaypoints");

            // Donate Button.
            guiComposer.AddButton(LangEx.UI("SettingsWindow.Labels.Donate"), OnDonateButton,
                                  ElementStdBounds.MenuButton(rows[3]).WithFixedWidth(width));

            // Back Button.
            guiComposer.AddButton(Lang.Get("pause-back2game"), OnBackToGame,
                                  ElementStdBounds.MenuButton(rows[4]).WithFixedWidth(width));

            guiComposer.GetSwitch("AutoTranslocatorWaypoints").On = Mod.Settings.AutoTranslocatorWaypoints;
            guiComposer.GetSwitch("AutoTraderWaypoints").On       = Mod.Settings.AutoTraderWaypoints;

            SingleComposer = guiComposer.EndChildElements().Compose();
        }
Beispiel #7
0
        private bool onClickItem(int page)
        {
            currentLoreItemIndex = page;
            this.page            = 0;

            CairoFont     font     = CairoFont.WhiteDetailText().WithFontSize(17).WithLineHeightMultiplier(1.15f);
            TextDrawUtil  prober   = new TextDrawUtil();
            StringBuilder fulltext = new StringBuilder();

            JournalEntry entry = journalitems[currentLoreItemIndex];

            for (int p = 0; p < entry.Chapters.Count; p++)
            {
                if (p > 0)
                {
                    fulltext.AppendLine();
                }
                fulltext.Append(Lang.Get(entry.Chapters[p].Text));
            }

            pages = Paginate(fulltext.ToString(), font, GuiElement.scaled(629), GuiElement.scaled(450));


            double elemToDlgPad = GuiStyle.ElementToDialogPadding;

            ElementBounds textBounds   = ElementBounds.Fixed(0, 0, 630, 450);
            ElementBounds dialogBounds = textBounds.ForkBoundingParent(elemToDlgPad, elemToDlgPad + 20, elemToDlgPad, elemToDlgPad + 30).WithAlignment(EnumDialogArea.LeftMiddle);

            dialogBounds.fixedX = 350;


            Composers["loreItem"] =
                capi.Gui
                .CreateCompo("loreItem", dialogBounds)
                .AddShadedDialogBG(ElementBounds.Fill, true)
                .AddDialogTitleBar(Lang.Get(journalitems[page].Title), CloseIconPressedLoreItem)
                .AddRichtext(pages[0], font, textBounds, "page")
                .AddDynamicText("1 / " + pages.Length, CairoFont.WhiteSmallishText().WithOrientation(EnumTextOrientation.Center), ElementBounds.Fixed(250, 500, 100, 30), "currentpage")
                .AddButton(Lang.Get("Previous Page"), OnPrevPage, ElementBounds.Fixed(17, 500, 100, 23).WithFixedPadding(10, 4), CairoFont.WhiteSmallishText())
                .AddButton(Lang.Get("Next Page"), OnNextPage, ElementBounds.Fixed(520, 500, 100, 23).WithFixedPadding(10, 4), CairoFont.WhiteSmallishText())
                .Compose()
            ;

            return(true);
        }
Beispiel #8
0
        private bool onClickItem(int i)
        {
            currentLoreItemIndex = i;
            page = 0;

            CairoFont      font     = CairoFont.WhiteDetailText().WithFontSize(17);
            TextSizeProber prober   = new TextSizeProber();
            StringBuilder  fulltext = new StringBuilder();

            for (int p = 0; p < journalitems[currentLoreItemIndex].Pieces.Length; p++)
            {
                if (p > 0)
                {
                    fulltext.AppendLine();
                }
                fulltext.Append(journalitems[currentLoreItemIndex].Pieces[p]);
            }

            pages = Paginate(fulltext, font, GuiElement.scaled(629), GuiElement.scaled(450), 1.15);


            double elemToDlgPad = ElementGeometrics.ElementToDialogPadding;

            ElementBounds textBounds   = ElementBounds.Fixed(0, 0, 630, 450);
            ElementBounds dialogBounds = textBounds.ForkBoundingParent(elemToDlgPad, elemToDlgPad + 20, elemToDlgPad, elemToDlgPad + 30).WithAlignment(EnumDialogArea.LeftMiddle);

            dialogBounds.fixedX = 350;


            DialogComposers["loreItem"] =
                capi.Gui
                .CreateCompo("loreItem", dialogBounds, false)
                .AddDialogBG(ElementBounds.Fill, true)
                .AddDialogTitleBar(journalitems[i].Title, CloseIconPressedLoreItem)
                .AddDynamicText(pages[0], font, EnumTextOrientation.Left, textBounds, 1.15f, "page")
                .AddDynamicText("1 / " + pages.Length, CairoFont.WhiteSmallishText(), EnumTextOrientation.Center, ElementBounds.Fixed(250, 500, 100, 30), 1, "currentpage")
                .AddButton("Previous Page", OnPrevPage, ElementBounds.Fixed(17, 500, 100, 23).WithFixedPadding(10, 4), CairoFont.WhiteSmallishText())
                .AddButton("Next Page", OnNextPage, ElementBounds.Fixed(520, 500, 100, 23).WithFixedPadding(10, 4), CairoFont.WhiteSmallishText())
                .Compose()
            ;

            return(true);
        }
Beispiel #9
0
        private void ComposeDialog()
        {
            ElementBounds leftColumn  = ElementBounds.Fixed(0, 28, 120, 25);
            ElementBounds rightColumn = leftColumn.RightCopy();

            ElementBounds buttonRow = ElementBounds.Fixed(0, 28, 360, 25);

            ElementBounds bgBounds = ElementBounds.Fill.WithFixedPadding(GuiStyle.ElementToDialogPadding);

            bgBounds.BothSizing = ElementSizing.FitToChildren;
            bgBounds.WithChildren(leftColumn, rightColumn);

            ElementBounds dialogBounds =
                ElementStdBounds.AutosizedMainDialog
                .WithAlignment(EnumDialogArea.CenterMiddle)
                .WithFixedAlignmentOffset(-GuiStyle.DialogToScreenPadding, 0);


            if (SingleComposer != null)
            {
                SingleComposer.Dispose();
            }

            string[] names = new string[] { "circle", "bee", "cave", "home", "ladder", "pick", "rocks", "ruins", "spiral", "star1", "star2", "trader", "vessel" };
            int      index = names.IndexOf(waypoint.Icon);

            if (index < 0)
            {
                index = 0;
            }

            SingleComposer = capi.Gui
                             .CreateCompo("worldmap-modwp", dialogBounds)
                             .AddShadedDialogBG(bgBounds, false)
                             .AddDialogTitleBar("Modify waypoint", () => TryClose())
                             .BeginChildElements(bgBounds)
                             .AddRichtext("Color (<a href=\"https://www.99colors.net/dot-net-colors\">List</a>)", CairoFont.WhiteSmallText(), leftColumn = leftColumn.FlatCopy())
                             .AddTextInput(rightColumn = rightColumn.FlatCopy().WithFixedWidth(150), onColorChanged, CairoFont.TextInput(), "colorInput")
                             .AddDynamicCustomDraw(rightColumn.FlatCopy().WithFixedWidth(30).WithFixedOffset(160, 0), onDrawColorRect, "colorRect")
                             .AddStaticText("Name", CairoFont.WhiteSmallText(), leftColumn = leftColumn.BelowCopy(0, 5))
                             .AddTextInput(rightColumn = rightColumn.BelowCopy(0, 5).WithFixedWidth(200), onNameChanged, CairoFont.TextInput(), "nameInput")

                             .AddStaticText("Icon", CairoFont.WhiteSmallText(), leftColumn = leftColumn.BelowCopy(0, 5))
                             .AddDropDown(
                names,
                new string[] { "<icon name=\"wpCircle\">", "<icon name=\"wpBee\">", "<icon name=\"wpCave\">", "<icon name=\"wpHome\">", "<icon name=\"wpLadder\">", "<icon name=\"wpPick\">", "<icon name=\"wpRocks\">", "<icon name=\"wpRuins\">", "<icon name=\"wpSpiral\">", "<icon name=\"wpStar1\">", "<icon name=\"wpStar2\">", "<icon name=\"wpTrader\">", "<icon name=\"wpVessel\">" },
                index,
                onIconSelectionChanged,
                rightColumn = rightColumn.BelowCopy(0, 5).WithFixedWidth(60),
                CairoFont.WhiteSmallishText(),
                "iconInput"
                )

                             .AddSmallButton("Cancel", onCancel, buttonRow.FlatCopy().FixedUnder(leftColumn, 0).WithFixedWidth(100), EnumButtonStyle.Normal)
                             .AddSmallButton("Delete", onDelete, buttonRow.FlatCopy().FixedUnder(leftColumn, 0).WithFixedWidth(100).WithAlignment(EnumDialogArea.CenterFixed), EnumButtonStyle.Normal)
                             .AddSmallButton("Save", onSave, buttonRow.FlatCopy().FixedUnder(leftColumn, 0).WithFixedWidth(100).WithAlignment(EnumDialogArea.RightFixed), EnumButtonStyle.Normal, key: "saveButton")
                             .EndChildElements()
                             .Compose()
            ;


            var col = System.Drawing.Color.FromArgb(0, ColorUtil.ColorR(waypoint.Color), ColorUtil.ColorG(waypoint.Color), ColorUtil.ColorB(waypoint.Color));

            if (col.IsKnownColor)
            {
                SingleComposer.GetTextInput("colorInput").SetValue(col.ToKnownColor().ToString().ToLowerInvariant());
            }
            else
            {
                SingleComposer.GetTextInput("colorInput").SetValue(ColorUtil.Int2Hex(waypoint.Color));
            }

            SingleComposer.GetTextInput("nameInput").SetValue(waypoint.Title);
        }
Beispiel #10
0
        public void initOverviewGui()
        {
            ElementBounds searchFieldBounds = ElementBounds.Fixed(GuiStyle.ElementToDialogPadding - 2, 45, 300, 30);
            ElementBounds stackListBounds   = ElementBounds.Fixed(0, 0, 500, listHeight).FixedUnder(searchFieldBounds, 5);

            ElementBounds clipBounds  = stackListBounds.ForkBoundingParent();
            ElementBounds insetBounds = stackListBounds.FlatCopy().FixedGrow(6).WithFixedOffset(-3, -3);

            ElementBounds scrollbarBounds = insetBounds.CopyOffsetedSibling(3 + stackListBounds.fixedWidth + 7).WithFixedWidth(20);

            ElementBounds closeButtonBounds = ElementBounds
                                              .FixedSize(0, 0)
                                              .FixedUnder(clipBounds, 2 * 5 + 8)
                                              .WithAlignment(EnumDialogArea.RightFixed)
                                              .WithFixedPadding(20, 4)
                                              .WithFixedAlignmentOffset(2, 0)
            ;

            // 2. Around all that is 10 pixel padding
            ElementBounds bgBounds = ElementBounds.Fill.WithFixedPadding(GuiStyle.ElementToDialogPadding);

            bgBounds.BothSizing = ElementSizing.FitToChildren;
            bgBounds.WithChildren(insetBounds, stackListBounds, scrollbarBounds, closeButtonBounds);

            // 3. Finally Dialog
            ElementBounds dialogBounds = ElementStdBounds.AutosizedMainDialog.WithAlignment(EnumDialogArea.None).WithAlignment(EnumDialogArea.CenterFixed).WithFixedPosition(0, 70);

            ElementBounds tabBounds = ElementBounds.Fixed(-200, 35, 200, 545);

            int           curTab;
            ElementBounds backButtonBounds = ElementBounds
                                             .FixedSize(0, 0)
                                             .FixedUnder(clipBounds, 2 * 5 + 5)
                                             .WithAlignment(EnumDialogArea.LeftFixed)
                                             .WithFixedPadding(20, 4)
                                             .WithFixedAlignmentOffset(-6, 3)
            ;

            overviewGui = capi.Gui
                          .CreateCompo("handbook-overview", dialogBounds)
                          .AddShadedDialogBG(bgBounds, true)
                          .AddDialogTitleBar(Lang.Get("Survival Handbook"), OnTitleBarClose)
                          .AddVerticalTabs(genTabs(out curTab), tabBounds, OnTabClicked, "verticalTabs")
                          .AddTextInput(searchFieldBounds, FilterItemsBySearchText, CairoFont.WhiteSmallishText(), "searchField")
                          .BeginChildElements(bgBounds)
                          .BeginClip(clipBounds)
                          .AddInset(insetBounds, 3)
                          .AddHandbookStackList(stackListBounds, onLeftClickListElement, shownHandbookPages, "stacklist")
                          .EndClip()
                          .AddVerticalScrollbar(OnNewScrollbarvalueOverviewPage, scrollbarBounds, "scrollbar")
                          .AddSmallButton(Lang.Get("general-back"), OnButtonBack, backButtonBounds, EnumButtonStyle.Normal, EnumTextOrientation.Center, "backButton")
                          .AddSmallButton(Lang.Get("Close Handbook"), OnButtonClose, closeButtonBounds)
                          .EndChildElements()
                          .Compose()
            ;

            overviewGui.GetScrollbar("scrollbar").SetHeights(
                (float)listHeight,
                (float)overviewGui.GetHandbookStackList("stacklist").insideBounds.fixedHeight
                );

            overviewGui.GetTextInput("searchField").SetPlaceHolderText("Search...");

            overviewGui.GetVerticalTab("verticalTabs").SetValue(curTab, false);

            overviewGui.FocusElement(overviewGui.GetTextInput("searchField").TabIndex);

            if (curTab == 0)
            {
                currentCatgoryCode = null;
            }
            else
            {
                currentCatgoryCode = categoryCodes[curTab - 1];
            }
            FilterItems();
        }
Beispiel #11
0
        public EyesOverlayRenderer(ICoreClientAPI capi, IShaderProgram eyeShaderProg)
        {
            this.capi          = capi;
            this.eyeShaderProg = eyeShaderProg;

            MeshData quadMesh = QuadMeshUtil.GetCustomQuadModelData(-1, -1, -20000 + 151 + 1, 2, 2);

            quadMesh.Rgba = null;

            quadRef = capi.Render.UploadMesh(quadMesh);

            string hotkey = capi.Input.HotKeys["sneak"].CurrentMapping.ToString();

            exitHelpTexture = capi.Gui.TextTexture.GenTextTexture(Lang.Get("bed-exithint", hotkey), CairoFont.WhiteSmallishText());
        }
        protected virtual void ComposeGuis()
        {
            double pad      = GuiElementItemSlotGrid.unscaledSlotPadding;
            double slotsize = GuiElementPassiveItemSlot.unscaledSlotSize;

            ElementBounds leftPrevButtonBounds = ElementBounds.Fixed(75, 120 + pad + 52, 19, 19).WithFixedPadding(2);
            ElementBounds leftNextButtonBounds = ElementBounds.Fixed(75, 120 + pad + 52, 19, 19).WithFixedPadding(2).FixedRightOf(leftPrevButtonBounds, 6);
            ElementBounds textBounds           = ElementBounds.Fixed(0, 120 + pad + 52, 19, 19).WithFixedPadding(2);

            ElementBounds humanButtonBounds = ElementBounds.Fixed(0, pad + 52, 19, 19).WithFixedPadding(2);
            ElementBounds dwarfButtonBounds = ElementBounds.Fixed(0, pad + 52, 19, 19).WithFixedPadding(2).FixedRightOf(humanButtonBounds, 40);

            ElementBounds maleButtonBounds   = ElementBounds.Fixed(0, 57 + pad + 52, 19, 19).WithFixedPadding(2);
            ElementBounds femaleButtonBounds = ElementBounds.Fixed(0, 57 + pad + 52, 19, 19).WithFixedPadding(2).FixedRightOf(maleButtonBounds, 30);

            ElementBounds titleTextBounds = ElementBounds.Fixed(0, pad + 20, 19, 19).WithFixedPadding(2);

            characterInv = capi.World.Player.InventoryManager.GetOwnInventory(GlobalConstants.characterInvClassName);
            ElementBounds leftSlotBounds = ElementStdBounds.SlotGrid(EnumDialogArea.None, pad, 20 + pad, 1, 6).FixedGrow(2 * pad, 2 * pad);

            insetSlotBounds = ElementBounds.Fixed(pad + 65 + 65, pad + 20 + 2, 300 - 60, leftSlotBounds.fixedHeight - 2 * pad - 4);

            ElementBounds bgBounds = ElementBounds.Fill.WithFixedPadding(GuiStyle.ElementToDialogPadding);

            bgBounds.BothSizing = ElementSizing.FitToChildren;


            ElementBounds dialogBounds = ElementStdBounds
                                         .AutosizedMainDialog.WithAlignment(EnumDialogArea.None)
                                         .WithFixedAlignmentOffset(GuiStyle.DialogToScreenPadding, 0);


            ClearComposers();
            SingleComposer = capi.Gui
                             .CreateCompo("playercharacter", dialogBounds)
                             .AddDialogBG(bgBounds, true)
                             //.AddDialogTitleBar(capi.World.Player.PlayerName, OnTitleBarClose)
                             .BeginChildElements(bgBounds)

                             // Race
                             .AddStaticTextAutoBoxSize("Race:", CairoFont.WhiteSmallishText(), EnumTextOrientation.Right, titleTextBounds.FlatCopy())
                             .AddSmallButton("Human", () => ButtonClickRace("human"), humanButtonBounds.FlatCopy())
                             .AddSmallButton("Dwarf", () => ButtonClickRace("dwarf"), dwarfButtonBounds.FlatCopy())

                             // Sex
                             .AddStaticTextAutoBoxSize("Sex:", CairoFont.WhiteSmallishText(), EnumTextOrientation.Right, titleTextBounds = titleTextBounds.BelowCopy(0, 35))
                             .AddSmallButton("Male", () => ButtonClickSex("male"), maleButtonBounds.FlatCopy())
                             .AddSmallButton("Female", () => ButtonClickSex("female"), femaleButtonBounds.FlatCopy())

                             .AddStaticTextAutoBoxSize("Appearance:", CairoFont.WhiteSmallishText(), EnumTextOrientation.Right, titleTextBounds = titleTextBounds.BelowCopy(0, 35))

                             // Skin Color
                             .AddIconButton("left", (on) => OnPrevious("skincolor"), leftPrevButtonBounds.FlatCopy())
                             .AddIconButton("right", (on) => OnNext("skincolor"), leftNextButtonBounds.FlatCopy())
                             .AddStaticTextAutoBoxSize("Skin color:", CairoFont.WhiteDetailText(), EnumTextOrientation.Right, textBounds.FlatCopy())

                             // Eye Color
                             .AddIconButton("left", (on) => OnPrevious("eyecolor"), leftPrevButtonBounds = leftPrevButtonBounds.BelowCopy(0, 5))
                             .AddIconButton("right", (on) => OnNext("eyecolor"), leftNextButtonBounds    = leftNextButtonBounds.BelowCopy(0, 5))
                             .AddStaticTextAutoBoxSize("Eye color:", CairoFont.WhiteDetailText(), EnumTextOrientation.Right, textBounds = textBounds.BelowCopy(0, 5))

                             // Hair Color
                             .AddIconButton("left", (on) => OnPrevious("haircolor"), leftPrevButtonBounds = leftPrevButtonBounds.BelowCopy(0, 5))
                             .AddIconButton("right", (on) => OnNext("haircolor"), leftNextButtonBounds    = leftNextButtonBounds.BelowCopy(0, 5))
                             .AddStaticTextAutoBoxSize("Hair color:", CairoFont.WhiteDetailText(), EnumTextOrientation.Right, textBounds = textBounds.BelowCopy(0, 7))

                             // Hair Type
                             .AddIconButton("left", (on) => OnPrevious("hairtype"), leftPrevButtonBounds = leftPrevButtonBounds.BelowCopy(0, 5))
                             .AddIconButton("right", (on) => OnNext("hairtype"), leftNextButtonBounds    = leftNextButtonBounds.BelowCopy(0, 5))
                             .AddStaticTextAutoBoxSize("Hair type:", CairoFont.WhiteDetailText(), EnumTextOrientation.Right, textBounds = textBounds.BelowCopy(0, 7))

                             // Facial Hair
                             .AddIconButton("left", (on) => OnPrevious("facialhair"), leftPrevButtonBounds = leftPrevButtonBounds.BelowCopy(0, 5))
                             .AddIconButton("right", (on) => OnNext("facialhair"), leftNextButtonBounds    = leftNextButtonBounds.BelowCopy(0, 5))
                             .AddStaticTextAutoBoxSize("Facial hair:", CairoFont.WhiteDetailText(), EnumTextOrientation.Right, textBounds = textBounds.BelowCopy(0, 7))

                             .AddSmallButton("Confirm", () => TryClose(), textBounds = textBounds.BelowCopy(0, 7))

                             //.AddItemSlotGrid(characterInv, SendInvPacket, 1, new int[] { 0, 1, 2, 11, 3, 4 }, leftSlotBounds, "leftSlots")
                             .AddInset(insetSlotBounds, 2)
                             //.AddItemSlotGrid(characterInv, SendInvPacket, 1, new int[] { 6, 7, 8, 10, 5, 9 }, rightSlotBounds, "rightSlots")
                             .EndChildElements()
                             .Compose()
            ;
        }
Beispiel #13
0
        void initOverviewGui()
        {
            ElementBounds searchFieldBounds = ElementBounds.Fixed(GuiStyle.ElementToDialogPadding - 2, 45, 300, 30);
            ElementBounds stackListBounds   = ElementBounds.Fixed(0, 0, 400, listHeight).FixedUnder(searchFieldBounds, 5);

            ElementBounds clipBounds  = stackListBounds.ForkBoundingParent();
            ElementBounds insetBounds = stackListBounds.FlatCopy().FixedGrow(6).WithFixedOffset(-3, -3);

            ElementBounds scrollbarBounds = insetBounds.CopyOffsetedSibling(3 + stackListBounds.fixedWidth + 7).WithFixedWidth(20);

            ElementBounds closeButtonBounds = ElementBounds
                                              .FixedSize(0, 0)
                                              .FixedUnder(clipBounds, 2 * 5 + 8)
                                              .WithAlignment(EnumDialogArea.RightFixed)
                                              .WithFixedPadding(20, 4)
                                              .WithFixedAlignmentOffset(2, 0)
            ;

            // 2. Around all that is 10 pixel padding
            ElementBounds bgBounds = ElementBounds.Fill.WithFixedPadding(GuiStyle.ElementToDialogPadding);

            bgBounds.BothSizing = ElementSizing.FitToChildren;
            bgBounds.WithChildren(insetBounds, stackListBounds, scrollbarBounds, closeButtonBounds);

            // 3. Finally Dialog
            ElementBounds dialogBounds = ElementStdBounds.AutosizedMainDialog.WithAlignment(EnumDialogArea.CenterMiddle);

            ElementBounds tabBounds = ElementBounds.Fixed(-130, 35, 130, 545);

            GuiTab[] tabs = new GuiTab[2];
            tabs[0] = new GuiTab()
            {
                DataInt = 0,
                Name    = Lang.Get("Blocks and Items"),
            };
            tabs[1] = new GuiTab()
            {
                DataInt = 1,
                Name    = Lang.Get("Crafting mechanics")
            };

            overviewGui = capi.Gui
                          .CreateCompo("handbook-overview", dialogBounds)
                          .AddShadedDialogBG(bgBounds, true)
                          .AddDialogTitleBar(Lang.Get("Survival Handbook"), OnTitleBarClose)
                          //.AddVerticalTabs(tabs, tabBounds, OnTabClicked, "verticalTabs")
                          .AddTextInput(searchFieldBounds, FilterItemsBySearchText, CairoFont.WhiteSmallishText(), "searchField")
                          .BeginChildElements(bgBounds)
                          .BeginClip(clipBounds)
                          .AddInset(insetBounds, 3)
                          .AddHandbookStackList(stackListBounds, onLeftClickListElement, listElements, "stacklist")
                          .EndClip()
                          .AddVerticalScrollbar(OnNewScrollbarvalueOverviewPage, scrollbarBounds, "scrollbar")
                          .AddSmallButton(Lang.Get("Close Handbook"), OnButtonClose, closeButtonBounds)
                          .EndChildElements()
                          .Compose()
            ;

            overviewGui.GetScrollbar("scrollbar").SetHeights(
                (float)listHeight, (float)overviewGui.GetHandbookStackList("stacklist").insideBounds.fixedHeight
                );
        }
Beispiel #14
0
        private void SetupDialog(int numSlots, int numInstalledUpgrades)
        {
            // title bar
            var bgBounds     = ElementStdBounds.DialogBackground();
            var dialogBounds = ElementStdBounds.AutosizedMainDialog.WithChild(bgBounds);

            int    searchCaretPos;
            string searchText;
            bool   searchHasFocus;

            if (SingleComposer == null)
            {
                SingleComposer = capi.Gui.CreateCompo("chardis", dialogBounds);
                searchCaretPos = 0;
                searchText     = "";
                searchHasFocus = true;
            }
            else
            {
                var oldSearch = SingleComposer.GetTextInput(SearchBoxKey);
                searchCaretPos = oldSearch?.CaretPosInLine ?? 0;
                searchText     = oldSearch?.GetText() ?? "";
                searchHasFocus = oldSearch?.HasFocus ?? true;
                SingleComposer.Clear(dialogBounds);
            }

            var numVisibleSlots = GetFilteredSlotCount();
            var rows            = (int)Math.Ceiling(numVisibleSlots / (double)GridColumns);

            SingleComposer
            .AddShadedDialogBG(bgBounds)
            .AddDialogTitleBar(Lang.Get("chardis:title"), () => TryClose())
            .BeginChildElements(bgBounds);
            var titleBarBounds = ElementStdBounds.TitleBar();

            bgBounds.WithChild(titleBarBounds);

            // search text box
            var searchBounds = ElementBounds.FixedSize(200, 30).FixedUnder(titleBarBounds).WithFixedOffset(-InsetSize, 0);

            bgBounds.WithChild(searchBounds);
            SingleComposer.AddInteractiveElement(new TextBox(capi, searchBounds, FilterItems, CairoFont.WhiteSmallishText()), SearchBoxKey);

            var searchBox = SingleComposer.GetTextInput(SearchBoxKey);

            searchBox.SetPlaceHolderText(Lang.Get("chardis:search-placeholder"));
            searchBox.LoadValue(searchText);
            searchBox.SetCaretPos(searchCaretPos);
            if (searchHasFocus)
            {
                SingleComposer.FocusElement(SingleComposer.GetTextInput(SearchBoxKey).TabIndex);
            }

            if (_upgradeSlot != null)
            {
                var countBounds = ElementBounds.FixedSize(32, 32).FixedUnder(titleBarBounds, 10).WithAlignment(EnumDialogArea.RightFixed);
                bgBounds.WithChild(countBounds);
                SingleComposer.AddInteractiveElement(new UpgradeSlot(capi, countBounds, _upgradeSlot));
            }

            // stacklist
            var stacklistBounds =
                ElementBounds.FixedSize(410, StackListHeight).FixedUnder(searchBounds, Padding);

            bgBounds.WithChild(stacklistBounds);
            var clipBounds      = stacklistBounds.ForkBoundingParent();
            var insetBounds     = stacklistBounds.FlatCopy().FixedGrow(6).WithFixedOffset(-3, -3);
            var scrollbarBounds =
                insetBounds.CopyOffsetedSibling(3 + stacklistBounds.fixedWidth + 7).WithFixedWidth(20);

            var pad        = GuiElementItemSlotGridBase.unscaledSlotPadding;
            var inv        = _chardisBlockEntity.Inventory;
            var slotBounds = ElementStdBounds.SlotGrid(EnumDialogArea.None, pad, 40 + pad, GridColumns, 1).FixedGrow(2 * pad, 0);

            SingleComposer
            .BeginClip(clipBounds)
            .AddInset(insetBounds, InsetSize)
            .AddItemSlotGrid(
                inv,
                DoSendPacket,
                GridColumns,
                slotBounds,
                StackListKey
                )
            .EndClip()
            ;

            var stacklist = SingleComposer.GetSlotGrid(StackListKey);

            SingleComposer.AddVerticalScrollbar(value =>
            {
                if (SingleComposer.GetSlotGrid(StackListKey).Bounds.fixedHeight > StackListHeight)
                {
                    stacklist.Bounds.fixedY = InsetSize - value;
                }
                else
                {
                    stacklist.Bounds.fixedY = 0;
                }
                stacklist.Bounds.CalcWorldBounds();
            }, scrollbarBounds, ScrollBarKey)
            ;

            stacklist.Bounds.fixedHeight = rows * (GuiElementPassiveItemSlot.unscaledSlotSize +
                                                   GuiElementItemSlotGridBase.unscaledSlotPadding);
            stacklist.Bounds.CalcWorldBounds();
            var scrollbar = SingleComposer.GetScrollbar(ScrollBarKey);

            scrollbar.SetHeights(
                StackListHeight,
                Math.Max(StackListHeight, (float)stacklist.Bounds.fixedHeight)
                );
            scrollbar.OnMouseWheel(capi, new MouseWheelEventArgs {
                deltaPrecise = 999999
            });                                // scroll to top hax

            SingleComposer.EndChildElements(); // bgBounds
            SingleComposer.Compose();
        }
        private void SetupDialog()
        {
            // title bar
            ElementBounds bgBounds     = ElementStdBounds.DialogBackground();
            ElementBounds dialogBounds = ElementStdBounds.AutosizedMainDialog.WithChild(bgBounds);

            SingleComposer = capi.Gui.CreateCompo("tailoring", dialogBounds)
                             .AddShadedDialogBG(bgBounds)
                             .AddDialogTitleBar("Tailoring", () => TryClose())
                             .BeginChildElements(bgBounds);
            ElementBounds titleBarBounds = ElementStdBounds.TitleBar();

            bgBounds.WithChild(titleBarBounds);

            // search text box
            ElementBounds searchBounds = ElementBounds.FixedSize(200, 30).FixedUnder(titleBarBounds);

            bgBounds.WithChild(searchBounds);
            SingleComposer.AddTextInput(searchBounds, (string newText) => {
                filterSearch = newText;
                FilterItems();
            }, CairoFont.WhiteSmallishText(), "search");
            SingleComposer.GetTextInput("search").SetPlaceHolderText("Search...");
            // SingleComposer.FocusElement(SingleComposer.GetTextInput("search").TabIndex);

            // prep for category dropdown
            string[]      characterDressTypeNames         = EnumCharacterDressType.GetNames(typeof(EnumCharacterDressType));
            List <string> filteredCharacterDressTypeNames = new List <string>();

            foreach (var characterDressTypeName in characterDressTypeNames)
            {
                if (categoryCount.ContainsKey(characterDressTypeName.ToLowerInvariant()))
                {
                    filteredCharacterDressTypeNames.Add(characterDressTypeName);
                }
            }
            string[] values = new string[filteredCharacterDressTypeNames.Count + 1];
            values[0] = "";
            filteredCharacterDressTypeNames.CopyTo(0, values, 1, filteredCharacterDressTypeNames.Count);
            string[] names = new string[filteredCharacterDressTypeNames.Count + 1];
            names[0] = "(Show all)";
            filteredCharacterDressTypeNames.CopyTo(0, names, 1, filteredCharacterDressTypeNames.Count);

            // category dropdown
            ElementBounds categoryDropdownBounds = ElementBounds.FixedSize(150, 30).FixedUnder(titleBarBounds).FixedRightOf(searchBounds, PADDING);

            bgBounds.WithChild(categoryDropdownBounds);
            SingleComposer.AddDropDown(values, names, 0, (value, selected) => {
                filterCategory = value;
                FilterItems();
            }, categoryDropdownBounds, "category");

            // stacklist
            ElementBounds stacklistBounds = ElementBounds.FixedSize(400, STACKLIST_HEIGHT).FixedUnder(searchBounds, PADDING);

            bgBounds.WithChild(stacklistBounds);
            ElementBounds clipBounds      = stacklistBounds.ForkBoundingParent();
            ElementBounds insetBounds     = stacklistBounds.FlatCopy().FixedGrow(6).WithFixedOffset(-3, -3);
            ElementBounds scrollbarBounds = insetBounds.CopyOffsetedSibling(3 + stacklistBounds.fixedWidth + 7).WithFixedWidth(20);

            SingleComposer
            .BeginClip(clipBounds)
            .AddInset(insetBounds, 3)
            .AddInteractiveElement(new GuiElementHandbookListWithTooltips(capi, stacklistBounds, (int index) => {
                OnSelectProduct((shownStacklistItems[index] as GuiHandbookItemStackPage).Stack);
            }, shownStacklistItems), "stacklist")
            .EndClip()
            .AddVerticalScrollbar((float value) => {
                GuiElementHandbookList stacklist = SingleComposer.GetHandbookStackList("stacklist");
                stacklist.insideBounds.fixedY    = 3 - value;
                stacklist.insideBounds.CalcWorldBounds();
            }, scrollbarBounds, "scrollbar")
            ;
            UpdateStacklistScrollbar();

            // costLabel
            ElementBounds costLabelBounds = ElementBounds.FixedSize(300, 80).FixedUnder(clipBounds, PADDING);

            bgBounds.WithChild(costLabelBounds);
            SingleComposer.AddDynamicText("", CairoFont.WhiteSmallText(), EnumTextOrientation.Left, costLabelBounds, "costLabel");

            // craftButton
            ElementBounds craftButtonBounds = ElementBounds
                                              .FixedSize(0, 0)
                                              .FixedUnder(clipBounds, PADDING)
                                              .WithAlignment(EnumDialogArea.RightFixed)
                                              .WithFixedPadding(20, 4)
                                              .WithFixedAlignmentOffset(-11, 1)
            ;

            bgBounds.WithChild(craftButtonBounds);
            SingleComposer.AddSmallButton("Craft", () => {
                OnCraftButtonClicked();
                return(true);
            }, craftButtonBounds, EnumButtonStyle.Normal, EnumTextOrientation.Center, "craftButton");
            var craftButton = SingleComposer.GetButton("craftButton");

            craftButton.Enabled = false;

            SingleComposer.EndChildElements(); // bgBounds
            SingleComposer.Compose();
        }
        /// <summary> Draw all the elements that go in the dialog. </summary>
        private void SetupDialog()
        {
            // Make the dialog centered and resize automatically
            ElementBounds dialogBounds = ElementStdBounds
                                         .AutosizedMainDialog
                                         .WithAlignment(EnumDialogArea.CenterMiddle);

            // Background boundaries. Make it fit the metal slots.
            ElementBounds bgBounds = ElementBounds
                                     .Fill
                                     .WithFixedPadding(GuiStyle.ElementToDialogPadding);

            bgBounds.BothSizing = ElementSizing.FitToChildren;

            // Create the boundaries for each metal slot, then assign them as children of the background.
            ElementBounds[] metalBounds = new ElementBounds[MistModSystem.METALS.Length];
            for (int i = 0; i < MistModSystem.METALS.Length; i++)
            {
                metalBounds[i] = BoundsForIndex(i / 2, i % 2 == 1);
            }
            bgBounds.WithChildren(metalBounds);

            // Create the boundaries for the decoration image.
            ElementBounds decoBounds = ElementBounds.Fixed(0, 40, 420, 405);

            // Create the boundaries for the text indicating which metal is selected.
            ElementBounds metalText = ElementBounds.Fixed(
                OriginX - (200 / 2) + 18,
                OriginY - (25 / 2),
                200,
                25);
            ElementBounds metalAmount = ElementBounds.Fixed(
                OriginX - (200 / 2) + 18,
                OriginY - (25 / 2) + 20,
                200,
                25);

            // Lastly, create the dialog
            SingleComposer = capi.Gui.CreateCompo("metalSelector", dialogBounds)
                             .AddShadedDialogBG(bgBounds)                                          // Draw background
                             .AddDialogTitleBar("Select allomantic metal", OnTitleBarCloseClicked) // Draw title.
                             .AddImageBG(decoBounds, "gui/backgrounds/metalselector.png")          // Draw decoration.
                             .AddDynamicText(
                "Metal",
                CairoFont.WhiteSmallText(),
                EnumTextOrientation.Center,
                metalText,
                "metalText")     // Draw metal name.
                             .AddDynamicText(
                "Amount",
                CairoFont.WhiteSmallText(),
                EnumTextOrientation.Center,
                metalAmount,
                "metalAmount");     // Draw metal amount.

            // Iterate to create the slot for this metal.
            for (int i = 0; i < MistModSystem.METALS.Length; i++)
            {
                // Create a dummy slot of the item that will be displayed.
                AssetLocation itemLocation = AssetLocation.Create(
                    DisplayItemCode + MistModSystem.METALS[i]);
                Item      item      = capi.World.GetItem(itemLocation);
                ItemStack stack     = new ItemStack(item, 1);
                ItemSlot  dummySlot = new DummySlot(stack);

                // Create a single-element dictionary to store the skill item.
                Dictionary <int, SkillItem> skillItems = new Dictionary <int, SkillItem>();
                skillItems.Add(0, new SkillItem()
                {
                    Code          = itemLocation,
                    Name          = MistModSystem.METALS[i],
                    Description   = "Select " + MistModSystem.METALS[i],
                    RenderHandler = (AssetLocation code, float dt, double posX, double posY) => {
                        // No idea why the weird offset and size multiplier
                        //double scsize = GuiElement.scaled(SlotSize - 5);
                        //capi.Render.RenderItemstackToGui(
                        //    dummySlot,
                        //    posX + scsize/2,
                        //    posY + scsize / 2,
                        //    100,
                        //    (float)GuiElement.scaled(GuiElementPassiveItemSlot.unscaledItemSize),
                        //    ColorUtil.WhiteArgb);
                    }
                });

                // Add the skill item to the UI.
                var j = i;
                SingleComposer = SingleComposer.AddSkillItemGrid(
                    skillItems,
                    1,
                    1,
                    delegate(int a) { SelectMetal(j); },
                    metalBounds[i],
                    "skill-" + MistModSystem.METALS[i]);

                // Add a text to easily tell which metal is being selected.
                SingleComposer = SingleComposer.AddHoverText(
                    MistModSystem.METALS[i],
                    CairoFont.WhiteSmallishText(),
                    150,
                    metalBounds[i]);
            }

            // Compose the dialog after all changes have been made.
            SingleComposer = SingleComposer.Compose();
        }