Example #1
0
        private static bool Prefix(UIDate __instance)
        {
            if (!Main.enabled)
            {
                return(true);
            }

            AutoHarvest.GetAllBooties();

            ResourceMaintainer.TryBuyingResources();

            ResourceMaintainer.UpdateResourceWarning();

            TurnEvent.AddEvent(__instance);

            if (Main.settings.autoAssignBuildingWorkers)
            {
                HumanResource hr          = new HumanResource();
                int           mainPartId  = int.Parse(DateFile.instance.GetGangDate(16, 3));
                int           mainPlaceId = int.Parse(DateFile.instance.GetGangDate(16, 4));
                hr.AssignBuildingWorkers(mainPartId, mainPlaceId);
            }

            return(true);
        }
Example #2
0
        // 设置过月事件文字
        public static void SetEventText(WindowManage __instance, bool on, GameObject tips)
        {
            if (tips == null || !on)
            {
                return;
            }
            if (tips.tag != "TrunEventIcon")
            {
                return;
            }

            string[] eventParams = tips.name.Split(',');
            int      eventId     = (eventParams.Length > 1) ? int.Parse(eventParams[1]) : 0;

            if (eventId != TurnEvent.EVENT_ID)
            {
                return;
            }

            __instance.informationName.text = DateFile.instance.trunEventDate[eventId][0];

            __instance.informationMassage.text = "您的管家向您禀报:\n" + AutoHarvest.GetBootiesSummary();

            if (!string.IsNullOrEmpty(ResourceMaintainer.shoppingRecord))
            {
                __instance.informationMassage.text += "\n" + ResourceMaintainer.shoppingRecord;
            }

            if (!string.IsNullOrEmpty(ResourceMaintainer.resourceWarning))
            {
                __instance.informationMassage.text += "\n" + ResourceMaintainer.resourceWarning;
            }
        }
Example #3
0
        // 获取所有据点的所有收获物
        public static void GetAllBooties()
        {
            AutoHarvest.InitializeBooties();

            foreach (var parts in DateFile.instance.homeShopBootysDate)
            {
                int partId = parts.Key;
                var places = parts.Value;
                foreach (var place in places)
                {
                    int placeId   = place.Key;
                    var buildings = place.Value;
                    foreach (var building in buildings)
                    {
                        int buildingIndex = building.Key;
                        var booties       = building.Value;
                        foreach (var booty in booties.ToArray())
                        {
                            bool gotBooty = AutoHarvest.GetBooty(partId, placeId, buildingIndex, booty);
                            if (gotBooty)
                            {
                                booties.Remove(booty);
                                AutoHarvest.RecordBooty(booty);
                            }
                        }
                    }
                }
            }
        }
Example #4
0
        static void Postfix(WindowManage __instance, bool on, GameObject tips)
        {
            if (!Main.enabled)
            {
                return;
            }

            AutoHarvest.SetEventText(__instance, on, tips);
        }
Example #5
0
        private static bool Prefix(ref UIDate __instance)
        {
            if (!Main.enabled)
            {
                return(true);
            }

            AutoHarvest.GetAllBooties();

            AutoHarvest.RegisterEvent(ref __instance);

            return(true);
        }
Example #6
0
        private static bool Prefix(UIDate __instance)
        {
            if (!Main.enabled)
            {
                return(true);
            }

            AutoHarvest.GetAllBooties();

            ResourceMaintainer.TryBuyingResources();

            ResourceMaintainer.UpdateResourceWarning();

            TurnEvent.RegisterEvent(__instance);

            return(true);
        }
Example #7
0
        private static bool Prefix(UIDate __instance)
        {
            if (!Main.enabled)
            {
                return(true);
            }

            AutoHarvest.GetAllBooties();

            ResourceMaintainer.TryBuyingResources();

            ResourceMaintainer.UpdateResourceWarning();

            TurnEvent.AddEvent(__instance);

            if (Main.settings.autoAssignBuildingWorkers)
            {
                HumanResource.AssignBuildingWorkersForTaiwuVillage();
            }

            return(true);
        }
Example #8
0
        /// <summary>
        /// 获取所有据点的所有收获物
        /// </summary>
        public static void GetAllBooties()
        {
            AutoHarvest.InitializeBooties();

            foreach (var parts in DateFile.instance.homeShopBootysDate)
            {
                int partId = parts.Key;
                var places = parts.Value;
                foreach (var place in places)
                {
                    int placeId   = place.Key;
                    var buildings = place.Value;
                    foreach (var building in buildings)
                    {
                        int buildingIndex = building.Key;
                        var booties       = building.Value;
                        foreach (var booty in booties.ToArray())
                        {
                            bool gotBooty = AutoHarvest.GetBooty(partId, placeId, buildingIndex, booty);
                            if (gotBooty)
                            {
                                booties.Remove(booty);
                                AutoHarvest.RecordBooty(booty);
                            }
                        }
                    }
                }
            }

            AutoHarvest.RecordHarvestDetails();

            if (Main.settings.showNewActorWindow && AutoHarvest.harvestedActors.Count > 0)
            {
                GetActorWindow.instance.ShowGetActorWindow(AutoHarvest.harvestedActors, 0);
            }
        }