private void UpdateModsView()
        {
            ILocalModsView.Items.Clear();

            var localMods      = LocalMod.GetLocalMods();
            var serverPathMods = LocalMod.GetLocalMods(true);
            var steamMods      = SteamMod.GetSteamMods();

            var modsToRemove = (from localMod in serverPathMods
                                from steamMod in steamMods
                                where localMod.Name == Functions.SafeName(steamMod.Name)
                                select localMod).ToList();

            foreach (var remove in modsToRemove)
            {
                try { serverPathMods.RemoveAt(serverPathMods.IndexOf(serverPathMods.Find(m => m.Name == remove.Name))); }
                catch (ArgumentOutOfRangeException) { /*IGNORED*/ }
            }

            localMods.AddRange(serverPathMods);

            if (localMods.Count <= 0)
            {
                return;
            }

            foreach (var localMod in localMods)
            {
                ILocalModsView.Items.Add(localMod);
            }
        }
Exemplo n.º 2
0
        internal static void PublishModCommandLine(string modName, string passphrase, string steamid64)
        {
            try {
                InstallVerifier.IsGoG          = true;
                ModLoader.SteamID64            = steamid64;
                ModLoader.modBrowserPassphrase = passphrase;

                if (string.IsNullOrWhiteSpace(ModLoader.modBrowserPassphrase) || string.IsNullOrWhiteSpace(ModLoader.SteamID64))
                {
                    throw new Exception("-passphrase and -steamid64 are required for publishing via command line");
                }

                LocalMod localMod;
                var      modPath = Path.Combine(ModLoader.ModPath, modName + ".tmod");
                var      modFile = new TmodFile(modPath);
                using (modFile.Open())                 // savehere, -tmlsavedirectory, normal (test linux too)
                    localMod = new LocalMod(modFile);

                PublishModInner(modFile, localMod.properties, true);
            }
            catch (Exception e) {
                Console.WriteLine("Something went wrong with command line mod publishing.");
                Console.WriteLine(e.ToString());
                Environment.Exit(1);
            }
            Environment.Exit(0);
        }
        private void UpdateModsView()
        {
            ILocalModsView.Items.Clear();

            var localMods      = LocalMod.GetLocalMods();
            var serverPathMods = LocalMod.GetLocalMods(true);
            var steamMods      = SteamMod.GetSteamMods();
            var modsToRemove   = new List <LocalMod>();

            foreach (LocalMod localMod in serverPathMods)
            {
                foreach (SteamMod steamMod in steamMods)
                {
                    if (localMod.Name == Functions.SafeName(steamMod.Name))
                    {
                        modsToRemove.Add(localMod);
                    }
                }
            }

            foreach (var remove in modsToRemove)
            {
                serverPathMods.RemoveAt(serverPathMods.IndexOf(serverPathMods.Find(m => m.Name == remove.Name)));
            }

            localMods.AddRange(serverPathMods);

            if (localMods.Count > 0)
            {
                foreach (var localMod in localMods)
                {
                    ILocalModsView.Items.Add(localMod);
                }
            }
        }
Exemplo n.º 4
0
 public UIModItem(LocalMod mod)
 {
     _mod          = mod;
     BorderColor   = new Color(89, 116, 213) * 0.7f;
     Height.Pixels = 90;
     Width.Percent = 1f;
     SetPadding(6f);
 }
Exemplo n.º 5
0
 public UIModItem(LocalMod mod)
 {
     _mod          = mod;
     BorderColor   = new Color(89, 116, 213) * 0.7f;
     Height.Pixels = 90;
     Width.Percent = 1f;
     SetPadding(6f);
     DisplayNameClean = string.Join("", ChatManager.ParseMessage(_mod.DisplayName, Color.White).Where(x => x.GetType() == typeof(TextSnippet)).Select(x => x.Text));
 }
Exemplo n.º 6
0
        public UIModSourceItem(string mod, LocalMod builtMod)
        {
            _mod = mod;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            this.builtMod = builtMod;
            if (builtMod != null)
            {
                var button3 = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.MSPublish"));
                button3.CopyStyle(button2);
                button3.Width.Pixels = 100;
                button3.Left.Pixels  = 390;
                button3.WithFadedMouseOver();
                button3.OnClick += this.Publish;
                Append(button3);
            }
            OnDoubleClick += BuildAndReload;
        }
Exemplo n.º 8
0
        public UIModSourceItem(string mod, LocalMod builtMod)
        {
            this.mod            = mod;
            this.BorderColor    = new Color(89, 116, 213) * 0.7f;
            this.dividerTexture = TextureManager.Load("Images/UI/Divider");
            this.Height.Set(90f, 0f);
            this.Width.Set(0f, 1f);
            base.SetPadding(6f);
            string addendum = Path.GetFileName(mod).Contains(" ") ? "  [c/FF0000:(Mod Sources folders can't have spaces)]" : "";

            this.modName = new UIText(Path.GetFileName(mod) + addendum, 1f, false);
            this.modName.Left.Set(10f, 0f);
            this.modName.Top.Set(5f, 0f);
            base.Append(this.modName);
            UITextPanel <string> button = new UITextPanel <string>(Language.GetTextValue("tModLoader.MSBuild"), 1f, false);

            button.Width.Set(100f, 0f);
            button.Height.Set(30f, 0f);
            button.Left.Set(10f, 0f);
            button.Top.Set(40f, 0f);
            button.PaddingTop    -= 2f;
            button.PaddingBottom -= 2f;
            button.OnMouseOver   += UICommon.FadedMouseOver;
            button.OnMouseOut    += UICommon.FadedMouseOut;
            button.OnClick       += this.BuildMod;
            base.Append(button);
            UITextPanel <string> button2 = new UITextPanel <string>(Language.GetTextValue("tModLoader.MSBuildReload"), 1f, false);

            button2.CopyStyle(button);
            button2.Width.Set(200f, 0f);
            button2.Left.Set(150f, 0f);
            button2.OnMouseOver += UICommon.FadedMouseOver;
            button2.OnMouseOut  += UICommon.FadedMouseOut;
            button2.OnClick     += this.BuildAndReload;
            base.Append(button2);
            this.builtMod = builtMod;
            if (builtMod != null)
            {
                UITextPanel <string> button3 = new UITextPanel <string>(Language.GetTextValue("tModLoader.MSPublish"), 1f, false);
                button3.CopyStyle(button2);
                button3.Width.Set(100f, 0f);
                button3.Left.Set(390f, 0f);
                button3.OnMouseOver += UICommon.FadedMouseOver;
                button3.OnMouseOut  += UICommon.FadedMouseOut;
                button3.OnClick     += this.Publish;
                base.Append(button3);
            }
            base.OnDoubleClick += this.BuildAndReload;
        }
Exemplo n.º 9
0
        public override void OnDeactivate()
        {
            base.OnDeactivate();

            _cts?.Cancel(false);
            _info           = string.Empty;
            _localMod       = null;
            _gotoMenu       = 0;
            _modName        = string.Empty;
            _modDisplayName = string.Empty;
            _url            = string.Empty;
            _modHomepageButton.Remove();
            _deleteButton.Remove();
            _extractButton.Remove();
        }
Exemplo n.º 10
0
        internal void Show(string modName, string displayName, int gotoMenu, LocalMod localMod, string description = "", string url = "", bool loadFromWeb = false)
        {
            _modName        = modName;
            _modDisplayName = displayName;
            _gotoMenu       = gotoMenu;
            _localMod       = localMod;
            _info           = description;
            if (_info.Equals("") && !loadFromWeb)
            {
                _info = Language.GetTextValue("tModLoader.ModInfoNoDescriptionAvailable");
            }
            _url         = url;
            _loadFromWeb = loadFromWeb;

            Main.gameMenu = true;
            Main.menuMode = Interface.modInfoID;
        }
Exemplo n.º 11
0
 internal void Show(LocalMod mod, int gotoMenu)
 {
     this.mod      = mod;
     this.gotoMenu = gotoMenu;
     Main.menuMode = Interface.extractModID;
 }
Exemplo n.º 12
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;
        }
Exemplo n.º 13
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;
        }
Exemplo n.º 14
0
        public UIModItem(LocalMod mod)
        {
            this.mod               = mod;
            this.BorderColor       = new Color(89, 116, 213) * 0.7f;
            this.dividerTexture    = TextureManager.Load("Images/UI/Divider");
            this.innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
            this.Height.Set(90f, 0f);
            this.Width.Set(0f, 1f);
            base.SetPadding(6f);
            //base.OnClick += this.ToggleEnabled;
            string text = mod.DisplayName + " v" + mod.modFile.version;

            if (mod.modFile.tModLoaderVersion < new Version(0, 10))
            {
                text += " [c/FF0000:(Old mod, enable at own risk)]";
            }

            if (mod.modFile.HasFile("icon.png"))
            {
                var modIconTexture = Texture2D.FromStream(Main.instance.GraphicsDevice, new MemoryStream(mod.modFile.GetFile("icon.png")));
                if (modIconTexture.Width == 80 && modIconTexture.Height == 80)
                {
                    modIcon = new UIImage(modIconTexture);
                    modIcon.Left.Set(0f, 0f);
                    modIcon.Top.Set(0f, 0f);
                    Append(modIcon);
                    modIconAdjust += 85;
                }
            }
            this.modName = new UIText(text, 1f, false);
            this.modName.Left.Set(modIconAdjust + 10f, 0f);
            this.modName.Top.Set(5f, 0f);
            base.Append(this.modName);
            UITextPanel <string> button = new UITextPanel <string>(Language.GetTextValue("tModLoader.ModsMoreInfo"), 1f, false);

            button.Width.Set(100f, 0f);
            button.Height.Set(30f, 0f);
            button.Left.Set(430f, 0f);
            button.Top.Set(40f, 0f);
            button.PaddingTop    -= 2f;
            button.PaddingBottom -= 2f;
            button.OnMouseOver   += UICommon.FadedMouseOver;
            button.OnMouseOut    += UICommon.FadedMouseOut;
            button.OnClick       += this.Moreinfo;
            base.Append(button);
            button2 = new UITextPanel <string>(mod.Enabled ? Language.GetTextValue("tModLoader.ModsDisable") : Language.GetTextValue("tModLoader.ModsEnable"), 1f, false);
            button2.Width.Set(100f, 0f);
            button2.Height.Set(30f, 0f);
            button2.Left.Set(button.Left.Pixels - button2.Width.Pixels - 5f, 0f);
            button2.Top.Set(40f, 0f);
            button2.PaddingTop    -= 2f;
            button2.PaddingBottom -= 2f;
            button2.OnMouseOver   += UICommon.FadedMouseOver;
            button2.OnMouseOut    += UICommon.FadedMouseOut;
            button2.OnClick       += this.ToggleEnabled;
            base.Append(button2);

            var modRefs = mod.properties.modReferences.Select(x => x.mod).ToArray();

            if (modRefs.Length > 0 && !mod.Enabled)
            {
                string    refs = String.Join(", ", mod.properties.modReferences);
                Texture2D icon = Texture2D.FromStream(Main.instance.GraphicsDevice,
                                                      Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.ButtonExclamation.png"));
                UIHoverImage modReferenceIcon = new UIHoverImage(icon, "This mod depends on: " + refs + "\n (click to enable)");
                modReferenceIcon.Left.Set(button2.Left.Pixels - 24f, 0f);
                modReferenceIcon.Top.Set(47f, 0f);
                modReferenceIcon.OnClick += (a, b) =>
                {
                    var modList = ModLoader.FindMods();
                    var missing = new List <string>();
                    foreach (var modRef in modRefs)
                    {
                        ModLoader.EnableMod(modRef);
                        if (!modList.Any(m => m.Name == modRef))
                        {
                            missing.Add(modRef);
                        }
                    }

                    Main.menuMode = Interface.modsMenuID;
                    if (missing.Any())
                    {
                        Interface.infoMessage.SetMessage("The following mods were not found: " + String.Join(",", missing));
                        Interface.infoMessage.SetGotoMenu(Interface.modsMenuID);
                        Main.menuMode = Interface.infoMessageID;
                    }
                };
                base.Append(modReferenceIcon);
            }
            if (mod.modFile.ValidModBrowserSignature)
            {
                keyImage = new UIHoverImage(Main.itemTexture[ID.ItemID.GoldenKey], Language.GetTextValue("tModLoader.ModsOriginatedFromModBrowser"));
                keyImage.Left.Set(-20, 1f);
                base.Append(keyImage);
            }
            if (mod.properties.beta)
            {
                keyImage = new UIHoverImage(Main.itemTexture[ID.ItemID.ShadowKey], "This mod was built on beta version and can't be published");
                keyImage.Left.Set(-10, 1f);
                Append(keyImage);
            }
            Mod loadedMod = ModLoader.GetMod(mod.Name);

            if (loadedMod != null)
            {
                loaded = true;
                int[]    values  = { loadedMod.items.Count, loadedMod.npcs.Count, loadedMod.tiles.Count, loadedMod.walls.Count, loadedMod.buffs.Count, loadedMod.mountDatas.Count };
                string[] strings = { " items", " NPCs", " tiles", " walls", " buffs", " mounts" };
                int      xOffset = -40;
                for (int i = 0; i < values.Length; i++)
                {
                    if (values[i] > 0)
                    {
                        Texture2D iconTexture = Main.instance.infoIconTexture[i];
                        keyImage = new UIHoverImage(iconTexture, values[i] + strings[i]);
                        keyImage.Left.Set(xOffset, 1f);
                        base.Append(keyImage);
                        xOffset -= 18;
                    }
                }
            }
        }
Exemplo n.º 15
0
        public UIModItem(LocalMod mod)
        {
            this.mod          = mod;
            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);
            //base.OnClick += this.ToggleEnabled;
            string text = mod.DisplayName + " v" + mod.modFile.version;

            if (mod.tModLoaderVersion < new Version(0, 10))
            {
                text += $" [c/FF0000:({Language.GetTextValue("tModLoader.ModOldWarning")})]";
            }

            if (mod.modFile.HasFile("icon.png"))
            {
                try {
                    Texture2D modIconTexture;
                    using (mod.modFile.Open())
                        using (var s = mod.modFile.GetStream("icon.png"))
                            modIconTexture = Texture2D.FromStream(Main.instance.GraphicsDevice, s);

                    if (modIconTexture.Width == 80 && modIconTexture.Height == 80)
                    {
                        modIcon = new UIImage(modIconTexture)
                        {
                            Left = { Percent = 0f },
                            Top  = { Percent = 0f }
                        };
                        Append(modIcon);
                        modIconAdjust += 85;
                    }
                }
                catch { }
            }
            modName = new UIText(text)
            {
                Left = new StyleDimension(modIconAdjust + 10f, 0f),
                Top  = { Pixels = 5 }
            };
            Append(modName);

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

            moreInfoButton.PaddingTop    -= 2f;
            moreInfoButton.PaddingBottom -= 2f;
            moreInfoButton.OnClick       += Moreinfo;
            Append(moreInfoButton);

            toggleModEnabledButton = new UIAutoScaleTextTextPanel <string>(mod.Enabled ? Language.GetTextValue("tModLoader.ModsDisable") : Language.GetTextValue("tModLoader.ModsEnable"))
            {
                Width  = { Pixels = 100 },
                Height = { Pixels = 36 },
                Top    = { Pixels = 40 }
            }.WithFadedMouseOver();
            toggleModEnabledButton.Left.Pixels    = moreInfoButton.Left.Pixels - toggleModEnabledButton.Width.Pixels - 5f;
            toggleModEnabledButton.PaddingTop    -= 2f;
            toggleModEnabledButton.PaddingBottom -= 2f;
            toggleModEnabledButton.OnClick       += ToggleEnabled;
            Append(toggleModEnabledButton);

            Mod loadedMod = ModLoader.GetMod(mod.Name);

            if (loadedMod != null && ConfigManager.Configs.ContainsKey(loadedMod))             // and has config
            {
                configButton = new UITextPanel <string>("Config", 1f, false);
                configButton.Width.Set(100f, 0f);
                configButton.Height.Set(30f, 0f);
                configButton.Left.Set(toggleModEnabledButton.Left.Pixels - configButton.Width.Pixels - 5f, 0f);
                configButton.Top.Set(40f, 0f);
                configButton.PaddingTop    -= 2f;
                configButton.PaddingBottom -= 2f;
                configButton.WithFadedMouseOver();
                configButton.OnClick += this.OpenConfig;
                Append(configButton);
                if (ConfigManager.ModNeedsReload(loadedMod))
                {
                    configChangesRequireReload = true;
                }
            }

            var modRefs = mod.properties.modReferences.Select(x => x.mod).ToArray();

            if (modRefs.Length > 0 && !mod.Enabled)
            {
                string refs = string.Join(", ", mod.properties.modReferences);
                var    icon = Texture2D.FromStream(Main.instance.GraphicsDevice,
                                                   Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.ButtonExclamation.png"));
                var modReferenceIcon = new UIHoverImage(icon, Language.GetTextValue("tModLoader.ModDependencyClickTooltip", refs))
                {
                    Left = new StyleDimension(toggleModEnabledButton.Left.Pixels - 24f, 0f),
                    Top  = { Pixels = 47 }
                };
                modReferenceIcon.OnClick += (a, b) => {
                    var modList = ModOrganizer.FindMods();
                    var missing = new List <string>();
                    foreach (var modRef in modRefs)
                    {
                        ModLoader.EnableMod(modRef);
                        if (!modList.Any(m => m.Name == modRef))
                        {
                            missing.Add(modRef);
                        }
                    }

                    Main.menuMode = Interface.modsMenuID;
                    if (missing.Any())
                    {
                        Interface.infoMessage.Show(Language.GetTextValue("tModLoader.ModDependencyModsNotFound", String.Join(",", missing)), Interface.modsMenuID);
                    }
                };
                Append(modReferenceIcon);
            }
            if (mod.modFile.ValidModBrowserSignature)
            {
                keyImage = new UIHoverImage(Main.itemTexture[ID.ItemID.GoldenKey], Language.GetTextValue("tModLoader.ModsOriginatedFromModBrowser"))
                {
                    Left = { Pixels = -20, Percent = 1f }
                };
                Append(keyImage);
            }
            if (ModLoader.badUnloaders.Contains(mod.Name))
            {
                keyImage = new UIHoverImage(Texture2D.FromStream(Main.instance.GraphicsDevice,
                                                                 Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.ButtonError.png")), "This mod did not fully unload during last unload.")
                {
                    Left = { Pixels = modIconAdjust + 4 },
                    Top  = { Pixels = 3 }
                };
                Append(keyImage);
                modName.Left.Pixels += 20;
            }
            if (mod.properties.beta)
            {
                keyImage = new UIHoverImage(Main.itemTexture[ID.ItemID.ShadowKey], Language.GetTextValue("tModLoader.BetaModCantPublish"))
                {
                    Left = { Pixels = -10, Percent = 1f }
                };
                Append(keyImage);
            }
            if (loadedMod != null)
            {
                loaded = true;
                int[]    values           = { loadedMod.items.Count, loadedMod.npcs.Count, loadedMod.tiles.Count, loadedMod.walls.Count, loadedMod.buffs.Count, loadedMod.mountDatas.Count };
                string[] localizationKeys = { "ModsXItems", "ModsXNPCs", "ModsXTiles", "ModsXWalls", "ModsXBuffs", "ModsXMounts" };
                int      xOffset          = -40;
                for (int i = 0; i < values.Length; i++)
                {
                    if (values[i] > 0)
                    {
                        Texture2D iconTexture = Main.instance.infoIconTexture[i];
                        keyImage = new UIHoverImage(iconTexture, Language.GetTextValue($"tModLoader.{localizationKeys[i]}", values[i]))
                        {
                            Left = { Pixels = xOffset, Percent = 1f }
                        };
                        Append(keyImage);
                        xOffset -= 18;
                    }
                }
            }
        }
Exemplo n.º 16
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;
        }
Exemplo n.º 17
0
 internal void SetMod(LocalMod mod)
 {
     localMod = mod;
 }
Exemplo n.º 18
0
        public UIModItem(LocalMod mod)
        {
            this.mod               = mod;
            this.BorderColor       = new Color(89, 116, 213) * 0.7f;
            this.dividerTexture    = TextureManager.Load("Images/UI/Divider");
            this.innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
            this.Height.Set(90f, 0f);
            this.Width.Set(0f, 1f);
            base.SetPadding(6f);
            //base.OnClick += this.ToggleEnabled;
            string text = mod.DisplayName + " v" + mod.modFile.version;

            if (mod.tModLoaderVersion < new Version(0, 10))
            {
                text += $" [c/FF0000:({Language.GetTextValue("tModLoader.ModOldWarning")})]";
            }

            if (mod.modFile.HasFile("icon.png"))
            {
                try
                {
                    Texture2D modIconTexture;
                    using (mod.modFile.EnsureOpen())
                        using (var s = mod.modFile.GetStream("icon.png"))
                            modIconTexture = Texture2D.FromStream(Main.instance.GraphicsDevice, s);

                    if (modIconTexture.Width == 80 && modIconTexture.Height == 80)
                    {
                        modIcon = new UIImage(modIconTexture);
                        modIcon.Left.Set(0f, 0f);
                        modIcon.Top.Set(0f, 0f);
                        Append(modIcon);
                        modIconAdjust += 85;
                    }
                }
                catch { }
            }
            this.modName = new UIText(text, 1f, false);
            this.modName.Left.Set(modIconAdjust + 10f, 0f);
            this.modName.Top.Set(5f, 0f);
            base.Append(this.modName);
            UIAutoScaleTextTextPanel <string> moreInfoButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModsMoreInfo"), 1f, false);

            moreInfoButton.Width.Set(100f, 0f);
            moreInfoButton.Height.Set(36f, 0f);
            moreInfoButton.Left.Set(430f, 0f);
            moreInfoButton.Top.Set(40f, 0f);
            moreInfoButton.PaddingTop    -= 2f;
            moreInfoButton.PaddingBottom -= 2f;
            moreInfoButton.OnMouseOver   += UICommon.FadedMouseOver;
            moreInfoButton.OnMouseOut    += UICommon.FadedMouseOut;
            moreInfoButton.OnClick       += this.Moreinfo;
            base.Append(moreInfoButton);
            toggleModEnabledButton = new UIAutoScaleTextTextPanel <string>(mod.Enabled ? Language.GetTextValue("tModLoader.ModsDisable") : Language.GetTextValue("tModLoader.ModsEnable"), 1f, false);
            toggleModEnabledButton.Width.Set(100f, 0f);
            toggleModEnabledButton.Height.Set(36f, 0f);
            toggleModEnabledButton.Left.Set(moreInfoButton.Left.Pixels - toggleModEnabledButton.Width.Pixels - 5f, 0f);
            toggleModEnabledButton.Top.Set(40f, 0f);
            toggleModEnabledButton.PaddingTop    -= 2f;
            toggleModEnabledButton.PaddingBottom -= 2f;
            toggleModEnabledButton.OnMouseOver   += UICommon.FadedMouseOver;
            toggleModEnabledButton.OnMouseOut    += UICommon.FadedMouseOut;
            toggleModEnabledButton.OnClick       += this.ToggleEnabled;
            base.Append(toggleModEnabledButton);

            var modRefs = mod.properties.modReferences.Select(x => x.mod).ToArray();

            if (modRefs.Length > 0 && !mod.Enabled)
            {
                string    refs = String.Join(", ", mod.properties.modReferences);
                Texture2D icon = Texture2D.FromStream(Main.instance.GraphicsDevice,
                                                      Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.ButtonExclamation.png"));
                UIHoverImage modReferenceIcon = new UIHoverImage(icon, Language.GetTextValue("tModLoader.ModDependencyClickTooltip", refs));
                modReferenceIcon.Left.Set(toggleModEnabledButton.Left.Pixels - 24f, 0f);
                modReferenceIcon.Top.Set(47f, 0f);
                modReferenceIcon.OnClick += (a, b) =>
                {
                    var modList = ModOrganizer.FindMods();
                    var missing = new List <string>();
                    foreach (var modRef in modRefs)
                    {
                        ModLoader.EnableMod(modRef);
                        if (!modList.Any(m => m.Name == modRef))
                        {
                            missing.Add(modRef);
                        }
                    }

                    Main.menuMode = Interface.modsMenuID;
                    if (missing.Any())
                    {
                        Interface.infoMessage.SetMessage(Language.GetTextValue("tModLoader.ModDependencyModsNotFound", String.Join(",", missing)));
                        Interface.infoMessage.SetGotoMenu(Interface.modsMenuID);
                        Main.menuMode = Interface.infoMessageID;
                    }
                };
                base.Append(modReferenceIcon);
            }
            if (mod.modFile.ValidModBrowserSignature)
            {
                keyImage = new UIHoverImage(Main.itemTexture[ID.ItemID.GoldenKey], Language.GetTextValue("tModLoader.ModsOriginatedFromModBrowser"));
                keyImage.Left.Set(-20, 1f);
                base.Append(keyImage);
            }
            if (mod.properties.beta)
            {
                keyImage = new UIHoverImage(Main.itemTexture[ID.ItemID.ShadowKey], Language.GetTextValue("tModLoader.BetaModCantPublish"));
                keyImage.Left.Set(-10, 1f);
                Append(keyImage);
            }
            Mod loadedMod = ModLoader.GetMod(mod.Name);

            if (loadedMod != null)
            {
                loaded = true;
                int[]    values           = { loadedMod.items.Count, loadedMod.npcs.Count, loadedMod.tiles.Count, loadedMod.walls.Count, loadedMod.buffs.Count, loadedMod.mountDatas.Count };
                string[] localizationKeys = { "ModsXItems", "ModsXNPCs", "ModsXTiles", "ModsXWalls", "ModsXBuffs", "ModsXMounts" };
                int      xOffset          = -40;
                for (int i = 0; i < values.Length; i++)
                {
                    if (values[i] > 0)
                    {
                        Texture2D iconTexture = Main.instance.infoIconTexture[i];
                        keyImage = new UIHoverImage(iconTexture, Language.GetTextValue($"tModLoader.{localizationKeys[i]}", values[i]));
                        keyImage.Left.Set(xOffset, 1f);
                        base.Append(keyImage);
                        xOffset -= 18;
                    }
                }
            }
        }
Exemplo n.º 19
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;
        }
Exemplo n.º 20
0
 IMod CreateLocalMod(LocalModInfo lm, ISupportModding game) => Game.Lists.Mods.FirstOrDefault(y => y.Name.Equals(lm.Name, StringComparison.OrdinalIgnoreCase))
 ?? Game.Lists.Mods.FirstOrDefault(y => y.Aliases.Contains(lm.Name, StringComparer.OrdinalIgnoreCase))
 ?? LocalMod.FromLocalModInfo(lm, game);
Exemplo n.º 21
0
 internal void SetMod(LocalMod mod)
 {
     this.mod = mod;
 }
Exemplo n.º 22
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;
            this.BorderColor       = new Color(89, 116, 213) * 0.7f;
            this.dividerTexture    = TextureManager.Load("Images/UI/Divider");
            this.innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
            this.Height.Set(90f, 0f);
            this.Width.Set(0f, 1f);
            base.SetPadding(6f);

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

            this.modName = new UIText(text, 1f, false);
            this.modName.Left.Set(this.left + 5, 0f);
            this.modName.Top.Set(5f, 0f);
            base.Append(this.modName);

            moreInfoButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.ModsMoreInfo"), 1f, false);
            moreInfoButton.Width.Set(100f, 0f);
            moreInfoButton.Height.Set(30f, 0f);
            moreInfoButton.Left.Set(this.left, 0f);
            moreInfoButton.Top.Set(40f, 0f);
            moreInfoButton.PaddingTop    -= 2f;
            moreInfoButton.PaddingBottom -= 2f;
            moreInfoButton.OnMouseOver   += UICommon.FadedMouseOver;
            moreInfoButton.OnMouseOut    += UICommon.FadedMouseOut;
            moreInfoButton.OnClick       += RequestMoreinfo;
            Append(moreInfoButton);

            if (update || installed == null)
            {
                updateButton = new UITextPanel <string>(this.update ? (updateIsDowngrade ? Language.GetTextValue("tModLoader.MBDowngrade") : Language.GetTextValue("tModLoader.MBUpdate")) : Language.GetTextValue("tModLoader.MBDownload"), 1f,
                                                        false);
                updateButton.CopyStyle(moreInfoButton);
                updateButton.Width.Set(HasModIcon ? 120f : 200f, 0f);
                updateButton.Left.Set(moreInfoButton.Width.Pixels + moreInfoButton.Left.Pixels + 5f, 0f);
                updateButton.OnMouseOver += UICommon.FadedMouseOver;
                updateButton.OnMouseOut  += UICommon.FadedMouseOut;
                updateButton.OnClick     += this.DownloadMod;
                Append(updateButton);
            }
            if (modreferences.Length > 0)
            {
                Texture2D icon = Texture2D.FromStream(Main.instance.GraphicsDevice,
                                                      Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.ButtonExclamation.png"));
                UIHoverImage modReferenceIcon = new UIHoverImage(icon, "Click to view dependency mods:\n" + string.Join("\n", modreferences.Split(',').Select(x => x.Trim())));
                modReferenceIcon.Left.Set(-149f, 1f);
                modReferenceIcon.Top.Set(48f, 0f);
                modReferenceIcon.OnClick += (s, e) =>
                {
                    UIModDownloadItem modListItem = (UIModDownloadItem)e.Parent;
                    Interface.modBrowser.SpecialModPackFilter        = modListItem.modreferences.Split(',').Select(x => x.Trim()).ToList();
                    Interface.modBrowser.SpecialModPackFilterTitle   = "Dependencies";                   // Toolong of \n" + modListItem.modName.Text;
                    Interface.modBrowser.filterTextBox.currentString = "";
                    Interface.modBrowser.updateNeeded = true;
                    Main.PlaySound(SoundID.MenuOpen);
                };
                Append(modReferenceIcon);
            }
            OnDoubleClick += RequestMoreinfo;
        }