コード例 #1
0
        void Display_MenuChanged(object sender, StardewModdingAPI.Events.MenuChangedEventArgs e)
        {
            if (e.NewMenu is CarpenterMenu menu)
            {
                Helper.Events.Input.ButtonReleased += CarpenterMenu_ButtonReleased;
                Composting.AddBlueprint(menu);
            }
            else if (e.OldMenu is CarpenterMenu oldmenu)
            {
                Helper.Events.Input.ButtonReleased -= CarpenterMenu_ButtonReleased;
                Game1.getFarm().buildings.Set(new List <Building>(Game1.getFarm().buildings).Select((Building building) => building is ShippingBin bin && Composting.IsComposter(bin) ? CompostingBin.FromShippingBin(bin) : building).ToList());
            }

            if (e.NewMenu is ComposterMenu compMenu)
            {
            }
            else if (e.OldMenu is ComposterMenu oldCompMenu)
            {
                oldCompMenu.SaveCompostItems();
            }
        }
コード例 #2
0
 public static void SetCompostingBins()
 {
     Game1.getFarm().buildings.Set(new List <Building>(Game1.getFarm().buildings).Select((Building building) => building is ShippingBin bin && Composting.IsComposter(bin) ? CompostingBin.FromShippingBin(bin) : building).ToList());
 }
コード例 #3
0
        public static void OnNewDay()
        {
            //if (Game1.getFarm().buildings.ToList().Exists((Building obj) => Composting.IsComposter(obj)))
            //    ModEntry.GetMonitor().Log("Found Composter", StardewModdingAPI.LogLevel.Alert);

            Game1.getFarm().buildings.Set(new List <Building>(Game1.getFarm().buildings).Select((Building building) => building is ShippingBin bin && Composting.IsComposter(bin) ? CompostingBin.FromShippingBin(bin) : building).ToList());

            //if (Game1.getFarm().buildings.ToList().Exists((Building obj) => obj is CompostingBin))
            //    ModEntry.GetMonitor().Log("transformed composter", StardewModdingAPI.LogLevel.Alert);
        }