Inheritance: Terraria.UI.UIElement
        public override void OnInitialize()
        {
            UIElement uIElement = new UIElement();
            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;

            UIPanel uIPanel = new UIPanel();
            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIPanel.PaddingTop = 0f;
            uIElement.Append(uIPanel);

            uITextPanel = new UITextPanel<string>("Please Enter Your Passcode", 0.8f, true);
            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);

            UITextPanel<string> button = new UITextPanel<string>("Back", 1f, false);
            button.Width.Set(-10f, 0.5f);
            button.Height.Set(25f, 0f);
            button.VAlign = 1f;
            button.Top.Set(-65f, 0f);
            button.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
            button.OnClick += new UIElement.MouseEvent(BackClick);
            uIElement.Append(button);

            UITextPanel<string> button2 = new UITextPanel<string>("Submit", 1f, false);
            button2.CopyStyle(button);
            button2.HAlign = 1f;
            button2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button2.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
            button2.OnClick += new UIElement.MouseEvent(OKClick);
            uIElement.Append(button2);

            UITextPanel<string> button3 = new UITextPanel<string>("Visit Website to Generate Passphrase", 1f, false);
            button3.CopyStyle(button);
            button3.Width.Set(0f, 1f);
            button3.Top.Set(-20f, 0f);
            button3.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button3.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
            button3.OnClick += new UIElement.MouseEvent(VisitRegisterWebpage);
            uIElement.Append(button3);

            passcodeTextField = new UIInputTextField("Paste Passphrase (ctrl-v)");
            passcodeTextField.HAlign = 0.5f;
            passcodeTextField.VAlign = 0.5f;
            passcodeTextField.Left.Set(-100, 0);
            passcodeTextField.OnTextChange += new UIInputTextField.EventHandler(OnTextChange);
            uIPanel.Append(passcodeTextField);

            base.Append(uIElement);
        }
Exemple #2
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);
        }
Exemple #3
0
        public override void OnInitialize()
        {
            UIElement uIElement = new UIElement();

            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;
            UIPanel uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIPanel.PaddingTop      = 0f;
            uIElement.Append(uIPanel);
            modListAll = new UIList();
            modList    = new UIList();
            modList.Width.Set(-25f, 1f);
            modList.Height.Set(-50f, 1f);
            modList.Top.Set(50f, 0f);
            modList.ListPadding = 5f;
            uIPanel.Append(modList);
            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(-50f, 1f);
            uIScrollbar.Top.Set(50f, 0f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);
            modList.SetScrollbar(uIScrollbar);
            uITextPanel        = new UITextPanel <string>("Mod Browser", 0.8f, true);
            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);
            reloadButton = new UITextPanel <string>("Loading...", 1f, false);
            reloadButton.Width.Set(-10f, 0.5f);
            reloadButton.Height.Set(25f, 0f);
            reloadButton.VAlign = 1f;
            reloadButton.Top.Set(-65f, 0f);
            reloadButton.OnMouseOver += UICommon.FadedMouseOver;
            reloadButton.OnMouseOut  += UICommon.FadedMouseOut;
            reloadButton.OnClick     += ReloadList;
            uIElement.Append(reloadButton);
            UITextPanel <string> backButton = new UITextPanel <string>("Back", 1f, false);

            backButton.Width.Set(-10f, 0.5f);
            backButton.Height.Set(25f, 0f);
            backButton.VAlign = 1f;
            backButton.Top.Set(-20f, 0f);
            backButton.OnMouseOver += UICommon.FadedMouseOver;
            backButton.OnMouseOut  += UICommon.FadedMouseOut;
            backButton.OnClick     += BackClick;
            uIElement.Append(backButton);
            base.Append(uIElement);
            UIElement uIElement2 = new UIElement();

            uIElement2.Width.Set(0f, 1f);
            uIElement2.Height.Set(32f, 0f);
            uIElement2.Top.Set(10f, 0f);
            Texture2D    texture = Texture2D.FromStream(Main.instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.UIModBrowserIcons.png"));
            UICycleImage uIToggleImage;

            for (int j = 0; j < 2; j++)
            {
                if (j == 0)
                {
                    uIToggleImage = new UICycleImage(texture, 5, 32, 32, 0, 0);
                    uIToggleImage.setCurrentState((int)sortMode);
                    uIToggleImage.OnClick += (a, b) =>
                    {
                        sortMode = sortMode.Next();
                        SortList();
                    };
                }
                else
                {
                    uIToggleImage = new UICycleImage(texture, 3, 32, 32, 34, 0);
                    uIToggleImage.setCurrentState((int)updateFilterMode);
                    uIToggleImage.OnClick += (a, b) =>
                    {
                        updateFilterMode = updateFilterMode.Next();
                        SortList();
                    };
                }
                uIToggleImage.Left.Set((float)(j * 36 + 8), 0f);
                _categoryButtons.Add(uIToggleImage);
                uIElement2.Append(uIToggleImage);
            }
            filterTextBox = new UIInputTextField("Type to search");
            filterTextBox.Top.Set(5, 0f);
            filterTextBox.Left.Set(-150, 1f);
            filterTextBox.OnTextChange += (sender, e) => SortList();
            uIElement2.Append(filterTextBox);
            UICycleImage SearchFilterToggle = new UICycleImage(texture, 2, 32, 32, 68, 0);

            SearchFilterToggle.setCurrentState((int)searchFilterMode);
            SearchFilterToggle.OnClick += (a, b) =>
            {
                searchFilterMode = searchFilterMode.Next();
                SortList();
            };
            SearchFilterToggle.Left.Set(545f, 0f);
            _categoryButtons.Add(SearchFilterToggle);
            uIElement2.Append(SearchFilterToggle);
            uIPanel.Append(uIElement2);

            PopulateModBrowser();
        }
Exemple #4
0
        public override void OnInitialize()
        {
            UIElement uIElement = new UIElement();

            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;

            UIPanel uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIPanel.PaddingTop      = 0f;
            uIElement.Append(uIPanel);

            uITextPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.EnterSteamID"), 0.8f, true)
            {
                HAlign = 0.5f
            };
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);

            UITextPanel <string> button = new UITextPanel <string>(Language.GetTextValue("UI.Back"), 1f, false);

            button.Width.Set(-10f, 0.5f);
            button.Height.Set(25f, 0f);
            button.VAlign = 1f;
            button.Top.Set(-65f, 0f);
            button.OnMouseOver += UICommon.FadedMouseOver;
            button.OnMouseOut  += UICommon.FadedMouseOut;
            button.OnClick     += BackClick;
            uIElement.Append(button);

            UITextPanel <string> button2 = new UITextPanel <string>(Language.GetTextValue("UI.Submit"), 1f, false);

            button2.CopyStyle(button);
            button2.HAlign       = 1f;
            button2.OnMouseOver += UICommon.FadedMouseOver;
            button2.OnMouseOut  += UICommon.FadedMouseOut;
            button2.OnClick     += OKClick;
            uIElement.Append(button2);

            //UITextPanel<string> button3 = new UITextPanel<string>("Visit Website to Generate Passphrase", 1f, false);
            //button3.CopyStyle(button);
            //button3.Width.Set(0f, 1f);
            //button3.Top.Set(-20f, 0f);
            //button3.OnMouseOver += UICommon.FadedMouseOver;
            //button3.OnMouseOut += UICommon.FadedMouseOut;
            //button3.OnClick += VisitRegisterWebpage;
            //uIElement.Append(button3);

            steamIDTextField = new UIInputTextField(Language.GetTextValue("tModLoader.PasteSteamID"))
            {
                HAlign = 0.5f,
                VAlign = 0.5f
            };
            steamIDTextField.Left.Set(-100, 0);
            steamIDTextField.OnTextChange += new UIInputTextField.EventHandler(OnTextChange);
            uIPanel.Append(steamIDTextField);

            base.Append(uIElement);
        }
Exemple #5
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);
        }
Exemple #6
0
		public override void OnInitialize()
		{
			UIElement uIElement = new UIElement();
			uIElement.Width.Set(0f, 0.8f);
			uIElement.MaxWidth.Set(600f, 0f);
			uIElement.Top.Set(220f, 0f);
			uIElement.Height.Set(-220f, 1f);
			uIElement.HAlign = 0.5f;
			UIPanel uIPanel = new UIPanel();
			uIPanel.Width.Set(0f, 1f);
			uIPanel.Height.Set(-110f, 1f);
			uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
			uIElement.Append(uIPanel);
			modListAll = new UIList();
			modList = new UIList();
			modList.Width.Set(-25f, 1f);
			modList.Height.Set(0f, 1f);
			modList.ListPadding = 5f;
			uIPanel.Append(modList);
			UIScrollbar uIScrollbar = new UIScrollbar();
			uIScrollbar.SetView(100f, 1000f);
			uIScrollbar.Height.Set(0f, 1f);
			uIScrollbar.HAlign = 1f;
			uIPanel.Append(uIScrollbar);
			modList.SetScrollbar(uIScrollbar);
			UITextPanel uITextPanel = new UITextPanel("Mods List", 0.8f, true);
			uITextPanel.HAlign = 0.5f;
			uITextPanel.Top.Set(-35f, 0f);
			uITextPanel.SetPadding(15f);
			uITextPanel.BackgroundColor = new Color(73, 94, 171);
			uIElement.Append(uITextPanel);
			UIColorTextPanel button = new UIColorTextPanel("Enable All", Color.Green, 1f, false);
			button.Width.Set(-10f, 1f / 3f);
			button.Height.Set(25f, 0f);
			button.VAlign = 1f;
			button.Top.Set(-65f, 0f);
			button.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button.OnClick += new UIElement.MouseEvent(this.EnableAll);
			uIElement.Append(button);
			UIColorTextPanel button2 = new UIColorTextPanel("Disable All", Color.Red, 1f, false);
			button2.CopyStyle(button);
			button2.HAlign = 0.5f;
			button2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button2.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button2.OnClick += new UIElement.MouseEvent(this.DisableAll);
			uIElement.Append(button2);
			UITextPanel button3 = new UITextPanel("Reload Mods", 1f, false);
			button3.CopyStyle(button);
			button3.HAlign = 1f;
			button3.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button3.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button3.OnClick += new UIElement.MouseEvent(ReloadMods);
			uIElement.Append(button3);
			UITextPanel button4 = new UITextPanel("Back", 1f, false);
			button4.CopyStyle(button);
			button4.Top.Set(-20f, 0f);
			button4.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button4.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button4.OnClick += new UIElement.MouseEvent(BackClick);
			uIElement.Append(button4);
			UITextPanel button5 = new UITextPanel("Open Mods Folder", 1f, false);
			button5.CopyStyle(button4);
			button5.HAlign = 0.5f;
			button5.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button5.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button5.OnClick += new UIElement.MouseEvent(OpenModsFolder);
			uIElement.Append(button5);
			UIPanel panel = new UIPanel();
			panel.Top.Set(-40f, 0f);
			panel.Left.Set(-200f, 1f);
			panel.Width.Set(200f, 0f);
			panel.Height.Set(40f, 0f);
			uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
			uIElement.Append(panel);
			filterTextBox = new UIInputTextField("Type to search");
			filterTextBox.Top.Set(-30f, 0f);
			filterTextBox.Left.Set(-180f, 1f);
			filterTextBox.OnTextChange += new UIInputTextField.EventHandler(FilterList);
			uIElement.Append(filterTextBox);
			UITextPanel modListButton = new UITextPanel("Mod Packs", 1f, false);
			modListButton.CopyStyle(button5);
			modListButton.HAlign = 1f;
			modListButton.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			modListButton.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			modListButton.OnClick += new UIElement.MouseEvent(GotoModPacksMenu);
			uIElement.Append(modListButton);
			base.Append(uIElement);
		}
		public override void OnInitialize()
		{
			UIElement uIElement = new UIElement();
			uIElement.Width.Set(0f, 0.8f);
			uIElement.MaxWidth.Set(600f, 0f);
			uIElement.Top.Set(220f, 0f);
			uIElement.Height.Set(-220f, 1f);
			uIElement.HAlign = 0.5f;
			UIPanel uIPanel = new UIPanel();
			uIPanel.Width.Set(0f, 1f);
			uIPanel.Height.Set(-110f, 1f);
			uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
			uIPanel.PaddingTop = 0f;
			uIElement.Append(uIPanel);
			modListAll = new UIList();
			modList = new UIList();
			modList.Width.Set(-25f, 1f);
			modList.Height.Set(-50f, 1f);
			modList.Top.Set(50f, 0f);
			modList.ListPadding = 5f;
			uIPanel.Append(modList);
			UIScrollbar uIScrollbar = new UIScrollbar();
			uIScrollbar.SetView(100f, 1000f);
			uIScrollbar.Height.Set(-50f, 1f);
			uIScrollbar.Top.Set(50f, 0f);
			uIScrollbar.HAlign = 1f;
			uIPanel.Append(uIScrollbar);
			modList.SetScrollbar(uIScrollbar);
			uITextPanel = new UITextPanel("Mod Browser", 0.8f, true);
			uITextPanel.HAlign = 0.5f;
			uITextPanel.Top.Set(-35f, 0f);
			uITextPanel.SetPadding(15f);
			uITextPanel.BackgroundColor = new Color(73, 94, 171);
			uIElement.Append(uITextPanel);
			UITextPanel button = new UITextPanel("Reload List", 1f, false);
			button.Width.Set(-10f, 0.5f);
			button.Height.Set(25f, 0f);
			button.VAlign = 1f;
			button.Top.Set(-65f, 0f);
			button.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button.OnClick += new UIElement.MouseEvent(ReloadList);
			uIElement.Append(button);
			UITextPanel button3 = new UITextPanel("Back", 1f, false);
			button3.Width.Set(-10f, 0.5f);
			button3.Height.Set(25f, 0f);
			button3.VAlign = 1f;
			button3.Top.Set(-20f, 0f);
			button3.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button3.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button3.OnClick += new UIElement.MouseEvent(BackClick);
			uIElement.Append(button3);
			base.Append(uIElement);
			UIElement uIElement2 = new UIElement();
			uIElement2.Width.Set(0f, 1f);
			uIElement2.Height.Set(32f, 0f);
			uIElement2.Top.Set(10f, 0f);
			Texture2D texture = Texture2D.FromStream(Main.instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.UIModBrowserIcons.png"));
			UICycleImage uIToggleImage;
			for (int j = 0; j < 2; j++)
			{
				if (j == 0)
				{
					uIToggleImage = new UICycleImage(texture, 5, 32, 32, 0, 0);
					uIToggleImage.setCurrentState((int)sortMode);
					uIToggleImage.OnClick += (a, b) => Interface.modBrowser.sortMode = sortMode.Next();
					uIToggleImage.OnClick += new UIElement.MouseEvent(this.SortList);
				}
				else
				{
					uIToggleImage = new UICycleImage(texture, 3, 32, 32, 34, 0);
					uIToggleImage.setCurrentState((int)updateFilterMode);
					uIToggleImage.OnClick += (a, b) => Interface.modBrowser.updateFilterMode = updateFilterMode.Next();
					uIToggleImage.OnClick += new UIElement.MouseEvent(this.SortList);
				}
				uIToggleImage.Left.Set((float)(j * 36 + 8), 0f);
				_categoryButtons.Add(uIToggleImage);
				uIElement2.Append(uIToggleImage);
			}
			filterTextBox = new UIInputTextField("Type to search");
			filterTextBox.Top.Set(5, 0f);
			filterTextBox.Left.Set(-150, 1f);
			filterTextBox.OnTextChange += new UIInputTextField.EventHandler(SortList);
			uIElement2.Append(filterTextBox);
			UICycleImage SearchFilterToggle = new UICycleImage(texture, 2, 32, 32, 68, 0);
			SearchFilterToggle.setCurrentState((int)searchFilterMode);
			SearchFilterToggle.OnClick += (a, b) => Interface.modBrowser.searchFilterMode = searchFilterMode.Next();
			SearchFilterToggle.OnClick += new UIElement.MouseEvent(this.SortList);
			SearchFilterToggle.Left.Set(545f, 0f);
			_categoryButtons.Add(SearchFilterToggle);
			uIElement2.Append(SearchFilterToggle);
			uIPanel.Append(uIElement2);
		}
        public override void OnInitialize()
        {
            uIElement = new UIElement();
            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;

            uIPanel = new UIPanel();
            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIPanel.PaddingTop      = 0f;
            uIElement.Append(uIPanel);

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

            modList = new UIList();
            modList.Width.Set(-25f, 1f);
            modList.Height.Set(-50f, 1f);
            modList.Top.Set(50f, 0f);
            modList.ListPadding = 5f;
            uIPanel.Append(modList);

            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(-50f, 1f);
            uIScrollbar.Top.Set(50f, 0f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);

            modList.SetScrollbar(uIScrollbar);
            uIHeaderTextPanel        = new UITextPanel <string>(Language.GetTextValue("tModLoader.MenuModBrowser"), 0.8f, true);
            uIHeaderTextPanel.HAlign = 0.5f;
            uIHeaderTextPanel.Top.Set(-35f, 0f);
            uIHeaderTextPanel.SetPadding(15f);
            uIHeaderTextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uIHeaderTextPanel);

            reloadButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.MBGettingData"), 1f, false);
            reloadButton.Width.Set(-10f, 0.5f);
            reloadButton.Height.Set(25f, 0f);
            reloadButton.VAlign = 1f;
            reloadButton.Top.Set(-65f, 0f);
            reloadButton.OnMouseOver += UICommon.FadedMouseOver;
            reloadButton.OnMouseOut  += UICommon.FadedMouseOut;
            reloadButton.OnClick     += ReloadList;
            uIElement.Append(reloadButton);

            UITextPanel <string> backButton = new UITextPanel <string>(Language.GetTextValue("UI.Back"), 1f, false);

            backButton.Width.Set(-10f, 0.5f);
            backButton.Height.Set(25f, 0f);
            backButton.VAlign = 1f;
            backButton.Top.Set(-20f, 0f);
            backButton.OnMouseOver += UICommon.FadedMouseOver;
            backButton.OnMouseOut  += UICommon.FadedMouseOut;
            backButton.OnClick     += BackClick;
            uIElement.Append(backButton);

            clearButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.MBClearSpecialFilter", "??"), 1f, false);
            clearButton.Width.Set(-10f, 0.5f);
            clearButton.Height.Set(25f, 0f);
            clearButton.HAlign = 1f;
            clearButton.VAlign = 1f;
            clearButton.Top.Set(-65f, 0f);
            clearButton.BackgroundColor = Color.Purple * 0.7f;
            clearButton.OnMouseOver    += (s, e) => UICommon.CustomFadedMouseOver(Color.Purple, s, e);
            clearButton.OnMouseOut     += (s, e) => UICommon.CustomFadedMouseOut(Color.Purple * 0.7f, s, e);
            clearButton.OnClick        += (s, e) =>
            {
                Interface.modBrowser.SpecialModPackFilter      = null;
                Interface.modBrowser.SpecialModPackFilterTitle = null;
                Interface.modBrowser.updateNeeded = true;
                Main.PlaySound(SoundID.MenuTick);
            };

            downloadAllButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.MBDownloadAll"), 1f, false);
            downloadAllButton.Width.Set(-10f, 0.5f);
            downloadAllButton.Height.Set(25f, 0f);
            downloadAllButton.HAlign = 1f;
            downloadAllButton.VAlign = 1f;
            downloadAllButton.Top.Set(-20f, 0f);
            downloadAllButton.BackgroundColor = Color.Azure * 0.7f;
            downloadAllButton.OnMouseOver    += (s, e) => UICommon.CustomFadedMouseOver(Color.Azure, s, e);
            downloadAllButton.OnMouseOut     += (s, e) => UICommon.CustomFadedMouseOut(Color.Azure * 0.7f, s, e);
            downloadAllButton.OnClick        += (s, e) => DownloadMods(SpecialModPackFilter, SpecialModPackFilterTitle);

            updateAllButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.MBUpdateAll"), 1f, false);
            updateAllButton.Width.Set(-10f, 0.5f);
            updateAllButton.Height.Set(25f, 0f);
            updateAllButton.HAlign = 1f;
            updateAllButton.VAlign = 1f;
            updateAllButton.Top.Set(-20f, 0f);
            updateAllButton.BackgroundColor = Color.Orange * 0.7f;
            updateAllButton.OnMouseOver    += UICommon.FadedMouseOver;
            updateAllButton.OnMouseOut     += UICommon.FadedMouseOut;
            updateAllButton.OnClick        += (s, e) =>
            {
                if (!loading)
                {
                    var updatableMods = items.Where(x => x.update && !x.updateIsDowngrade).Select(x => x.mod).ToList();
                    DownloadMods(updatableMods, Language.GetTextValue("tModLoader.MBUpdateAll"));
                }
            };

            Append(uIElement);

            UIElement upperMenuContainer = new UIElement();

            upperMenuContainer.Width.Set(0f, 1f);
            upperMenuContainer.Height.Set(32f, 0f);
            upperMenuContainer.Top.Set(10f, 0f);
            Texture2D texture = Texture2D.FromStream(Main.instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.UIModBrowserIcons.png"));

            SortModeFilterToggle = new UICycleImage(texture, 6, 32, 32, 0, 0);
            SortModeFilterToggle.setCurrentState((int)sortMode);
            SortModeFilterToggle.OnClick += (a, b) =>
            {
                sortMode     = sortMode.NextEnum();
                updateNeeded = true;
            };
            SortModeFilterToggle.OnRightClick += (a, b) =>
            {
                sortMode     = sortMode.PreviousEnum();
                updateNeeded = true;
            };
            SortModeFilterToggle.Left.Set((float)(0 * 36 + 8), 0f);
            _categoryButtons.Add(SortModeFilterToggle);
            upperMenuContainer.Append(SortModeFilterToggle);

            UpdateFilterToggle = new UICycleImage(texture, 3, 32, 32, 34, 0);
            UpdateFilterToggle.setCurrentState((int)updateFilterMode);
            UpdateFilterToggle.OnClick += (a, b) =>
            {
                updateFilterMode = updateFilterMode.NextEnum();
                updateNeeded     = true;
            };
            UpdateFilterToggle.OnRightClick += (a, b) =>
            {
                updateFilterMode = updateFilterMode.PreviousEnum();
                updateNeeded     = true;
            };
            UpdateFilterToggle.Left.Set((float)(1 * 36 + 8), 0f);
            _categoryButtons.Add(UpdateFilterToggle);
            upperMenuContainer.Append(UpdateFilterToggle);

            ModSideFilterToggle = new UICycleImage(texture, 5, 32, 32, 34 * 5, 0);
            ModSideFilterToggle.setCurrentState((int)modSideFilterMode);
            ModSideFilterToggle.OnClick += (a, b) =>
            {
                modSideFilterMode = modSideFilterMode.NextEnum();
                updateNeeded      = true;
            };
            ModSideFilterToggle.OnRightClick += (a, b) =>
            {
                modSideFilterMode = modSideFilterMode.PreviousEnum();
                updateNeeded      = true;
            };
            ModSideFilterToggle.Left.Set((float)(2 * 36 + 8), 0f);
            _categoryButtons.Add(ModSideFilterToggle);
            upperMenuContainer.Append(ModSideFilterToggle);

            UIPanel filterTextBoxBackground = new UIPanel();

            filterTextBoxBackground.Top.Set(0f, 0f);
            filterTextBoxBackground.Left.Set(-170, 1f);
            filterTextBoxBackground.Width.Set(135f, 0f);
            filterTextBoxBackground.Height.Set(40f, 0f);
            filterTextBoxBackground.OnRightClick += (a, b) => filterTextBox.SetText("");
            upperMenuContainer.Append(filterTextBoxBackground);

            filterTextBox = new UIInputTextField(Language.GetTextValue("tModLoader.ModsTypeToSearch"));
            filterTextBox.Top.Set(5, 0f);
            filterTextBox.Left.Set(-160, 1f);
            filterTextBox.Width.Set(100f, 0f);
            filterTextBox.Height.Set(10f, 0f);
            filterTextBox.OnTextChange += (sender, e) => updateNeeded = true;
            upperMenuContainer.Append(filterTextBox);

            SearchFilterToggle = new UICycleImage(texture, 2, 32, 32, 34 * 2, 0);
            SearchFilterToggle.setCurrentState((int)searchFilterMode);
            SearchFilterToggle.OnClick += (a, b) =>
            {
                searchFilterMode = searchFilterMode.NextEnum();
                updateNeeded     = true;
            };
            SearchFilterToggle.OnRightClick += (a, b) =>
            {
                searchFilterMode = searchFilterMode.PreviousEnum();
                updateNeeded     = true;
            };
            SearchFilterToggle.Left.Set(545f, 0f);
            _categoryButtons.Add(SearchFilterToggle);
            upperMenuContainer.Append(SearchFilterToggle);
            uIPanel.Append(upperMenuContainer);
        }
        public override void OnInitialize()
        {
            uIElement = new UIElement();
            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;

            uIPanel = new UIPanel();
            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIPanel.PaddingTop      = 0f;
            uIElement.Append(uIPanel);

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

            modList = new UIList();
            modList.Width.Set(-25f, 1f);
            modList.Height.Set(-50f, 1f);
            modList.Top.Set(50f, 0f);
            modList.ListPadding = 5f;
            uIPanel.Append(modList);

            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(-50f, 1f);
            uIScrollbar.Top.Set(50f, 0f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);

            modList.SetScrollbar(uIScrollbar);
            uIHeaderTextPanel        = new UITextPanel <string>("Mod Browser", 0.8f, true);
            uIHeaderTextPanel.HAlign = 0.5f;
            uIHeaderTextPanel.Top.Set(-35f, 0f);
            uIHeaderTextPanel.SetPadding(15f);
            uIHeaderTextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uIHeaderTextPanel);

            reloadButton = new UITextPanel <string>("Getting data...", 1f, false);
            reloadButton.Width.Set(-10f, 0.5f);
            reloadButton.Height.Set(25f, 0f);
            reloadButton.VAlign = 1f;
            reloadButton.Top.Set(-65f, 0f);
            reloadButton.OnMouseOver += UICommon.FadedMouseOver;
            reloadButton.OnMouseOut  += UICommon.FadedMouseOut;
            reloadButton.OnClick     += ReloadList;
            uIElement.Append(reloadButton);

            UITextPanel <string> backButton = new UITextPanel <string>("Back", 1f, false);

            backButton.Width.Set(-10f, 0.5f);
            backButton.Height.Set(25f, 0f);
            backButton.VAlign = 1f;
            backButton.Top.Set(-20f, 0f);
            backButton.OnMouseOver += UICommon.FadedMouseOver;
            backButton.OnMouseOut  += UICommon.FadedMouseOut;
            backButton.OnClick     += BackClick;
            uIElement.Append(backButton);

            clearButton = new UITextPanel <string>("Clear Special Filter: ??", 1f, false);
            clearButton.Width.Set(-10f, 0.5f);
            clearButton.Height.Set(25f, 0f);
            clearButton.HAlign = 1f;
            clearButton.VAlign = 1f;
            clearButton.Top.Set(-65f, 0f);
            clearButton.BackgroundColor = Color.Purple * 0.7f;
            clearButton.OnMouseOver    += (s, e) => UICommon.CustomFadedMouseOver(Color.Purple, s, e);
            clearButton.OnMouseOut     += (s, e) => UICommon.CustomFadedMouseOut(Color.Purple * 0.7f, s, e);
            clearButton.OnClick        += (s, e) =>
            {
                Interface.modBrowser.SpecialModPackFilter      = null;
                Interface.modBrowser.SpecialModPackFilterTitle = null;
                Interface.modBrowser.updateNeeded = true;
                Main.PlaySound(SoundID.MenuTick);
            };

            Append(uIElement);

            UIElement upperMenuContainer = new UIElement();

            upperMenuContainer.Width.Set(0f, 1f);
            upperMenuContainer.Height.Set(32f, 0f);
            upperMenuContainer.Top.Set(10f, 0f);
            Texture2D texture = Texture2D.FromStream(Main.instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.UIModBrowserIcons.png"));

            for (int j = 0; j < 2; j++)
            {
                if (j == 0)
                {
                    uIToggleImage = new UICycleImage(texture, 6, 32, 32, 0, 0);
                    uIToggleImage.setCurrentState((int)sortMode);
                    uIToggleImage.OnClick += (a, b) =>
                    {
                        sortMode     = sortMode.NextEnum();
                        updateNeeded = true;
                    };
                    uIToggleImage.OnRightClick += (a, b) =>
                    {
                        sortMode     = sortMode.PreviousEnum();
                        updateNeeded = true;
                    };
                }
                else
                {
                    uIToggleImage = new UICycleImage(texture, 3, 32, 32, 34, 0);
                    uIToggleImage.setCurrentState((int)updateFilterMode);
                    uIToggleImage.OnClick += (a, b) =>
                    {
                        updateFilterMode = updateFilterMode.NextEnum();
                        updateNeeded     = true;
                    };
                    uIToggleImage.OnRightClick += (a, b) =>
                    {
                        updateFilterMode = updateFilterMode.PreviousEnum();
                        updateNeeded     = true;
                    };
                }
                uIToggleImage.Left.Set((float)(j * 36 + 8), 0f);
                _categoryButtons.Add(uIToggleImage);
                upperMenuContainer.Append(uIToggleImage);
            }
            UIPanel filterTextBoxBackground = new UIPanel();

            filterTextBoxBackground.Top.Set(0f, 0f);
            filterTextBoxBackground.Left.Set(-170, 1f);
            filterTextBoxBackground.Width.Set(135f, 0f);
            filterTextBoxBackground.Height.Set(40f, 0f);
            upperMenuContainer.Append(filterTextBoxBackground);

            filterTextBox = new UIInputTextField("Type to search");
            filterTextBox.Top.Set(5, 0f);
            filterTextBox.Left.Set(-160, 1f);
            filterTextBox.OnTextChange += (sender, e) => updateNeeded = true;
            upperMenuContainer.Append(filterTextBox);

            SearchFilterToggle = new UICycleImage(texture, 2, 32, 32, 68, 0);
            SearchFilterToggle.setCurrentState((int)searchFilterMode);
            SearchFilterToggle.OnClick += (a, b) =>
            {
                searchFilterMode = searchFilterMode.NextEnum();
                updateNeeded     = true;
            };
            SearchFilterToggle.OnRightClick += (a, b) =>
            {
                searchFilterMode = searchFilterMode.PreviousEnum();
                updateNeeded     = true;
            };
            SearchFilterToggle.Left.Set(545f, 0f);
            _categoryButtons.Add(SearchFilterToggle);
            upperMenuContainer.Append(SearchFilterToggle);
            uIPanel.Append(upperMenuContainer);
        }
Exemple #10
0
        public override void OnInitialize()
        {
            uIElement = new UIElement();
            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;

            uIPanel = new UIPanel();
            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIPanel.PaddingTop      = 0f;
            uIElement.Append(uIPanel);

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

            modListAll = new List <UIModItem>();
            modList    = new UIList();
            modList.Width.Set(-25f, 1f);
            modList.Height.Set(-50f, 1f);
            modList.Top.Set(50f, 0f);
            modList.ListPadding = 5f;
            uIPanel.Append(modList);

            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(-50f, 1f);
            uIScrollbar.Top.Set(50f, 0f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);

            modList.SetScrollbar(uIScrollbar);

            UITextPanel <string> uIHeaderTexTPanel = new UITextPanel <string>("Mods List", 0.8f, true);

            uIHeaderTexTPanel.HAlign = 0.5f;
            uIHeaderTexTPanel.Top.Set(-35f, 0f);
            uIHeaderTexTPanel.SetPadding(15f);
            uIHeaderTexTPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uIHeaderTexTPanel);
            buttonEA = new UIColorTextPanel("Enable All", Color.Green, 1f, false);
            buttonEA.Width.Set(-10f, 1f / 3f);
            buttonEA.Height.Set(25f, 0f);
            buttonEA.VAlign = 1f;
            buttonEA.Top.Set(-65f, 0f);
            buttonEA.OnMouseOver += UICommon.FadedMouseOver;
            buttonEA.OnMouseOut  += UICommon.FadedMouseOut;
            buttonEA.OnClick     += this.EnableAll;
            uIElement.Append(buttonEA);
            buttonDA = new UIColorTextPanel("Disable All", Color.Red, 1f, false);
            buttonDA.CopyStyle(buttonEA);
            buttonDA.HAlign       = 0.5f;
            buttonDA.OnMouseOver += UICommon.FadedMouseOver;
            buttonDA.OnMouseOut  += UICommon.FadedMouseOut;
            buttonDA.OnClick     += this.DisableAll;
            uIElement.Append(buttonDA);
            buttonRM = new UITextPanel <string>("Reload Mods", 1f, false);
            buttonRM.CopyStyle(buttonEA);
            buttonRM.HAlign       = 1f;
            buttonRM.OnMouseOver += UICommon.FadedMouseOver;
            buttonRM.OnMouseOut  += UICommon.FadedMouseOut;
            buttonRM.OnClick     += ReloadMods;
            uIElement.Append(buttonRM);
            buttonB = new UITextPanel <string>("Back", 1f, false);
            buttonB.CopyStyle(buttonEA);
            buttonB.Top.Set(-20f, 0f);
            buttonB.OnMouseOver += UICommon.FadedMouseOver;
            buttonB.OnMouseOut  += UICommon.FadedMouseOut;
            buttonB.OnClick     += BackClick;
            uIElement.Append(buttonB);
            buttonOMF = new UITextPanel <string>("Open Mods Folder", 1f, false);
            buttonOMF.CopyStyle(buttonB);
            buttonOMF.HAlign       = 0.5f;
            buttonOMF.OnMouseOver += UICommon.FadedMouseOver;
            buttonOMF.OnMouseOut  += UICommon.FadedMouseOut;
            buttonOMF.OnClick     += OpenModsFolder;
            uIElement.Append(buttonOMF);

            Texture2D texture            = Texture2D.FromStream(Main.instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.UIModBrowserIcons.png"));
            UIElement upperMenuContainer = new UIElement();

            upperMenuContainer.Width.Set(0f, 1f);
            upperMenuContainer.Height.Set(32f, 0f);
            upperMenuContainer.Top.Set(10f, 0f);

            UICycleImage toggleImage;

            for (int j = 0; j < 2; j++)
            {
                if (j == 0)
                {
                    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
                {
                    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;
                    };
                }
                toggleImage.Left.Set((float)(j * 36 + 8), 0f);
                _categoryButtons.Add(toggleImage);
                upperMenuContainer.Append(toggleImage);
            }

            UIPanel filterTextBoxBackground = new UIPanel();

            filterTextBoxBackground.Top.Set(0f, 0f);
            filterTextBoxBackground.Left.Set(-170f, 1f);
            filterTextBoxBackground.Width.Set(135f, 0f);
            filterTextBoxBackground.Height.Set(40f, 0f);
            upperMenuContainer.Append(filterTextBoxBackground);

            filterTextBox = new UIInputTextField("Type to search");
            filterTextBox.Top.Set(5f, 0f);
            filterTextBox.Left.Set(-160f, 1f);
            filterTextBox.OnTextChange += (a, b) => { updateNeeded = true; };
            upperMenuContainer.Append(filterTextBox);

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

            buttonMP = new UITextPanel <string>("Mod Packs", 1f, false);
            buttonMP.CopyStyle(buttonOMF);
            buttonMP.HAlign       = 1f;
            buttonMP.OnMouseOver += UICommon.FadedMouseOver;
            buttonMP.OnMouseOut  += UICommon.FadedMouseOut;
            buttonMP.OnClick     += GotoModPacksMenu;
            uIElement.Append(buttonMP);

            uIPanel.Append(upperMenuContainer);
            Append(uIElement);
        }
Exemple #11
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
            };

            var uIPanel = new UIPanel {
                Width           = { Percent = 1f },
                Height          = { Pixels = -110, Percent = 1f },
                BackgroundColor = UICommon.MainPanelBackground,
                PaddingTop      = 0f
            };

            uIElement.Append(uIPanel);

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

            var buttonBack = new UITextPanel <string>(Language.GetTextValue("UI.Back"))
            {
                Width  = { Pixels = -10, Percent = 0.5f },
                Height = { Pixels = 25 },
                VAlign = 1f,
                Top    = { Pixels = -65 }
            }.WithFadedMouseOver();

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

            var buttonSubmit = new UITextPanel <string>(Language.GetTextValue("UI.Submit"));

            buttonSubmit.CopyStyle(buttonBack);
            buttonSubmit.HAlign = 1f;
            buttonSubmit.WithFadedMouseOver();
            buttonSubmit.OnClick += SubmitPassphrase;
            uIElement.Append(buttonSubmit);

            var buttonVisitWebsite = new UITextPanel <string>(Language.GetTextValue("tModLoader.MBPublishVisitWebsiteForPassphrase"));

            buttonVisitWebsite.CopyStyle(buttonBack);
            buttonVisitWebsite.Width.Percent = 1f;
            buttonVisitWebsite.Top.Pixels    = -20;
            buttonVisitWebsite.WithFadedMouseOver();
            buttonVisitWebsite.OnClick += VisitRegisterWebpage;
            uIElement.Append(buttonVisitWebsite);

            PasscodeTextField = new UIInputTextField(Language.GetTextValue("tModLoader.MBPublishPastePassphrase"))
            {
                HAlign = 0.5f,
                VAlign = 0.5f,
                Left   = { Pixels = -100, Percent = 0 }
            };
            PasscodeTextField.OnTextChange += OnTextChange;
            uIPanel.Append(PasscodeTextField);

            Append(uIElement);
        }
Exemple #12
0
        public override void OnInitialize()
        {
            uIElement = new UIElement();
            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;

            uIPanel = new UIPanel();
            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIElement.Append(uIPanel);

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

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

            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(0f, 1f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);

            modList.SetScrollbar(uIScrollbar);

            UITextPanel <string> uIHeaderTexTPanel = new UITextPanel <string>("Mods List", 0.8f, true);

            uIHeaderTexTPanel.HAlign = 0.5f;
            uIHeaderTexTPanel.Top.Set(-35f, 0f);
            uIHeaderTexTPanel.SetPadding(15f);
            uIHeaderTexTPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uIHeaderTexTPanel);
            buttonEA = new UIColorTextPanel("Enable All", Color.Green, 1f, false);
            buttonEA.Width.Set(-10f, 1f / 3f);
            buttonEA.Height.Set(25f, 0f);
            buttonEA.VAlign = 1f;
            buttonEA.Top.Set(-65f, 0f);
            buttonEA.OnMouseOver += UICommon.FadedMouseOver;
            buttonEA.OnMouseOut  += UICommon.FadedMouseOut;
            buttonEA.OnClick     += this.EnableAll;
            uIElement.Append(buttonEA);
            buttonDA = new UIColorTextPanel("Disable All", Color.Red, 1f, false);
            buttonDA.CopyStyle(buttonEA);
            buttonDA.HAlign       = 0.5f;
            buttonDA.OnMouseOver += UICommon.FadedMouseOver;
            buttonDA.OnMouseOut  += UICommon.FadedMouseOut;
            buttonDA.OnClick     += this.DisableAll;
            uIElement.Append(buttonDA);
            buttonRM = new UITextPanel <string>("Reload Mods", 1f, false);
            buttonRM.CopyStyle(buttonEA);
            buttonRM.HAlign       = 1f;
            buttonRM.OnMouseOver += UICommon.FadedMouseOver;
            buttonRM.OnMouseOut  += UICommon.FadedMouseOut;
            buttonRM.OnClick     += ReloadMods;
            uIElement.Append(buttonRM);
            buttonB = new UITextPanel <string>("Back", 1f, false);
            buttonB.CopyStyle(buttonEA);
            buttonB.Top.Set(-20f, 0f);
            buttonB.OnMouseOver += UICommon.FadedMouseOver;
            buttonB.OnMouseOut  += UICommon.FadedMouseOut;
            buttonB.OnClick     += BackClick;
            uIElement.Append(buttonB);
            buttonOMF = new UITextPanel <string>("Open Mods Folder", 1f, false);
            buttonOMF.CopyStyle(buttonB);
            buttonOMF.HAlign       = 0.5f;
            buttonOMF.OnMouseOver += UICommon.FadedMouseOver;
            buttonOMF.OnMouseOut  += UICommon.FadedMouseOut;
            buttonOMF.OnClick     += OpenModsFolder;
            uIElement.Append(buttonOMF);
            UIPanel panel = new UIPanel();

            panel.Top.Set(-40f, 0f);
            panel.Left.Set(-200f, 1f);
            panel.Width.Set(200f, 0f);
            panel.Height.Set(40f, 0f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIElement.Append(panel);
            filterTextBox = new UIInputTextField("Type to search");
            filterTextBox.Top.Set(-30f, 0f);
            filterTextBox.Left.Set(-180f, 1f);
            filterTextBox.OnTextChange += new UIInputTextField.EventHandler(FilterList);
            uIElement.Append(filterTextBox);
            buttonMP = new UITextPanel <string>("Mod Packs", 1f, false);
            buttonMP.CopyStyle(buttonOMF);
            buttonMP.HAlign       = 1f;
            buttonMP.OnMouseOver += UICommon.FadedMouseOver;
            buttonMP.OnMouseOut  += UICommon.FadedMouseOut;
            buttonMP.OnClick     += GotoModPacksMenu;
            uIElement.Append(buttonMP);
            Append(uIElement);
        }
Exemple #13
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
            };

            var uIPanel = new UIPanel {
                Width           = { Percent = 1f },
                Height          = { Pixels = -110, Percent = 1f },
                BackgroundColor = UICommon.MainPanelBackground,
                PaddingTop      = 0f
            };

            uIElement.Append(uIPanel);

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

            var button = new UITextPanel <string>(Language.GetTextValue("UI.Back"))
            {
                Width  = { Pixels = -10, Percent = 0.5f },
                Height = { Pixels = 25 },
                VAlign = 1f,
                Top    = { Pixels = -65 }
            };

            button.WithFadedMouseOver();
            button.OnClick += BackClick;
            uIElement.Append(button);

            button = new UITextPanel <string>(Language.GetTextValue("UI.Submit"));
            button.CopyStyle(button);
            button.HAlign = 1f;
            button.WithFadedMouseOver();
            button.OnClick += SubmitSteamID;
            uIElement.Append(button);

            // TODO Commented code, yuck
            //UITextPanel<string> button3 = new UITextPanel<string>("Visit Website to Generate Passphrase");
            //button3.CopyStyle(button);
            //button3.Width.Set(0f, 1f);
            //button3.Top.Set(-20f, 0f);
            //button3.OnMouseOver += UICommon.FadedMouseOver;
            //button3.OnMouseOut += UICommon.FadedMouseOut;
            //button3.OnClick += VisitRegisterWebpage;
            //uIElement.Append(button3);

            SteamIdTextField = new UIInputTextField(Language.GetTextValue("tModLoader.PasteSteamID"))
            {
                HAlign = 0.5f,
                VAlign = 0.5f,
                Left   = { Pixels = -100, Percent = 0 }
            };
            SteamIdTextField.OnTextChange += OnTextChange;
            uIPanel.Append(SteamIdTextField);

            Append(uIElement);
        }
Exemple #14
0
        public override void OnInitialize()
        {
            UIElement uIElement = new UIElement();

            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;
            UIPanel uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIElement.Append(uIPanel);
            modListAll = new UIList();
            modList    = new UIList();
            modList.Width.Set(-25f, 1f);
            modList.Height.Set(0f, 1f);
            modList.ListPadding = 5f;
            uIPanel.Append(modList);
            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(0f, 1f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);
            modList.SetScrollbar(uIScrollbar);
            UITextPanel <string> uITextPanel = new UITextPanel <string>("Mods List", 0.8f, true);

            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);
            UIColorTextPanel button = new UIColorTextPanel("Enable All", Color.Green, 1f, false);

            button.Width.Set(-10f, 1f / 3f);
            button.Height.Set(25f, 0f);
            button.VAlign = 1f;
            button.Top.Set(-65f, 0f);
            button.OnMouseOver += UICommon.FadedMouseOver;
            button.OnMouseOut  += UICommon.FadedMouseOut;
            button.OnClick     += this.EnableAll;
            uIElement.Append(button);
            UIColorTextPanel button2 = new UIColorTextPanel("Disable All", Color.Red, 1f, false);

            button2.CopyStyle(button);
            button2.HAlign       = 0.5f;
            button2.OnMouseOver += UICommon.FadedMouseOver;
            button2.OnMouseOut  += UICommon.FadedMouseOut;
            button2.OnClick     += this.DisableAll;
            uIElement.Append(button2);
            UITextPanel <string> button3 = new UITextPanel <string>("Reload Mods", 1f, false);

            button3.CopyStyle(button);
            button3.HAlign       = 1f;
            button3.OnMouseOver += UICommon.FadedMouseOver;
            button3.OnMouseOut  += UICommon.FadedMouseOut;
            button3.OnClick     += ReloadMods;
            uIElement.Append(button3);
            UITextPanel <string> button4 = new UITextPanel <string>("Back", 1f, false);

            button4.CopyStyle(button);
            button4.Top.Set(-20f, 0f);
            button4.OnMouseOver += UICommon.FadedMouseOver;
            button4.OnMouseOut  += UICommon.FadedMouseOut;
            button4.OnClick     += BackClick;
            uIElement.Append(button4);
            UITextPanel <string> button5 = new UITextPanel <string>("Open Mods Folder", 1f, false);

            button5.CopyStyle(button4);
            button5.HAlign       = 0.5f;
            button5.OnMouseOver += UICommon.FadedMouseOver;
            button5.OnMouseOut  += UICommon.FadedMouseOut;
            button5.OnClick     += OpenModsFolder;
            uIElement.Append(button5);
            UIPanel panel = new UIPanel();

            panel.Top.Set(-40f, 0f);
            panel.Left.Set(-200f, 1f);
            panel.Width.Set(200f, 0f);
            panel.Height.Set(40f, 0f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIElement.Append(panel);
            filterTextBox = new UIInputTextField("Type to search");
            filterTextBox.Top.Set(-30f, 0f);
            filterTextBox.Left.Set(-180f, 1f);
            filterTextBox.OnTextChange += new UIInputTextField.EventHandler(FilterList);
            uIElement.Append(filterTextBox);
            UITextPanel <string> modListButton = new UITextPanel <string>("Mod Packs", 1f, false);

            modListButton.CopyStyle(button5);
            modListButton.HAlign       = 1f;
            modListButton.OnMouseOver += UICommon.FadedMouseOver;
            modListButton.OnMouseOut  += UICommon.FadedMouseOut;
            modListButton.OnClick     += GotoModPacksMenu;
            uIElement.Append(modListButton);
            base.Append(uIElement);
        }
        public override void OnInitialize()
        {
            UIElement uIElement = new UIElement();

            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;

            UIPanel uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIPanel.PaddingTop      = 0f;
            uIElement.Append(uIPanel);

            uITextPanel        = new UITextPanel <string>("Please Enter Your Passcode", 0.8f, true);
            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);

            UITextPanel <string> button = new UITextPanel <string>("Back", 1f, false);

            button.Width.Set(-10f, 0.5f);
            button.Height.Set(25f, 0f);
            button.VAlign = 1f;
            button.Top.Set(-65f, 0f);
            button.OnMouseOver += UICommon.FadedMouseOver;
            button.OnMouseOut  += UICommon.FadedMouseOut;
            button.OnClick     += BackClick;
            uIElement.Append(button);

            UITextPanel <string> button2 = new UITextPanel <string>("Submit", 1f, false);

            button2.CopyStyle(button);
            button2.HAlign       = 1f;
            button2.OnMouseOver += UICommon.FadedMouseOver;
            button2.OnMouseOut  += UICommon.FadedMouseOut;
            button2.OnClick     += OKClick;
            uIElement.Append(button2);

            UITextPanel <string> button3 = new UITextPanel <string>("Visit Website to Generate Passphrase", 1f, false);

            button3.CopyStyle(button);
            button3.Width.Set(0f, 1f);
            button3.Top.Set(-20f, 0f);
            button3.OnMouseOver += UICommon.FadedMouseOver;
            button3.OnMouseOut  += UICommon.FadedMouseOut;
            button3.OnClick     += VisitRegisterWebpage;
            uIElement.Append(button3);

            passcodeTextField        = new UIInputTextField("Paste Passphrase (ctrl-v)");
            passcodeTextField.HAlign = 0.5f;
            passcodeTextField.VAlign = 0.5f;
            passcodeTextField.Left.Set(-100, 0);
            passcodeTextField.OnTextChange += new UIInputTextField.EventHandler(OnTextChange);
            uIPanel.Append(passcodeTextField);

            base.Append(uIElement);
        }
        public override void OnInitialize()
        {
            UIElement uIElement = new UIElement();

            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;
            UIPanel uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIPanel.PaddingTop      = 0f;
            uIElement.Append(uIPanel);
            modListAll = new UIList();
            modList    = new UIList();
            modList.Width.Set(-25f, 1f);
            modList.Height.Set(-50f, 1f);
            modList.Top.Set(50f, 0f);
            modList.ListPadding = 5f;
            uIPanel.Append(modList);
            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(-50f, 1f);
            uIScrollbar.Top.Set(50f, 0f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);
            modList.SetScrollbar(uIScrollbar);
            uITextPanel        = new UITextPanel("Mod Browser", 0.8f, true);
            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);
            UITextPanel button = new UITextPanel("Reload List", 1f, false);

            button.Width.Set(-10f, 0.5f);
            button.Height.Set(25f, 0f);
            button.VAlign = 1f;
            button.Top.Set(-65f, 0f);
            button.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button.OnMouseOut  += new UIElement.MouseEvent(FadedMouseOut);
            button.OnClick     += new UIElement.MouseEvent(ReloadList);
            uIElement.Append(button);
            UITextPanel button3 = new UITextPanel("Back", 1f, false);

            button3.Width.Set(-10f, 0.5f);
            button3.Height.Set(25f, 0f);
            button3.VAlign = 1f;
            button3.Top.Set(-20f, 0f);
            button3.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button3.OnMouseOut  += new UIElement.MouseEvent(FadedMouseOut);
            button3.OnClick     += new UIElement.MouseEvent(BackClick);
            uIElement.Append(button3);
            base.Append(uIElement);
            UIElement uIElement2 = new UIElement();

            uIElement2.Width.Set(0f, 1f);
            uIElement2.Height.Set(32f, 0f);
            uIElement2.Top.Set(10f, 0f);
            Texture2D    texture = Texture2D.FromStream(Main.instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.UIModBrowserIcons.png"));
            UICycleImage uIToggleImage;

            for (int j = 0; j < 2; j++)
            {
                if (j == 0)
                {
                    uIToggleImage = new UICycleImage(texture, 5, 32, 32, 0, 0);
                    uIToggleImage.setCurrentState((int)sortMode);
                    uIToggleImage.OnClick += (a, b) => Interface.modBrowser.sortMode = sortMode.Next();
                    uIToggleImage.OnClick += new UIElement.MouseEvent(this.SortList);
                }
                else
                {
                    uIToggleImage = new UICycleImage(texture, 3, 32, 32, 34, 0);
                    uIToggleImage.setCurrentState((int)updateFilterMode);
                    uIToggleImage.OnClick += (a, b) => Interface.modBrowser.updateFilterMode = updateFilterMode.Next();
                    uIToggleImage.OnClick += new UIElement.MouseEvent(this.SortList);
                }
                uIToggleImage.Left.Set((float)(j * 36 + 8), 0f);
                _categoryButtons.Add(uIToggleImage);
                uIElement2.Append(uIToggleImage);
            }
            filterTextBox = new UIInputTextField("Filter by name");
            filterTextBox.Top.Set(5, 0f);
            filterTextBox.Left.Set(-150, 1f);
            filterTextBox.OnTextChange += new UIInputTextField.EventHandler(SortList);
            uIElement2.Append(filterTextBox);
            uIPanel.Append(uIElement2);
        }