Esempio n. 1
0
        public override void Dispose()
        {
            base.Dispose();

            capi.Event.UnregisterGameTickListener(listenerId);
            listenerId = 0;

            fullDialog.Dispose();
            hudDialog.Dispose();
        }
Esempio n. 2
0
 public override void Dispose()
 {
     overviewGui?.Dispose();
     detailViewGui?.Dispose();
 }
Esempio n. 3
0
        void initDetailGui()
        {
            ElementBounds textBounds = ElementBounds.Fixed(9, 45, 500, 30 + listHeight + 17);

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

            ElementBounds scrollbarBounds = clipBounds.CopyOffsetedSibling(textBounds.fixedWidth + 7, -6, 0, 6).WithFixedWidth(20);

            ElementBounds closeButtonBounds = ElementBounds
                                              .FixedSize(0, 0)
                                              .FixedUnder(clipBounds, 2 * 5 + 5)
                                              .WithAlignment(EnumDialogArea.RightFixed)
                                              .WithFixedPadding(20, 4)
                                              .WithFixedAlignmentOffset(-11, 1)
            ;
            ElementBounds backButtonBounds = ElementBounds
                                             .FixedSize(0, 0)
                                             .FixedUnder(clipBounds, 2 * 5 + 5)
                                             .WithAlignment(EnumDialogArea.LeftFixed)
                                             .WithFixedPadding(20, 4)
                                             .WithFixedAlignmentOffset(4, 1)
            ;
            ElementBounds overviewButtonBounds = ElementBounds
                                                 .FixedSize(0, 0)
                                                 .FixedUnder(clipBounds, 2 * 5 + 5)
                                                 .WithAlignment(EnumDialogArea.CenterFixed)
                                                 .WithFixedPadding(20, 4)
                                                 .WithFixedAlignmentOffset(0, 1)
            ;

            ElementBounds bgBounds = insetBounds.ForkBoundingParent(5, 40, 36, 52).WithFixedPadding(GuiStyle.ElementToDialogPadding / 2);

            bgBounds.WithChildren(insetBounds, textBounds, scrollbarBounds, backButtonBounds, closeButtonBounds);

            BrowseHistoryElement curPage = browseHistory.Peek();
            float posY = curPage.PosY;

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

            //dialogBounds.Code = "dialogbounds";

            RichTextComponentBase[] cmps = curPage.Page.GetPageText(capi, allstacks, OpenDetailPageFor);

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

            detailViewGui?.Dispose();
            detailViewGui = capi.Gui
                            .CreateCompo("handbook-detail", dialogBounds)
                            .AddShadedDialogBG(bgBounds, true)
                            .AddDialogTitleBar(Lang.Get("Survival Handbook"), OnTitleBarClose)
                            .AddVerticalTabs(genTabs(out curTab), tabBounds, OnDetailViewTabClicked, "verticalTabs")
                            .BeginChildElements(bgBounds)
                            .BeginClip(clipBounds)
                            .AddInset(insetBounds, 3)
                            .AddRichtext(cmps, textBounds, "richtext")
                            .EndClip()
                            .AddVerticalScrollbar(OnNewScrollbarvalueDetailPage, scrollbarBounds, "scrollbar")
                            .AddSmallButton(Lang.Get("general-back"), OnButtonBack, backButtonBounds)
                            .AddSmallButton(Lang.Get("handbook-overview"), OnButtonOverview, overviewButtonBounds)
                            .AddSmallButton(Lang.Get("general-close"), OnButtonClose, closeButtonBounds)
                            .EndChildElements()
                            .Compose()
            ;

            GuiElementRichtext richtextelem = detailViewGui.GetRichtext("richtext");

            detailViewGui.GetScrollbar("scrollbar").SetHeights(
                (float)listHeight, (float)richtextelem.Bounds.fixedHeight
                );
            detailViewGui.GetScrollbar("scrollbar").CurrentYPosition = posY;
            OnNewScrollbarvalueDetailPage(posY);

            detailViewGui.GetVerticalTab("verticalTabs").SetValue(curTab, false);
        }
        void initDetailGui()
        {
            ElementBounds textBounds = ElementBounds.Fixed(9, 45, 500, 30 + listHeight + 17);

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

            ElementBounds scrollbarBounds = clipBounds.CopyOffsetedSibling(textBounds.fixedWidth + 7, -6, 0, 6).WithFixedWidth(20);

            ElementBounds closeButtonBounds = ElementBounds
                                              .FixedSize(0, 0)
                                              .FixedUnder(clipBounds, 2 * 5 + 5)
                                              .WithAlignment(EnumDialogArea.RightFixed)
                                              .WithFixedPadding(20, 4)
                                              .WithFixedAlignmentOffset(-11, 1)
            ;
            ElementBounds backButtonBounds = ElementBounds
                                             .FixedSize(0, 0)
                                             .FixedUnder(clipBounds, 2 * 5 + 5)
                                             .WithAlignment(EnumDialogArea.LeftFixed)
                                             .WithFixedPadding(20, 4)
                                             .WithFixedAlignmentOffset(4, 1)
            ;
            ElementBounds overviewButtonBounds = ElementBounds
                                                 .FixedSize(0, 0)
                                                 .FixedUnder(clipBounds, 2 * 5 + 5)
                                                 .WithAlignment(EnumDialogArea.CenterFixed)
                                                 .WithFixedPadding(20, 4)
                                                 .WithFixedAlignmentOffset(0, 1)
            ;

            ElementBounds bgBounds = insetBounds.ForkBoundingParent(5, 40, 36, 52).WithFixedPadding(GuiStyle.ElementToDialogPadding / 2);

            bgBounds.WithChildren(insetBounds, textBounds, scrollbarBounds, backButtonBounds, closeButtonBounds);

            BrowseHistoryElement curPage = browseHistory.Peek();
            float posY = curPage.PosY;

            // 3. Finally Dialog
            ElementBounds dialogBounds = bgBounds.ForkBoundingParent().WithAlignment(EnumDialogArea.None).WithAlignment(EnumDialogArea.CenterFixed).WithFixedPosition(0, 70);
            //dialogBounds.Code = "dialogbounds";

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

            string essence = "";
            int    num;

            if (pageNumberByPageCode.TryGetValue(curPage.Page.PageCode, out num))
            {
                essence  = essenceItemName[num];
                essence += "\n\n";
                essence += GetEssences(curPage.Page.PageCode);
            }

            detailViewGui?.Dispose();
            detailViewGui = capi.Gui
                            .CreateCompo("essence-handbook-detail", dialogBounds)
                            .AddShadedDialogBG(bgBounds, true)
                            .AddDialogTitleBar(Lang.Get("Potion Essence Handbook"), OnTitleBarClose)
                            .AddVerticalTabs(genTabs(out curTab), tabBounds, OnDetailViewTabClicked, "verticalTabs")
                            .BeginChildElements(bgBounds)
                            .BeginClip(clipBounds)
                            .AddInset(insetBounds, 3)
                            .AddStaticText(Lang.Get(essence), CairoFont.WhiteSmallText().WithWeight(Cairo.FontWeight.Bold), textBounds)
                            .EndClip()
                            .AddSmallButton(Lang.Get("general-back"), OnButtonBack, backButtonBounds)
                            .AddSmallButton(Lang.Get("essence-handbook-overview"), OnButtonOverview, overviewButtonBounds)
                            .AddSmallButton(Lang.Get("general-close"), OnButtonClose, closeButtonBounds)
                            .EndChildElements()
                            .Compose()
            ;

            detailViewGui.GetVerticalTab("verticalTabs").SetValue(curTab, false);
        }