示例#1
0
        public static void Junimo_ctor_Postfix(
            Junimo __instance,
            Vector2 position,
            int whichArea)
        {
            if (whichArea >= Bundles.CustomAreaInitialIndex &&
                !Bundles.IsAbandonedJojaMartBundleAvailableOrComplete())
            {
                CustomCommunityCentre.Data.BundleMetadata bundleMetadata = Bundles.GetAllCustomBundleMetadataEntries()
                                                                           .First(bmd => Bundles.GetCustomAreaNumberFromName(bmd.AreaName) == whichArea);

                __instance.friendly.Value = Bundles.IsAreaComplete(cc: Bundles.CC, areaNumber: whichArea);

                int restoreAreaPhase = Reflection.GetField
                                       <int>
                                           (obj: Bundles.CC, name: "restoreAreaPhase")
                                       .GetValue();
                if (restoreAreaPhase != CommunityCenter.PHASE_junimoAppear)
                {
                    Reflection.GetField
                    <Netcode.NetColor>
                        (obj: __instance, name: "color")
                    .GetValue()
                    .Set(bundleMetadata.Colour);
                }
            }
        }
示例#2
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;
                }
            }
        }