예제 #1
0
        public BundleRoom(CommunityCenterBundles Bundles, string Name, List <Tuple <int, string> > Tasks)
        {
            this.Bundles = Bundles;
            this.Name    = Name;
            int RoomNumber = CommunityCenter.getAreaNumberFromName(Name);

            this.DisplayName = CommunityCenter.getAreaDisplayNameFromNumber(RoomNumber);
            this.Tasks       = Tasks.Select(x => new BundleTask(this, x.Item1, x.Item2)).ToList().AsReadOnly();
        }
예제 #2
0
        internal static void JunimoNoteMenuPatch(JunimoNoteMenu __instance, bool ___specificBundlePage, int ___whichArea, Bundle ___currentPageBundle)
        {
            try
            {
                int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
                if (!___specificBundlePage)
                {
                    currentIngredientListItem = -1;
                    isUsingCustomButtons      = false;

                    string areaName = __instance.scrambledText ? CommunityCenter.getAreaEnglishDisplayNameFromNumber(___whichArea) : CommunityCenter.getAreaDisplayNameFromNumber(___whichArea);
                    string reward   = __instance.getRewardNameForArea(___whichArea);

                    if (__instance.scrambledText)
                    {
                        string toSpeak = "Scrambled Text";
                        if (junimoNoteMenuQuery != toSpeak)
                        {
                            junimoNoteMenuQuery = toSpeak;
                            MainClass.ScreenReader.Say(toSpeak, true);
                        }
                        return;
                    }

                    if (currentJunimoArea != areaName)
                    {
                        currentJunimoArea = areaName;
                        MainClass.DebugLog(areaName);
                        MainClass.ScreenReader.Say($"Area {areaName}, {reward}", true);
                        return;
                    }

                    for (int i = 0; i < __instance.bundles.Count; i++)
                    {
                        if (__instance.bundles[i].containsPoint(x, y))
                        {
                            string toSpeak = $"{__instance.bundles[i].name} bundle";
                            if (junimoNoteMenuQuery != toSpeak)
                            {
                                junimoNoteMenuQuery = toSpeak;
                                MainClass.ScreenReader.Say(toSpeak, true);
                            }
                            return;
                        }
                    }
                    if (__instance.presentButton != null && __instance.presentButton.containsPoint(x, y))
                    {
                        string toSpeak = "Present Button";
                        if (junimoNoteMenuQuery != toSpeak)
                        {
                            junimoNoteMenuQuery = toSpeak;
                            MainClass.ScreenReader.Say(toSpeak, true);
                        }
                        return;
                    }
                    if (__instance.fromGameMenu)
                    {
                        if (__instance.areaNextButton.visible && __instance.areaNextButton.containsPoint(x, y))
                        {
                            string toSpeak = "Next Area Button";
                            if (junimoNoteMenuQuery != toSpeak)
                            {
                                junimoNoteMenuQuery = toSpeak;
                                MainClass.ScreenReader.Say(toSpeak, true);
                            }
                            return;
                        }
                        if (__instance.areaBackButton.visible && __instance.areaBackButton.containsPoint(x, y))
                        {
                            string toSpeak = "Previous Area Button";
                            if (junimoNoteMenuQuery != toSpeak)
                            {
                                junimoNoteMenuQuery = toSpeak;
                                MainClass.ScreenReader.Say(toSpeak, true);
                            }
                            return;
                        }
                    }
                }
                else
                {
                    bool isIPressed         = MainClass.Config.BundleMenuIngredientsInputSlotKey.JustPressed(); // For the ingredients
                    bool isCPressed         = MainClass.Config.BundleMenuInventoryItemsKey.JustPressed();       // For the items in inventory
                    bool isPPressed         = MainClass.Config.BundleMenuPurchaseButtonKey.JustPressed();       // For the Purchase Button
                    bool isVPressed         = MainClass.Config.BundleMenuIngredientsInputSlotKey.JustPressed(); // For the ingredient input slots
                    bool isBackPressed      = MainClass.Config.BundleMenuBackButtonKey.JustPressed();           // For the back button
                    bool isLeftShiftPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift);

                    if (isIPressed && !isUsingCustomButtons)
                    {
                        isUsingCustomButtons = true;
                        JunimoNoteCustomButtons(__instance, ___currentPageBundle, 0, isLeftShiftPressed);
                        Task.Delay(200).ContinueWith(_ => { isUsingCustomButtons = false; });
                    }
                    else if (isVPressed && !isUsingCustomButtons)
                    {
                        isUsingCustomButtons = true;
                        JunimoNoteCustomButtons(__instance, ___currentPageBundle, 1, isLeftShiftPressed);
                        Task.Delay(200).ContinueWith(_ => { isUsingCustomButtons = false; });
                    }
                    else if (isCPressed && !isUsingCustomButtons)
                    {
                        isUsingCustomButtons = true;
                        JunimoNoteCustomButtons(__instance, ___currentPageBundle, 2, isLeftShiftPressed);
                        Task.Delay(200).ContinueWith(_ => { isUsingCustomButtons = false; });
                    }
                    else if (isBackPressed && __instance.backButton != null && !__instance.backButton.containsPoint(x, y))
                    {
                        __instance.backButton.snapMouseCursorToCenter();
                        MainClass.ScreenReader.Say("Back Button", true);
                    }
                    else if (isPPressed && __instance.purchaseButton != null && !__instance.purchaseButton.containsPoint(x, y))
                    {
                        __instance.purchaseButton.snapMouseCursorToCenter();
                        MainClass.ScreenReader.Say("Purchase Button", true);
                    }
                }
            }
            catch (Exception e)
            {
                MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
            }
        }