internal static void ChooseFromListMenuPatch(ChooseFromListMenu __instance, List <string> ___options, int ___index, bool ___isJukebox) { try { int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position string toSpeak = ""; if (__instance.okButton != null && __instance.okButton.containsPoint(x, y)) { toSpeak = "Select " + (___isJukebox ? Utility.getSongTitleFromCueName(___options[___index]) : ___options[___index]) + " button"; } else if (__instance.cancelButton != null && __instance.cancelButton.containsPoint(x, y)) { toSpeak = "Cancel button"; } else if (__instance.backButton != null && __instance.backButton.containsPoint(x, y)) { toSpeak = "Previous option: " + (___isJukebox ? Utility.getSongTitleFromCueName(___options[Math.Max(0, ___index - 1)]) : ___options[Math.Max(0, ___index - 1)]) + " button"; } else if (__instance.forwardButton != null && __instance.forwardButton.containsPoint(x, y)) { toSpeak = "Next option: " + (___isJukebox ? Utility.getSongTitleFromCueName(___options[Math.Min(___options.Count, ___index + 1)]) : ___options[Math.Min(___options.Count, ___index + 1)]) + " button"; } MainClass.ScreenReader.SayWithMenuChecker(toSpeak, true); } catch (System.Exception e) { MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } }
static bool CheckForAction_Prefix(Sign __instance, Farmer who, bool justCheckingForActivity, ref bool __result) { // Pass through the passive checks if (justCheckingForActivity) { return(true); } // if the sign has anything on it, never allow changes if (__instance.displayType.Value != 0 || __instance.displayItem.Value != null) { return(false); } // if clicking with empty hands, allow more options if (who.CurrentItem == null) { var menu = new ChooseFromListMenu(npcs, (s) => { instance.Monitor.Log($"!!!!!!{s}"); __instance.displayType.Value = idOfNPC(s); }, false); Game1.activeClickableMenu = menu; __result = true; return(false); } // otherwise pass through return(true); }
public MusicMenu(List <string> songs, actionOnChoosingListOption chooseAction, bool isJukebox = false, string default_selection = null) : base(0, 0, 0, 0, showUpperRightCloseButton: true) { // Filter songs using base game logic ChooseFromListMenu.FilterJukeboxTracks(songs); this.songs = songs; this.chooseAction = chooseAction; Game1.playSound("bigSelect"); this.PaginateSongs(); base.width = Game1.uiViewport.Width / 2 < maxSongWidth ? Game1.uiViewport.Width / 4 + maxSongWidth : Game1.uiViewport.Width / 2; base.height = 576; if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ko || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.fr) { base.height += 64; } Vector2 topLeft = Utility.getTopLeftPositionForCenteringOnScreen(base.width, base.height); base.xPositionOnScreen = (int)topLeft.X; base.yPositionOnScreen = (int)topLeft.Y + 32; // Create the buttons used for teleporting and renaming this.songButtons = new List <ClickableComponent>(); for (int i = 0; i < songsPerPage; i++) { this.songButtons.Add(new ClickableComponent(new Rectangle(base.xPositionOnScreen + 16, base.yPositionOnScreen + 16 + i * ((base.height - 32) / songsPerPage), base.width - 32, (base.height - 32) / songsPerPage + 4), string.Concat(i)) { myID = i, downNeighborID = -7777, upNeighborID = ((i > 0) ? (i - 1) : (-1)), rightNeighborID = i + 103, leftNeighborID = -7777, fullyImmutable = true }); } base.upperRightCloseButton = new ClickableTextureComponent(new Rectangle(base.xPositionOnScreen + base.width - 20, base.yPositionOnScreen - 8, 48, 48), Game1.mouseCursors, new Rectangle(337, 494, 12, 12), 4f); this.backButton = new ClickableTextureComponent(new Rectangle(base.xPositionOnScreen - 64, base.yPositionOnScreen + base.height - 48, 48, 44), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), 4f) { myID = region_backButton, rightNeighborID = -7777 }; this.forwardButton = new ClickableTextureComponent(new Rectangle(base.xPositionOnScreen + base.width + 64 - 48, base.yPositionOnScreen + base.height - 48, 48, 44), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), 4f) { myID = region_forwardButton }; if (Game1.options.SnappyMenus) { base.populateClickableComponentList(); this.snapToDefaultClickableComponent(); } }