Exemplo n.º 1
0
        void ILoadable.OnPostModsLoad()
        {
            if (Main.netMode != NetmodeID.Server)
            {
                this.DialogueElem = new UIThemedPanel(UITheme.Vanilla, false);
                this.DialogueElem.Width.Set(560f, 0f);
                this.DialogueElem.Height.Set(160f, 0f);
                this.DialogueElem.Left.Set(-280f, 0.5f);
                this.DialogueElem.Top.Set(96f, 0f);

                this.PortraitElem = new UIImage(ModContent.GetTexture("Terraria/MapDeath"));
                this.PortraitElem.Width.Set(128f, 0f);
                this.PortraitElem.Height.Set(128f, 0f);
                this.PortraitElem.Left.Set(8f, 0f);
                this.PortraitElem.Top.Set(8f, 0f);
                this.DialogueElem.AppendThemed(this.PortraitElem);

                this.TextElem = new UIThemedText(UITheme.Vanilla, false, "");
                this.TextElem.Width.Set(-128f, 1f);
                this.TextElem.Left.Set(12f + 128f, 0f);
                this.TextElem.Top.Set(8f, 0f);
                this.DialogueElem.AppendThemed(this.TextElem);

                this.DialogueElem.Hide();

                FreeHUD.AddElement("CutsceneDialogue", this.DialogueElem);
            }
        }
Exemplo n.º 2
0
        ////////////////

        public void HideDialogue()
        {
            var panel = FreeHUD.GetElement("CutsceneDialogue") as UIThemedPanel;

            panel?.Hide();

            this.TextElem?.SetText("");

            foreach (UITextPanelButton button in this.ChoiceButtons)
            {
                this.DialogueElem.RemoveChild(button);
                button.Remove();
            }
            this.ChoiceButtons.Clear();
        }
        ////////////////

        private static void DisplayNote(string titleText, string[] pages)
        {
            UINote elem = FreeHUD.GetElement("ReadableBook") as UINote;

            if (elem == null)
            {
                elem = new UINote(titleText, pages);
                elem.Initialize();
                FreeHUD.AddElement("ReadableBook", elem);
            }
            else
            {
                elem.SetTitle(titleText);
                elem.SetPages(pages);
            }

            LayerDisable.Instance.DisabledLayers.Add(LayerDisable.InfoAccessoriesBar);
        }
        ////

        private static void ClearDisplay()
        {
            FreeHUD.RemoveElement("ReadableBook");

            LayerDisable.Instance.DisabledLayers.Remove(LayerDisable.InfoAccessoriesBar);
        }