예제 #1
0
 /// <summary>The method to call before <see cref="HoeDirt.seasonUpdate"/>.</summary>
 private static void Before_SeasonUpdate(HoeDirt __instance, bool onLoad)
 {
     if (!onLoad && !__instance.currentLocation.SeedsIgnoreSeasonsHere() && (__instance.crop == null || __instance.crop.dead.Value || !__instance.crop.seasonsToGrowIn.Contains(Game1.currentLocation.GetSeasonForLocation())))
     {
         foreach (string key in DirtHelper.GetFertilizerTypes())
         {
             __instance.modData.Remove(key);
         }
     }
 }
예제 #2
0
        private static void DrawMultiFertilizer(SpriteBatch spriteBatch, Texture2D tex, Vector2 pos, Rectangle?sourceRect, Color col, float rot, Vector2 origin, float scale, SpriteEffects fx, float depth, HoeDirt __instance)
        {
            List <FertilizerData> fertilizers = new List <FertilizerData>();

            foreach (string type in DirtHelper.GetFertilizerTypes())
            {
                if (__instance.TryGetFertilizer(type, out FertilizerData fertilizer))
                {
                    fertilizers.Add(fertilizer);
                }
            }

            foreach (FertilizerData fertilizer in fertilizers)
            {
                spriteBatch.Draw(Game1.mouseCursors, pos, new Rectangle(173 + fertilizer.SpriteIndex / 3 * 16, 462 + fertilizer.SpriteIndex % 3 * 16, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1.89E-08f);
            }

            // Draw custom fertilizer, if needed.
            if (__instance.fertilizer.Value > 0)
            {
                spriteBatch.Draw(tex, pos, sourceRect, col, rot, origin, scale, fx, depth);
            }
        }