Ejemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (watchedFileChanged)
            {
                if (watcherCooldown > 0)
                {
                    watcherCooldown--;
                }
                if (watcherCooldown == 0)
                {
                    Texture2D file;
                    using (Stream stream = File.OpenRead(path))
                    {
                        file = Texture2D.FromStream(Main.instance.GraphicsDevice, stream);
                    }
                    if (file.Width != selectedTexture2D.Width || file.Height != selectedTexture2D.Height)
                    {
                        Main.NewText("Width or height changed, aborting.");
                    }
                    else
                    {
                        Color[] c = new Color[file.Width * file.Height];
                        file.GetData <Color>(c, 0, c.Length);
                        selectedTexture2D.SetData <Color>(c);
                        Main.NewText("Texture updated from watch file.");
                    }
                    watchedFileChanged = false;
                }
            }

            if (watchedFileChangedSources)
            {
                if (watcherCooldownSources > 0)
                {
                    watcherCooldownSources--;
                }
                if (watcherCooldownSources == 0)
                {
                    watchedFileChangedSources = false;
                    string dir            = ModLoader.ModSourcePath + Path.DirectorySeparatorChar + selectedMod.Name + Path.DirectorySeparatorChar;
                    string innername      = watchedFileChangedSourcesFileName.Substring(dir.Length);
                    string innernamenoext = System.IO.Path.ChangeExtension(innername, null);
                    innernamenoext = innernamenoext.Replace("\\", "/");

                    FieldInfo texturesField = typeof(Mod).GetField("textures", BindingFlags.Instance | BindingFlags.NonPublic);
                    var       textures      = (Dictionary <string, Texture2D>)texturesField.GetValue(selectedMod);

                    if (!textures.ContainsKey(innernamenoext))
                    {
                        Main.NewText("Detected png change, but file not present at load: " + innername);
                        return;
                    }

                    Texture2D modTexture = textures[innernamenoext];

                    Texture2D file;
                    using (Stream stream = File.OpenRead(watchedFileChangedSourcesFileName))
                    {
                        file = Texture2D.FromStream(Main.instance.GraphicsDevice, stream);
                    }

                    if (file.Width != modTexture.Width || file.Height != modTexture.Height)
                    {
                        Main.NewText("Width or height changed, aborting.");
                    }
                    else
                    {
                        Color[] c = new Color[file.Width * file.Height];
                        file.GetData <Color>(c, 0, c.Length);
                        modTexture.SetData <Color>(c);
                        Main.NewText("Texture updated from watch mod sources folder.");
                    }
                }
            }

            if (!updateneeded)
            {
                return;
            }
            updateneeded = false;

            if (modList.Count == 0)
            {
                foreach (var otherMod in ModLoader.LoadedMods)
                {
                    UITextPanel <string> button = new UITextPanel <string>(otherMod.DisplayName);
                    button.OnClick += (a, b) =>
                    {
                        selectedMod               = otherMod;
                        updateneeded              = true;
                        watchModSources.Selected  = false;
                        watchModSources.Clickable = Directory.Exists(ModLoader.ModSourcePath + Path.DirectorySeparatorChar + otherMod.Name);
                        if (watchModSources.Clickable)
                        {
                            watchModSources.Selected = true;
                        }
                    };
                    modList.Add(button);
                }
            }

            if (selectedMod != null)
            {
                textureList.Clear();
                FieldInfo texturesField = typeof(Mod).GetField("textures", BindingFlags.Instance | BindingFlags.NonPublic);
                var       textures      = (Dictionary <string, Texture2D>)texturesField.GetValue(selectedMod);
                foreach (var textureEntry in textures)
                {
                    if (searchFilter.Text.Length > 0)
                    {
                        if (textureEntry.Key.ToLower().IndexOf(searchFilter.Text, StringComparison.OrdinalIgnoreCase) == -1)
                        {
                            continue;
                        }
                    }
                    UIImage image = new UIHoverImage(textureEntry.Value, textureEntry.Key);
                    //image.ImageScale = Math.Min(1f, 60f/textureEntry.Value.Height);
                    image.OnClick += (a, b) =>
                    {
                        selectedTexture2D = textureEntry.Value;
                        currentTexture.SetText("Current: " + textureEntry.Key);
                        SelectedTexture2DChanged();
                    };
                    textureList.Add(image);
                }
            }
        }
Ejemplo n.º 2
0
        public UIModDownloadItem(string displayName, string name, string version, string author, string modReferences, ModSide modSide, string modIconUrl, string downloadUrl, int downloads, int hot, string timeStamp, bool hasUpdate, bool updateIsDowngrade, LocalMod installed, string modloaderversion)
        {
            ModName     = name;
            DisplayName = displayName;
            DownloadUrl = downloadUrl;

            _author        = author;
            _modReferences = modReferences;
            _modSide       = modSide;
            _modIconUrl    = modIconUrl;
            if (UIModBrowser.AvoidImgur)
            {
                _modIconUrl = null;
            }
            _downloads        = downloads;
            _hot              = hot;
            _timeStamp        = timeStamp;
            HasUpdate         = hasUpdate;
            UpdateIsDowngrade = updateIsDowngrade;
            Installed         = installed;

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

            float leftOffset = HasModIcon ? ModIconAdjust : 0f;

            _modName = new UIText(displayName)
            {
                Left = new StyleDimension(leftOffset + PADDING, 0f),
                Top  = { Pixels = 5 }
            };
            Append(_modName);

            _moreInfoButton = new UIImage(UICommon.ButtonModInfoTexture)
            {
                Width  = { Pixels = 36 },
                Height = { Pixels = 36 },
                Left   = { Pixels = leftOffset },
                Top    = { Pixels = 40 }
            };
            _moreInfoButton.OnClick += ViewModInfo;
            Append(_moreInfoButton);

            if (modloaderversion != null)
            {
                tMLUpdateRequired = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MBRequiresTMLUpdate", modloaderversion)).WithFadedMouseOver(Color.Orange, Color.Orange * 0.7f);
                tMLUpdateRequired.BackgroundColor = Color.Orange * 0.7f;
                tMLUpdateRequired.CopyStyle(_moreInfoButton);
                tMLUpdateRequired.Width.Pixels = 340;
                tMLUpdateRequired.Left.Pixels += 36 + PADDING;
                tMLUpdateRequired.OnClick     += (a, b) => {
                    Process.Start("https://github.com/tModLoader/tModLoader/releases/latest");
                };
                Append(tMLUpdateRequired);
            }
            else if (hasUpdate || installed == null)
            {
                _updateButton = new UIImage(UpdateIsDowngrade ? UICommon.ButtonDowngradeTexture : UICommon.ButtonDownloadTexture);
                _updateButton.CopyStyle(_moreInfoButton);
                _updateButton.Left.Pixels += 36 + PADDING;
                _updateButton.OnClick     += DownloadMod;
                Append(_updateButton);

                if (_modReferences.Length > 0)
                {
                    _updateWithDepsButton = new UIImage(UICommon.ButtonDownloadMultipleTexture);
                    _updateWithDepsButton.CopyStyle(_updateButton);
                    _updateWithDepsButton.Left.Pixels += 36 + PADDING;
                    _updateWithDepsButton.OnClick     += DownloadWithDeps;
                    Append(_updateWithDepsButton);
                }
            }

            if (modReferences.Length > 0)
            {
                var icon             = UICommon.ButtonExclamationTexture;
                var modReferenceIcon = new UIHoverImage(icon, Language.GetTextValue("tModLoader.MBClickToViewDependencyMods", string.Join("\n", modReferences.Split(',').Select(x => x.Trim()))))
                {
                    Left = { Pixels = -icon.Width - PADDING, Percent = 1f }
                };
                modReferenceIcon.OnClick += ShowModDependencies;
                Append(modReferenceIcon);
            }

            OnDoubleClick += ViewModInfo;
        }
Ejemplo n.º 3
0
        public override void OnInitialize()
        {
            Visible = false;

            /*
             * baseLayer = new UIPanel();
             * baseLayer.HAlign = 0.5f;
             * baseLayer.VAlign = 0.5f;
             * baseLayer.Width.Set(1358 * horizontalScale,0);
             * baseLayer.Height.Set(622 * verticalScale,0);
             * baseLayer.BackgroundColor = new Color(0,0,0,100);
             * baseLayer.BorderColor = new Color(0,0,0,0);
             */
            cookbookSkin = new UIImage(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/CookbookSkin"));
            //cookbookSkin.ImageScale = horizontalScale;
            cookbookSkin.Width.Pixels  = 1358; // * horizontalScale;
            cookbookSkin.Height.Pixels = 622;  // * verticalScale;
            cookbookSkin.Left.Pixels   = Main.screenWidth / 2 - cookbookSkin.Width.Pixels / 2;
            cookbookSkin.Top.Pixels    = Main.screenHeight / 2 - cookbookSkin.Height.Pixels / 2;
            //cookbookSkin.ImageScale = horizontalScale;
            //baseLayer.Append(cookbookSkin);


            tabs = new UIElement();
            tabs.Width.Pixels  = 300;
            tabs.Height.Pixels = cookbookSkin.Width.Pixels;
            test = new UIPanel();
            test.BackgroundColor = Color.Black;
            test.Width           = tabs.Width;
            test.Height          = tabs.Height;
            tabs.VAlign          = 0.5f;
            //tabs.Top.Pixels = -32 * verticalScale;
            tabs.Left.Pixels = cookbookSkin.Width.Pixels - 180;
            //tabs.Append(test);
            //tabs.Left.Pixels = (cookbookSkin.Width.Pixels - 180) * horizontalScale;
            //tabs.Left.Pixels = Main.screenWidth / 2;// + cookbookSkin.Width.Pixels / 2;
            //cookbookSkin.Append(tabs);

            handyNotesPages = new HandyNotesPages();
            handyNotesPages.BackgroundColor = new Color(100, 100, 100);
            cookbookSkin.Append(handyNotesPages);

            randomNotesPages = new RandomNotesPages();
            randomNotesPages.BackgroundColor = new Color(100, 100, 100);
            cookbookSkin.Append(randomNotesPages);

            resourcefulNotesPages = new ResourcefulNotesPages();
            resourcefulNotesPages.BackgroundColor = new Color(100, 100, 100);
            cookbookSkin.Append(resourcefulNotesPages);

            safetyNotesPages = new SafetyNotesPages();
            safetyNotesPages.BackgroundColor = new Color(100, 100, 100);
            cookbookSkin.Append(safetyNotesPages);

            utilityNotesPages = new UtilityNotesPages();
            utilityNotesPages.BackgroundColor = new Color(100, 100, 100);
            cookbookSkin.Append(utilityNotesPages);

            HandyNotes = new UIHoverImage(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/HandyNotesTab"), "Handy Notes");
            HandyNotes.Left.Set(8, 0);
            HandyNotes.Top.Set(-24, 0);
            HandyNotes.VAlign = 1 / 6f;
            HandyNotes.Width.Set(60 * horizontalScale, 0);
            HandyNotes.Height.Set(100 * verticalScale, 0);
            HandyNotes.OnClick += new MouseEvent(MoveToHandyNotesPage);
            tabs.Append(HandyNotes);

            RandomNotes = new UIHoverImage(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/RandomNotesTab"), "Random Notes");
            RandomNotes.Left.Set(0, 0);
            RandomNotes.Top.Set(-12, 0);
            RandomNotes.VAlign = 2 / 6f;
            RandomNotes.Width.Set(60 * horizontalScale, 0);
            RandomNotes.Height.Set(100 * verticalScale, 0);
            RandomNotes.OnClick += new MouseEvent(MoveToRandomNotesPage);
            tabs.Append(RandomNotes);

            ResourcefulNotes = new UIHoverImage(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/ResourcefulNotesTab"), "Resourceful Notes");
            ResourcefulNotes.Left.Set(4, 0);
            ResourcefulNotes.Top.Set(0, 0);
            ResourcefulNotes.VAlign = 3 / 6f;
            ResourcefulNotes.Width.Set(60 * horizontalScale, 0);
            ResourcefulNotes.Height.Set(100 * verticalScale, 0);
            ResourcefulNotes.OnClick += new MouseEvent(MoveToResourcefulNotesPage);
            tabs.Append(ResourcefulNotes);

            SafetyNotes = new UIHoverImage(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/SafetyNotesTab"), "SafetyNotes");
            SafetyNotes.Left.Set(16, 0);
            SafetyNotes.Top.Set(12, 0);
            SafetyNotes.VAlign = 4 / 6f;
            SafetyNotes.Width.Set(60 * horizontalScale, 0);
            SafetyNotes.Height.Set(100 * verticalScale, 0);
            SafetyNotes.OnClick += new MouseEvent(MoveToSafetyNotesPage);
            tabs.Append(SafetyNotes);

            UtilityNotes = new UIHoverImage(ModContent.GetTexture("ExtraExplosives/UI/AnarchistCookbookUI/UtilityNotesTab"), "Utility Notes");
            UtilityNotes.Left.Set(12, 0);
            UtilityNotes.Top.Set(24, 0);
            UtilityNotes.VAlign = 5 / 6f;
            UtilityNotes.Width.Set(60 * horizontalScale, 0);
            UtilityNotes.Height.Set(100 * verticalScale, 0);
            UtilityNotes.OnClick += new MouseEvent(MoveToUtilityNotesPage);
            tabs.Append(UtilityNotes);
            Append(cookbookSkin);
            Append(tabs);
        }
Ejemplo n.º 4
0
        public UIModDownloadItem(string displayName, string name, string version, string author, string modReferences, ModSide modSide, string modIconUrl, string downloadUrl, int downloads, int hot, string timeStamp, bool hasUpdate, bool updateIsDowngrade, LocalMod installed)
        {
            ModName     = name;
            DisplayName = displayName;
            DownloadUrl = downloadUrl;

            _version          = version;
            _author           = author;
            _modReferences    = modReferences;
            _modSide          = modSide;
            _modIconUrl       = modIconUrl;
            _downloads        = downloads;
            _hot              = hot;
            _timeStamp        = timeStamp;
            HasUpdate         = hasUpdate;
            UpdateIsDowngrade = updateIsDowngrade;
            Installed         = installed;

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

            float left = HasModIcon ? 85f : 0f;

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

            _authorText = new UIText(Language.GetTextValue("tModLoader.ModsByline", author))
            {
                Top = { Pixels = 83 }
            };
            Append(_authorText);

            if (_timeStamp != "0000-00-00 00:00:00")
            {
                try {
                    var    myDateTime = DateTime.Parse(_timeStamp);
                    string text       = TimeHelper.HumanTimeSpanString(myDateTime);
                    int    textWidth  = (int)Main.fontMouseText.MeasureString(text).X;
                    _authorText.Left.Set(125 + 5, 0f);
                }
                catch (Exception e) {
                    Logging.tML.Error(e.ToString());
                }
            }

            _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 (hasUpdate || installed == null)
            {
                _updateButton = new UIAutoScaleTextTextPanel <string>(UpdateText).WithFadedMouseOver();
                _updateButton.CopyStyle(_moreInfoButton);
                _updateButton.Width.Pixels = 120;
                _updateButton.Left.Pixels  = _moreInfoButton.Width.Pixels + _moreInfoButton.Left.Pixels + 5f;
                _updateButton.OnClick     += DownloadMod;
                Append(_updateButton);

                if (_modReferences.Length > 0)
                {
                    _updateWithDepsButton = new UIAutoScaleTextTextPanel <string>(UpdateWithDepsText).WithFadedMouseOver();
                    _updateWithDepsButton.CopyStyle(_updateButton);
                    _updateWithDepsButton.Width.Pixels = 220;
                    _updateWithDepsButton.Left.Pixels  = _updateButton.Width.Pixels + _updateButton.Left.Pixels + 5f;
                    _updateWithDepsButton.OnClick     += DownloadWithDeps;
                    Append(_updateWithDepsButton);
                }
            }

            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 = -icon.Width, Percent = 1f },
                    Top  = { Pixels = 83 }
                };
                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;
        }
Ejemplo n.º 5
0
        public UIModDownloadItem(string displayName, string name, string version, string author, string modReferences, ModSide modSide, string modIconUrl, string downloadUrl, int downloads, int hot, string timeStamp, bool hasUpdate, bool updateIsDowngrade, LocalMod installed, string modloaderversion)
        {
            ModName     = name;
            DisplayName = displayName;
            DownloadUrl = downloadUrl;

            _version          = version;
            _author           = author;
            _modReferences    = modReferences;
            _modSide          = modSide;
            _modIconUrl       = modIconUrl;
            _downloads        = downloads;
            _hot              = hot;
            _timeStamp        = timeStamp;
            HasUpdate         = hasUpdate;
            UpdateIsDowngrade = updateIsDowngrade;
            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);

            float left = HasModIcon ? 85f : 0f;

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

            if (_timeStamp != "0000-00-00 00:00:00")
            {
                try {
                    var    myDateTime = DateTime.Parse(_timeStamp);
                    string text       = TimeHelper.HumanTimeSpanString(myDateTime);
                    int    textWidth  = (int)Main.fontMouseText.MeasureString(text).X;
                }
                catch (Exception e) {
                    Logging.tML.Error(e.ToString());
                }
            }

            _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 (modloaderversion != null)
            {
                tMLUpdateRequired = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MBRequiresTMLUpdate", modloaderversion)).WithFadedMouseOver(Color.Orange, Color.Orange * 0.7f);
                tMLUpdateRequired.BackgroundColor = Color.Orange * 0.7f;
                tMLUpdateRequired.CopyStyle(_moreInfoButton);
                tMLUpdateRequired.Width.Pixels = 340;
                tMLUpdateRequired.Left.Pixels  = _moreInfoButton.Width.Pixels + _moreInfoButton.Left.Pixels + 5f;
                tMLUpdateRequired.OnClick     += (a, b) => {
                    Process.Start("https://github.com/tModLoader/tModLoader/releases/latest");
                };
                Append(tMLUpdateRequired);
            }
            else if (hasUpdate || installed == null)
            {
                _updateButton            = new UIImage(UICommon.buttonDownloadTexture);
                _updateButton.Top.Pixels = 40;
                _updateButton.Left.Set(-166, 1f);
                _updateButton.OnClick += DownloadMod;
                Append(_updateButton);

                if (_modReferences.Length > 0)
                {
                    _updateButton.Left.Set(_updateButton.Left.Pixels - _updateButton.Width.Pixels - 6, 1f);
                    _updateWithDepsButton = new UIImage(UICommon.buttonDownloadMultipleTexture);
                    _updateWithDepsButton.CopyStyle(_updateButton);
                    _updateWithDepsButton.Left.Pixels = _updateButton.Width.Pixels + _updateButton.Left.Pixels + 5f;
                    _updateWithDepsButton.OnClick    += DownloadWithDeps;
                    Append(_updateWithDepsButton);
                }
            }

            if (modReferences.Length > 0)
            {
                var icon             = UICommon.buttonExclamationTexture;
                var modReferenceIcon = new UIHoverImage(icon, Language.GetTextValue("tModLoader.MBClickToViewDependencyMods", string.Join("\n", modReferences.Split(',').Select(x => x.Trim()))))
                {
                    Left = { Pixels = -icon.Width, Percent = 1f }
                };
                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;
        }
Ejemplo n.º 6
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;
        }