Example #1
0
        public UIModSourceItem(string mod, LocalMod builtMod)
        {
            _mod = mod;

            BorderColor     = new Color(89, 116, 213) * 0.7f;
            _dividerTexture = UICommon.DividerTexture;
            Height.Pixels   = 90;
            Width.Percent   = 1f;
            SetPadding(6f);

            string addendum = Path.GetFileName(mod).Contains(" ") ? $"  [c/FF0000:{Language.GetTextValue("tModLoader.MSModSourcesCantHaveSpaces")}]" : "";

            modName  = Path.GetFileName(mod);
            _modName = new UIText(modName + addendum)
            {
                Left = { Pixels = 10 },
                Top  = { Pixels = 5 }
            };
            Append(_modName);

            var buildButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSBuild"))
            {
                Width  = { Pixels = 100 },
                Height = { Pixels = 36 },
                Left   = { Pixels = 10 },
                Top    = { Pixels = 40 }
            }.WithFadedMouseOver();

            buildButton.PaddingTop    -= 2f;
            buildButton.PaddingBottom -= 2f;
            buildButton.OnClick       += BuildMod;
            Append(buildButton);

            var buildReloadButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSBuildReload"));

            buildReloadButton.CopyStyle(buildButton);
            buildReloadButton.Width.Pixels = 200;
            buildReloadButton.Left.Pixels  = 150;
            buildReloadButton.WithFadedMouseOver();
            buildReloadButton.OnClick += BuildAndReload;
            Append(buildReloadButton);

            _builtMod = builtMod;
            if (builtMod != null)
            {
                var publishButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSPublish"));
                publishButton.CopyStyle(buildReloadButton);
                publishButton.Width.Pixels = 100;
                publishButton.Left.Pixels  = 390;
                publishButton.WithFadedMouseOver();
                publishButton.OnClick += PublishMod;
                Append(publishButton);
            }
            OnDoubleClick += BuildAndReload;
        }
Example #2
0
        public UIModSourceItem(string mod, LocalMod builtMod)
        {
            this.mod = mod;

            BorderColor    = new Color(89, 116, 213) * 0.7f;
            dividerTexture = TextureManager.Load("Images/UI/Divider");
            Height.Pixels  = 90;
            Width.Percent  = 1f;
            SetPadding(6f);

            string addendum = Path.GetFileName(mod).Contains(" ") ? $"  [c/FF0000:{Language.GetTextValue("tModLoader.MSModSourcesCantHaveSpaces")}]" : "";

            modName = new UIText(Path.GetFileName(mod) + addendum)
            {
                Left = { Pixels = 10 },
                Top  = { Pixels = 5 }
            };
            Append(modName);

            var button = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSBuild"))
            {
                Width  = { Pixels = 100 },
                Height = { Pixels = 36 },
                Left   = { Pixels = 10 },
                Top    = { Pixels = 40 }
            }.WithFadedMouseOver();

            button.PaddingTop    -= 2f;
            button.PaddingBottom -= 2f;
            button.OnClick       += BuildMod;
            Append(button);

            var button2 = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSBuildReload"));

            button2.CopyStyle(button);
            button2.Width.Pixels = 200;
            button2.Left.Pixels  = 150;
            button2.WithFadedMouseOver();
            button2.OnClick += BuildAndReload;
            Append(button2);

            this.builtMod = builtMod;
            if (builtMod != null)
            {
                var button3 = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSPublish"));
                button3.CopyStyle(button2);
                button3.Width.Pixels = 100;
                button3.Left.Pixels  = 390;
                button3.WithFadedMouseOver();
                button3.OnClick += this.Publish;
                Append(button3);
            }
            OnDoubleClick += BuildAndReload;
        }
Example #3
0
        public override void OnInitialize()
        {
            uIElement = new UIElement {
                Width    = { Percent = 0.8f },
                MaxWidth = UICommon.MaxPanelWidth,
                Top      = { Pixels = 220 },
                Height   = { Pixels = -220, Percent = 1f },
                HAlign   = 0.5f
            };

            uIPanel = new UIPanel {
                Width           = { Percent = 1f },
                Height          = { Pixels = -110, Percent = 1f },
                BackgroundColor = UICommon.mainPanelBackground,
                PaddingTop      = 0f
            };
            uIElement.Append(uIPanel);

            uiLoader = new UILoaderAnimatedImage(0.5f, 0.5f, 1f);

            modList = new UIList {
                Width       = { Pixels = -25, Percent = 1f },
                Height      = { Pixels = -50, Percent = 1f },
                Top         = { Pixels = 50 },
                ListPadding = 5f
            };
            uIPanel.Append(modList);

            var uIScrollbar = new UIScrollbar {
                Height = { Pixels = -50, Percent = 1f },
                Top    = { Pixels = 50 },
                HAlign = 1f
            }.WithView(100f, 1000f);

            uIPanel.Append(uIScrollbar);

            modList.SetScrollbar(uIScrollbar);

            var uIHeaderTexTPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.ModsModsList"), 0.8f, true)
            {
                HAlign          = 0.5f,
                Top             = { Pixels = -35 },
                BackgroundColor = UICommon.defaultUIBlue
            }.WithPadding(15f);

            uIElement.Append(uIHeaderTexTPanel);

            buttonEA = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModsEnableAll"))
            {
                TextColor = Color.Green,
                Width     = new StyleDimension(-10f, 1f / 3f),
                Height    = { Pixels = 40 },
                VAlign    = 1f,
                Top       = { Pixels = -65 }
            }.WithFadedMouseOver();
            buttonEA.OnClick += EnableAll;
            uIElement.Append(buttonEA);

            // TODO CopyStyle doesn't capture all the duplication here, consider an inner method
            buttonDA = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModsDisableAll"));
            buttonDA.CopyStyle(buttonEA);
            buttonDA.TextColor = Color.Red;
            buttonDA.HAlign    = 0.5f;
            buttonDA.WithFadedMouseOver();
            buttonDA.OnClick += DisableAll;
            uIElement.Append(buttonDA);

            buttonRM = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModsReloadMods"));
            buttonRM.CopyStyle(buttonEA);
            buttonRM.HAlign = 1f;
            buttonDA.WithFadedMouseOver();
            buttonRM.OnClick += ReloadMods;
            uIElement.Append(buttonRM);

            buttonB = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("UI.Back"));
            buttonB.CopyStyle(buttonEA);
            buttonB.Top.Pixels = -20;
            buttonB.WithFadedMouseOver();
            buttonB.OnClick += BackClick;

            uIElement.Append(buttonB);
            buttonOMF = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModsOpenModsFolder"));
            buttonOMF.CopyStyle(buttonB);
            buttonOMF.HAlign = 0.5f;
            buttonOMF.WithFadedMouseOver();
            buttonOMF.OnClick += OpenModsFolder;
            uIElement.Append(buttonOMF);

            var texture            = Texture2D.FromStream(Main.instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.UIModBrowserIcons.png"));
            var upperMenuContainer = new UIElement {
                Width  = { Percent = 1f },
                Height = { Pixels = 32 },
                Top    = { Pixels = 10 }
            };

            UICycleImage toggleImage;

            for (int j = 0; j < 3; j++)
            {
                if (j == 0)                   //TODO: ouch, at least there's a loop but these click events look quite similar
                {
                    toggleImage = new UICycleImage(texture, 3, 32, 32, 34 * 3, 0);
                    toggleImage.setCurrentState((int)sortMode);
                    toggleImage.OnClick += (a, b) => {
                        sortMode     = sortMode.NextEnum();
                        updateNeeded = true;
                    };
                    toggleImage.OnRightClick += (a, b) => {
                        sortMode     = sortMode.PreviousEnum();
                        updateNeeded = true;
                    };
                }
                else if (j == 1)
                {
                    toggleImage = new UICycleImage(texture, 3, 32, 32, 34 * 4, 0);
                    toggleImage.setCurrentState((int)enabledFilterMode);
                    toggleImage.OnClick += (a, b) => {
                        enabledFilterMode = enabledFilterMode.NextEnum();
                        updateNeeded      = true;
                    };
                    toggleImage.OnRightClick += (a, b) => {
                        enabledFilterMode = enabledFilterMode.PreviousEnum();
                        updateNeeded      = true;
                    };
                }
                else
                {
                    toggleImage = new UICycleImage(texture, 5, 32, 32, 34 * 5, 0);
                    toggleImage.setCurrentState((int)modSideFilterMode);
                    toggleImage.OnClick += (a, b) => {
                        modSideFilterMode = modSideFilterMode.NextEnum();
                        updateNeeded      = true;
                    };
                    toggleImage.OnRightClick += (a, b) => {
                        modSideFilterMode = modSideFilterMode.PreviousEnum();
                        updateNeeded      = true;
                    };
                }
                toggleImage.Left.Pixels = j * 36 + 8;
                _categoryButtons.Add(toggleImage);
                upperMenuContainer.Append(toggleImage);
            }

            var filterTextBoxBackground = new UIPanel {
                Top    = { Percent = 0f },
                Left   = { Pixels = -170, Percent = 1f },
                Width  = { Pixels = 135 },
                Height = { Pixels = 40 }
            };

            filterTextBoxBackground.OnRightClick += (a, b) => filterTextBox.Text = "";
            upperMenuContainer.Append(filterTextBoxBackground);

            filterTextBox = new UIInputTextField(Language.GetTextValue("tModLoader.ModsTypeToSearch"))
            {
                Top    = { Pixels = 5 },
                Left   = { Pixels = -160, Percent = 1f },
                Width  = { Pixels = 120 },
                Height = { Pixels = 20 }
            };
            filterTextBox.OnTextChange += (a, b) => updateNeeded = true;
            upperMenuContainer.Append(filterTextBox);

            SearchFilterToggle = new UICycleImage(texture, 2, 32, 32, 34 * 2, 0)
            {
                Left = { Pixels = 545 }
            };
            SearchFilterToggle.setCurrentState((int)searchFilterMode);
            SearchFilterToggle.OnClick += (a, b) => {
                searchFilterMode = searchFilterMode.NextEnum();
                updateNeeded     = true;
            };
            SearchFilterToggle.OnRightClick += (a, b) => {
                searchFilterMode = searchFilterMode.PreviousEnum();
                updateNeeded     = true;
            };
            _categoryButtons.Add(SearchFilterToggle);
            upperMenuContainer.Append(SearchFilterToggle);

            buttonMP = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModsModPacks"));
            buttonMP.CopyStyle(buttonOMF);
            buttonMP.HAlign = 1f;
            buttonMP.WithFadedMouseOver();
            buttonMP.OnClick += GotoModPacksMenu;
            uIElement.Append(buttonMP);

            uIPanel.Append(upperMenuContainer);
            Append(uIElement);
        }
Example #4
0
        public override void OnInitialize()
        {
            _uIElement = new UIElement {
                Width    = { Percent = 0.8f },
                MaxWidth = UICommon.MaxPanelWidth,
                Top      = { Pixels = 220 },
                Height   = { Pixels = -220, Percent = 1f },
                HAlign   = 0.5f
            };

            _uIPanel = new UIPanel {
                Width           = { Percent = 1f },
                Height          = { Pixels = -110, Percent = 1f },
                BackgroundColor = UICommon.MainPanelBackground
            };
            _uIElement.Append(_uIPanel);

            _uiLoader = new UILoaderAnimatedImage(0.5f, 0.5f, 1f);

            _modList = new UIList {
                Width       = { Pixels = -25, Percent = 1f },
                Height      = { Percent = 1f },
                ListPadding = 5f
            };
            _uIPanel.Append(_modList);

            var uIScrollbar = new UIScrollbar {
                Height = { Percent = 1f },
                HAlign = 1f
            }.WithView(100f, 1000f);

            _uIPanel.Append(uIScrollbar);
            _modList.SetScrollbar(uIScrollbar);

            var uIHeaderTextPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.MenuModSources"), 0.8f, true)
            {
                HAlign          = 0.5f,
                Top             = { Pixels = -35 },
                BackgroundColor = UICommon.DefaultUIBlue
            }.WithPadding(15f);

            _uIElement.Append(uIHeaderTextPanel);

            var buttonBA = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSBuildAll"))
            {
                Width  = { Pixels = -10, Percent = 1f / 3f },
                Height = { Pixels = 40 },
                VAlign = 1f,
                Top    = { Pixels = -65 }
            };

            buttonBA.WithFadedMouseOver();
            buttonBA.OnClick += BuildMods;
            _uIElement.Append(buttonBA);

            var buttonBRA = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSBuildReloadAll"));

            buttonBRA.CopyStyle(buttonBA);
            buttonBRA.HAlign = 0.5f;
            buttonBRA.WithFadedMouseOver();
            buttonBRA.OnClick += BuildAndReload;
            _uIElement.Append(buttonBRA);

            var buttonCreateMod = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSCreateMod"));

            buttonCreateMod.CopyStyle(buttonBA);
            buttonCreateMod.HAlign = 1f;
            buttonCreateMod.WithFadedMouseOver();
            buttonCreateMod.OnClick += ButtonCreateMod_OnClick;
            _uIElement.Append(buttonCreateMod);

            var buttonB = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("UI.Back"));

            buttonB.CopyStyle(buttonBA);
            //buttonB.Width.Set(-10f, 1f / 3f);
            buttonB.Top.Pixels = -20;
            buttonB.WithFadedMouseOver();
            buttonB.OnClick += BackClick;
            _uIElement.Append(buttonB);

            var buttonOS = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSOpenSources"));

            buttonOS.CopyStyle(buttonB);
            buttonOS.HAlign = .5f;
            buttonOS.WithFadedMouseOver();
            buttonOS.OnClick += OpenSources;
            _uIElement.Append(buttonOS);

            var buttonMP = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSManagePublished"));

            buttonMP.CopyStyle(buttonB);
            buttonMP.HAlign = 1f;
            buttonMP.WithFadedMouseOver();
            buttonMP.OnClick += ManagePublished;
            _uIElement.Append(buttonMP);
            Append(_uIElement);
        }
Example #5
0
        public UIModDownloadItem(string displayname, string name, string version, string author, string modreferences, ModSide modside, string modIconURL, string download, int downloads, int hot, string timeStamp, bool update, bool updateIsDowngrade, LocalMod installed)
        {
            this.displayname       = displayname;
            this.mod               = name;
            this.version           = version;
            this.author            = author;
            this.modreferences     = modreferences;
            this.modside           = modside;
            this.modIconURL        = modIconURL;
            this.download          = download;
            this.downloads         = downloads;
            this.hot               = hot;
            this.timeStamp         = timeStamp;
            this.update            = update;
            this.updateIsDowngrade = updateIsDowngrade;
            this.installed         = installed;

            BorderColor       = new Color(89, 116, 213) * 0.7f;
            dividerTexture    = TextureManager.Load("Images/UI/Divider");
            innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
            Height.Pixels     = 90;
            Width.Percent     = 1f;
            SetPadding(6f);

            left = HasModIcon ? 85f : 0f;
            string text = displayname + " " + version;

            modName = new UIText(text)
            {
                Left = new StyleDimension(left + 5, 0f),
                Top  = { Pixels = 5 }
            };
            Append(modName);

            moreInfoButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModsMoreInfo"))
            {
                Width  = { Pixels = 100 },
                Height = { Pixels = 36 },
                Left   = { Pixels = left },
                Top    = { Pixels = 40 }
            }.WithFadedMouseOver();
            moreInfoButton.PaddingTop    -= 2f;
            moreInfoButton.PaddingBottom -= 2f;
            moreInfoButton.OnClick       += RequestMoreinfo;
            Append(moreInfoButton);

            if (update || installed == null)
            {
                updateButton = new UIAutoScaleTextTextPanel <string>(this.update ? (updateIsDowngrade ? Language.GetTextValue("tModLoader.MBDowngrade") : Language.GetTextValue("tModLoader.MBUpdate")) : Language.GetTextValue("tModLoader.MBDownload"), 1f,
                                                                     false);
                updateButton.CopyStyle(moreInfoButton);
                updateButton.Width.Pixels = HasModIcon ? 120 : 200;
                updateButton.Left.Pixels  = moreInfoButton.Width.Pixels + moreInfoButton.Left.Pixels + 5f;
                updateButton.WithFadedMouseOver();
                updateButton.OnClick += DownloadMod;
                Append(updateButton);
            }
            if (modreferences.Length > 0)
            {
                var icon = Texture2D.FromStream(Main.instance.GraphicsDevice,
                                                Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.ButtonExclamation.png"));
                var modReferenceIcon = new UIHoverImage(icon, Language.GetTextValue("tModLoader.MBClickToViewDependencyMods", string.Join("\n", modreferences.Split(',').Select(x => x.Trim()))))
                {
                    Left = { Pixels = -149, Percent = 1f },
                    Top  = { Pixels = 48 }
                };
                modReferenceIcon.OnClick += (s, e) => {
                    var modListItem = (UIModDownloadItem)e.Parent;
                    Interface.modBrowser.SpecialModPackFilter      = modListItem.modreferences.Split(',').Select(x => x.Trim()).ToList();
                    Interface.modBrowser.SpecialModPackFilterTitle = Language.GetTextValue("tModLoader.MBFilterDependencies");                     // Toolong of \n" + modListItem.modName.Text;
                    Interface.modBrowser.filterTextBox.Text        = "";
                    Interface.modBrowser.updateNeeded = true;
                    Main.PlaySound(SoundID.MenuOpen);
                };
                Append(modReferenceIcon);
            }
            OnDoubleClick += RequestMoreinfo;
        }
Example #6
0
        public override void OnInitialize()
        {
            _uIElement = new UIElement {
                Width    = { Percent = 0.8f },
                MaxWidth = UICommon.MaxPanelWidth,
                Top      = { Pixels = 220 },
                Height   = { Pixels = -220, Percent = 1f },
                HAlign   = 0.5f
            };

            _uIPanel = new UIPanel {
                Width           = { Percent = 1f },
                Height          = { Pixels = -110, Percent = 1f },
                BackgroundColor = UICommon.MainPanelBackground,
                PaddingTop      = 0f
            };
            _uIElement.Append(_uIPanel);

            _uiLoader = new UILoaderAnimatedImage(0.5f, 0.5f, 1f);

            var upperMenuContainer = new UIElement {
                Width  = { Percent = 1f },
                Height = { Pixels = 32 },
                Top    = { Pixels = 10 }
            };
            var filterTextBoxBackground = new UIPanel {
                Top    = { Percent = 0f },
                Left   = { Pixels = -135, Percent = 1f },
                Width  = { Pixels = 135 },
                Height = { Pixels = 40 }
            };

            filterTextBoxBackground.OnRightClick += (a, b) => filterTextBox.Text = "";
            upperMenuContainer.Append(filterTextBoxBackground);

            filterTextBox = new UIInputTextField(Language.GetTextValue("tModLoader.ModsTypeToSearch"))
            {
                Top    = { Pixels = 5 },
                Left   = { Pixels = -125, Percent = 1f },
                Width  = { Pixels = 120 },
                Height = { Pixels = 20 }
            };
            filterTextBox.OnTextChange += (a, b) => _updateNeeded = true;
            upperMenuContainer.Append(filterTextBox);
            _uIPanel.Append(upperMenuContainer);

            _modList = new UIList {
                Width       = { Pixels = -25, Percent = 1f },
                Height      = { Pixels = -50, Percent = 1f },
                Top         = { Pixels = 50 },
                ListPadding = 5f
            };
            _uIPanel.Append(_modList);

            var uIScrollbar = new UIScrollbar {
                Height = { Pixels = -50, Percent = 1f },
                Top    = { Pixels = 50 },
                HAlign = 1f
            }.WithView(100f, 1000f);

            _uIPanel.Append(uIScrollbar);
            _modList.SetScrollbar(uIScrollbar);

            var uIHeaderTextPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.MenuModSources"), 0.8f, true)
            {
                HAlign          = 0.5f,
                Top             = { Pixels = -35 },
                BackgroundColor = UICommon.DefaultUIBlue
            }.WithPadding(15f);

            _uIElement.Append(uIHeaderTextPanel);

            var buttonBA = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSBuildAll"))
            {
                Width  = { Pixels = -10, Percent = 1f / 3f },
                Height = { Pixels = 40 },
                VAlign = 1f,
                Top    = { Pixels = -65 }
            };

            buttonBA.WithFadedMouseOver();
            buttonBA.OnClick += BuildMods;
            //_uIElement.Append(buttonBA);

            var buttonBRA = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSBuildReloadAll"));

            buttonBRA.CopyStyle(buttonBA);
            buttonBRA.HAlign = 0.5f;
            buttonBRA.WithFadedMouseOver();
            buttonBRA.OnClick += BuildAndReload;
            //_uIElement.Append(buttonBRA);

            var buttonCreateMod = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSCreateMod"));

            buttonCreateMod.CopyStyle(buttonBA);
            buttonCreateMod.HAlign = 1f;
            buttonCreateMod.WithFadedMouseOver();
            buttonCreateMod.OnClick += ButtonCreateMod_OnClick;
            _uIElement.Append(buttonCreateMod);

            var buttonB = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("UI.Back"));

            buttonB.CopyStyle(buttonBA);
            //buttonB.Width.Set(-10f, 1f / 3f);
            buttonB.Top.Pixels = -20;
            buttonB.WithFadedMouseOver();
            buttonB.OnClick += BackClick;
            _uIElement.Append(buttonB);

            var buttonOS = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSOpenSources"));

            buttonOS.CopyStyle(buttonB);
            buttonOS.HAlign = .5f;
            buttonOS.WithFadedMouseOver();
            buttonOS.OnClick += OpenSources;
            _uIElement.Append(buttonOS);

            var buttonMP = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSManagePublished"));

            buttonMP.CopyStyle(buttonB);
            buttonMP.HAlign = 1f;
            buttonMP.WithFadedMouseOver();
            buttonMP.OnClick += ManagePublished;
            _uIElement.Append(buttonMP);
            Append(_uIElement);
        }
Example #7
0
        public override void OnInitialize()
        {
            var uIElement = new UIElement {
                Width    = { Percent = 0.8f },
                MaxWidth = UICommon.MaxPanelWidth,
                Top      = { Pixels = 220 },
                Height   = { Pixels = -220, Percent = 1f },
                HAlign   = 0.5f
            };

            uiLoader = new UILoaderAnimatedImage(0.5f, 0.5f, 1f);

            scrollPanel = new UIPanel {
                Width           = { Percent = 1f },
                Height          = { Pixels = -65, Percent = 1f },
                BackgroundColor = UICommon.mainPanelBackground
            };
            uIElement.Append(scrollPanel);

            modPacks = new UIList {
                Width       = { Pixels = -25, Percent = 1f },
                Height      = { Percent = 1f },
                ListPadding = 5f
            };
            scrollPanel.Append(modPacks);

            var uIScrollbar = new UIScrollbar {
                Height = { Percent = 1f },
                HAlign = 1f
            }.WithView(100f, 1000f);

            scrollPanel.Append(uIScrollbar);
            modPacks.SetScrollbar(uIScrollbar);

            var titleTextPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.ModPacksHeader"), 0.8f, true)
            {
                HAlign          = 0.5f,
                Top             = { Pixels = -35 },
                BackgroundColor = UICommon.defaultUIBlue
            }.WithPadding(15f);

            uIElement.Append(titleTextPanel);

            var backButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("UI.Back"))
            {
                Width  = new StyleDimension(-10f, 1f / 2f),
                Height = { Pixels = 40 },
                VAlign = 1f,
                Top    = { Pixels = -20 }
            }.WithFadedMouseOver();

            backButton.OnClick += BackClick;
            uIElement.Append(backButton);

            var saveNewButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPacksSaveEnabledAsNewPack"));

            saveNewButton.CopyStyle(backButton);
            saveNewButton.TextColor = Color.Green;
            saveNewButton.HAlign    = 1f;
            saveNewButton.WithFadedMouseOver();
            saveNewButton.OnClick += SaveNewModList;
            uIElement.Append(saveNewButton);

            Append(uIElement);
        }