public UIModPackItem(string name, string[] mods) { _filename = name; _mods = mods; _numMods = mods.Length; _modMissing = new bool[mods.Length]; _numModsEnabled = 0; _numModsDisabled = 0; _numModsMissing = 0; for (int i = 0; i < mods.Length; i++) { if (UIModPacks.Mods.Contains(mods[i])) { if (ModLoader.IsEnabled(mods[i])) { _numModsEnabled++; } else { _numModsDisabled++; } } else { _modMissing[i] = true; _numModsMissing++; } } BorderColor = new Color(89, 116, 213) * 0.7f; _dividerTexture = UICommon.DividerTexture; _innerPanelTexture = UICommon.InnerPanelTexture; Height.Pixels = 126; Width.Percent = 1f; SetPadding(6f); _modName = new UIText(name) { Left = { Pixels = 10 }, Top = { Pixels = 5 } }; Append(_modName); var viewListButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackViewList")) { Width = { Pixels = 100 }, Height = { Pixels = 36 }, Left = { Pixels = 407 }, Top = { Pixels = 40 } }.WithFadedMouseOver(); viewListButton.PaddingTop -= 2f; viewListButton.PaddingBottom -= 2f; viewListButton.OnClick += ViewListInfo; Append(viewListButton); _enableListButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackEnableThisList")) { Width = { Pixels = 151 }, Height = { Pixels = 36 }, Left = { Pixels = 248 }, Top = { Pixels = 40 } }.WithFadedMouseOver(); _enableListButton.PaddingTop -= 2f; _enableListButton.PaddingBottom -= 2f; _enableListButton.OnClick += EnableList; Append(_enableListButton); _enableListOnlyButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackEnableOnlyThisList")) { Width = { Pixels = 190 }, Height = { Pixels = 36 }, Left = { Pixels = 50 }, Top = { Pixels = 40 } }.WithFadedMouseOver(); _enableListOnlyButton.PaddingTop -= 2f; _enableListOnlyButton.PaddingBottom -= 2f; _enableListOnlyButton.OnClick += EnableListOnly; Append(_enableListOnlyButton); _viewInModBrowserButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackViewModsInModBrowser")) { Width = { Pixels = 246 }, Height = { Pixels = 36 }, Left = { Pixels = 50 }, Top = { Pixels = 80 } }.WithFadedMouseOver(); _viewInModBrowserButton.PaddingTop -= 2f; _viewInModBrowserButton.PaddingBottom -= 2f; _viewInModBrowserButton.OnClick += ViewInModBrowser; Append(_viewInModBrowserButton); _updateListWithEnabledButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackUpdateListWithEnabled")) { Width = { Pixels = 225 }, Height = { Pixels = 36 }, Left = { Pixels = 304 }, Top = { Pixels = 80 } }.WithFadedMouseOver(); _updateListWithEnabledButton.PaddingTop -= 2f; _updateListWithEnabledButton.PaddingBottom -= 2f; _updateListWithEnabledButton.OnClick += (a, b) => UIModPacks.SaveModList(_filename); Append(_updateListWithEnabledButton); _deleteButton = new UIImageButton(Main.Assets.Request <Texture2D>("Images/UI/ButtonDelete")) { Top = { Pixels = 40 } }; _deleteButton.OnClick += DeleteButtonClick; Append(_deleteButton); }
public UIModPackItem(string name, string[] mods) { this.filename = name; this.mods = mods; this.numMods = mods.Length; modMissing = new bool[mods.Length]; numModsEnabled = 0; numModsDisabled = 0; numModsMissing = 0; for (int i = 0; i < mods.Length; i++) { if (UIModPacks.mods.Contains(mods[i])) { if (ModLoader.IsEnabled(mods[i])) { numModsEnabled++; } else { numModsDisabled++; } } else { modMissing[i] = true; numModsMissing++; } } BorderColor = new Color(89, 116, 213) * 0.7f; dividerTexture = TextureManager.Load("Images/UI/Divider"); innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground"); Height.Pixels = 126; Width.Percent = 1f; SetPadding(6f); modName = new UIText(name) { Left = { Pixels = 10 }, Top = { Pixels = 5 } }; Append(modName); var viewListButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackViewList")) { Width = { Pixels = 100 }, Height = { Pixels = 36 }, Left = { Pixels = 407 }, Top = { Pixels = 40 } }.WithFadedMouseOver(); viewListButton.PaddingTop -= 2f; viewListButton.PaddingBottom -= 2f; viewListButton.OnClick += ViewListInfo; Append(viewListButton); enableListButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackEnableThisList")) { Width = { Pixels = 151 }, Height = { Pixels = 36 }, Left = { Pixels = 248 }, Top = { Pixels = 40 } }.WithFadedMouseOver(); enableListButton.PaddingTop -= 2f; enableListButton.PaddingBottom -= 2f; enableListButton.OnClick += EnableList; Append(enableListButton); enableListOnlyButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackEnableOnlyThisList")) { Width = { Pixels = 190 }, Height = { Pixels = 36 }, Left = { Pixels = 50 }, Top = { Pixels = 40 } }.WithFadedMouseOver(); enableListOnlyButton.PaddingTop -= 2f; enableListOnlyButton.PaddingBottom -= 2f; enableListOnlyButton.OnClick += EnableListOnly; Append(enableListOnlyButton); viewInModBrowserButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackViewModsInModBrowser")) { Width = { Pixels = 246 }, Height = { Pixels = 36 }, Left = { Pixels = 50 }, Top = { Pixels = 80 } }.WithFadedMouseOver(); viewInModBrowserButton.PaddingTop -= 2f; viewInModBrowserButton.PaddingBottom -= 2f; viewInModBrowserButton.OnClick += ViewInModBrowser; Append(viewInModBrowserButton); updateListWithEnabledButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackUpdateListWithEnabled")) { Width = { Pixels = 225 }, Height = { Pixels = 36 }, Left = { Pixels = 304 }, Top = { Pixels = 80 } }.WithFadedMouseOver(); updateListWithEnabledButton.PaddingTop -= 2f; updateListWithEnabledButton.PaddingBottom -= 2f; updateListWithEnabledButton.OnClick += (a, b) => UIModPacks.SaveModList(filename); Append(updateListWithEnabledButton); deleteButton = new UIImageButton(TextureManager.Load("Images/UI/ButtonDelete")) { Top = { Pixels = 40 } }; deleteButton.OnClick += DeleteButtonClick; Append(deleteButton); }
public UIModPackItem(string name, string[] mods) { this.filename = name; this.mods = mods; this.numMods = mods.Length; modMissing = new bool[mods.Length]; numModsEnabled = 0; numModsDisabled = 0; numModsMissing = 0; for (int i = 0; i < mods.Length; i++) { if (UIModPacks.mods.Contains(mods[i])) { if (ModLoader.IsEnabled(mods[i])) { numModsEnabled++; } else { numModsDisabled++; } } else { modMissing[i] = true; numModsMissing++; } } 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(126f, 0f); this.Width.Set(0f, 1f); base.SetPadding(6f); this.modName = new UIText(name, 1f, false); this.modName.Left.Set(10f, 0f); this.modName.Top.Set(5f, 0f); base.Append(this.modName); UIAutoScaleTextTextPanel <string> viewListButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackViewList"), 1f, false); viewListButton.Width.Set(100f, 0f); viewListButton.Height.Set(40f, 0f); viewListButton.Left.Set(407f, 0f); viewListButton.Top.Set(40f, 0f); viewListButton.PaddingTop -= 2f; viewListButton.PaddingBottom -= 2f; viewListButton.OnMouseOver += UICommon.FadedMouseOver; viewListButton.OnMouseOut += UICommon.FadedMouseOut; viewListButton.OnClick += ViewListInfo; base.Append(viewListButton); enableListButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackEnableThisList"), 1f, false); enableListButton.Width.Set(151f, 0f); enableListButton.Height.Set(36f, 0f); enableListButton.Left.Set(248f, 0f); enableListButton.Top.Set(40f, 0f); enableListButton.PaddingTop -= 2f; enableListButton.PaddingBottom -= 2f; enableListButton.OnMouseOver += UICommon.FadedMouseOver; enableListButton.OnMouseOut += UICommon.FadedMouseOut; enableListButton.OnClick += EnableList; base.Append(enableListButton); enableListOnlyButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackEnableOnlyThisList"), 1f, false); enableListOnlyButton.Width.Set(190f, 0f); enableListOnlyButton.Height.Set(36f, 0f); enableListOnlyButton.Left.Set(50f, 0f); enableListOnlyButton.Top.Set(40f, 0f); enableListOnlyButton.PaddingTop -= 2f; enableListOnlyButton.PaddingBottom -= 2f; enableListOnlyButton.OnMouseOver += UICommon.FadedMouseOver; enableListOnlyButton.OnMouseOut += UICommon.FadedMouseOut; enableListOnlyButton.OnClick += EnableListOnly; base.Append(enableListOnlyButton); viewInModBrowserButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackViewModsInModBrowser"), 1f, false); viewInModBrowserButton.Width.Set(246f, 0f); viewInModBrowserButton.Height.Set(36f, 0f); viewInModBrowserButton.Left.Set(50f, 0f); viewInModBrowserButton.Top.Set(80f, 0f); viewInModBrowserButton.PaddingTop -= 2f; viewInModBrowserButton.PaddingBottom -= 2f; viewInModBrowserButton.OnMouseOver += UICommon.FadedMouseOver; viewInModBrowserButton.OnMouseOut += UICommon.FadedMouseOut; viewInModBrowserButton.OnClick += ViewInModBrowser; base.Append(viewInModBrowserButton); updateListWithEnabledButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackUpdateListWithEnabled"), 1f, false); updateListWithEnabledButton.Width.Set(225f, 0f); updateListWithEnabledButton.Height.Set(36f, 0f); updateListWithEnabledButton.Left.Set(304f, 0f); updateListWithEnabledButton.Top.Set(80f, 0f); updateListWithEnabledButton.PaddingTop -= 2f; updateListWithEnabledButton.PaddingBottom -= 2f; updateListWithEnabledButton.OnMouseOver += UICommon.FadedMouseOver; updateListWithEnabledButton.OnMouseOut += UICommon.FadedMouseOut; updateListWithEnabledButton.OnClick += (a, b) => UIModPacks.SaveModList(filename); Append(updateListWithEnabledButton); deleteButton = new UIImageButton(TextureManager.Load("Images/UI/ButtonDelete")); deleteButton.Top.Set(40f, 0f); deleteButton.OnClick += this.DeleteButtonClick; base.Append(deleteButton); }