Beispiel #1
0
        private void drawIconForFarmAnimals()
        {
            StardewValley.SerializableDictionary <long, FarmAnimal> animals = getAnimalsInCurrentLocation();

            if (animals == null)
            {
                return;
            }

            foreach (var animal in animals.Values)
            {
                if (animal.isEmoting)
                {
                    continue;
                }

                // Draw if needs pet
                if (animal.wasPet == false)
                {
                    Vector2 handPosition = getPositionAboveAnimal(animal);

                    // Adjust hand for larger animals
                    if (animal.type.Contains("Cow") || animal.type.Contains("Sheep") | animal.type.Contains("Goat") || animal.type.Contains("Pig"))
                    {
                        handPosition.X += 50;
                        handPosition.Y += 50;
                    }

                    Game1.spriteBatch.Draw(Game1.mouseCursors, new Vector2(handPosition.X, handPosition.Y + movementYPerDraw), new Rectangle(32, 0, 16, 16), Color.White * alpha, 0, Vector2.Zero, 4f, SpriteEffects.None, 1);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Draws the icon bubble and product above the animals head
        /// </summary>
        private void drawAnimalHasProduct(object sender, EventArgs e)
        {
            if (Game1.eventUp || Game1.activeClickableMenu != null)
            {
                return;
            }

            StardewValley.SerializableDictionary <long, FarmAnimal> animals = getAnimalsInCurrentLocation();

            if (animals == null)
            {
                return;
            }

            foreach (var animal in animals.Values)
            {
                // Draw nothing if emoting or if truffles
                if (animal.isEmoting || animal.currentProduce == 430)
                {
                    continue;
                }

                // Check if animal has a yield
                if (animal.currentProduce > 0 && animal.age >= ( int )animal.ageWhenMature)
                {
                    Vector2 speechBubblePosition = getPositionAboveAnimal(animal);

                    // Make that bubble into a sin!! ohhh offset by its hashname so nothing lines up... so twist!
                    speechBubblePosition.Y += (float)Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 300 + animal.name.GetHashCode()) * 5;

                    // Draw speech bubble
                    Game1.spriteBatch.Draw(Game1.emoteSpriteSheet, new Vector2(speechBubblePosition.X + 14, speechBubblePosition.Y), new Rectangle(3 * (Game1.tileSize / 4) % Game1.emoteSpriteSheet.Width, 3 * (Game1.tileSize / 4) / Game1.emoteSpriteSheet.Width * (Game1.tileSize / 4), Game1.tileSize / 4, Game1.tileSize / 4), Color.White * 0.9f, 0, Vector2.Zero, 4f, SpriteEffects.None, 1);

                    // Draw item
                    Rectangle?sourceRectangle1 = new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(animal.currentProduce));
                    Game1.spriteBatch.Draw(Game1.objectSpriteSheet, new Vector2(speechBubblePosition.X + 28, speechBubblePosition.Y + 8), sourceRectangle1, Color.White * 0.9f, 0, Vector2.Zero, 2.2f, SpriteEffects.None, ( float )1);
                }
            }
        }