private void OnGameLaunched(object sender, EventArgs e) { TileActionHandler.Initialize(Helper); ImageMenu.Setup(Helper); MapMenu.Setup(Helper); TrashCans.Setup(Helper); RSVWorldMap.Setup(Helper); ExternalAPIs.Initialize(Helper); Config = Helper.ReadConfig <ModConfig>(); if (!Helper.ModRegistry.IsLoaded("spacechase0.JsonAssets")) { Log.Error("JSON Assets is not loaded! This mod *requires* JSON Assets!"); return; } // Custom CP Token Set-up CustomCPTokens.RegisterTokens(); Helper.ConsoleCommands.Add("RSV_reset_pedestals", "", ResetPedestals); Helper.ConsoleCommands.Add("RSV_open_portal", "", OpenPortal); // RSV_rivera_secret in Patches/WalletItem // Generic Mod Config Menu setup ConfigMenu.RegisterMenu(); }
internal static void Open(string tileAction, Vector2 position) { //parse string //has form "ShowImage "path/to/file" scale [i18nkey]" var quoteSplit = tileAction.Split('"'); if (quoteSplit.Length < 3) { Log.Debug($"Error in {tileAction}. (Perhaps you missed a \"?"); return; } string path = quoteSplit[1]; var split = quoteSplit[2].Trim().Split(' '); float scale = 1f; if(!float.TryParse(split[0],out scale)) { scale = 4f; } bool showTextBefore = false; if (split.Length >= 2 && split[1].Length > 0) { Log.Debug("has i18n key argument"); var i18n_key = split[1]; string text = Helper.Translation.Get(i18n_key); if (text != null && !text.StartsWith("(no")) { showTextBefore = true; string tileActionShortened = $"ShowImage \"{path}\" {scale}"; Game1.activeClickableMenu = new DialogueBox(text); Game1.afterDialogues = delegate { ImageMenu.Open(tileActionShortened, position); }; } else { Log.Debug($"No translation found for {i18n_key}: {text}"); } } if (!showTextBefore) { Texture2D image = ModEntry.Helper.Content.Load<Texture2D>(PathUtilities.NormalizePath(path), ContentSource.GameContent); Vector2 topLeft = Utility.getTopLeftPositionForCenteringOnScreen((int)(image.Width * scale), (int)(image.Height * scale)); Game1.activeClickableMenu = new ImageMenu((int)topLeft.X, (int)topLeft.Y, scale, image); } }
private static void OpenDaiaBook() { Game1.activeClickableMenu = new DialogueBox(Helper.Translation.Get("Daia.BookOpen")); if (!Game1.player.eventsSeen.Contains(HasUnsealedRae)) { var responses = new List <Response> { new Response("page1", Helper.Translation.Get("Daia.Page1")), new Response("page2", Helper.Translation.Get("Daia.Page2")), new Response("page3", Helper.Translation.Get("Daia.Page3")), new Response("page4", Helper.Translation.Get("Daia.Page4")), new Response("cancel", Helper.Translation.Get("Daia.BookClose")), }; var responseActions = new List <Action> { delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint1")); }, delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint2")); }, delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint3")); }, delegate { ImageMenu.Open("ShowImage \"LooseSprites/RSVDaiaPage4\" 4f", Vector2.Zero); }, delegate {} }; Game1.activeClickableMenu = new DialogueBoxWithActions(Helper.Translation.Get("Daia.BookPages"), responses, responseActions); } else if (Game1.player.eventsSeen.Contains(HasUnsealedRae) && !Game1.player.eventsSeen.Contains(75160265)) { var responses = new List <Response> { new Response("page1", Helper.Translation.Get("Daia.Page1")), new Response("page2", Helper.Translation.Get("Daia.Page2")), new Response("page3", Helper.Translation.Get("Daia.Page3")), new Response("page4", Helper.Translation.Get("Daia.Page4")), new Response("page5", Helper.Translation.Get("Daia.Page5")), new Response("page6", Helper.Translation.Get("Daia.Page6")), new Response("page7", Helper.Translation.Get("Daia.Page7")), new Response("cancel", Helper.Translation.Get("Daia.BookClose")), }; var responseActions = new List <Action> { delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint1")); }, delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint2")); }, delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint3")); }, delegate { ImageMenu.Open("ShowImage \"LooseSprites/RSVDaiaPage4\" 4f", Vector2.Zero); }, delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint4")); }, delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint5")); }, delegate { ImageMenu.Open("ShowImage \"LooseSprites/RSVDaiaPage7\" 4f", Vector2.Zero); }, delegate {} }; Game1.activeClickableMenu = new DialogueBoxWithActions(Helper.Translation.Get("Daia.BookPages"), responses, responseActions); } else if (Game1.player.eventsSeen.Contains(75160265)) { var responses = new List <Response> { new Response("page1", Helper.Translation.Get("Daia.Page1")), new Response("page2", Helper.Translation.Get("Daia.Page2")), new Response("page3", Helper.Translation.Get("Daia.Page3")), new Response("page4", Helper.Translation.Get("Daia.Page4")), new Response("page5", Helper.Translation.Get("Daia.Page5")), new Response("page6", Helper.Translation.Get("Daia.Page6")), new Response("page7", Helper.Translation.Get("Daia.Page7")), new Response("page8", Helper.Translation.Get("Daia.LegendFishes")), new Response("cancel", Helper.Translation.Get("Daia.BookClose")), }; var responseActions = new List <Action> { delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint1")); }, delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint2")); }, delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint3")); }, delegate { ImageMenu.Open("ShowImage \"LooseSprites/RSVDaiaPage4\" 4f", Vector2.Zero); }, delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint4")); }, delegate { Game1.activeClickableMenu = new LetterViewerMenu(Helper.Translation.Get("Daia.RelicHint5")); }, delegate { ImageMenu.Open("ShowImage \"LooseSprites/RSVDaiaPage7\" 4f", Vector2.Zero); }, delegate { ImageMenu.Open("ShowImage \"LooseSprites/RSVDaiaPage8\" 4f", Vector2.Zero); }, delegate {} }; Game1.activeClickableMenu = new DialogueBoxWithActions(Helper.Translation.Get("Daia.BookPages"), responses, responseActions); } }