Example #1
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            if (debugDraw)
            {
                Rectangle hitbox = GetInnerDimensions().ToRectangle();
                Main.spriteBatch.Draw(Main.magicPixel, hitbox, Color.Red * 0.6f);

                hitbox = label.GetInnerDimensions().ToRectangle();
                //hitbox.Offset((int)-Main.screenPosition.X, (int)-Main.screenPosition.Y);
                Main.spriteBatch.Draw(Main.magicPixel, hitbox, Color.LightCyan * 0.6f);

                hitbox = slider.GetOuterDimensions().ToRectangle();
                Main.spriteBatch.Draw(Main.magicPixel, hitbox, Color.AliceBlue * 0.6f);

                hitbox = input.GetOuterDimensions().ToRectangle();
                Main.spriteBatch.Draw(Main.magicPixel, hitbox, Color.Yellow * 0.6f);

                if (minus != null)
                {
                    hitbox = minus.GetOuterDimensions().ToRectangle();
                    Main.spriteBatch.Draw(Main.magicPixel, hitbox, Color.Green * 0.6f);
                    hitbox = plus.GetOuterDimensions().ToRectangle();
                    Main.spriteBatch.Draw(Main.magicPixel, hitbox, Color.BlueViolet * 0.6f);
                }
            }
        }
Example #2
0
        //static string modSourcespath = ModLoader.ModSourcePath

        public override void OnInitialize()
        {
            mainPanel = new UIPanel();
            mainPanel.Left.Set(-350f, 1f);
            mainPanel.Top.Set(-620f, 1f);
            mainPanel.Width.Set(310f, 0f);
            mainPanel.Height.Set(520f, 0f);
            mainPanel.SetPadding(12);
            mainPanel.BackgroundColor = Color.PeachPuff * 0.8f;

            int    top  = 0;
            UIText text = new UIText("Textures:", 0.85f);

            text.Top.Set(top, 0f);
            mainPanel.Append(text);
            top += 20;

            modList            = new UIList();
            modList.Top.Pixels = top;
            modList.Width.Set(-25f, 1f);
            modList.Height.Set(140, 0f);
            modList.ListPadding = 0f;
            mainPanel.Append(modList);

            var modListScrollbar = new UIElements.FixedUIScrollbar(userInterface);

            modListScrollbar.SetView(100f, 1000f);
            modListScrollbar.Top.Pixels = top + 10;            // + spacing;
            modListScrollbar.Height.Set(120, 0f);
            modListScrollbar.HAlign = 1f;
            mainPanel.Append(modListScrollbar);
            modList.SetScrollbar(modListScrollbar);

            top += 140;

            watchModSources = new UICheckbox("Watch Mod Sources", "Automatically Watch Mod Sources for Changes", false);
            watchModSources.Top.Set(top, 0);
            watchModSources.OnSelectedChanged += WatchModSources_OnSelectedChanged;
            mainPanel.Append(watchModSources);

            top += 20;

            UIText text2 = new UIText("Filter:", 0.85f);

            text2.Top.Set(top, 0f);
            mainPanel.Append(text2);

            searchFilter = new NewUITextBox("Search", 0.85f);
            searchFilter.SetPadding(0);
            searchFilter.OnTextChanged += () => { updateneeded = true; };
            searchFilter.Top.Set(top, 0f);
            searchFilter.Left.Set(text2.GetInnerDimensions().Width + 6, 0f);
            searchFilter.Width.Set(-(text2.GetInnerDimensions().Width + 6), 1f);
            searchFilter.Height.Set(20, 0f);
            mainPanel.Append(searchFilter);

            top += 20;

            currentTexture = new UIText("Current: None selected", 0.85f);
            currentTexture.Top.Set(top, 0f);
            currentTexture.Left.Set(0, 0f);
            currentTexture.Width.Set(0, 1);
            currentTexture.HAlign = 0;
            mainPanel.Append(currentTexture);

            top += 20;

            textureList            = new UIList();
            textureList.Top.Pixels = top;
            textureList.Width.Set(-25f, 1f);
            textureList.Height.Set(250, 0f);
            textureList.ListPadding = 6f;
            mainPanel.Append(textureList);

            var textureListScrollbar = new UIElements.FixedUIScrollbar(userInterface);

            textureListScrollbar.SetView(100f, 1000f);
            textureListScrollbar.Top.Pixels = top + 10;            // + spacing;
            textureListScrollbar.Height.Set(230, 0f);
            textureListScrollbar.HAlign = 1f;
            mainPanel.Append(textureListScrollbar);
            textureList.SetScrollbar(textureListScrollbar);

            top += 250;

            //UIHoverImageButton exportImageButton = new UIHoverImageButton(ModdersToolkit.instance.GetTexture("UIElements/CopyCodeButton"), "Export Image for Editing");
            //exportImageButton.OnClick += ExportImageButton_OnClick;
            //exportImageButton.Top.Set(top + 5, 0f);
            //exportImageButton.Left.Set(0, 0f);
            //mainPanel.Append(exportImageButton);

            UIHoverImageButton editImageButton = new UIHoverImageButton(ModdersToolkit.instance.GetTexture("UIElements/eyedropper"), "Open Exported Image in Default Editor");

            editImageButton.OnClick += EditImageButton_OnClick;
            editImageButton.Top.Set(top + 5, 0f);
            editImageButton.Left.Set(0, 0f);
            mainPanel.Append(editImageButton);

            updateneeded = true;
            Append(mainPanel);
        }
Example #3
0
        public override void OnInitialize()
        {
            base.OnInitialize();
            mainPanel = new UIPanel();
            width     = 310;
            height    = 610;
            mainPanel.SetPadding(6);
            mainPanel.BackgroundColor = Color.Orange * 0.7f;

            int    top  = 0;
            UIText text = new UIText("Projectiles:", 0.85f);

            text.Top.Set(top, 0f);
            mainPanel.Append(text);

            UITextPanel <string> clearProjectilesButton = new UITextPanel <string>("Clear Projectiles");

            clearProjectilesButton.OnClick += (a, b) => {
                for (int i = 0; i < Main.maxProjectiles; i++)
                {
                    if (Main.projectile[i].active)
                    {
                        Main.projectile[i].Kill();
                        if (Main.netMode == 1)
                        {
                            NetMessage.SendData(27, -1, -1, null, i, 0f, 0f, 0f, 0);
                        }
                    }
                }
            };
            clearProjectilesButton.Top.Set(top, 0f);
            clearProjectilesButton.Width.Set(-10, 0.5f);
            clearProjectilesButton.HAlign = 1;
            clearProjectilesButton.SetPadding(4);
            mainPanel.Append(clearProjectilesButton);

            top += 20;

            UIText text2 = new UIText("Filter:", 0.85f);

            text2.Top.Set(top, 0f);
            mainPanel.Append(text2);

            searchFilter = new NewUITextBox("Search", 0.85f);
            searchFilter.SetPadding(0);
            searchFilter.OnTextChanged += () => { ValidateInput(); updateNeeded = true; };
            searchFilter.Top.Set(top, 0f);
            searchFilter.Left.Set(text2.GetInnerDimensions().Width, 0f);
            searchFilter.Width.Set(-text2.GetInnerDimensions().Width, 1f);
            searchFilter.Height.Set(20, 0f);
            //searchFilter.VAlign = 0.5f;
            mainPanel.Append(searchFilter);
            top += 20;

            speedXDataProperty = new UIFloatRangedDataValue("SpeedX:", 0, -10, 10);
            speedYDataProperty = new UIFloatRangedDataValue("SpeedY:", 0, -10, 10);
            var ui2DRange = new UI2DRange <float>(speedXDataProperty, speedYDataProperty);

            ui2DRange.Top.Set(top, 0f);
            mainPanel.Append(ui2DRange);
            top += 30;

            ai0DataProperty = new UIFloatRangedDataValue("ai0:", 0, -10, 10);
            var uiRange = new UIRange <float>(ai0DataProperty);

            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);
            top += 30;

            ai1DataProperty = new UIFloatRangedDataValue("ai1:", 0, -10, 10);
            uiRange         = new UIRange <float>(ai1DataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);
            top += 30;

            knockbackDataProperty = new UIFloatRangedDataValue("Knockback:", 0, 0, 20);
            uiRange = new UIRange <float>(knockbackDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);
            top += 30;

            damageDataProperty = new UIIntRangedDataValue("Damage:", 20, 0, 200);
            var uiRangeI = new UIRange <int>(damageDataProperty);

            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            aiStyleDataProperty = new UIIntRangedDataValue("AIStyle:", -1, -1, 145);
            uiRangeI            = new UIRange <int>(aiStyleDataProperty);
            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            drawOffsetXDataProperty = new UIIntRangedDataValue("drawOffsetX:", 0, -30, 30);
            uiRangeI = new UIRange <int>(drawOffsetXDataProperty);
            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            drawOriginOffsetXDataProperty = new UIIntRangedDataValue("drawOriginOffsetX:", 0, -30, 30);
            uiRangeI = new UIRange <int>(drawOriginOffsetXDataProperty);
            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            drawOriginOffsetYDataProperty = new UIIntRangedDataValue("drawOriginOffsetY:", 0, -30, 30);
            uiRangeI = new UIRange <int>(drawOriginOffsetYDataProperty);
            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            hostile = new UIBoolNDataValue("Hostile");
            var hostileCheckbox = new UITriStateCheckbox(hostile);

            hostileCheckbox.Top.Set(top, 0f);
            mainPanel.Append(hostileCheckbox);
            top += 30;

            friendly = new UIBoolNDataValue("Friendly");
            var friendlyCheckbox = new UITriStateCheckbox(friendly);

            friendlyCheckbox.Top.Set(top, 0f);
            mainPanel.Append(friendlyCheckbox);
            top += 25;

            pause = new UICheckbox("Pause", "Pauses All Projectiles (Prevent AI from running)");
            pause.Top.Set(top, 0f);
            mainPanel.Append(pause);

            UIHoverImageButton stepButton = new UIHoverImageButton(ModdersToolkit.Instance.GetTexture("UIElements/next"), "Step");

            stepButton.OnClick += (s, e) => step = true;
            stepButton.Top.Set(top - 6, 0f);
            stepButton.Left.Set(80, 0f);
            mainPanel.Append(stepButton);

            top += 25;

            freeze = new UICheckbox("Freeze", "Zero out velocity during PreAI for All Projectiles");
            freeze.Top.Set(top, 0f);
            mainPanel.Append(freeze);
            top += 25;

            projectileGrid            = new UIGrid(7);
            projectileGrid.Top.Pixels = top;
            //autoTrashGrid.Left.Pixels = spacing;
            projectileGrid.Width.Set(-25f, 1f);             // leave space for scroll?
            projectileGrid.Height.Set(-top, 1f);
            projectileGrid.ListPadding = 6f;
            mainPanel.Append(projectileGrid);

            // this will initialize grid
            updateNeeded = true;

            var projectileGridScrollbar = new UIElements.FixedUIScrollbar(_userInterface);

            projectileGridScrollbar.SetView(100f, 1000f);
            projectileGridScrollbar.Top.Pixels = top;            // + spacing;
            projectileGridScrollbar.Height.Set(-top /*- spacing*/, 1f);
            projectileGridScrollbar.HAlign = 1f;
            mainPanel.Append(projectileGridScrollbar);
            projectileGrid.SetScrollbar(projectileGridScrollbar);

            AdjustMainPanelDimensions(mainPanel);
            Append(mainPanel);
        }
        ////////////////

        private void InitializeComponents()
        {
            var mymod = ModHelpersMod.Instance;
            UIModControlPanelTab self  = this;
            ModControlPanelLogic logic = this.Logic;
            float top = 0;

            this.Theme.ApplyPanel(this);


            ////////

            var tip = new UIText("To enable issue reports for your mod, ");

            this.Append((UIElement)tip);

            this.TipUrl = new UIWebUrl(this.Theme, "read this.",
                                       "https://forums.terraria.org/index.php?threads/mod-helpers.63670/#modders",
                                       false, 1f);
            this.TipUrl.Left.Set(tip.GetInnerDimensions().Width, 0f);
            this.TipUrl.Top.Set(-2f, 0f);
            this.Append((UIElement)this.TipUrl);

            top += 24f;

            ////

            var modListPanel = new UIPanel();

            {
                modListPanel.Top.Set(top, 0f);
                modListPanel.Width.Set(0f, 1f);
                modListPanel.Height.Set(UIModControlPanelTab.ModListHeight, 0f);
                modListPanel.HAlign = 0f;
                modListPanel.SetPadding(4f);
                modListPanel.PaddingTop      = 0.0f;
                modListPanel.BackgroundColor = this.Theme.ListBgColor;
                modListPanel.BorderColor     = this.Theme.ListEdgeColor;
                this.Append((UIElement)modListPanel);

                this.ModListElem = new UIList();
                {
                    this.ModListElem.Width.Set(-25, 1f);
                    this.ModListElem.Height.Set(0f, 1f);
                    this.ModListElem.HAlign      = 0f;
                    this.ModListElem.ListPadding = 4f;
                    this.ModListElem.SetPadding(0f);
                    modListPanel.Append((UIElement)this.ModListElem);

                    top += UIModControlPanelTab.ModListHeight + this.PaddingTop;

                    UIScrollbar scrollbar = new UIScrollbar();
                    {
                        scrollbar.Top.Set(8f, 0f);
                        scrollbar.Height.Set(-16f, 1f);
                        scrollbar.SetView(100f, 1000f);
                        scrollbar.HAlign = 1f;
                        modListPanel.Append((UIElement)scrollbar);
                        this.ModListElem.SetScrollbar(scrollbar);
                    }
                }
            }

            ////

            this.IssueTitleInput = new UITextArea(this.Theme, "Enter title of mod issue", 128);
            this.IssueTitleInput.Top.Set(top, 0f);
            this.IssueTitleInput.Width.Set(0f, 1f);
            this.IssueTitleInput.Height.Pixels = 36f;
            this.IssueTitleInput.HAlign        = 0f;
            this.IssueTitleInput.SetPadding(8f);
            this.IssueTitleInput.Disable();
            this.IssueTitleInput.OnPreChange += delegate(StringBuilder newText) {
                self.RefreshIssueSubmitButton();
            };
            this.Append((UIElement)this.IssueTitleInput);

            top += 40f;

            this.IssueBodyInput = new UITextArea(this.Theme, "Describe mod issue");
            this.IssueBodyInput.Top.Set(top, 0f);
            this.IssueBodyInput.Width.Set(0f, 1f);
            this.IssueBodyInput.Height.Pixels = 36f;
            this.IssueBodyInput.HAlign        = 0f;
            this.IssueBodyInput.SetPadding(8f);
            this.IssueBodyInput.Disable();
            this.IssueBodyInput.OnPreChange += delegate(StringBuilder newText) {
                self.RefreshIssueSubmitButton();
            };
            this.Append((UIElement)this.IssueBodyInput);

            top += 40f;

            ////

            this.IssueSubmitButton = new UITextPanelButton(this.Theme, "Submit Issue");
            this.IssueSubmitButton.Top.Set(top, 0f);
            this.IssueSubmitButton.Left.Set(0f, 0f);
            this.IssueSubmitButton.Width.Set(200f, 0f);
            this.IssueSubmitButton.Disable();
            this.IssueSubmitButton.OnClick += delegate(UIMouseEvent evt, UIElement listeningElement) {
                if (self.AwaitingReport || !self.IssueSubmitButton.IsEnabled)
                {
                    return;
                }
                self.SubmitIssue();
            };
            this.Append(this.IssueSubmitButton);

            this.ApplyConfigButton = new UITextPanelButton(this.Theme, "Apply Config Changes");
            this.ApplyConfigButton.Top.Set(top, 0f);
            this.ApplyConfigButton.Left.Set(0f, 0f);
            this.ApplyConfigButton.Width.Set(200f, 0f);
            this.ApplyConfigButton.HAlign = 1f;
            if (Main.netMode != 0)
            {
                this.ApplyConfigButton.Disable();
            }
            this.ApplyConfigButton.OnClick += delegate(UIMouseEvent evt, UIElement listeningElement) {
                if (!self.ApplyConfigButton.IsEnabled)
                {
                    return;
                }
                self.ApplyConfigChanges();
            };
            this.Append(this.ApplyConfigButton);

            top += 30f;

            this.ModLockButton = new UITextPanelButton(this.Theme, UIModControlPanelTab.ModLockTitle);
            this.ModLockButton.Top.Set(top, 0f);
            this.ModLockButton.Left.Set(0f, 0f);
            this.ModLockButton.Width.Set(0f, 1f);
            if (Main.netMode != 0 || !mymod.Config.WorldModLockEnable)
            {
                this.ModLockButton.Disable();
            }
            this.ModLockButton.OnClick += delegate(UIMouseEvent evt, UIElement listeningElement) {
                if (!self.ModLockButton.IsEnabled)
                {
                    return;
                }
                self.ToggleModLock();
                Main.PlaySound(SoundID.Unlock);
            };
            this.Append(this.ModLockButton);

            this.RefreshModLockButton();

            top += 36f;

            ////

            /*var modrec_url = new UIWebUrl( this.Theme, "Need mods?", "https://sites.google.com/site/terrariamodsuggestions/" );
             * modrecUrl.Top.Set( top, 0f );
             * modrecUrl.Left.Set( 0f, 0f );
             * this.InnerContainer.Append( modrecUrl );
             *
             * var serverbrowser_url = new UIWebUrl( this.Theme, "Lonely?", "https://forums.terraria.org/index.php?threads/server-browser-early-beta.68346/" );
             * serverbrowser_url.Top.Set( top, 0f );
             * this.InnerContainer.Append( serverbrowser_url );
             * serverbrowser_url.Left.Set( -serverbrowser_url.GetDimensions().Width * 0.5f, 0.5f );*/

            string supportMsg = UIModControlPanelTab.SupportMessages[this.RandomSupportTextIdx];

            this.SupportUrl = new UIWebUrl(this.Theme, supportMsg, "https://www.patreon.com/hamstar0", false);
            this.SupportUrl.Top.Set(top, 0f);
            this.Append(this.SupportUrl);
            //this.SupportUrl.Left.Set( -this.SupportUrl.GetDimensions().Width, 1f );
            this.SupportUrl.Left.Set(-this.SupportUrl.GetDimensions().Width * 0.5f, 0.5f);
        }
Example #5
0
        public override void OnInitialize()
        {
            mainPanel = new UIPanel();
            mainPanel.Left.Set(-350f, 1f);
            mainPanel.Top.Set(-740f, 1f);
            mainPanel.Width.Set(310f, 0f);
            mainPanel.Height.Set(640f, 0f);
            mainPanel.SetPadding(6);
            mainPanel.BackgroundColor = Color.PeachPuff * 0.8f;

            int    top  = 0;
            UIText text = new UIText("Shaders:", 0.85f);

            text.Top.Set(top, 0f);
            mainPanel.Append(text);
            top += 20;

            int topModSourcesPanel = 0;
            var modSourcesPanel    = new UIPanel();

            modSourcesPanel.Top.Set(top, 0f);
            modSourcesPanel.Width.Set(0, 1f);
            modSourcesPanel.Height.Set(370f, 0f);
            modSourcesPanel.SetPadding(6);
            modSourcesPanel.BackgroundColor = Color.Blue * 0.7f;
            top += 376;

            text = new UIText("Mod Sources:", 0.85f);
            text.Top.Set(topModSourcesPanel, 0f);
            modSourcesPanel.Append(text);
            topModSourcesPanel += 20;

            var modListBackPanel = new UIPanel();

            modListBackPanel.Top.Set(topModSourcesPanel, 0);
            modListBackPanel.Width.Set(0, 1f);
            modListBackPanel.Height.Set(120f, 0f);
            modListBackPanel.SetPadding(6);
            modListBackPanel.BackgroundColor = Color.Green * 0.7f;

            modList = new UIList();
            modList.Width.Set(-25f, 1f);
            modList.Height.Set(0, 1f);
            modList.ListPadding = 0f;
            modListBackPanel.Append(modList);

            var modListScrollbar = new UIElements.FixedUIScrollbar(userInterface);

            modListScrollbar.SetView(100f, 1000f);
            modListScrollbar.Top.Pixels = 4;
            modListScrollbar.Height.Set(-8, 1f);
            modListScrollbar.HAlign = 1f;
            modListBackPanel.Append(modListScrollbar);
            modList.SetScrollbar(modListScrollbar);

            modSourcesPanel.Append(modListBackPanel);
            mainPanel.Append(modSourcesPanel);
            topModSourcesPanel += 130;

            text = new UIText("Filter:", 0.85f);
            text.Top.Set(topModSourcesPanel, 0f);
            modSourcesPanel.Append(text);

            searchFilter = new NewUITextBox("Search", 0.85f);
            searchFilter.SetPadding(0);
            searchFilter.OnTextChanged += () => { updateneeded = true; };
            searchFilter.Top.Set(topModSourcesPanel, 0f);
            searchFilter.Left.Set(text.GetInnerDimensions().Width + 6, 0f);
            searchFilter.Width.Set(-(text.GetInnerDimensions().Width + 6), 1f);
            searchFilter.Height.Set(20, 0f);
            modSourcesPanel.Append(searchFilter);
            topModSourcesPanel += 26;

            currentShader = new UIText("Current: None selected", 0.85f);
            currentShader.Top.Set(topModSourcesPanel, 0f);
            currentShader.Left.Set(0, 0f);
            currentShader.Width.Set(0, 1);
            currentShader.HAlign = 0;
            modSourcesPanel.Append(currentShader);
            topModSourcesPanel += 20;

            var shaderListBackPanel = new UIPanel();

            shaderListBackPanel.Top.Set(topModSourcesPanel, 0);
            shaderListBackPanel.Width.Set(0, 1f);
            shaderListBackPanel.Height.Set(140f, 0f);
            shaderListBackPanel.SetPadding(6);
            shaderListBackPanel.BackgroundColor = Color.Green * 0.7f;

            shaderList = new UIList();
            shaderList.Width.Set(-25f, 1f);
            shaderList.Height.Set(0, 1f);
            shaderList.ListPadding = 0f;
            shaderListBackPanel.Append(shaderList);

            var shaderListScrollbar = new UIElements.FixedUIScrollbar(userInterface);

            shaderListScrollbar.SetView(100f, 1000f);
            shaderListScrollbar.Top.Pixels = 4;
            shaderListScrollbar.Height.Set(-8, 1f);
            shaderListScrollbar.HAlign = 1f;
            shaderListBackPanel.Append(shaderListScrollbar);
            shaderList.SetScrollbar(shaderListScrollbar);
            modSourcesPanel.Append(shaderListBackPanel);

            topModSourcesPanel     += 146;
            watchModSourcesCheckbox = new UICheckbox("Watch Mod Sources", "Automatically Compile Mod Sources Shaders when Changed on Disk", false);
            watchModSourcesCheckbox.Top.Set(topModSourcesPanel, 0);
            watchModSourcesCheckbox.OnSelectedChanged += WatchModSources_OnSelectedChanged;
            modSourcesPanel.Append(watchModSourcesCheckbox);
            topModSourcesPanel += 20;


            int topTestShaderPanel = 0;
            var testShaderPanel    = new UIPanel();

            testShaderPanel.Top.Set(top, 0f);
            testShaderPanel.Width.Set(0, 1f);
            testShaderPanel.Height.Set(230f, 0f);
            testShaderPanel.SetPadding(6);
            testShaderPanel.BackgroundColor = Color.LightBlue * 0.7f;
            top += 230;
            mainPanel.Append(testShaderPanel);

            text = new UIText("Test Shader:", 0.85f);
            text.Top.Set(topTestShaderPanel, 0f);
            testShaderPanel.Append(text);
            topTestShaderPanel += 20;

            // Current Working Shader
            // Status Text: "Compiled .fx"
            // Filter?
            // Checkbox: Force

            UIRadioButtonGroup g = new UIRadioButtonGroup();

            armorShaderRadioButton  = new UIRadioButton("Armor", "Generate an Armor Shader");
            screenShaderRadioButton = new UIRadioButton("Screen", "Generate a Screen Shader");
            g.Add(armorShaderRadioButton);
            g.Add(screenShaderRadioButton);
            g.Top.Pixels = topTestShaderPanel;
            g.Width.Set(0, .75f);
            testShaderPanel.Append(g);
            armorShaderRadioButton.Selected = true;
            topTestShaderPanel += (int)g.Height.Pixels;

            var createTestShaderButton = new UITextPanel <string>("Create/Recreate Test Shader");

            createTestShaderButton.OnClick += CreateTestShaderFileButton_OnClick;
            createTestShaderButton.Top.Set(topTestShaderPanel, 0f);
            createTestShaderButton.Left.Set(0, 0f);
            createTestShaderButton.SetPadding(4);
            testShaderPanel.Append(createTestShaderButton);
            topTestShaderPanel += 26;

            var openTestShaderButton = new UITextPanel <string>("Edit Test Shader");

            openTestShaderButton.OnClick += OpenTestShaderFileButton_OnClick;
            openTestShaderButton.Top.Set(topTestShaderPanel, 0f);
            openTestShaderButton.Left.Set(0, 0f);
            openTestShaderButton.SetPadding(4);
            testShaderPanel.Append(openTestShaderButton);
            topTestShaderPanel += 26;

            var compileShaderButton = new UITextPanel <string>("Compile Test Shader");

            compileShaderButton.OnClick += CompileTestShaderButton_OnClick;
            compileShaderButton.Top.Set(topTestShaderPanel, 0f);
            compileShaderButton.Left.Set(0, 0f);
            compileShaderButton.SetPadding(4);
            testShaderPanel.Append(compileShaderButton);
            topTestShaderPanel += 26;

            topTestShaderPanel     += 4;
            watchTestShaderCheckbox = new UICheckbox("Watch Test Shader File", "Automatically Compile Test Shader when Changed on Disk", true);
            watchTestShaderCheckbox.Top.Set(topTestShaderPanel, 0);
            watchTestShaderCheckbox.OnSelectedChanged += WatchTestShader_OnSelectedChanged;
            testShaderPanel.Append(watchTestShaderCheckbox);
            topTestShaderPanel += 20;

            forceShaderCheckbox = new UICheckbox("Force Shader Active", "Automatically enable the last compiled screen shader.", true);
            forceShaderCheckbox.Top.Set(topTestShaderPanel, 0);
            //forceShaderCheckbox.OnSelectedChanged += ForceShaderCheckbox_OnSelectedChanged;
            testShaderPanel.Append(forceShaderCheckbox);
            topTestShaderPanel += 20;

            var uiRanges = new List <UIElement>();

            colorDataProperty = new Dusts.ColorDataRangeProperty("uColor:");
            colorDataProperty.range.Top.Set(top, 0f);
            colorDataProperty.OnValueChanged += () => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseColor(colorDataProperty.Data);
            uiRanges.Add(colorDataProperty.range);

            intensityData            = new UIFloatRangedDataValue("uIntensity:", 1f, 0f, 1f);
            intensityData.DataGetter = () => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().Intensity;
            intensityData.DataSetter = (value) => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseIntensity(value);
            uiRanges.Add(new UIRange <float>(intensityData));

            //var uDirectionXProperty = new UIFloatRangedDataValue("uDirectionX:", 0, -1, 1);
            //uDirectionXProperty.DataGetter = () => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseDirection.Intensity;
            //uDirectionXProperty.DataSetter = (value) => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseDirection(value);
            //var uDirectionYProperty = new UIFloatRangedDataValue("uDirectionY:", 0, -1, 1);
            //var ui2DRange = new UI2DRange<float>(uDirectionXProperty, uDirectionYProperty);
            //uiRanges.Add(ui2DRange);
            //ui2DRange.Top.Set(top, 0f);
            //ui2DRange.Left.Set(200, 0f);
            //mainPanel.Append(ui2DRange);
            //top += 30;

            foreach (var uiRange in uiRanges)
            {
                uiRange.Top.Set(topTestShaderPanel, 0f);
                uiRange.Width.Set(0, 1f);
                testShaderPanel.Append(uiRange);
                topTestShaderPanel += 22;
            }

            updateneeded = true;
            Append(mainPanel);
        }
Example #6
0
        ////////////////

        private void InitializeComponents()
        {
            UIControlPanel    self  = this;
            ControlPanelLogic logic = this.Logic;
            var   mymod             = HamstarHelpersMod.Instance;
            float top = 0;

            this.OuterContainer = new UIElement();
            this.OuterContainer.Width.Set(UIControlPanel.ContainerWidth, 0f);
            this.OuterContainer.Height.Set(UIControlPanel.ContainerHeight, 0f);
            this.OuterContainer.MaxWidth.Set(UIControlPanel.ContainerWidth, 0f);
            this.OuterContainer.MaxHeight.Set(UIControlPanel.ContainerHeight, 0f);
            this.OuterContainer.HAlign = 0f;
            //this.MainElement.BackgroundColor = ControlPanelUI.MainBgColor;
            //this.MainElement.BorderColor = ControlPanelUI.MainEdgeColor;
            this.Append(this.OuterContainer);

            this.RecalculateContainer();

            this.InnerContainer = new UIPanel();
            this.InnerContainer.Width.Set(0f, 1f);
            this.InnerContainer.Height.Set(0f, 1f);
            this.OuterContainer.Append((UIElement)this.InnerContainer);

            this.Theme.ApplyPanel(this.InnerContainer);


            ////////

            this.DialogClose = new UITextPanelButton(this.Theme, "X");
            this.DialogClose.Top.Set(-8f, 0f);
            this.DialogClose.Left.Set(-16f, 1f);
            this.DialogClose.Width.Set(24f, 0f);
            this.DialogClose.Height.Set(24f, 0f);
            this.DialogClose.OnClick += delegate(UIMouseEvent evt, UIElement listening_element) {
                self.Close();
                Main.PlaySound(SoundID.MenuClose);
            };
            this.DialogClose.OnMouseOver += delegate(UIMouseEvent evt, UIElement listening_element) {
                self.Theme.ApplyButtonLit(self.DialogClose);
            };
            this.DialogClose.OnMouseOut += delegate(UIMouseEvent evt, UIElement listening_element) {
                self.Theme.ApplyButton(self.DialogClose);
            };
            this.InnerContainer.Append(this.DialogClose);

            ////

            var tip = new UIText("To enable issue reports for your mod, ");

            this.InnerContainer.Append((UIElement)tip);

            var tip_url = new UIWebUrl(this.Theme, "read this.",
                                       "https://forums.terraria.org/index.php?threads/mod-helpers-a-modders-mod-for-mods-and-modding.63670/#modders",
                                       true, 1f);

            tip_url.Left.Set(tip.GetInnerDimensions().Width, 0f);
            tip_url.Top.Set(-2f, 0f);
            this.InnerContainer.Append((UIElement)tip_url);

            top += 24f;

            ////

            var mod_list_panel = new UIPanel();

            {
                mod_list_panel.Top.Set(top, 0f);
                mod_list_panel.Width.Set(0f, 1f);
                mod_list_panel.Height.Set(UIControlPanel.ModListHeight, 0f);
                mod_list_panel.HAlign = 0f;
                mod_list_panel.SetPadding(4f);
                mod_list_panel.PaddingTop      = 0.0f;
                mod_list_panel.BackgroundColor = this.Theme.ListBgColor;
                mod_list_panel.BorderColor     = this.Theme.ListEdgeColor;
                this.InnerContainer.Append((UIElement)mod_list_panel);

                this.ModListElem = new UIList();
                {
                    this.ModListElem.Width.Set(-25, 1f);
                    this.ModListElem.Height.Set(0f, 1f);
                    this.ModListElem.HAlign      = 0f;
                    this.ModListElem.ListPadding = 4f;
                    this.ModListElem.SetPadding(0f);
                    mod_list_panel.Append((UIElement)this.ModListElem);

                    top += UIControlPanel.ModListHeight + this.InnerContainer.PaddingTop;

                    UIScrollbar scrollbar = new UIScrollbar();
                    {
                        scrollbar.Top.Set(8f, 0f);
                        scrollbar.Height.Set(-16f, 1f);
                        scrollbar.SetView(100f, 1000f);
                        scrollbar.HAlign = 1f;
                        mod_list_panel.Append((UIElement)scrollbar);
                        this.ModListElem.SetScrollbar(scrollbar);
                    }
                }
            }

            ////

            this.IssueTitleInput = new UITextArea(this.Theme, "Enter title of mod issue", 128);
            this.IssueTitleInput.Top.Set(top, 0f);
            this.IssueTitleInput.Width.Set(0f, 1f);
            this.IssueTitleInput.Height.Pixels = 36f;
            this.IssueTitleInput.HAlign        = 0f;
            this.IssueTitleInput.SetPadding(8f);
            this.IssueTitleInput.Disable();
            this.IssueTitleInput.OnPreChange += delegate(StringBuilder new_text) {
                self.RefreshIssueSubmitButton();
            };
            this.InnerContainer.Append((UIElement)this.IssueTitleInput);

            top += 40f;

            this.IssueBodyInput = new UITextArea(this.Theme, "Describe mod issue");
            this.IssueBodyInput.Top.Set(top, 0f);
            this.IssueBodyInput.Width.Set(0f, 1f);
            this.IssueBodyInput.Height.Pixels = 36f;
            this.IssueBodyInput.HAlign        = 0f;
            this.IssueBodyInput.SetPadding(8f);
            this.IssueBodyInput.Disable();
            this.IssueBodyInput.OnPreChange += delegate(StringBuilder new_text) {
                self.RefreshIssueSubmitButton();
            };
            this.InnerContainer.Append((UIElement)this.IssueBodyInput);

            top += 40f;

            ////

            this.IssueSubmitButton = new UITextPanelButton(this.Theme, "Submit Issue");
            this.IssueSubmitButton.Top.Set(top, 0f);
            this.IssueSubmitButton.Left.Set(0f, 0f);
            this.IssueSubmitButton.Width.Set(200f, 0f);
            this.IssueSubmitButton.Disable();
            this.IssueSubmitButton.OnClick += delegate(UIMouseEvent evt, UIElement listening_element) {
                if (self.AwaitingReport || !self.IssueSubmitButton.IsEnabled)
                {
                    return;
                }
                self.SubmitIssue();
            };
            this.InnerContainer.Append(this.IssueSubmitButton);

            this.ApplyConfigButton = new UITextPanelButton(this.Theme, "Apply Config Changes");
            this.ApplyConfigButton.Top.Set(top, 0f);
            this.ApplyConfigButton.Left.Set(0f, 0f);
            this.ApplyConfigButton.Width.Set(200f, 0f);
            this.ApplyConfigButton.HAlign = 1f;
            if (Main.netMode != 0)
            {
                this.ApplyConfigButton.Disable();
            }
            this.ApplyConfigButton.OnClick += delegate(UIMouseEvent evt, UIElement listening_element) {
                if (!self.ApplyConfigButton.IsEnabled)
                {
                    return;
                }
                self.ApplyConfigChanges(HamstarHelpersMod.Instance);
            };
            this.InnerContainer.Append(this.ApplyConfigButton);

            top += 30f;

            this.ModLockButton = new UITextPanelButton(this.Theme, UIControlPanel.ModLockTitle);
            this.ModLockButton.Top.Set(top, 0f);
            this.ModLockButton.Left.Set(0f, 0f);
            this.ModLockButton.Width.Set(0f, 1f);
            if (Main.netMode != 0 || !mymod.Config.WorldModLockEnable)
            {
                this.ModLockButton.Disable();
            }
            this.ModLockButton.OnClick += delegate(UIMouseEvent evt, UIElement listening_element) {
                if (!self.ModLockButton.IsEnabled)
                {
                    return;
                }
                self.ToggleModLock(HamstarHelpersMod.Instance);
                Main.PlaySound(SoundID.Unlock);
            };
            this.InnerContainer.Append(this.ModLockButton);

            this.RefreshModLockButton(mymod);

            top += 36f;

            ////

            var modrec_url = new UIWebUrl(this.Theme, "Need mods?", "https://sites.google.com/site/terrariamodsuggestions/");

            modrec_url.Top.Set(top, 0f);
            modrec_url.Left.Set(0f, 0f);
            this.InnerContainer.Append(modrec_url);

            var serverbrowser_url = new UIWebUrl(this.Theme, "Lonely?", "https://forums.terraria.org/index.php?threads/server-browser-early-beta.68346/");

            serverbrowser_url.Top.Set(top, 0f);
            this.InnerContainer.Append(serverbrowser_url);
            serverbrowser_url.Left.Set(-serverbrowser_url.GetDimensions().Width * 0.5f, 0.5f);

            var support_url = new UIWebUrl(this.Theme, "Support my mods!", "https://www.patreon.com/hamstar0");

            support_url.Top.Set(top, 0f);
            this.InnerContainer.Append(support_url);
            support_url.Left.Set(-support_url.GetDimensions().Width, 1f);
        }
Example #7
0
        public override void OnInitialize()
        {
            mainPanel = new UIPanel();
            mainPanel.Left.Set(-350f, 1f);
            mainPanel.Top.Set(-620f, 1f);
            mainPanel.Width.Set(310f, 0f);
            mainPanel.Height.Set(520f, 0f);
            mainPanel.SetPadding(12);
            mainPanel.BackgroundColor = Color.Orange * 0.7f;

            int    top  = 0;
            UIText text = new UIText("Projectiles:", 0.85f);

            text.Top.Set(top, 0f);
            mainPanel.Append(text);
            top += 20;

            UIText text2 = new UIText("Filter:", 0.85f);

            text2.Top.Set(top, 0f);
            mainPanel.Append(text2);

            searchFilter = new NewUITextBox("Search", 0.85f);
            searchFilter.SetPadding(0);
            searchFilter.OnTextChanged += () => { ValidateInput(); updateneeded = true; };
            searchFilter.Top.Set(top, 0f);
            searchFilter.Left.Set(text2.GetInnerDimensions().Width, 0f);
            searchFilter.Width.Set(0, 1f);
            searchFilter.Height.Set(20, 0f);
            //searchFilter.VAlign = 0.5f;
            mainPanel.Append(searchFilter);
            top += 20;

            speedXDataProperty = new UIFloatRangedDataValue("SpeedX:", 0, -10, 10);
            speedYDataProperty = new UIFloatRangedDataValue("SpeedY:", 0, -10, 10);
            var ui2DRange = new UI2DRange <float>(speedXDataProperty, speedYDataProperty);

            ui2DRange.Top.Set(top, 0f);
            mainPanel.Append(ui2DRange);
            top += 30;

            ai0DataProperty = new UIFloatRangedDataValue("ai0:", 0, -10, 10);
            var uiRange = new UIRange <float>(ai0DataProperty);

            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);
            top += 30;

            ai1DataProperty = new UIFloatRangedDataValue("ai1:", 0, -10, 10);
            uiRange         = new UIRange <float>(ai1DataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);
            top += 30;

            knockbackDataProperty = new UIFloatRangedDataValue("Knockback:", 0, 0, 20);
            uiRange = new UIRange <float>(knockbackDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);
            top += 30;

            damageDataProperty = new UIIntRangedDataValue("Damage:", 20, 0, 200);
            var uiRangeI = new UIRange <int>(damageDataProperty);

            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            aiStyleDataProperty = new UIIntRangedDataValue("AIStyle:", -1, -1, 145);
            uiRangeI            = new UIRange <int>(aiStyleDataProperty);
            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            hostile = new UIBoolNDataValue("Hostile");
            var hostileCheckbox = new UITriStateCheckbox(hostile);

            hostileCheckbox.Top.Set(top, 0f);
            mainPanel.Append(hostileCheckbox);
            top += 30;

            friendly = new UIBoolNDataValue("Friendly");
            var friendlyCheckbox = new UITriStateCheckbox(friendly);

            friendlyCheckbox.Top.Set(top, 0f);
            mainPanel.Append(friendlyCheckbox);
            top += 30;

            projectileGrid            = new UIGrid(7);
            projectileGrid.Top.Pixels = top;
            //autoTrashGrid.Left.Pixels = spacing;
            projectileGrid.Width.Set(-25f, 1f);             // leave space for scroll?
            projectileGrid.Height.Set(-top, 1f);
            projectileGrid.ListPadding = 6f;
            mainPanel.Append(projectileGrid);

            // this will initialize grid
            updateneeded = true;

            var projectileGridScrollbar = new UIElements.FixedUIScrollbar(userInterface);

            projectileGridScrollbar.SetView(100f, 1000f);
            projectileGridScrollbar.Top.Pixels = top;            // + spacing;
            projectileGridScrollbar.Height.Set(-top /*- spacing*/, 1f);
            projectileGridScrollbar.HAlign = 1f;
            mainPanel.Append(projectileGridScrollbar);
            projectileGrid.SetScrollbar(projectileGridScrollbar);

            Append(mainPanel);
        }
Example #8
0
        public override void OnInitialize()
        {
            playerBackGroundTexture = TextureManager.Load("Images/UI/PlayerBackground");

            teamDPSPanel = new UIDragablePanel();
            teamDPSPanel.SetPadding(6);
            teamDPSPanel.Left.Set(-310f, 0f);
            teamDPSPanel.HAlign = 1f;
            teamDPSPanel.Top.Set(90f, 0f);
            teamDPSPanel.Width.Set(415f, 0f);
            teamDPSPanel.MinWidth.Set(50f, 0f);
            teamDPSPanel.MaxWidth.Set(500f, 0f);
            teamDPSPanel.Height.Set(350, 0f);
            teamDPSPanel.MinHeight.Set(50, 0f);
            teamDPSPanel.MaxHeight.Set(300, 0f);
            teamDPSPanel.BackgroundColor = new Color(73, 94, 171);
            //Append(favoritePanel);

            label          = new UIText("DPS");
            label.OnClick += Label_OnClick;
            teamDPSPanel.Append(label);
            teamDPSPanel.AddDragTarget(label);

            //var togglePercentButton = new UIHoverImageButton(Main.itemTexture[ItemID.SuspiciousLookingEye], "Toggle %");
            var togglePercentButton = new UIHoverImageButton(DPSExtreme.instance.GetTexture("PercentButton"), "Toggle %");

            togglePercentButton.OnClick    += (a, b) => showPercent = !showPercent;
            togglePercentButton.Left.Pixels = 174;
            togglePercentButton.Top.Pixels  = -4;
            //toggleCompletedButton.Top.Pixels = spacing;
            teamDPSPanel.Append(togglePercentButton);

            var labelDimensions = label.GetInnerDimensions();
            int top             = (int)labelDimensions.Height + 4;

            dpsList = new UIGrid();
            dpsList.Width.Set(0, 1f);
            dpsList.Height.Set(-top, 1f);
            dpsList.Top.Set(top, 0f);
            dpsList.ListPadding = 0f;
            teamDPSPanel.Append(dpsList);
            teamDPSPanel.AddDragTarget(dpsList);

            var       type          = Assembly.GetAssembly(typeof(Mod)).GetType("Terraria.ModLoader.UI.Elements.UIGrid");
            FieldInfo loadModsField = type.GetField("_innerList", BindingFlags.Instance | BindingFlags.NonPublic);

            teamDPSPanel.AddDragTarget((UIElement)loadModsField.GetValue(dpsList));             // list._innerList

            bossList = new UIGrid();
            bossList.Width.Set(0, 1f);
            bossList.Height.Set(-top, 1f);
            bossList.Top.Set(top, 0f);
            bossList.ListPadding = 0f;
            //teamDPSPanel.Append(bossList);
            teamDPSPanel.AddDragTarget(bossList);
            teamDPSPanel.AddDragTarget((UIElement)loadModsField.GetValue(bossList));

            var scrollbar = new InvisibleFixedUIScrollbar(userInterface);

            scrollbar.SetView(100f, 1000f);
            scrollbar.Height.Set(0, 1f);
            scrollbar.Left.Set(-20, 1f);
            teamDPSPanel.Append(scrollbar);
            dpsList.SetScrollbar(scrollbar);

            scrollbar = new InvisibleFixedUIScrollbar(userInterface);
            scrollbar.SetView(100f, 1000f);
            scrollbar.Height.Set(0, 1f);
            scrollbar.Left.Set(-20, 1f);
            teamDPSPanel.Append(scrollbar);
            bossList.SetScrollbar(scrollbar);

            //updateNeeded = true;
        }
Example #9
0
        internal void UpdateDamageLists()
        {
            //ShowFavoritePanel = favoritedRecipes.Count > 0;
            //	teamDPSPanel.RemoveAllChildren();

            //UIText label = new UIText("DPS");
            //label.OnClick += Label_OnClick;
            //teamDPSPanel.Append(label);

            //label.Recalculate();
            var labelDimensions = label.GetInnerDimensions();
            int top             = (int)labelDimensions.Height + 4;

            if (showDPSPanel)
            {
                dpsList.Clear();
                int   width  = 1;
                int   height = 0;
                float max    = 1f;
                int   total  = 0;
                for (int i = 0; i < DPSExtreme.dpss.Length; i++)
                {
                    int playerDPS = DPSExtreme.dpss[i];
                    if (playerDPS > -1)
                    {
                        max    = Math.Max(max, playerDPS);
                        total += playerDPS;
                    }
                }
                for (int i = 0; i < DPSExtreme.dpss.Length; i++)
                {
                    int playerDPS = DPSExtreme.dpss[i];
                    if (playerDPS > -1)
                    {
                        UIPlayerDPS t = new UIPlayerDPS(i, "", "");
                        t.SetDPS(playerDPS, max, total);
                        t.Recalculate();
                        var inner = t.GetInnerDimensions();
                        t.Width.Set(200, 0);
                        height += (int)(inner.Height + dpsList.ListPadding);
                        width   = Math.Max(width, (int)inner.Width);
                        dpsList.Add(t);
                        teamDPSPanel.AddDragTarget(t);
                    }
                }

                dpsList.Recalculate();
                var fff = dpsList.GetTotalHeight();

                width = 200;
                teamDPSPanel.Height.Pixels = top + /*height*/ fff + teamDPSPanel.PaddingBottom + teamDPSPanel.PaddingTop - dpsList.ListPadding;
                teamDPSPanel.Width.Pixels  = width + teamDPSPanel.PaddingLeft + teamDPSPanel.PaddingRight;
                teamDPSPanel.Recalculate();
            }
            else
            {
                bossList.Clear();

                int height = 0;
                int max    = 1;
                int total  = 0;
                for (int i = 0; i < DPSExtreme.bossDamage.Length; i++)
                {
                    int playerBossDamage = DPSExtreme.bossDamage[i];
                    if (playerBossDamage > -1)
                    {
                        max    = Math.Max(max, playerBossDamage);
                        total += playerBossDamage;
                    }
                }
                for (int i = 0; i < DPSExtreme.dpss.Length; i++)
                {
                    int playerBossDamage = DPSExtreme.bossDamage[i];
                    if (playerBossDamage > -1)
                    {
                        UIPlayerDPS t = new UIPlayerDPS(i, "", "");
                        t.SetDPS(playerBossDamage, max, total);
                        t.Recalculate();
                        var inner = t.GetInnerDimensions();
                        t.Width.Set(200, 0);
                        height += (int)(inner.Height + bossList.ListPadding);
                        bossList.Add(t);
                        teamDPSPanel.AddDragTarget(t);
                    }
                }

                if (bossUpdateNeeded)
                {
                    string bossname = "No Boss";
                    if (DPSExtreme.bossIndex > -1)
                    {
                        bossname = Lang.GetNPCNameValue(Main.npc[DPSExtreme.bossIndex].type);
                    }
                    label.SetText("Boss - " + bossname);
                    bossUpdateNeeded = false;
                }

                bossList.Recalculate();
                var fff = bossList.GetTotalHeight();
                teamDPSPanel.Height.Pixels = top + /*height*/ fff + teamDPSPanel.PaddingBottom + teamDPSPanel.PaddingTop - dpsList.ListPadding;
                teamDPSPanel.Width.Pixels  = 200 + teamDPSPanel.PaddingLeft + teamDPSPanel.PaddingRight;
                teamDPSPanel.Recalculate();
            }
        }
        ////////////////

        private void InitializeComponents()
        {
            var mymod = ModHelpersMod.Instance;
            UIModControlPanelTab self  = this;
            ModControlPanelLogic logic = this.Logic;
            float top = 0;

            this.Theme.ApplyPanel(this);


            ////////

            var tip = new UIText("To enable issue reports for your mod, ");

            this.Append((UIElement)tip);

            this.TipUrl = new UIWebUrl(this.Theme, "read this.",
                                       "https://forums.terraria.org/index.php?threads/mod-helpers.63670/#modders",
                                       false, 1f);
            this.TipUrl.Left.Set(tip.GetInnerDimensions().Width, 0f);
            this.TipUrl.Top.Set(-2f, 0f);
            this.Append((UIElement)this.TipUrl);

            this.OpenConfigList = new UITextPanelButton(this.Theme, "Edit Configs");
            this.OpenConfigList.Top.Set(top - 8f, 0f);
            this.OpenConfigList.Left.Set(-188f, 1f);
            this.OpenConfigList.Width.Set(160f, 0f);
            this.OpenConfigList.OnClick += (_, __) => {
                MainMenuHelpers.OpenModConfigListUI();
            };
            this.Append(this.OpenConfigList);

            top += 24f;

            ////

            var modListPanel = new UIPanel();

            {
                modListPanel.Top.Set(top, 0f);
                modListPanel.Width.Set(0f, 1f);
                modListPanel.Height.Set(UIModControlPanelTab.ModListHeight, 0f);
                modListPanel.HAlign = 0f;
                modListPanel.SetPadding(4f);
                modListPanel.PaddingTop      = 0.0f;
                modListPanel.BackgroundColor = this.Theme.ListBgColor;
                modListPanel.BorderColor     = this.Theme.ListEdgeColor;
                this.Append((UIElement)modListPanel);

                this.ModListElem = new UIList();
                {
                    this.ModListElem.Width.Set(-25, 1f);
                    this.ModListElem.Height.Set(0f, 1f);
                    this.ModListElem.HAlign      = 0f;
                    this.ModListElem.ListPadding = 4f;
                    this.ModListElem.SetPadding(0f);
                    modListPanel.Append((UIElement)this.ModListElem);

                    top += UIModControlPanelTab.ModListHeight + this.PaddingTop - 8;

                    UIScrollbar scrollbar = new UIScrollbar();
                    {
                        scrollbar.Top.Set(8f, 0f);
                        scrollbar.Height.Set(-16f, 1f);
                        scrollbar.SetView(100f, 1000f);
                        scrollbar.HAlign = 1f;
                        modListPanel.Append((UIElement)scrollbar);
                        this.ModListElem.SetScrollbar(scrollbar);
                    }
                }
            }

            ////

            this.IssueTitleInput = new UITextInputAreaPanel(this.Theme, "Enter title of mod issue", 128);
            this.IssueTitleInput.Top.Set(top, 0f);
            this.IssueTitleInput.Width.Set(0f, 1f);
            this.IssueTitleInput.Height.Pixels = 36f;
            this.IssueTitleInput.HAlign        = 0f;
            this.IssueTitleInput.SetPadding(8f);
            this.IssueTitleInput.Disable();
            this.IssueTitleInput.OnPreTextChange += (_) => {
                self.RefreshIssueSubmitButton();
                return(true);
            };
            this.Append((UIElement)this.IssueTitleInput);

            top += 36f;

            this.IssueBodyInput = new UITextInputAreaPanel(this.Theme, "Describe mod issue");
            this.IssueBodyInput.Top.Set(top, 0f);
            this.IssueBodyInput.Width.Set(0f, 1f);
            this.IssueBodyInput.Height.Pixels = 36f;
            this.IssueBodyInput.HAlign        = 0f;
            this.IssueBodyInput.SetPadding(8f);
            this.IssueBodyInput.Disable();
            this.IssueBodyInput.OnPreTextChange += (_) => {
                self.RefreshIssueSubmitButton();
                return(true);
            };
            this.Append((UIElement)this.IssueBodyInput);

            top += 36f;

            ////

            this.IssueSubmitButton = new UITextPanelButton(this.Theme, "Submit Issue");
            this.IssueSubmitButton.Top.Set(top, 0f);
            this.IssueSubmitButton.Left.Set(0f, 0f);
            this.IssueSubmitButton.Width.Set(200f, 0f);
            this.IssueSubmitButton.Disable();
            this.IssueSubmitButton.OnClick += (_, __) => {
                if (self.AwaitingReport || !self.IssueSubmitButton.IsEnabled)
                {
                    return;
                }
                self.SubmitIssue();
            };
            this.Append(this.IssueSubmitButton);

            top += 26f;

            this.ModLockButton = new UITextPanelButton(this.Theme, UIModControlPanelTab.ModLockTitle);
            this.ModLockButton.Top.Set(top, 0f);
            this.ModLockButton.Left.Set(0f, 0f);
            this.ModLockButton.Width.Set(0f, 1f);
            if (Main.netMode != 0 || !ModHelpersMod.Config.WorldModLockEnable)
            {
                this.ModLockButton.Disable();
            }
            this.ModLockButton.OnClick += (_, __) => {
                if (!self.ModLockButton.IsEnabled)
                {
                    return;
                }
                self.ToggleModLock();
                Main.PlaySound(SoundID.Unlock);
            };
            this.Append(this.ModLockButton);

            this.RefreshModLockButton();

            top += 26f;

            this.CleanupModTiles = new UITextPanelButton(this.Theme, "Cleanup unused mod tiles");
            this.CleanupModTiles.Top.Set(top, 0f);
            this.CleanupModTiles.Left.Set(0f, 0f);
            this.CleanupModTiles.Width.Set(0f, 1f);
            if (Main.netMode != 0)
            {
                this.CleanupModTiles.Disable();
            }
            this.CleanupModTiles.OnClick += (_, __) => {
                if (!self.CleanupModTiles.IsEnabled)
                {
                    return;
                }

                int cleaned = 0;

                for (int i = 0; i < Main.maxTilesX; i++)
                {
                    for (int j = 0; j < Main.maxTilesY; j++)
                    {
                        Tile tile = Framing.GetTileSafely(i, j);
                        if (TileHelpers.IsAir(tile))
                        {
                            continue;
                        }
                        ModTile modTile = ModContent.GetModTile(tile.type);
                        if (modTile == null)
                        {
                            continue;
                        }

                        if (modTile.mod == null || modTile is MysteryTile)
                        {
                            TileHelpers.KillTile(i, j, false, false);
                            cleaned++;
                        }
                    }
                }

                Main.NewText(cleaned + " modded tiles cleaned up.", Color.Lime);
            };
            this.Append(this.CleanupModTiles);

            top += 32f;

            ////

            /*var modrec_url = new UIWebUrl( this.Theme, "Need mods?", "https://sites.google.com/site/terrariamodsuggestions/" );
             * modrecUrl.Top.Set( top, 0f );
             * modrecUrl.Left.Set( 0f, 0f );
             * this.InnerContainer.Append( modrecUrl );
             *
             * var serverbrowser_url = new UIWebUrl( this.Theme, "Lonely?", "https://forums.terraria.org/index.php?threads/server-browser-early-beta.68346/" );
             * serverbrowser_url.Top.Set( top, 0f );
             * this.InnerContainer.Append( serverbrowser_url );
             * serverbrowser_url.Left.Set( -serverbrowser_url.GetDimensions().Width * 0.5f, 0.5f );*/

            string supportMsg = UIModControlPanelTab.SupportMessages[this.RandomSupportTextIdx];

            this.SupportUrl = new UIWebUrl(this.Theme, supportMsg, "https://www.patreon.com/hamstar0", false);
            this.SupportUrl.Top.Set(top, 0f);
            this.Append(this.SupportUrl);
            //this.SupportUrl.Left.Set( -this.SupportUrl.GetDimensions().Width, 1f );
            this.SupportUrl.Left.Set(-this.SupportUrl.GetDimensions().Width * 0.5f, 0.5f);
        }