Exemplo n.º 1
0
        public static void JunimoNoteMenu_ctor_Postfix(
            JunimoNoteMenu __instance,
            bool fromGameMenu,
            int area,
            bool fromThisMenu)
        {
            CommunityCenter cc = Bundles.CC;

            if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete())
            {
                return;
            }

            IReflectedField <int> whichAreaField = Reflection.GetField
                                                   <int>
                                                       (__instance, "whichArea");

            bool isAreaSet       = false;
            bool isNavigationSet = false;

            foreach (string areaName in Bundles.GetAllAreaNames())
            {
                int areaNumber = CommunityCenter.getAreaNumberFromName(areaName);

                // Set default area for menu view with custom areas
                if (!isAreaSet &&
                    fromGameMenu && !fromThisMenu && !isAreaSet &&
                    cc.shouldNoteAppearInArea(areaNumber) && !Bundles.IsAreaComplete(cc: cc, areaNumber: areaNumber))
                {
                    area = areaNumber;
                    whichAreaField.SetValue(area);
                    isAreaSet = true;
                }

                // Show navigation arrows when custom areas
                if (!isNavigationSet &&
                    areaNumber >= 0 && areaNumber != area && cc.shouldNoteAppearInArea(areaNumber))
                {
                    __instance.areaNextButton.visible = true;
                    __instance.areaBackButton.visible = true;
                    isNavigationSet = true;
                }

                if (isAreaSet && isNavigationSet)
                {
                    break;
                }
            }
        }