public override void OnInitialize() { uIElement = new UIElement(); uIElement.Width.Set(0f, 0.8f); uIElement.MaxWidth.Set(600f, 0f); uIElement.Top.Set(220f, 0f); uIElement.Height.Set(-220f, 1f); uIElement.HAlign = 0.5f; UIPanel uIPanel = new UIPanel(); uIPanel.Width.Set(0f, 1f); uIPanel.Height.Set(-110f, 1f); uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uIElement.Append(uIPanel); modInfo = new UIMessageBox("This is a test of mod info here."); modInfo.Width.Set(-25f, 1f); modInfo.Height.Set(0f, 1f); uIPanel.Append(modInfo); UIScrollbar uIScrollbar = new UIScrollbar(); uIScrollbar.SetView(100f, 1000f); uIScrollbar.Height.Set(-20, 1f); uIScrollbar.VAlign = 0.5f; uIScrollbar.HAlign = 1f; uIPanel.Append(uIScrollbar); modInfo.SetScrollbar(uIScrollbar); uITextPanel = new UITextPanel <string>("Mod Info", 0.8f, true); uITextPanel.HAlign = 0.5f; uITextPanel.Top.Set(-35f, 0f); uITextPanel.SetPadding(15f); uITextPanel.BackgroundColor = new Color(73, 94, 171); uIElement.Append(uITextPanel); modHomepageButton = new UITextPanel <string>("Visit the Mod's Homepage for even more info", 1f, false); modHomepageButton.Width.Set(-10f, 1f); modHomepageButton.Height.Set(25f, 0f); modHomepageButton.VAlign = 1f; modHomepageButton.Top.Set(-65f, 0f); modHomepageButton.OnMouseOver += UICommon.FadedMouseOver; modHomepageButton.OnMouseOut += UICommon.FadedMouseOut; modHomepageButton.OnClick += VisitModHomePage; uIElement.Append(modHomepageButton); UITextPanel <string> backButton = new UITextPanel <string>("Back", 1f, false); backButton.Width.Set(-10f, 0.5f); backButton.Height.Set(25f, 0f); backButton.VAlign = 1f; backButton.Top.Set(-20f, 0f); backButton.OnMouseOver += UICommon.FadedMouseOver; backButton.OnMouseOut += UICommon.FadedMouseOut; backButton.OnClick += BackClick; uIElement.Append(backButton); Append(uIElement); }
public override void OnInitialize() { var area = new UIElement { Width = { Percent = 0.8f }, Top = { Pixels = 200 }, Height = { Pixels = -240, Percent = 1f }, HAlign = 0.5f }; var uIPanel = new UIPanel { Width = { Percent = 1f }, Height = { Pixels = -110, Percent = 1f }, BackgroundColor = UICommon.mainPanelBackground }; area.Append(uIPanel); messageBox = new UIMessageBox("") { Width = { Pixels = -25, Percent = 1f }, Height = { Percent = 1f } }; uIPanel.Append(messageBox); var uIScrollbar = new UIScrollbar { Height = { Pixels = -20, Percent = 1f }, VAlign = 0.5f, HAlign = 1f }.WithView(100f, 1000f); uIPanel.Append(uIScrollbar); messageBox.SetScrollbar(uIScrollbar); var buttonOk = new UITextPanel <string>(Language.GetTextValue("tModLoader.OK"), 0.7f, true) { Width = { Pixels = -10, Percent = 0.5f }, Height = { Pixels = 50 }, Left = { Percent = 0f }, VAlign = 1f, Top = { Pixels = -30 } }.WithFadedMouseOver(); buttonOk.OnClick += OKClick; area.Append(buttonOk); buttonAlt = new UITextPanel <string>("???", 0.7f, true) { Width = { Pixels = -10, Percent = 0.5f }, Height = { Pixels = 50 }, Left = { Percent = .5f }, VAlign = 1f, Top = { Pixels = -30 } }.WithFadedMouseOver(); buttonAlt.OnClick += AltClick; area.Append(buttonAlt); Append(area); }
public override void OnInitialize() { area = new UIElement { Width = { Percent = 0.8f }, Top = { Pixels = 200 }, Height = { Pixels = -210, Percent = 1f }, HAlign = 0.5f }; messageBox = new UIMessageBox("") { Width = { Percent = 1f }, Height = { Pixels = -110, Percent = 1f }, HAlign = 0.5f }; area.Append(messageBox); continueButton = new UITextPanel <string>("", 0.7f, true) { Width = { Pixels = -10, Percent = 0.5f }, Height = { Pixels = 50 }, Top = { Pixels = -108, Percent = 1f } }; continueButton.WithFadedMouseOver(); continueButton.OnClick += ContinueClick; area.Append(continueButton); var openLogsButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.OpenLogs"), 0.7f, true); openLogsButton.CopyStyle(continueButton); openLogsButton.HAlign = 1f; openLogsButton.WithFadedMouseOver(); openLogsButton.OnClick += OpenFile; area.Append(openLogsButton); webHelpButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.OpenWebHelp"), 0.7f, true); webHelpButton.CopyStyle(openLogsButton); webHelpButton.Top.Set(-55f, 1f); webHelpButton.WithFadedMouseOver(); webHelpButton.OnClick += VisitRegisterWebpage; area.Append(webHelpButton); skipLoadButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.SkipToMainMenu"), 0.7f, true); skipLoadButton.CopyStyle(continueButton); skipLoadButton.Top.Set(-55f, 1f); skipLoadButton.WithFadedMouseOver(); skipLoadButton.OnClick += SkipLoad; area.Append(skipLoadButton); exitAndDisableAllButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.ExitAndDisableAll"), 0.7f, true); exitAndDisableAllButton.CopyStyle(skipLoadButton); exitAndDisableAllButton.TextColor = Color.Red; exitAndDisableAllButton.WithFadedMouseOver(); exitAndDisableAllButton.OnClick += ExitAndDisableAll; Append(area); }
public UIErrorMessage() { if (Main.dedServ) { return; } message = new UIMessageBox(""); continueButton = new UITextPanel <string>("", 0.7f, true); }
private void ShowOfflineTroubleshootingMessage() { var message = new UIMessageBox(Language.GetTextValue("tModLoader.MBOfflineTroubleshooting")); message.Width.Set(0, 1); message.Height.Set(400, 0); message.OnDoubleClick += (a, b) => { System.Diagnostics.Process.Start("http://javid.ddns.net/tModLoader/DirectModDownloadListing.php"); }; modList.Add(message); message.SetScrollbar(new UIScrollbar()); uIPanel.RemoveChild(uILoader); }
public override void OnInitialize() { uIElement = new UIElement(); uIElement.Width.Set(0f, 0.8f); uIElement.MaxWidth.Set(600f, 0f); uIElement.Top.Set(220f, 0f); uIElement.Height.Set(-220f, 1f); uIElement.HAlign = 0.5f; UIPanel uIPanel = new UIPanel(); uIPanel.Width.Set(0f, 1f); uIPanel.Height.Set(-110f, 1f); uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uIElement.Append(uIPanel); modInfo = new UIMessageBox("This is a test of mod info here."); modInfo.Width.Set(-25f, 1f); modInfo.Height.Set(0f, 1f); uIPanel.Append(modInfo); UIScrollbar uIScrollbar = new UIScrollbar(); uIScrollbar.SetView(100f, 1000f); uIScrollbar.Height.Set(0f, 1f); uIScrollbar.HAlign = 1f; uIPanel.Append(uIScrollbar); modInfo.SetScrollbar(uIScrollbar); uITextPanel = new UITextPanel("Mod Info", 0.8f, true); uITextPanel.HAlign = 0.5f; uITextPanel.Top.Set(-35f, 0f); uITextPanel.SetPadding(15f); uITextPanel.BackgroundColor = new Color(73, 94, 171); uIElement.Append(uITextPanel); modHomepageButton = new UITextPanel("Visit the Mod's Homepage for even more info", 1f, false); modHomepageButton.Width.Set(-10f, 1f); modHomepageButton.Height.Set(25f, 0f); modHomepageButton.VAlign = 1f; modHomepageButton.Top.Set(-65f, 0f); modHomepageButton.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver); modHomepageButton.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut); modHomepageButton.OnClick += new UIElement.MouseEvent(VisitModHomePage); uIElement.Append(modHomepageButton); UITextPanel backButton = new UITextPanel("Back", 1f, false); backButton.Width.Set(-10f, 0.5f); backButton.Height.Set(25f, 0f); backButton.VAlign = 1f; backButton.Top.Set(-20f, 0f); backButton.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver); backButton.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut); backButton.OnClick += new UIElement.MouseEvent(BackClick); uIElement.Append(backButton); base.Append(uIElement); }
public override void OnInitialize() { UIElement uIElement = new UIElement(); uIElement.Width.Set(0f, 0.8f); uIElement.MaxWidth.Set(600f, 0f); uIElement.Top.Set(220f, 0f); uIElement.Height.Set(-220f, 1f); uIElement.HAlign = 0.5f; UIPanel uIPanel = new UIPanel(); uIPanel.Width.Set(0f, 1f); uIPanel.Height.Set(-110f, 1f); uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uIElement.Append(uIPanel); modInfo = new UIMessageBox("This is a test of mod info here."); modInfo.Width.Set(0f, 1f); modInfo.Height.Set(0f, 1f); uIPanel.Append(modInfo); uITextPanel = new UITextPanel("Mod Info", 0.8f, true); uITextPanel.HAlign = 0.5f; uITextPanel.Top.Set(-35f, 0f); uITextPanel.SetPadding(15f); uITextPanel.BackgroundColor = new Color(73, 94, 171); uIElement.Append(uITextPanel); UITextPanel button3 = new UITextPanel("Back", 1f, false); button3.Width.Set(-10f, 0.5f); button3.Height.Set(25f, 0f); button3.VAlign = 1f; button3.Top.Set(-20f, 0f); button3.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver); button3.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut); button3.OnClick += new UIElement.MouseEvent(BackClick); uIElement.Append(button3); base.Append(uIElement); }
public override void OnInitialize() { _uIElement = new UIElement { Width = { Percent = 0.8f }, MaxWidth = UICommon.MaxPanelWidth, Top = { Pixels = 220 }, Height = { Pixels = -220, Percent = 1f }, HAlign = 0.5f }; var uIPanel = new UIPanel { Width = { Percent = 1f }, Height = { Pixels = -110, Percent = 1f }, BackgroundColor = UICommon.MainPanelBackground }; _uIElement.Append(uIPanel); _modInfo = new UIMessageBox(string.Empty) { Width = { Pixels = -25, Percent = 1f }, Height = { Percent = 1f } }; uIPanel.Append(_modInfo); var uIScrollbar = new UIScrollbar { Height = { Pixels = -20, Percent = 1f }, VAlign = 0.5f, HAlign = 1f }.WithView(100f, 1000f); uIPanel.Append(uIScrollbar); _modInfo.SetScrollbar(uIScrollbar); _uITextPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.ModInfoHeader"), 0.8f, true) { HAlign = 0.5f, Top = { Pixels = -35 }, BackgroundColor = UICommon.DefaultUIBlue }.WithPadding(15f); _uIElement.Append(_uITextPanel); _modHomepageButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModInfoVisitHomepage")) { Width = { Percent = 1f }, Height = { Pixels = 40 }, VAlign = 1f, Top = { Pixels = -65 } }.WithFadedMouseOver(); _modHomepageButton.OnClick += VisitModHomePage; var backButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("UI.Back")) { Width = { Pixels = -10, Percent = 0.333f }, Height = { Pixels = 40 }, VAlign = 1f, Top = { Pixels = -20 } }.WithFadedMouseOver(); backButton.OnClick += BackClick; _uIElement.Append(backButton); _extractButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModInfoExtract")) { Width = { Pixels = -10, Percent = 0.333f }, Height = { Pixels = 40 }, VAlign = 1f, HAlign = 0.5f, Top = { Pixels = -20 } }.WithFadedMouseOver(); _extractButton.OnClick += ExtractMod; _deleteButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("UI.Delete")) { Width = { Pixels = -10, Percent = 0.333f }, Height = { Pixels = 40 }, VAlign = 1f, HAlign = 1f, Top = { Pixels = -20 } }.WithFadedMouseOver(); _deleteButton.OnClick += DeleteMod; _fakeDeleteButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("UI.Delete")) { Width = { Pixels = -10, Percent = 0.333f }, Height = { Pixels = 40 }, VAlign = 1f, HAlign = 1f, Top = { Pixels = -20 } }; _fakeDeleteButton.BackgroundColor = Color.Gray; Append(_uIElement); }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (!_updateRequired) { return; } _updateRequired = false; _backPanel.RemoveAllChildren(); int i = 0; UIMessageBox AddMessageBox(string text) { var msgBox = new UIMessageBox(text) { Width = { Percent = 1f }, Height = { Percent = .2f }, Top = { Percent = (i++) / 4f + 0.05f }, }.WithPadding(6); _backPanel.Append(msgBox); msgBox.Activate(); return(msgBox); } void AddButton(UIElement elem, string text, Action clickAction) { var button = new UITextPanel <string>(text) { Top = { Pixels = -2 }, Left = { Pixels = -2 }, HAlign = 1, VAlign = 1 }.WithFadedMouseOver(); button.OnClick += (evt, _) => clickAction(); button.Activate(); elem.Append(button); } bool frameworkCheck = ModCompile.RoslynCompatibleFrameworkCheck(out var dotNetMsg); if (monoStartScriptsUpdated) { dotNetMsg = Language.GetTextValue("tModLoader.DMScriptsRequireRestart"); } var dotNetMsgBox = AddMessageBox(dotNetMsg); if (!frameworkCheck && !monoStartScriptsUpdated) { if (ModCompile.systemMonoSuitable) { AddButton(dotNetMsgBox, Language.GetTextValue("tModLoader.DMUpdateScripts"), UpdateMonoStartScripts); } else if (FrameworkVersion.Framework == Framework.Mono) { AddButton(dotNetMsgBox, Language.GetTextValue("tModLoader.MBDownload"), DownloadMono); } else { AddButton(dotNetMsgBox, Language.GetTextValue("tModLoader.MBDownload"), DownloadDotNet); } } bool modCompileCheck = ModCompile.ModCompileVersionCheck(out var modCompileMsg); if (!modCompileCheck && !ModBrowser.UIModBrowser.PlatformSupportsTls12) { modCompileMsg = "tModLoader.DMUpdateMonoToDownloadModCompile"; } var modCompileMsgBox = AddMessageBox(Language.GetTextValue(modCompileMsg)); #if !DEBUG if (!modCompileCheck && ModBrowser.UIModBrowser.PlatformSupportsTls12) { AddButton(modCompileMsgBox, Language.GetTextValue("tModLoader.MBDownload"), DownloadModCompile); } #endif bool refAssemCheck = ModCompile.ReferenceAssembliesCheck(out var refAssemMsg); var refAssemMsgBox = AddMessageBox(refAssemMsg); if (!refAssemCheck) { if (ModCompile.PlatformSupportsVisualStudio) { AddButton(refAssemMsgBox, Language.GetTextValue("tModLoader.DMVisualStudio"), DevelopingWithVisualStudio); } var icon = UICommon.ButtonExclamationTexture; _refAssemDirectDlButton = new UIHoverImage(icon, Language.GetTextValue("tModLoader.DMReferenceAssembliesDownload")) { Left = { Pixels = -1 }, Top = { Pixels = -1 }, VAlign = 1, }; _refAssemDirectDlButton.OnClick += (evt, _) => DirectDownloadRefAssemblies(); refAssemMsgBox.Append(_refAssemDirectDlButton); } var tutorialMsgBox = AddMessageBox(Language.GetTextValue("tModLoader.DMTutorialWelcome")); AddButton(tutorialMsgBox, Language.GetTextValue("tModLoader.DMTutorial"), OpenTutorial); _allChecksSatisfied = frameworkCheck && modCompileCheck && refAssemCheck; _bottomButton.SetText(_allChecksSatisfied ? Language.GetTextValue("tModLoader.Continue") : Language.GetTextValue("UI.Back")); }
public override void OnInitialize() { uIElement = new UIElement(); uIElement.Width.Set(0f, 0.8f); uIElement.MaxWidth.Set(600f, 0f); uIElement.Top.Set(220f, 0f); uIElement.Height.Set(-220f, 1f); uIElement.HAlign = 0.5f; UIPanel uIPanel = new UIPanel(); uIPanel.Width.Set(0f, 1f); uIPanel.Height.Set(-110f, 1f); uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uIElement.Append(uIPanel); modInfo = new UIMessageBox("This is a test of mod info here."); modInfo.Width.Set(-25f, 1f); modInfo.Height.Set(0f, 1f); uIPanel.Append(modInfo); UIScrollbar uIScrollbar = new UIScrollbar(); uIScrollbar.SetView(100f, 1000f); uIScrollbar.Height.Set(-20, 1f); uIScrollbar.VAlign = 0.5f; uIScrollbar.HAlign = 1f; uIPanel.Append(uIScrollbar); modInfo.SetScrollbar(uIScrollbar); uITextPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.ModInfoHeader"), 0.8f, true) { HAlign = 0.5f }; uITextPanel.Top.Set(-35f, 0f); uITextPanel.SetPadding(15f); uITextPanel.BackgroundColor = new Color(73, 94, 171); uIElement.Append(uITextPanel); modHomepageButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModInfoVisitHomepage"), 1f, false); modHomepageButton.Width.Set(0f, 1f); modHomepageButton.Height.Set(40f, 0f); modHomepageButton.VAlign = 1f; modHomepageButton.Top.Set(-65f, 0f); modHomepageButton.OnMouseOver += UICommon.FadedMouseOver; modHomepageButton.OnMouseOut += UICommon.FadedMouseOut; modHomepageButton.OnClick += VisitModHomePage; uIElement.Append(modHomepageButton); UIAutoScaleTextTextPanel <string> backButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("UI.Back"), 1f, false); backButton.Width.Set(-10f, 0.333f); backButton.Height.Set(40f, 0f); backButton.VAlign = 1f; backButton.Top.Set(-20f, 0f); backButton.OnMouseOver += UICommon.FadedMouseOver; backButton.OnMouseOut += UICommon.FadedMouseOut; backButton.OnClick += BackClick; uIElement.Append(backButton); extractButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModInfoExtract"), 1f, false); extractButton.Width.Set(-10f, 0.333f); extractButton.Height.Set(40f, 0f); extractButton.VAlign = 1f; extractButton.HAlign = 0.5f; extractButton.Top.Set(-20f, 0f); extractButton.OnMouseOver += UICommon.FadedMouseOver; extractButton.OnMouseOut += UICommon.FadedMouseOut; extractButton.OnClick += ExtractClick; uIElement.Append(extractButton); deleteButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("UI.Delete"), 1f, false); deleteButton.Width.Set(-10f, 0.333f); deleteButton.Height.Set(40f, 0f); deleteButton.VAlign = 1f; deleteButton.HAlign = 1f; deleteButton.Top.Set(-20f, 0f); deleteButton.OnMouseOver += UICommon.FadedMouseOver; deleteButton.OnMouseOut += UICommon.FadedMouseOut; deleteButton.OnClick += DeleteClick; uIElement.Append(deleteButton); Append(uIElement); }
public override void OnActivate() { backPanel.RemoveAllChildren(); int i = 0; UIMessageBox AddMessageBox(bool check, string text) { var msgBox = new UIMessageBox(text); msgBox.Width = new StyleDimension(0, 1f); msgBox.Height = new StyleDimension(0, .2f); msgBox.Top = new StyleDimension(0, (i++) / 4f + 0.05f); backPanel.Append(msgBox); return(msgBox); } UITextPanel <string> AddButton(UIElement elem, string text, Action clickAction) { var button = new UITextPanel <string>(text) { Top = new StyleDimension(-2, 0), Left = new StyleDimension(-2, 0), HAlign = 1, VAlign = 1 }; button.OnMouseOver += UICommon.FadedMouseOver; button.OnMouseOut += UICommon.FadedMouseOut; button.OnClick += (evt, _) => clickAction(); elem.Append(button); return(button); } bool dotNetCheck = ModCompile.DotNet46Check(out var dotNetMsg); var dotNetMsgBox = AddMessageBox(dotNetCheck, Language.GetTextValue(dotNetMsg, $"{FrameworkVersion.Framework} {FrameworkVersion.Version}")); if (!dotNetCheck) { AddButton(dotNetMsgBox, Language.GetTextValue("tModLoader.MBDownload"), DownloadDotNet); } bool modCompileCheck = ModCompile.ModCompileVersionCheck(out var modCompileMsg); var modCompileMsgBox = AddMessageBox(modCompileCheck, Language.GetTextValue(modCompileMsg)); #if !DEBUG if (!modCompileCheck) { AddButton(modCompileMsgBox, Language.GetTextValue("tModLoader.MBDownload"), DownloadModCompile); } #endif bool refAssemCheck = ModCompile.ReferenceAssembliesCheck(out var refAssemMsg); var refAssemMsgBox = AddMessageBox(refAssemCheck, Language.GetTextValue(refAssemMsg)); if (!refAssemCheck) { var vsButton = AddButton(refAssemMsgBox, Language.GetTextValue("tModLoader.DMVisualStudio"), DevelopingWithVisualStudio); var icon = Texture2D.FromStream(Main.instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.ButtonExclamation.png")); refAssemDirectDlButton = new UIHoverImage(icon, Language.GetTextValue("tModLoader.DMReferenceAssembliesDownload")) { Left = new StyleDimension(-1, 0f), Top = new StyleDimension(-1, 0f), VAlign = 1, }; refAssemDirectDlButton.OnClick += (evt, _) => DirectDownloadRefAssemblies(); refAssemMsgBox.Append(refAssemDirectDlButton); } var tutorialMsgBox = AddMessageBox(true, Language.GetTextValue("tModLoader.DMTutorialWelcome")); AddButton(tutorialMsgBox, Language.GetTextValue("tModLoader.DMTutorial"), OpenTutorial); allChecksSatisfied = dotNetCheck && modCompileCheck && refAssemCheck; bottomButton.SetText(allChecksSatisfied ? Language.GetTextValue("tModLoader.Continue") : Language.GetTextValue("UI.Back")); }