Пример #1
0
        protected override void resetLocalState()
        {
            base.resetLocalState();
            shippingBinLidOpenArea = new Microsoft.Xna.Framework.Rectangle((shippingBinPosition.X - 1) * 64, (shippingBinPosition.Y - 1) * 64, 256, 192);
            shippingBinLid         = new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Microsoft.Xna.Framework.Rectangle(134, 226, 30, 25), new Vector2(shippingBinPosition.X, shippingBinPosition.Y - 1) * 64f + new Vector2(2f, -7f) * 4f, flipped: false, 0f, Color.White)
            {
                holdLastFrame   = true,
                destroyable     = false,
                interval        = 20f,
                animationLength = 13,
                paused          = true,
                scale           = 4f,
                layerDepth      = (float)((shippingBinPosition.Y + 1) * 64) / 10000f + 0.0001f,
                pingPong        = true,
                pingPongMotion  = 0
            };
            if (sandDuggy.Value != null)
            {
                sandDuggy.Value.ResetForPlayerEntry();
            }
            if (farmhouseRestored.Value)
            {
                ApplyFarmHouseRestore();
            }
            if (farmObelisk.Value)
            {
                ApplyFarmObeliskBuild();
            }
            NPC i = getCharacterFromName("Birdie");

            if (i != null)
            {
                if (i.Sprite.SourceRect.Width < 32)
                {
                    i.extendSourceRect(16, 0);
                }
                i.Sprite.SpriteWidth             = 32;
                i.Sprite.ignoreSourceRectUpdates = false;
                i.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>
                {
                    new FarmerSprite.AnimationFrame(8, 1000, 0, secondaryArm: false, flip: false),
                    new FarmerSprite.AnimationFrame(9, 1000, 0, secondaryArm: false, flip: false)
                });
                i.Sprite.loop = true;
                i.HideShadow  = true;
                i.IsInvisible = Game1.IsRainingHere(this);
            }
            if (Game1.timeOfDay > 1700)
            {
                temporarySprites.Add(new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Microsoft.Xna.Framework.Rectangle(276, 1985, 12, 11), new Vector2(23f, 58f) * 64f + new Vector2(-16f, -32f), flipped: false, 0f, Color.White)
                {
                    interval           = 50f,
                    totalNumberOfLoops = 99999,
                    animationLength    = 4,
                    light       = true,
                    lightID     = 987654,
                    id          = 987654f,
                    lightRadius = 2f,
                    scale       = 4f,
                    layerDepth  = 0.37824f
                });
                AmbientLocationSounds.addSound(new Vector2(23f, 58f), 1);
            }
            if (Game1.currentSeason == "winter" && !Game1.IsRainingHere(this) && Game1.isDarkOut())
            {
                addMoonlightJellies(100, new Random((int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame - 24917), new Microsoft.Xna.Framework.Rectangle(35, 0, 60, 60));
            }
        }
Пример #2
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            Item old      = heldItem;
            int  oldStack = old?.Stack ?? (-1);

            if (isWithinBounds(x, y))
            {
                base.receiveLeftClick(x, y, playSound: false);
                if (itemChangeBehavior == null && old == null && heldItem != null && Game1.oldKBState.IsKeyDown(Keys.LeftShift))
                {
                    heldItem = ItemsToGrabMenu.tryToAddItem(heldItem, "Ship");
                }
            }
            bool sound = true;

            if (ItemsToGrabMenu.isWithinBounds(x, y))
            {
                heldItem = ItemsToGrabMenu.leftClick(x, y, heldItem, playSound: false);
                if ((heldItem != null && old == null) || (heldItem != null && old != null && !heldItem.Equals(old)))
                {
                    if (itemChangeBehavior != null)
                    {
                        sound = itemChangeBehavior(heldItem, ItemsToGrabMenu.getInventoryPositionOfClick(x, y), old, this, onRemoval: true);
                    }
                    if (sound)
                    {
                        Game1.playSound("dwop");
                    }
                }
                if ((heldItem == null && old != null) || (heldItem != null && old != null && !heldItem.Equals(old)))
                {
                    Item tmp = heldItem;
                    if (heldItem == null && ItemsToGrabMenu.getItemAt(x, y) != null && oldStack < ItemsToGrabMenu.getItemAt(x, y).Stack)
                    {
                        tmp       = old.getOne();
                        tmp.Stack = oldStack;
                    }
                    if (itemChangeBehavior != null)
                    {
                        sound = itemChangeBehavior(old, ItemsToGrabMenu.getInventoryPositionOfClick(x, y), tmp, this);
                    }
                    if (sound)
                    {
                        Game1.playSound("Ship");
                    }
                }
                if (heldItem is Object && (bool)(heldItem as Object).isRecipe)
                {
                    string recipeName = heldItem.Name.Substring(0, heldItem.Name.IndexOf("Recipe") - 1);
                    try
                    {
                        if ((heldItem as Object).Category == -7)
                        {
                            Game1.player.cookingRecipes.Add(recipeName, 0);
                        }
                        else
                        {
                            Game1.player.craftingRecipes.Add(recipeName, 0);
                        }
                        poof = new TemporaryAnimatedSprite("TileSheets\\animations", new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2(x - x % 64 + 16, y - y % 64 + 16), flicker: false, flipped: false);
                        Game1.playSound("newRecipe");
                    }
                    catch (Exception)
                    {
                    }
                    heldItem = null;
                }
                else if (Game1.oldKBState.IsKeyDown(Keys.LeftShift) && Game1.player.addItemToInventoryBool(heldItem))
                {
                    heldItem = null;
                    if (itemChangeBehavior != null)
                    {
                        sound = itemChangeBehavior(heldItem, ItemsToGrabMenu.getInventoryPositionOfClick(x, y), old, this, onRemoval: true);
                    }
                    if (sound)
                    {
                        Game1.playSound("coin");
                    }
                }
            }
            if (okButton.containsPoint(x, y) && readyToClose())
            {
                Game1.playSound("bigDeSelect");
                Game1.exitActiveMenu();
            }
            if (trashCan.containsPoint(x, y) && heldItem != null && heldItem.canBeTrashed())
            {
                Utility.trashItem(heldItem);
                heldItem = null;
            }
        }
Пример #3
0
 public override void receiveRightClick(int x, int y, bool playSound = true)
 {
     if (!this.allowRightClick)
     {
         return;
     }
     base.receiveRightClick(x, y, playSound && this.playRightClickSound);
     if (this.heldItem == null && this.showReceivingMenu)
     {
         this.heldItem = this.ItemsToGrabMenu.rightClick(x, y, this.heldItem, false);
         if (this.heldItem != null && this.behaviorOnItemGrab != null)
         {
             this.behaviorOnItemGrab(this.heldItem, Game1.player);
             if (Game1.activeClickableMenu != null && Game1.activeClickableMenu is ItemGrabMenu)
             {
                 (Game1.activeClickableMenu as ItemGrabMenu).setSourceItem(this.sourceItem);
             }
         }
         if (this.heldItem is StardewValley.Object && (this.heldItem as StardewValley.Object).parentSheetIndex == 326)
         {
             this.heldItem = null;
             Game1.player.canUnderstandDwarves = true;
             this.poof = new TemporaryAnimatedSprite(Game1.animations, new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2((float)(x - x % Game1.tileSize + Game1.tileSize / 4), (float)(y - y % Game1.tileSize + Game1.tileSize / 4)), false, false);
             Game1.playSound("fireball");
             return;
         }
         if (this.heldItem is StardewValley.Object && (this.heldItem as StardewValley.Object).isRecipe)
         {
             string key = this.heldItem.Name.Substring(0, this.heldItem.Name.IndexOf("Recipe") - 1);
             try
             {
                 if ((this.heldItem as StardewValley.Object).category == -7)
                 {
                     Game1.player.cookingRecipes.Add(key, 0);
                 }
                 else
                 {
                     Game1.player.craftingRecipes.Add(key, 0);
                 }
                 this.poof = new TemporaryAnimatedSprite(Game1.animations, new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2((float)(x - x % Game1.tileSize + Game1.tileSize / 4), (float)(y - y % Game1.tileSize + Game1.tileSize / 4)), false, false);
                 Game1.playSound("newRecipe");
             }
             catch (Exception)
             {
             }
             this.heldItem = null;
             return;
         }
         if (Game1.player.addItemToInventoryBool(this.heldItem, false))
         {
             this.heldItem = null;
             Game1.playSound("coin");
             return;
         }
     }
     else if (this.reverseGrab || this.behaviorFunction != null)
     {
         this.behaviorFunction(this.heldItem, Game1.player);
         if (Game1.activeClickableMenu != null && Game1.activeClickableMenu is ItemGrabMenu)
         {
             (Game1.activeClickableMenu as ItemGrabMenu).setSourceItem(this.sourceItem);
         }
         if (this.destroyItemOnClick)
         {
             this.heldItem = null;
             return;
         }
     }
 }
Пример #4
0
        /// <summary>Get whether the in-game container is open.</summary>
        public bool IsOpen()
        {
            TemporaryAnimatedSprite lid = this.Reflection.GetField <TemporaryAnimatedSprite>(this.Farm, "shippingBinLid").GetValue();

            return(lid != null && lid.currentParentTileIndex != lid.initialParentTileIndex);
        }
        public static bool beginUsing(MilkPail __instance, GameLocation location, int x, int y, StardewValley.Farmer who, ref bool __result)
        {
            if (!IsFeedingBasket(__instance))
            {
                return(true);
            }

            string feedingBasketId = __instance.modData[FeedingBasketKey];

            x = (int)who.GetToolLocation(false).X;
            y = (int)who.GetToolLocation(false).Y;
            Rectangle rectangle = new Rectangle(x - Game1.tileSize / 2, y - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize);

            // Added this because for some wierd reason the current value appears subtracted by 5 the first time the tool is used.
            __instance.CurrentParentTileIndex = InitialParentTileIndex;

            if (!DataLoader.ModConfig.DisableTreats)
            {
                if (location is Farm farm)
                {
                    foreach (FarmAnimal farmAnimal in farm.animals.Values)
                    {
                        if (farmAnimal.GetBoundingBox().Intersects(rectangle))
                        {
                            Animals[feedingBasketId] = farmAnimal;
                            break;
                        }
                    }
                    if (!Animals.ContainsKey(feedingBasketId) || Animals[feedingBasketId] == null)
                    {
                        foreach (Pet localPet in farm.characters.Where(i => i is Pet))
                        {
                            if (localPet.GetBoundingBox().Intersects(rectangle))
                            {
                                Pets[feedingBasketId] = localPet;
                                break;
                            }
                        }
                    }
                }
                else if (location is AnimalHouse animalHouse)
                {
                    foreach (FarmAnimal farmAnimal in animalHouse.animals.Values)
                    {
                        if (farmAnimal.GetBoundingBox().Intersects(rectangle))
                        {
                            Animals[feedingBasketId] = farmAnimal;
                            break;
                        }
                    }
                }
                else if (location is FarmHouse)
                {
                    foreach (Pet localPet in location.characters.Where(i => i is Pet))
                    {
                        if (localPet.GetBoundingBox().Intersects(rectangle))
                        {
                            Pets[feedingBasketId] = localPet;
                            break;
                        }
                    }
                }
            }

            Animals.TryGetValue(feedingBasketId, out FarmAnimal animal);
            if (animal != null)
            {
                string dialogue = "";
                if (__instance.attachments[0] == null)
                {
                    if (who != null && Game1.player.Equals(who))
                    {
                        Game1.showRedMessage(DataLoader.i18n.Get("Tool.FeedingBasket.Empty"));
                    }
                    Animals[feedingBasketId] = animal = null;
                }
                else if (!TreatsController.CanReceiveTreat(animal))
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.NotLikeTreat", new { itemName = __instance.attachments[0].DisplayName });
                }
                else if (!TreatsController.IsLikedTreat(animal, __instance.attachments[0]))
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.NotLikeTreat", new { itemName = __instance.attachments[0].DisplayName });
                }
                else if (__instance.attachments[0].Category == SObject.MilkCategory && !animal.isBaby())
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.OnlyBabiesCanEatMilk");
                }
                else if (!TreatsController.IsReadyForTreat(animal))
                {
                    if (TreatsController.GetTreatItem(animal)?.MinimumDaysBetweenTreats == 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.AlreadyAteTreatToday", new { animalName = animal.displayName });
                    }
                    else
                    {
                        int daysUntilNextTreat = TreatsController.DaysUntilNextTreat(animal);
                        if (daysUntilNextTreat > 1)
                        {
                            dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatInDays", new { animalName = animal.displayName, numberOfDays = daysUntilNextTreat });
                        }
                        else if (daysUntilNextTreat == 1)
                        {
                            dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatTomorrow", new { animalName = animal.displayName });
                        }
                    }
                }
                else
                {
                    animal.pauseTimer = 1000;
                }


                if (dialogue.Length > 0)
                {
                    if (who != null && Game1.player.Equals(who))
                    {
                        DelayedAction.showDialogueAfterDelay(dialogue, 150);
                    }
                    Animals[feedingBasketId] = animal = null;
                }
            }
            Pets.TryGetValue(feedingBasketId, out Pet pet);
            if (pet != null)
            {
                string dialogue = "";
                if (__instance.attachments[0] == null)
                {
                    if (who != null && Game1.player.Equals(who))
                    {
                        Game1.showRedMessage(DataLoader.i18n.Get("Tool.FeedingBasket.Empty"));
                    }
                    Pets[feedingBasketId] = pet = null;
                }
                else if (!TreatsController.IsLikedTreat(pet, __instance.attachments[0]))
                {
                    dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.NotLikeTreat", new { itemName = __instance.attachments[0].DisplayName });
                }
                else if (!TreatsController.IsReadyForTreat(pet))
                {
                    int daysUntilNextTreat = TreatsController.DaysUntilNextTreat(pet);

                    if (DataLoader.AnimalData.Pet.MinimumDaysBetweenTreats == 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.AlreadyAteTreatToday", new { animalName = pet.displayName });
                    }
                    else if (daysUntilNextTreat > 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatInDays", new { animalName = pet.displayName, numberOfDays = daysUntilNextTreat });
                    }
                    else if (daysUntilNextTreat == 1)
                    {
                        dialogue = DataLoader.i18n.Get("Tool.FeedingBasket.WantsTreatTomorrow", new { animalName = pet.displayName });
                    }
                }
                else
                {
                    pet.Halt();
                    pet.FacingDirection = 2;
                    pet.CurrentBehavior = 2;
                    DataLoader.Helper.Reflection.GetField <int>(pet, "_currentBehavior").SetValue(2);
                    pet.Halt();
                    pet.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>()
                    {
                        new FarmerSprite.AnimationFrame(18, 200)
                    });
                    pet.Sprite.loop = true;
                }

                if (dialogue.Length > 0)
                {
                    if (who != null && Game1.player.Equals(who))
                    {
                        DelayedAction.showDialogueAfterDelay(dialogue, 150);
                    }
                    Pets[feedingBasketId] = pet = null;
                }
            }

            who.Halt();
            int currentFrame = who.FarmerSprite.currentFrame;

            if (animal != null || pet != null)
            {
                switch (who.FacingDirection)
                {
                case 0:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(62, 900, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;

                case 1:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(58, 900, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;

                case 2:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(54, 900, false, false, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;

                case 3:
                    who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                        new FarmerSprite.AnimationFrame(58, 900, false, true, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                    });
                    break;
                }
            }
            else
            {
                who.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] {
                    new FarmerSprite.AnimationFrame(currentFrame, 0, false, who.FacingDirection == 3, new AnimatedSprite.endOfAnimationBehavior(StardewValley.Farmer.useTool), true)
                });
            }
            who.FarmerSprite.oldFrame = currentFrame;
            who.UsingTool             = true;
            who.CanMove = false;

            if (animal != null || pet != null)
            {
                Rectangle boundingBox;
                boundingBox = animal != null?animal.GetBoundingBox() : pet.GetBoundingBox();

                double numX = boundingBox.Center.X;
                double numY = boundingBox.Center.Y;

                Vector2 vectorBasket = new Vector2((float)numX - 32, (float)numY);
                Vector2 vectorFood   = new Vector2((float)numX - 24, (float)numY - 10);
                var     foodScale    = Game1.pixelZoom * 0.75f;

                TemporaryAnimatedSprite basketSprite = new TemporaryAnimatedSprite(Game1.toolSpriteSheetName,
                                                                                   Game1.getSourceRectForStandardTileSheet(Game1.toolSpriteSheet, __instance.CurrentParentTileIndex, 16, 16),
                                                                                   750.0f, 1, 1, vectorBasket, false, false, ((float)boundingBox.Bottom + 0.1f) / 10000f, 0.0f,
                                                                                   Color.White, Game1.pixelZoom, 0.0f, 0.0f, 0.0f)
                {
                    delayBeforeAnimationStart = 100
                };
                location.temporarySprites.Add(basketSprite);
                TemporaryAnimatedSprite foodSprite = new TemporaryAnimatedSprite(Game1.objectSpriteSheetName,
                                                                                 Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.attachments[0].ParentSheetIndex,
                                                                                                                         16, 16), 500.0f, 1, 1, vectorFood, false, false, ((float)boundingBox.Bottom + 0.2f) / 10000f, 0.0f,
                                                                                 Color.White, foodScale, 0.0f, 0.0f, 0.0f)
                {
                    delayBeforeAnimationStart = 100
                };
                location.temporarySprites.Add(foodSprite);

                for (int index = 0; index < 8; ++index)
                {
                    Rectangle standardTileSheet = Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet,
                                                                                          __instance.attachments[0].ParentSheetIndex, 16, 16);
                    standardTileSheet.X += 8;
                    standardTileSheet.Y += 8;

                    standardTileSheet.Width  = Game1.pixelZoom;
                    standardTileSheet.Height = Game1.pixelZoom;
                    TemporaryAnimatedSprite temporaryAnimatedSprite2 =
                        new TemporaryAnimatedSprite(Game1.objectSpriteSheetName, standardTileSheet, 400f, 1, 0,
                                                    vectorFood + new Vector2(12, 12), false, false,
                                                    ((float)boundingBox.Bottom + 0.2f) / 10000f, 0.0f, Color.White, (float)foodScale, 0.0f,
                                                    0.0f, 0.0f, false)
                    {
                        motion       = new Vector2((float)Game1.random.Next(-30, 31) / 10f, (float)Game1.random.Next(-6, -3)),
                        acceleration = new Vector2(0.0f, 0.5f),
                        delayBeforeAnimationStart = 600
                    };
                    location.temporarySprites.Add(temporaryAnimatedSprite2);
                }

                if (animal != null)
                {
                    FarmAnimal tempAnimal = animal;
                    Game1.delayedActions.Add(new DelayedAction(300, new DelayedAction.delayedBehavior(() => {
                        if (tempAnimal.buildingTypeILiveIn.Contains("Barn"))
                        {
                            tempAnimal.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>
                            {
                                new FarmerSprite.AnimationFrame(16, 100),
                                new FarmerSprite.AnimationFrame(17, 100),
                                new FarmerSprite.AnimationFrame(18, 100),
                                new FarmerSprite.AnimationFrame(19, 100),
                                new FarmerSprite.AnimationFrame(19, 100, secondaryArm: false, flip: false, (f) =>
                                {
                                    tempAnimal.doEmote(20, true);
                                    tempAnimal.Sprite.CurrentAnimation = null;
                                    tempAnimal.Sprite.loop             = true;
                                    tempAnimal.Sprite.currentFrame     = 0;
                                    tempAnimal.faceDirection(2);
                                })
                            });
                        }
                        else
                        {
                            tempAnimal.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>
                            {
                                new FarmerSprite.AnimationFrame(24, 100),
                                new FarmerSprite.AnimationFrame(25, 100),
                                new FarmerSprite.AnimationFrame(26, 100),
                                new FarmerSprite.AnimationFrame(27, 100),
                                new FarmerSprite.AnimationFrame(27, 100, secondaryArm: false, flip: false, (f) =>
                                {
                                    tempAnimal.doEmote(20, true);
                                    tempAnimal.Sprite.CurrentAnimation = null;
                                    tempAnimal.Sprite.loop             = true;
                                    tempAnimal.Sprite.currentFrame     = 0;
                                    tempAnimal.faceDirection(2);
                                })
                            });
                        }
                        tempAnimal.Sprite.loop = false;
                    })));
                }
                else if (pet != null)
                {
                    pet.Sprite.setCurrentAnimation(new List <FarmerSprite.AnimationFrame>()
                    {
                        new FarmerSprite.AnimationFrame(18, 300),
                        new FarmerSprite.AnimationFrame(17, 100),
                        new FarmerSprite.AnimationFrame(16, 100),
                        new FarmerSprite.AnimationFrame(0, 100),
                        new FarmerSprite.AnimationFrame(16, 100),
                        new FarmerSprite.AnimationFrame(17, 100, secondaryArm: false, flip: false, (f) => pet.doEmote(20, true), true),
                        new FarmerSprite.AnimationFrame(18, 300, false, false, pet.hold, true)
                    });
                    pet.Sprite.loop = false;
                }
                if (who != null && Game1.player.Equals(who))
                {
                    DelayedAction.playSoundAfterDelay("eat", 600, location);
                }
            }
            __result = true;
            return(false);
        }
Пример #6
0
 public override void update(GameTime time)
 {
     base.update(time);
     if (this.saveGameMenu != null)
     {
         this.saveGameMenu.update(time);
         if (this.saveGameMenu.quit)
         {
             this.saveGameMenu = (SaveGameMenu)null;
             this.savedYet     = true;
         }
     }
     this.weatherX = this.weatherX + (float)time.ElapsedGameTime.Milliseconds * 0.03f;
     for (int index = this.animations.Count - 1; index >= 0; --index)
     {
         if (this.animations[index].update(time))
         {
             this.animations.RemoveAt(index);
         }
     }
     if (this.outro)
     {
         if (this.outroFadeTimer > 0)
         {
             this.outroFadeTimer = this.outroFadeTimer - time.ElapsedGameTime.Milliseconds;
         }
         else if (this.outroFadeTimer <= 0 && this.dayPlaqueY < this.centerY - Game1.tileSize)
         {
             if (this.animations.Count > 0)
             {
                 this.animations.Clear();
             }
             this.dayPlaqueY = this.dayPlaqueY + (int)Math.Ceiling((double)time.ElapsedGameTime.Milliseconds * 0.349999994039536);
             if (this.dayPlaqueY >= this.centerY - Game1.tileSize)
             {
                 this.outroPauseBeforeDateChange = 700;
             }
         }
         else if (this.outroPauseBeforeDateChange > 0)
         {
             this.outroPauseBeforeDateChange = this.outroPauseBeforeDateChange - time.ElapsedGameTime.Milliseconds;
             if (this.outroPauseBeforeDateChange <= 0)
             {
                 this.newDayPlaque = true;
                 Game1.playSound("newRecipe");
                 if (!Game1.currentSeason.Equals("winter"))
                 {
                     DelayedAction.playSoundAfterDelay(Game1.isRaining ? "rainsound" : "rooster", 1500);
                 }
                 this.finalOutroTimer = 2000;
                 this.animations.Clear();
                 if (!this.savedYet)
                 {
                     if (this.saveGameMenu != null)
                     {
                         return;
                     }
                     this.saveGameMenu = new SaveGameMenu();
                     return;
                 }
             }
         }
         else if (this.finalOutroTimer > 0 && this.savedYet)
         {
             this.finalOutroTimer = this.finalOutroTimer - time.ElapsedGameTime.Milliseconds;
             if (this.finalOutroTimer <= 0)
             {
                 this.exitThisMenu(false);
             }
         }
     }
     if (this.introTimer >= 0)
     {
         int introTimer = this.introTimer;
         this.introTimer = this.introTimer - time.ElapsedGameTime.Milliseconds * (Game1.oldMouseState.LeftButton == ButtonState.Pressed ? 3 : 1);
         int num = 500;
         if (introTimer % num < this.introTimer % 500 && this.introTimer <= 3000)
         {
             int which = 4 - this.introTimer / 500;
             if (which < 6 && which > -1)
             {
                 if (this.categoryItems[which].Count > 0)
                 {
                     Game1.playSound(this.getCategorySound(which));
                     this.categoryDials[which].currentValue        = 0;
                     this.categoryDials[which].previousTargetValue = 0;
                 }
                 else
                 {
                     Game1.playSound("stoneStep");
                 }
             }
         }
         if (this.introTimer >= 0)
         {
             return;
         }
         Game1.playSound("money");
         this.categoryDials[5].currentValue        = 0;
         this.categoryDials[5].previousTargetValue = 0;
     }
     else
     {
         if (Game1.dayOfMonth == 28 || this.outro)
         {
             return;
         }
         if (!Game1.wasRainingYesterday)
         {
             Vector2   position   = new Vector2((float)Game1.viewport.Width, (float)Game1.random.Next(200));
             Rectangle sourceRect = new Rectangle(640, 752, 16, 16);
             int       num1       = Game1.random.Next(1, 4);
             if (Game1.random.NextDouble() < 0.001)
             {
                 bool flipped = Game1.random.NextDouble() < 0.5;
                 if (Game1.random.NextDouble() < 0.5)
                 {
                     List <TemporaryAnimatedSprite> animations = this.animations;
                     TemporaryAnimatedSprite        temporaryAnimatedSprite = new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(640, 826, 16, 8), 40f, 4, 0, new Vector2((float)Game1.random.Next(this.centerX * 2), (float)Game1.random.Next(this.centerY)), false, flipped);
                     temporaryAnimatedSprite.rotation = 3.141593f;
                     double pixelZoom = (double)Game1.pixelZoom;
                     temporaryAnimatedSprite.scale = (float)pixelZoom;
                     Vector2 vector2 = new Vector2(flipped ? -8f : 8f, 8f);
                     temporaryAnimatedSprite.motion = vector2;
                     int num2 = 1;
                     temporaryAnimatedSprite.local = num2 != 0;
                     animations.Add(temporaryAnimatedSprite);
                 }
                 else
                 {
                     List <TemporaryAnimatedSprite> animations = this.animations;
                     TemporaryAnimatedSprite        temporaryAnimatedSprite = new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(258, 1680, 16, 16), 40f, 4, 0, new Vector2((float)Game1.random.Next(this.centerX * 2), (float)Game1.random.Next(this.centerY)), false, flipped);
                     temporaryAnimatedSprite.scale  = (float)Game1.pixelZoom;
                     temporaryAnimatedSprite.motion = new Vector2(flipped ? -8f : 8f, 8f);
                     int num2 = 1;
                     temporaryAnimatedSprite.local = num2 != 0;
                     animations.Add(temporaryAnimatedSprite);
                 }
             }
             else if (Game1.random.NextDouble() < 0.0002)
             {
                 position = new Vector2((float)Game1.viewport.Width, (float)Game1.random.Next(4, Game1.tileSize * 4));
                 this.animations.Add(new TemporaryAnimatedSprite(Game1.staminaRect, new Rectangle(0, 0, 1, 1), 9999f, 1, 10000, position, false, false, 0.01f, 0.0f, Color.White * (0.25f + (float)Game1.random.NextDouble()), 4f, 0.0f, 0.0f, 0.0f, true)
                 {
                     motion = new Vector2(-0.25f, 0.0f)
                 });
             }
             else if (Game1.random.NextDouble() < 5E-05)
             {
                 position = new Vector2((float)Game1.viewport.Width, (float)(Game1.viewport.Height - Game1.tileSize * 3));
                 for (int index = 0; index < num1; ++index)
                 {
                     this.animations.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, sourceRect, (float)Game1.random.Next(60, 101), 4, 100, position + new Vector2((float)((index + 1) * Game1.random.Next(15, 18)), (float)((index + 1) * -20)), false, false, 0.01f, 0.0f, Color.Black, 4f, 0.0f, 0.0f, 0.0f, true)
                     {
                         motion = new Vector2(-1f, 0.0f)
                     });
                     this.animations.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, sourceRect, (float)Game1.random.Next(60, 101), 4, 100, position + new Vector2((float)((index + 1) * Game1.random.Next(15, 18)), (float)((index + 1) * 20)), false, false, 0.01f, 0.0f, Color.Black, 4f, 0.0f, 0.0f, 0.0f, true)
                     {
                         motion = new Vector2(-1f, 0.0f)
                     });
                 }
             }
             else if (Game1.random.NextDouble() < 1E-05)
             {
                 sourceRect = new Rectangle(640, 784, 16, 16);
                 this.animations.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, sourceRect, 75f, 4, 1000, position, false, false, 0.01f, 0.0f, Color.White, 4f, 0.0f, 0.0f, 0.0f, true)
                 {
                     motion            = new Vector2(-3f, 0.0f),
                     yPeriodic         = true,
                     yPeriodicLoopTime = 1000f,
                     yPeriodicRange    = (float)(Game1.tileSize / 8),
                     shakeIntensity    = 0.5f
                 });
             }
         }
         this.smokeTimer = this.smokeTimer - time.ElapsedGameTime.Milliseconds;
         if (this.smokeTimer > 0)
         {
             return;
         }
         this.smokeTimer = 50;
         this.animations.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(684, 1075, 1, 1), 1000f, 1, 1000, new Vector2((float)(Game1.tileSize * 2 + Game1.tileSize * 3 / 4 + Game1.pixelZoom * 3), (float)(Game1.viewport.Height - Game1.tileSize * 2 + Game1.pixelZoom * 5)), false, false)
         {
             color        = Game1.wasRainingYesterday ? Color.SlateGray : Color.White,
             scale        = (float)Game1.pixelZoom,
             scaleChange  = 0.0f,
             alphaFade    = 1f / 400f,
             motion       = new Vector2(0.0f, (float)((double)-Game1.random.Next(25, 75) / 100.0 / 4.0)),
             acceleration = new Vector2(-1f / 1000f, 0.0f)
         });
     }
 }
Пример #7
0
        public void deathAnimation(int xTrajectory, int yTrajectory)
        {
            Game1.playSound("serpentDie");
            Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(this.sprite.Texture, new Rectangle(0, 64, 32, 32), 200f, 4, 0, this.position, false, false, 0.9f, 1f / 1000f, Color.White, (float)Game1.pixelZoom * this.scale, 0.01f, this.rotation + 3.141593f, (float)((double)Game1.random.Next(3, 5) * Math.PI / 64.0), false)
            {
                motion     = new Vector2((float)xTrajectory, (float)yTrajectory),
                layerDepth = 1f
            });
            List <TemporaryAnimatedSprite> temporarySprites1        = Game1.currentLocation.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite1 = new TemporaryAnimatedSprite(5, Utility.PointToVector2(this.GetBoundingBox().Center) + new Vector2((float)(-Game1.tileSize / 2), 0.0f), Color.LightGreen * 0.9f, 10, false, 70f, 0, -1, -1f, -1, 0);

            temporaryAnimatedSprite1.delayBeforeAnimationStart = 50;
            temporaryAnimatedSprite1.startSound = "cowboy_monsterhit";
            Vector2 vector2_1 = new Vector2((float)xTrajectory, (float)yTrajectory);

            temporaryAnimatedSprite1.motion = vector2_1;
            double num1 = 1.0;

            temporaryAnimatedSprite1.layerDepth = (float)num1;
            temporarySprites1.Add(temporaryAnimatedSprite1);
            List <TemporaryAnimatedSprite> temporarySprites2        = Game1.currentLocation.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite2 = new TemporaryAnimatedSprite(5, Utility.PointToVector2(this.GetBoundingBox().Center) + new Vector2((float)(Game1.tileSize / 2), 0.0f), Color.LightGreen * 0.8f, 10, false, 70f, 0, -1, -1f, -1, 0);

            temporaryAnimatedSprite2.delayBeforeAnimationStart = 100;
            temporaryAnimatedSprite2.startSound = "cowboy_monsterhit";
            Vector2 vector2_2 = new Vector2((float)xTrajectory, (float)yTrajectory) * 0.8f;

            temporaryAnimatedSprite2.motion = vector2_2;
            double num2 = 1.0;

            temporaryAnimatedSprite2.layerDepth = (float)num2;
            temporarySprites2.Add(temporaryAnimatedSprite2);
            List <TemporaryAnimatedSprite> temporarySprites3        = Game1.currentLocation.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite3 = new TemporaryAnimatedSprite(5, Utility.PointToVector2(this.GetBoundingBox().Center) + new Vector2(0.0f, (float)(-Game1.tileSize / 2)), Color.LightGreen * 0.7f, 10, false, 100f, 0, -1, -1f, -1, 0);

            temporaryAnimatedSprite3.delayBeforeAnimationStart = 150;
            temporaryAnimatedSprite3.startSound = "cowboy_monsterhit";
            Vector2 vector2_3 = new Vector2((float)xTrajectory, (float)yTrajectory) * 0.6f;

            temporaryAnimatedSprite3.motion = vector2_3;
            double num3 = 1.0;

            temporaryAnimatedSprite3.layerDepth = (float)num3;
            temporarySprites3.Add(temporaryAnimatedSprite3);
            List <TemporaryAnimatedSprite> temporarySprites4        = Game1.currentLocation.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite4 = new TemporaryAnimatedSprite(5, Utility.PointToVector2(this.GetBoundingBox().Center), Color.LightGreen * 0.6f, 10, false, 70f, 0, -1, -1f, -1, 0);

            temporaryAnimatedSprite4.delayBeforeAnimationStart = 200;
            temporaryAnimatedSprite4.startSound = "cowboy_monsterhit";
            Vector2 vector2_4 = new Vector2((float)xTrajectory, (float)yTrajectory) * 0.4f;

            temporaryAnimatedSprite4.motion = vector2_4;
            double num4 = 1.0;

            temporaryAnimatedSprite4.layerDepth = (float)num4;
            temporarySprites4.Add(temporaryAnimatedSprite4);
            List <TemporaryAnimatedSprite> temporarySprites5        = Game1.currentLocation.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite5 = new TemporaryAnimatedSprite(5, Utility.PointToVector2(this.GetBoundingBox().Center) + new Vector2(0.0f, (float)(Game1.tileSize / 2)), Color.LightGreen * 0.5f, 10, false, 100f, 0, -1, -1f, -1, 0);

            temporaryAnimatedSprite5.delayBeforeAnimationStart = 250;
            temporaryAnimatedSprite5.startSound = "cowboy_monsterhit";
            Vector2 vector2_5 = new Vector2((float)xTrajectory, (float)yTrajectory) * 0.2f;

            temporaryAnimatedSprite5.motion = vector2_5;
            double num5 = 1.0;

            temporaryAnimatedSprite5.layerDepth = (float)num5;
            temporarySprites5.Add(temporaryAnimatedSprite5);
        }
Пример #8
0
        public static void addSpecificTemporarySprite(Event __instance, ref string key, GameLocation location, string[] split)
        {
            if (!key.StartsWith("animalContest"))
            {
                return;
            }
            if (key == "animalContest")
            {
                _shouldTimePass = false;
                String outdoorsTextureName = null;
                switch (SDate.Now().Season)
                {
                case "spring":
                    outdoorsTextureName = spring_outdoorsTileSheetName;
                    break;

                case "summer":
                    outdoorsTextureName = summer_outdoorsTileSheetName;
                    break;

                case "fall":
                    outdoorsTextureName = fall_outdoorsTileSheetName;
                    break;

                case "winter":
                    outdoorsTextureName = winter_outdoorsTileSheetName;
                    break;
                }

                location.TemporarySprites.Add(new TemporaryAnimatedSprite(DataLoader.LooseSpritesName,
                                                                          new Rectangle(84, 0, 98, 79), 9999f, 1, 999,
                                                                          new Vector2(26f, 59f) * (float)Game1.tileSize, false, false,
                                                                          (float)(59 * Game1.tileSize) / 10000f, 0.0f, Color.White,
                                                                          (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false));

                //Outdoors
                Rectangle singleFeed = new Rectangle(304, 144, 16, 32);
                Rectangle doubleFeed = new Rectangle(320, 128, 32, 32);
                Rectangle water      = new Rectangle(288, 112, 32, 32);
                Rectangle create     = new Rectangle(288, 144, 16, 32);
                //LooseSprites
                Rectangle TopLeft      = new Rectangle(0, 44, 16, 16);
                Rectangle TopCenter    = new Rectangle(16, 44, 16, 16);
                Rectangle TopRight     = new Rectangle(32, 44, 16, 16);
                Rectangle CenterLeft   = new Rectangle(0, 60, 16, 16);
                Rectangle CenterCenter = new Rectangle(16, 60, 16, 16);
                Rectangle CenterRight  = new Rectangle(32, 60, 16, 16);
                Rectangle BottonLeft   = new Rectangle(0, 76, 16, 16);
                Rectangle BottonCenter = new Rectangle(16, 76, 16, 16);
                Rectangle BottonRight  = new Rectangle(32, 76, 16, 16);

                Rectangle LeftUp    = new Rectangle(48, 44, 16, 16);
                Rectangle RightUp   = new Rectangle(64, 44, 16, 16);
                Rectangle LeftDown  = new Rectangle(48, 60, 16, 16);
                Rectangle RightDown = new Rectangle(64, 60, 16, 16);

                addTemporarySprite(location, outdoorsTextureName, doubleFeed, 24, 62);
                addTemporarySprite(location, outdoorsTextureName, water, 32, 62);
                addTemporarySprite(location, outdoorsTextureName, singleFeed, 34, 62);
                addTemporarySprite(location, outdoorsTextureName, create, 23, 62);

                addTemporarySprite(location, DataLoader.LooseSpritesName, TopLeft, 22, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopRight, 23, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopLeft, 24, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 25, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 26, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 27, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 28, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 29, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 30, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 31, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopRight, 32, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopLeft, 33, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopCenter, 34, 64);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopRight, 35, 64);

                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 22, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, RightUp, 23, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, LeftUp, 24, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 25, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 26, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 27, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 28, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 29, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 30, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 31, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterRight, 32, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 33, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 34, 65);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterRight, 35, 65);

                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 22, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 23, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 24, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 25, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 26, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 27, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 28, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 29, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 30, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 31, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterRight, 32, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 33, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 34, 66);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterRight, 35, 66);

                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 22, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 23, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, RightDown, 24, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, LeftDown, 25, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 26, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 27, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 28, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 29, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 30, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, RightDown, 31, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonRight, 32, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterLeft, 33, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterCenter, 34, 67);
                addTemporarySprite(location, DataLoader.LooseSpritesName, CenterRight, 35, 67);

                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonLeft, 22, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 23, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonRight, 24, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopLeft, 24, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonLeft, 25, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, TopRight, 25, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 26, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 27, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 28, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 29, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 30, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonRight, 31, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonLeft, 33, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonCenter, 34, 68);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonRight, 35, 68);

                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonLeft, 24, 69);
                addTemporarySprite(location, DataLoader.LooseSpritesName, BottonRight, 25, 69);
            }
            else if (key == "animalContestJoshDogSteak")
            {
                location.removeTemporarySpritesWithID(10);
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_cursorsName,
                                                                          new Microsoft.Xna.Framework.Rectangle(324, 1936, 12, 20), 80f, 4, 99999,
                                                                          new Vector2(31f, 65f) * (float)Game1.tileSize + new Vector2(3f, 3f) * 4f, false, false,
                                                                          (float)((66 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                {
                    id = 11f
                });
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_cursorsName,
                                                                          new Microsoft.Xna.Framework.Rectangle(497, 1918, 11, 11), 999f, 1, 9999,
                                                                          new Vector2(30f, 66f) * (float)Game1.tileSize + new Vector2(32f, -8f), false, false,
                                                                          1f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                {
                    id = 12f
                });
            }
            else if (key == "animalContestJoshDogOut")
            {
                location.removeTemporarySpritesWithID(1);
                location.removeTemporarySpritesWithID(12);
                location.removeTemporarySpritesWithID(11);
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_cursorsName,
                                                                          new Microsoft.Xna.Framework.Rectangle(324, 1916, 12, 20), 500f, 6, 9999,
                                                                          new Vector2(31f, 65f) * (float)Game1.tileSize + new Vector2(3f, 3f) * 4f, false, false,
                                                                          (float)((66 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                {
                    id = 10f
                });
            }
            else if (key == "animalContestJoshDog")
            {
                String townTextureName = null;
                switch (SDate.Now().Season)
                {
                case "spring":
                    townTextureName = spring_towntName;
                    break;

                case "summer":
                    townTextureName = summer_towntName;
                    break;

                case "fall":
                    townTextureName = fall_towntName;
                    break;

                case "winter":
                    townTextureName = winter_towntName;
                    break;
                }

                location.TemporarySprites.Add(new TemporaryAnimatedSprite(townTextureName,
                                                                          new Microsoft.Xna.Framework.Rectangle(208, 0, 16, 32), 9999f, 1, 999
                                                                          , new Vector2(31, 64) * (float)Game1.tileSize, false, false,
                                                                          (float)(65 * Game1.tileSize) / 10000f, 0.0f, Color.White,
                                                                          (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false));

                Action <int> addDogEyes = null;
                void AddDogEyesHidden(int x)
                {
                    location.TemporarySprites.Add(new TemporaryAnimatedSprite(townTextureName,
                                                                              new Microsoft.Xna.Framework.Rectangle(192, 0, 16, 16), 1000f, 1, 8,
                                                                              new Vector2(31f, 65f) * (float)Game1.tileSize, false, false,
                                                                              (float)((66 * Game1.tileSize) / 10000f) - 0.01f, 0.0f, Color.White,
                                                                              (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                    {
                        id          = 1,
                        endFunction = new TemporaryAnimatedSprite.endBehavior(addDogEyes)
                    });
                }

                addDogEyes = (int x) =>
                {
                    location.TemporarySprites.Add(new TemporaryAnimatedSprite(townTextureName,
                                                                              new Microsoft.Xna.Framework.Rectangle(192, 0, 16, 16), 1000f, 1, 1,
                                                                              new Vector2(31f, 65f) * (float)Game1.tileSize, false, false,
                                                                              (float)((66 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White,
                                                                              (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                    {
                        id          = 1,
                        endFunction = new TemporaryAnimatedSprite.endBehavior((Action <int>)AddDogEyesHidden)
                    });
                };
                AddDogEyesHidden(0);
            }
            else if (key == "animalContestFrogShow")
            {
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                          new Microsoft.Xna.Framework.Rectangle(0, 240, 16, 16), 500f, 1, 9999,
                                                                          new Vector2(29f, 64f) * (float)Game1.tileSize + FrogOffset * 4f, false, false,
                                                                          (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                {
                    id = 2
                });
            }
            else if (key == "animalContestFrogCroak")
            {
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                          new Microsoft.Xna.Framework.Rectangle(64, 240, 16, 16), 100f, 4, 1,
                                                                          new Vector2(29f, 64f) * (float)Game1.tileSize + FrogOffset * 4f, false, false,
                                                                          (float)((64 * Game1.tileSize) / 10000f) + 0.00003f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false));
            }
            else if (key == "animalContestFrogRun")
            {
                location.removeTemporarySpritesWithID(2);
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                          new Microsoft.Xna.Framework.Rectangle(0, 240, 16, 16), 100f, 4, 5,
                                                                          new Vector2(29f, 64f) * (float)Game1.tileSize + FrogOffset * 4f, false, false,
                                                                          (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                {
                    motion = new Vector2(5f, 0f)
                });
            }
            else if (key == "animalContestSquirrelShow")
            {
                Action <int> addStillSquirrel = null;
                void AddNimbleSquirrel(int x)
                {
                    location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                              new Microsoft.Xna.Framework.Rectangle(0, 192, 32, 32), 200f, 2, 4,
                                                                              new Vector2(29f, 64f) * (float)Game1.tileSize + SquirrelOffset * 4f, false, false,
                                                                              (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom,
                                                                              0.0f, 0.0f, 0.0f, false)
                    {
                        id          = 3,
                        endFunction = new TemporaryAnimatedSprite.endBehavior(addStillSquirrel)
                    });
                }

                addStillSquirrel = (int x) =>
                {
                    location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                              new Microsoft.Xna.Framework.Rectangle(0, 192, 32, 32), 2500f, 1, 1,
                                                                              new Vector2(29f, 64f) * (float)Game1.tileSize + SquirrelOffset * 4f, false, false,
                                                                              (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom,
                                                                              0.0f, 0.0f, 0.0f, false)
                    {
                        id          = 3,
                        endFunction = new TemporaryAnimatedSprite.endBehavior((Action <int>)AddNimbleSquirrel)
                    });
                };
                AddNimbleSquirrel(0);
            }
            else if (key == "animalContestSquirrelRun")
            {
                location.removeTemporarySpritesWithID(3);
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                          new Microsoft.Xna.Framework.Rectangle(64, 192, 32, 32), 50f, 6, 8,
                                                                          new Vector2(29f, 64f) * (float)Game1.tileSize + SquirrelOffset * 4f, false, false,
                                                                          (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom,
                                                                          0.0f, 0.0f, 0.0f, false)
                {
                    motion = new Vector2(5f, 0f)
                });
            }
            else if (key == "animalContestBirdShow")
            {
                Action <int> addSleepBird = null;
                void AddStillBird(int x)
                {
                    location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                              new Microsoft.Xna.Framework.Rectangle(160, 64, 32, 32), 2500f, 1, 1,
                                                                              new Vector2(29f, 64f) * (float)Game1.tileSize + BirdOffset * 4f, false, true,
                                                                              (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom,
                                                                              0.0f, 0.0f, 0.0f, false)
                    {
                        id          = 4,
                        endFunction = new TemporaryAnimatedSprite.endBehavior(addSleepBird)
                    });
                }

                addSleepBird = (int x) =>
                {
                    location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                              new Microsoft.Xna.Framework.Rectangle(0, 96, 32, 32), 1500f, 1, 1,
                                                                              new Vector2(29f, 64f) * (float)Game1.tileSize + BirdOffset * 4f, false, true,
                                                                              (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom,
                                                                              0.0f, 0.0f, 0.0f, false)
                    {
                        id          = 4,
                        endFunction = new TemporaryAnimatedSprite.endBehavior((Action <int>)AddStillBird)
                    });
                };
                AddStillBird(0);
            }
            else if (key == "animalContestWildBird")
            {
                Action <int> addSleepBird = null;
                void AddStillBird(int x)
                {
                    location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                              new Microsoft.Xna.Framework.Rectangle(160, 128, 32, 32), 2500f, 1, 1,
                                                                              new Vector2(34f, 66f) * (float)Game1.tileSize + BirdOffset * 4f, false, true,
                                                                              (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom,
                                                                              0.0f, 0.0f, 0.0f, false)
                    {
                        id          = 7,
                        endFunction = new TemporaryAnimatedSprite.endBehavior(addSleepBird)
                    });
                }

                addSleepBird = (int x) =>
                {
                    location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                              new Microsoft.Xna.Framework.Rectangle(0, 160, 32, 32), 1500f, 1, 1,
                                                                              new Vector2(34f, 66f) * (float)Game1.tileSize + BirdOffset * 4f, false, true,
                                                                              (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom,
                                                                              0.0f, 0.0f, 0.0f, false)
                    {
                        id          = 7,
                        endFunction = new TemporaryAnimatedSprite.endBehavior((Action <int>)AddStillBird)
                    });
                };
                AddStillBird(0);
            }
            else if (key == "animalContestBirdFly2")
            {
                location.removeTemporarySpritesWithID(4);
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                          new Microsoft.Xna.Framework.Rectangle(32, 96, 32, 32), 60f, 3, 18,
                                                                          new Vector2(29f, 64f) * (float)Game1.tileSize + BirdOffset * 4f, false, true,
                                                                          (float)((64 * Game1.tileSize) / 10000f) + 0.00003f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                {
                    pingPong = true,
                    motion   = new Vector2(6f, -1f)
                });
            }
            else if (key == "animalContestBirdFly")
            {
                location.removeTemporarySpritesWithID(4);
                int                     count       = 18;
                Action <int>            addBirdFlap = null;
                TemporaryAnimatedSprite lastSprite  = null;
                void AddBirdFly(int x)
                {
                    if (count == 0)
                    {
                        return;
                    }
                    Game1.playSound("batFlap");
                    Vector2 position = lastSprite == null ? new Vector2(29f, 64f) * (float)Game1.tileSize + BirdOffset * 4f : lastSprite.Position;

                    lastSprite = new TemporaryAnimatedSprite(tileSheets_critters,
                                                             new Microsoft.Xna.Framework.Rectangle(32, 96, 32, 32), 60f, 3, 1,
                                                             position, false, true,
                                                             (float)((64 * Game1.tileSize) / 10000f) + 0.00003f, 0.0f, Color.White, (float)Game1.pixelZoom,
                                                             0.0f, 0.0f, 0.0f, false)
                    {
                        endFunction = new TemporaryAnimatedSprite.endBehavior(addBirdFlap),
                        motion      = new Vector2(6f, -1.3f)
                    };
                    location.TemporarySprites.Add(lastSprite);
                    count--;
                }

                addBirdFlap = (int x) =>
                {
                    lastSprite = new TemporaryAnimatedSprite(tileSheets_critters,
                                                             new Microsoft.Xna.Framework.Rectangle(64, 96, 32, 32), 60f, 1, 1,
                                                             lastSprite.Position, false, true,
                                                             (float)((64 * Game1.tileSize) / 10000f) + 0.00003f, 0.0f, Color.White, (float)Game1.pixelZoom,
                                                             0.0f, 0.0f, 0.0f, false)
                    {
                        endFunction = new TemporaryAnimatedSprite.endBehavior((Action <int>)AddBirdFly),
                        motion      = new Vector2(6f, -1.3f)
                    };
                    location.TemporarySprites.Add(lastSprite);
                };
                AddBirdFly(0);
            }
            else if (key == "animalContestRabbitShow")
            {
                bool flipped = split.Length > 4 && Convert.ToBoolean(split[4]);
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                          new Microsoft.Xna.Framework.Rectangle(256, 192, 32, 32), 9999f, 1, 999,
                                                                          new Vector2(Convert.ToSingle(split[2]), Convert.ToSingle(split[3])) * (float)Game1.tileSize + new Vector2(flipped? -7f: -10f, -20f) * 4f, false, flipped,
                                                                          (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                {
                    id = split.Length > 5 ? 5 : 0
                });
            }
            else if (key == "animalContestRabbitRun")
            {
                location.removeTemporarySpritesWithID(5);
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(tileSheets_critters,
                                                                          new Microsoft.Xna.Framework.Rectangle(128, 160, 32, 32), 45f, 6, 14,
                                                                          new Vector2(29f, 64f) * (float)Game1.tileSize + new Vector2(-10f, -20f) * 4f, false, false,
                                                                          (float)((64 * Game1.tileSize) / 10000f) + 0.00002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                {
                    motion = new Vector2(6f, 0f)
                });
            }
            else if (key == "animalContestEmilyParrot")
            {
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(townInterior,
                                                                          new Microsoft.Xna.Framework.Rectangle(464, 1056, 16, 32), 9999f, 1, 999,
                                                                          new Vector2(34f, 65f) * (float)Game1.tileSize, false, false,
                                                                          0.000001f, 0.0f, Color.White,
                                                                          (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false));
                location.TemporarySprites.Add(new EmilysParrot(new Vector2(34, 64) * (float)Game1.tileSize + new Vector2(4f, 8f) * 4f));
            }
            else if (key == "animalContestEmilyParrotAction")
            {
                if (location.getTemporarySpriteByID(5858585) is EmilysParrot emilysParrot)
                {
                    emilysParrot.doAction();
                }
            }
            else if (key == "animalContestEmilyBoomBox")
            {
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_cursorsName,
                                                                          new Microsoft.Xna.Framework.Rectangle(586, 1871, 24, 14), 9999f, 1, 999,
                                                                          new Vector2(33f, 65f) * (float)Game1.tileSize, false, false,
                                                                          0.0000009f, 0.0f, Color.White,
                                                                          (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                {
                    id = 6
                });
            }
            else if (key == "animalContestEmilyBoomBoxStart")
            {
                location.getTemporarySpriteByID(6).pulse     = true;
                location.getTemporarySpriteByID(6).pulseTime = 420f;
            }
            else if (key == "animalContestEmilyBoomBoxStop")
            {
                location.getTemporarySpriteByID(6).pulse = false;
                location.getTemporarySpriteByID(6).scale = 4f;
            }
            else if (key == "animalContestEmilyParrotDance")
            {
                if (location.getTemporarySpriteByID(5858585) is EmilysParrot emilysParrot)
                {
                    Vector2 position = emilysParrot.initialPosition;
                    location.removeTemporarySpritesWithID(5858585);
                    location.TemporarySprites.Add(new EmilysParrotDancer(position));
                }
            }
            else if (key == "animalContestEmilyParrotStopDance")
            {
                if (location.getTemporarySpriteByID(5858586) is EmilysParrotDancer emilysParrotDancer)
                {
                    Vector2 position = emilysParrotDancer.initialPosition;
                    location.removeTemporarySpritesWithID(5858586);
                    location.TemporarySprites.Add(new EmilysParrot(position));
                }
            }
            else if (key == "animalContestMaruRobot")
            {
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(townInterior,
                                                                          new Microsoft.Xna.Framework.Rectangle(448, 576, 16, 16), 9999f, 1, 999,
                                                                          new Vector2(31f, 66f) * (float)Game1.tileSize, false, false,
                                                                          0.000001f, 0.0f, Color.White,
                                                                          (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false));
            }
            else if (key == "animalContestAbigailSlime")
            {
                __instance.actors.Add(new EventGreenSlime(new Vector2(31f, 66f) * (float)Game1.tileSize, 5));
            }
            else if (key == "animalContestWillyCrab")
            {
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_temporary_sprites_1,
                                                                          new Microsoft.Xna.Framework.Rectangle(259, 146, 18, 18), 250f, 3, 99999,
                                                                          new Vector2(31f, 66f) * (float)Game1.tileSize + CrabOffset * 4f, false, false,
                                                                          0.000001f, 0.0f, Color.White,
                                                                          (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
                {
                    pingPong = true
                });
            }
            else if (key == "animalContestMarnieWinning")
            {
                location.TemporarySprites.Add(new TemporaryAnimatedSprite(looseSprites_cursorsName, new Microsoft.Xna.Framework.Rectangle(558, 1425, 20, 26), 400f, 3, 99999, new Vector2(24f, 65f) * 64f, false, false, 0.416f, 0.0f, Color.White, 4f, 0.0f, 0.0f, 0.0f, false)
                {
                    pingPong = true
                });
            }
            else if (key == "animalContestEnding")
            {
                _shouldTimePass = true;
                if (Context.IsMainPlayer)
                {
                    AnimalContestController.EndEvent(FarmerLoader.FarmerData.AnimalContestData.Last());
                }
            }
        }
Пример #9
0
 public virtual void PerformCompleteAnimation()
 {
     if (upgradeName.Contains("Volcano"))
     {
         for (int j = 0; j < 16; j++)
         {
             locationRef.Value.temporarySprites.Add(new TemporaryAnimatedSprite(5, Utility.getRandomPositionInThisRectangle(upgradeRect, Game1.random) * 64f, Color.White)
             {
                 motion                    = new Vector2(Game1.random.Next(-1, 2), -1f),
                 scale                     = 1f,
                 layerDepth                = 1f,
                 drawAboveAlwaysFront      = true,
                 delayBeforeAnimationStart = j * 15
             });
             TemporaryAnimatedSprite t4 = new TemporaryAnimatedSprite("LooseSprites\\Cursors2", new Microsoft.Xna.Framework.Rectangle(65, 229, 16, 6), Utility.getRandomPositionInThisRectangle(upgradeRect, Game1.random) * 64f, Game1.random.NextDouble() < 0.5, 0f, Color.White)
             {
                 motion               = new Vector2(Game1.random.Next(-2, 3), -16f),
                 acceleration         = new Vector2(0f, 0.5f),
                 rotationChange       = (float)Game1.random.Next(-4, 5) * 0.05f,
                 scale                = 4f,
                 animationLength      = 1,
                 totalNumberOfLoops   = 1,
                 interval             = 1000 + Game1.random.Next(500),
                 layerDepth           = 1f,
                 drawAboveAlwaysFront = true,
                 yStopCoordinate      = (upgradeRect.Bottom + 1) * 64
             };
             t4.reachedStopCoordinate = t4.bounce;
             locationRef.Value.TemporarySprites.Add(t4);
             t4 = new TemporaryAnimatedSprite("LooseSprites\\Cursors2", new Microsoft.Xna.Framework.Rectangle(65, 229, 16, 6), Utility.getRandomPositionInThisRectangle(upgradeRect, Game1.random) * 64f, Game1.random.NextDouble() < 0.5, 0f, Color.White)
             {
                 motion               = new Vector2(Game1.random.Next(-2, 3), -16f),
                 acceleration         = new Vector2(0f, 0.5f),
                 rotationChange       = (float)Game1.random.Next(-4, 5) * 0.05f,
                 scale                = 4f,
                 animationLength      = 1,
                 totalNumberOfLoops   = 1,
                 interval             = 1000 + Game1.random.Next(500),
                 layerDepth           = 1f,
                 drawAboveAlwaysFront = true,
                 yStopCoordinate      = (upgradeRect.Bottom + 1) * 64
             };
             t4.reachedStopCoordinate = t4.bounce;
             locationRef.Value.TemporarySprites.Add(t4);
         }
         if (locationRef.Value == Game1.currentLocation)
         {
             Game1.flashAlpha = 1f;
             Game1.playSound("boulderBreak");
         }
     }
     else if ((string)upgradeName == "House")
     {
         for (int i = 0; i < 16; i++)
         {
             locationRef.Value.temporarySprites.Add(new TemporaryAnimatedSprite(5, Utility.getRandomPositionInThisRectangle(upgradeRect, Game1.random) * 64f, Color.White)
             {
                 motion                    = new Vector2(Game1.random.Next(-1, 2), -1f),
                 scale                     = 1f,
                 layerDepth                = 1f,
                 drawAboveAlwaysFront      = true,
                 delayBeforeAnimationStart = i * 15
             });
             TemporaryAnimatedSprite t2 = new TemporaryAnimatedSprite("LooseSprites\\Cursors2", new Microsoft.Xna.Framework.Rectangle(49 + 16 * Game1.random.Next(3), 229, 16, 6), Utility.getRandomPositionInThisRectangle(upgradeRect, Game1.random) * 64f, Game1.random.NextDouble() < 0.5, 0f, Color.White)
             {
                 motion               = new Vector2(Game1.random.Next(-2, 3), -16f),
                 acceleration         = new Vector2(0f, 0.5f),
                 rotationChange       = (float)Game1.random.Next(-4, 5) * 0.05f,
                 scale                = 4f,
                 animationLength      = 1,
                 totalNumberOfLoops   = 1,
                 interval             = 1000 + Game1.random.Next(500),
                 layerDepth           = 1f,
                 drawAboveAlwaysFront = true,
                 yStopCoordinate      = (upgradeRect.Bottom + 1) * 64
             };
             t2.reachedStopCoordinate = t2.bounce;
             locationRef.Value.TemporarySprites.Add(t2);
             t2 = new TemporaryAnimatedSprite("LooseSprites\\Cursors2", new Microsoft.Xna.Framework.Rectangle(49 + 16 * Game1.random.Next(3), 229, 16, 6), Utility.getRandomPositionInThisRectangle(upgradeRect, Game1.random) * 64f, Game1.random.NextDouble() < 0.5, 0f, Color.White)
             {
                 motion               = new Vector2(Game1.random.Next(-2, 3), -16f),
                 acceleration         = new Vector2(0f, 0.5f),
                 rotationChange       = (float)Game1.random.Next(-4, 5) * 0.05f,
                 scale                = 4f,
                 animationLength      = 1,
                 totalNumberOfLoops   = 1,
                 interval             = 1000 + Game1.random.Next(500),
                 layerDepth           = 1f,
                 drawAboveAlwaysFront = true,
                 yStopCoordinate      = (upgradeRect.Bottom + 1) * 64
             };
             t2.reachedStopCoordinate = t2.bounce;
             locationRef.Value.TemporarySprites.Add(t2);
         }
         if (locationRef.Value == Game1.currentLocation)
         {
             Game1.flashAlpha = 1f;
             Game1.playSound("boulderBreak");
         }
     }
     else if (((string)upgradeName == "Resort" || (string)upgradeName == "Trader" || (string)upgradeName == "Obelisk") && locationRef.Value == Game1.currentLocation)
     {
         Game1.flashAlpha = 1f;
     }
     if (locationRef.Value == Game1.currentLocation && (string)upgradeName != "Hut")
     {
         DelayedAction.playSoundAfterDelay("secret1", 800);
     }
 }
Пример #10
0
 protected override void resetLocalState()
 {
     base.resetLocalState();
     leaving            = false;
     Game1.ambientLight = Color.White;
     if (Game1.player.getTileX() == 35 && Game1.player.getTileY() == 43)
     {
         warpedToDesert = true;
     }
     if (Game1.player.getTileY() > 40 || Game1.player.getTileY() < 10)
     {
         drivingOff  = false;
         drivingBack = false;
         busMotion   = Vector2.Zero;
         busPosition = new Vector2(17f, 24f) * 64f;
         busDoor     = new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Microsoft.Xna.Framework.Rectangle(288, 1311, 16, 38), busPosition + new Vector2(16f, 26f) * 4f, flipped: false, 0f, Color.White)
         {
             interval        = 999999f,
             animationLength = 6,
             holdLastFrame   = true,
             layerDepth      = (busPosition.Y + 192f) / 10000f + 1E-05f,
             scale           = 4f
         };
         Game1.changeMusicTrack("wavy");
     }
     else
     {
         if (Game1.isRaining)
         {
             Game1.changeMusicTrack("none");
         }
         busPosition = new Vector2(17f, 24f) * 64f;
         busDoor     = new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Microsoft.Xna.Framework.Rectangle(368, 1311, 16, 38), busPosition + new Vector2(16f, 26f) * 4f, flipped: false, 0f, Color.White)
         {
             interval        = 999999f,
             animationLength = 1,
             holdLastFrame   = true,
             layerDepth      = (busPosition.Y + 192f) / 10000f + 1E-05f,
             scale           = 4f
         };
         Game1.displayFarmer = false;
         busDriveBack();
     }
     temporarySprites.Add(new TemporaryAnimatedSprite
     {
         texture               = Game1.temporaryContent.Load <Texture2D>("LooseSprites\\temporary_sprites_1"),
         sourceRect            = new Microsoft.Xna.Framework.Rectangle(0, 513, 208, 101),
         sourceRectStartingPos = new Vector2(0f, 513f),
         animationLength       = 1,
         totalNumberOfLoops    = 9999,
         interval              = 99999f,
         scale      = 4f,
         position   = new Vector2(528f, 298f) * 4f,
         layerDepth = 0.1324f,
         id         = 996f
     });
     if (isTravelingDeserteMerchantHere())
     {
         temporarySprites.Add(new TemporaryAnimatedSprite
         {
             texture               = Game1.temporaryContent.Load <Texture2D>("LooseSprites\\temporary_sprites_1"),
             sourceRect            = new Microsoft.Xna.Framework.Rectangle(0, 614, 20, 26),
             sourceRectStartingPos = new Vector2(0f, 614f),
             animationLength       = 1,
             totalNumberOfLoops    = 999,
             interval              = 99999f,
             scale      = 4f,
             position   = new Vector2(663f, 354f) * 4f,
             layerDepth = 0.1328f,
             id         = 995f
         });
     }
     if (Game1.timeOfDay >= Game1.getModeratelyDarkTime())
     {
         lightMerchantLamps();
     }
 }
Пример #11
0
 /*********
 ** Public methods
 *********/
 public AnimatedComponent(Point position, TemporaryAnimatedSprite sprite)
 {
     this.SetScaledArea(new Rectangle(position.X, position.Y, sprite.sourceRect.Width, sprite.sourceRect.Height));
     this.Sprite = sprite;
 }
 // Token: 0x06000DE3 RID: 3555 RVA: 0x0011C062 File Offset: 0x0011A262
 public ClickableAnimatedComponent(Rectangle bounds, string name, string hoverText, TemporaryAnimatedSprite sprite) : this(bounds, name, hoverText, sprite, true)
 {
 }
 // Token: 0x06000DE2 RID: 3554 RVA: 0x0011C000 File Offset: 0x0011A200
 public ClickableAnimatedComponent(Rectangle bounds, string name, string hoverText, TemporaryAnimatedSprite sprite, bool drawLabel) : base(bounds, name)
 {
     this.sprite          = sprite;
     this.sprite.position = new Vector2((float)bounds.X, (float)bounds.Y);
     this.baseScale       = sprite.scale;
     this.hoverText       = hoverText;
     this.drawLabel       = drawLabel;
 }
Пример #14
0
 public override void UpdateWhenCurrentLocation(GameTime time)
 {
     base.UpdateWhenCurrentLocation(time);
     foreach (SuspensionBridge suspensionBridge in suspensionBridges)
     {
         suspensionBridge.Update(time);
     }
     if (!caveOpened && Utility.isOnScreen(Utility.PointToVector2(boulderPosition.Location), 1))
     {
         boulderKnockTimer -= (float)time.ElapsedGameTime.TotalMilliseconds;
         boulderTextTimer  -= (float)time.ElapsedGameTime.TotalMilliseconds;
         if (doneHittingBoulderWithToolTimer > 0f)
         {
             doneHittingBoulderWithToolTimer -= (float)time.ElapsedGameTime.TotalMilliseconds;
             if (doneHittingBoulderWithToolTimer <= 0f)
             {
                 boulderTextTimer  = 2000f;
                 boulderTextString = Game1.content.LoadString("Strings\\Locations:IslandNorth_CaveTool_" + Game1.random.Next(4));
             }
         }
         if (boulderKnocksLeft > 0)
         {
             if (boulderKnockTimer < 0f)
             {
                 Game1.playSound("hammer");
                 boulderKnocksLeft--;
                 boulderKnockTimer = 500f;
                 if (boulderKnocksLeft == 0 && Game1.random.NextDouble() < 0.5)
                 {
                     DelayedAction.functionAfterDelay(delegate
                     {
                         boulderTextTimer  = 2000f;
                         boulderTextString = Game1.content.LoadString("Strings\\Locations:IslandNorth_CaveHelp_" + Game1.random.Next(4));
                     }, 1000);
                 }
             }
         }
         else if (Game1.random.NextDouble() < 0.002 && boulderTextTimer < -500f)
         {
             boulderKnocksLeft = Game1.random.Next(3, 6);
         }
     }
     if (!_sawFlameSpriteSouth && Utility.isThereAFarmerWithinDistance(new Vector2(36f, 79f), 5, this) == Game1.player)
     {
         Game1.addMailForTomorrow("Saw_Flame_Sprite_North_South", noLetter: true);
         TemporaryAnimatedSprite v4 = getTemporarySpriteByID(999);
         if (v4 != null)
         {
             v4.yPeriodic               = false;
             v4.xPeriodic               = false;
             v4.sourceRect.Y            = 0;
             v4.sourceRectStartingPos.Y = 0f;
             v4.motion               = new Vector2(1f, -4f);
             v4.acceleration         = new Vector2(0f, -0.04f);
             v4.drawAboveAlwaysFront = true;
         }
         localSound("magma_sprite_spot");
         v4 = getTemporarySpriteByID(998);
         if (v4 != null)
         {
             v4.yPeriodic    = false;
             v4.xPeriodic    = false;
             v4.motion       = new Vector2(1f, -4f);
             v4.acceleration = new Vector2(0f, -0.04f);
         }
         _sawFlameSpriteSouth = true;
     }
     if (!_sawFlameSpriteNorth && Utility.isThereAFarmerWithinDistance(new Vector2(41f, 30f), 5, this) == Game1.player)
     {
         Game1.addMailForTomorrow("Saw_Flame_Sprite_North_North", noLetter: true);
         TemporaryAnimatedSprite v2 = getTemporarySpriteByID(9999);
         if (v2 != null)
         {
             v2.yPeriodic               = false;
             v2.xPeriodic               = false;
             v2.sourceRect.Y            = 0;
             v2.sourceRectStartingPos.Y = 0f;
             v2.motion                = new Vector2(0f, -4f);
             v2.acceleration          = new Vector2(0f, -0.04f);
             v2.yStopCoordinate       = 1216;
             v2.reachedStopCoordinate = delegate
             {
                 removeTemporarySpritesWithID(9999);
             };
         }
         localSound("magma_sprite_spot");
         v2 = getTemporarySpriteByID(9998);
         if (v2 != null)
         {
             v2.yPeriodic             = false;
             v2.xPeriodic             = false;
             v2.motion                = new Vector2(0f, -4f);
             v2.acceleration          = new Vector2(0f, -0.04f);
             v2.yStopCoordinate       = 1280;
             v2.reachedStopCoordinate = delegate
             {
                 removeTemporarySpritesWithID(9998);
             };
         }
         _sawFlameSpriteNorth = true;
     }
     if (hasTriedFirstEntryDigSiteLoad)
     {
         return;
     }
     if (Game1.IsMasterGame && !Game1.player.hasOrWillReceiveMail("ISLAND_NORTH_DIGSITE_LOAD"))
     {
         Game1.addMail("ISLAND_NORTH_DIGSITE_LOAD", noLetter: true);
         for (int i = 0; i < 40; i++)
         {
             digSiteUpdate();
         }
     }
     hasTriedFirstEntryDigSiteLoad = true;
 }
Пример #15
0
 public virtual void proceedToNextScene()
 {
     if (currentChannel == 2)
     {
         if (screenOverlay == null)
         {
             screen = new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Rectangle(497, 305, 42, 28), 9999f, 1, 999999, getScreenPosition(), flicker: false, flipped: false, (float)(boundingBox.Bottom - 1) / 10000f + 1E-05f, 0f, Color.White, getScreenSizeModifier(), 0f, 0f, 0f)
             {
                 id = 777f
             };
             Game1.drawObjectDialogue(Game1.parseText(getWeatherForecast()));
             setWeatherOverlay();
             Game1.afterDialogues = proceedToNextScene;
         }
         else if (Game1.player.hasOrWillReceiveMail("Visited_Island") && screen.id == 777f)
         {
             screen = new TemporaryAnimatedSprite("LooseSprites\\Cursors2", new Rectangle(148, 62, 42, 28), 9999f, 1, 999999, getScreenPosition(), flicker: false, flipped: false, (float)(boundingBox.Bottom - 1) / 10000f + 1E-05f, 0f, Color.White, getScreenSizeModifier(), 0f, 0f, 0f);
             Game1.drawObjectDialogue(Game1.parseText(getIslandWeatherForecast()));
             setWeatherOverlay(island: true);
             Game1.afterDialogues = proceedToNextScene;
         }
         else
         {
             turnOffTV();
         }
     }
     else if (currentChannel == 3)
     {
         if (screenOverlay == null)
         {
             screen = new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Rectangle(624, 305, 42, 28), 9999f, 1, 999999, getScreenPosition(), flicker: false, flipped: false, (float)(boundingBox.Bottom - 1) / 10000f + 1E-05f, 0f, Color.White, getScreenSizeModifier(), 0f, 0f, 0f);
             Game1.drawObjectDialogue(Game1.parseText(getFortuneForecast(Game1.player)));
             setFortuneOverlay(Game1.player);
             Game1.afterDialogues = proceedToNextScene;
         }
         else
         {
             turnOffTV();
         }
     }
     else if (currentChannel == 4)
     {
         if (screenOverlay == null)
         {
             Game1.drawObjectDialogue(Game1.parseText(getTodaysTip()));
             Game1.afterDialogues = proceedToNextScene;
             screenOverlay        = new TemporaryAnimatedSprite
             {
                 alpha = 1E-07f
             };
         }
         else
         {
             turnOffTV();
         }
     }
     else if (currentChannel == 5)
     {
         if (screenOverlay == null)
         {
             Game1.multipleDialogues(getWeeklyRecipe());
             Game1.afterDialogues = proceedToNextScene;
             screenOverlay        = new TemporaryAnimatedSprite
             {
                 alpha = 1E-07f
             };
         }
         else
         {
             turnOffTV();
         }
     }
     else if (currentChannel == 666)
     {
         Game1.flashAlpha = 1f;
         Game1.soundBank.PlayCue("batScreech");
         Game1.createItemDebris(new Object(103, 1), Game1.player.getStandingPosition(), 1, Game1.currentLocation);
         Game1.player.mailReceived.Add("cursed_doll");
         turnOffTV();
     }
     else if (currentChannel == 6)
     {
         if (screenOverlay == null)
         {
             Game1.multipleDialogues(getFishingInfo());
             Game1.afterDialogues = proceedToNextScene;
             screenOverlay        = new TemporaryAnimatedSprite
             {
                 alpha = 1E-07f
             };
         }
         else
         {
             turnOffTV();
         }
     }
 }
Пример #16
0
        public static bool Prefix(StardewValley.Object o, bool playThrowSound, Farm __instance)
        {
            if (playThrowSound)
            {
                __instance.localSound("backpackIN");
            }
            DelayedAction.playSoundAfterDelay("Ship", playThrowSound ? 250 : 0, (GameLocation)null);
            int num1 = Game1.random.Next();
            List <TemporaryAnimatedSprite> temporarySprites1        = __instance.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite1 = new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Microsoft.Xna.Framework.Rectangle(524, 218, 34, 22), new Vector2(FarmState.shippingCrateLocation.X, FarmState.shippingCrateLocation.Y - 1) * 64f + new Vector2(0.0f, 5f) * 4f, false, 0.0f, Color.White);

            temporaryAnimatedSprite1.interval           = 100f;
            temporaryAnimatedSprite1.totalNumberOfLoops = 1;
            temporaryAnimatedSprite1.animationLength    = 3;
            temporaryAnimatedSprite1.pingPong           = true;
            temporaryAnimatedSprite1.scale      = 4f;
            temporaryAnimatedSprite1.layerDepth = ((FarmState.shippingCrateLocation.Y + 1) * 64 + 1f) / 10000f;
            double num2 = (double)num1;

            temporaryAnimatedSprite1.id = (float)num2;
            int num3 = num1;

            temporaryAnimatedSprite1.extraInfoForEndBehavior = num3;
            TemporaryAnimatedSprite.endBehavior endBehavior = new TemporaryAnimatedSprite.endBehavior(((GameLocation)__instance).removeTemporarySpritesWithID);
            temporaryAnimatedSprite1.endFunction = endBehavior;
            temporarySprites1.Add(temporaryAnimatedSprite1);
            List <TemporaryAnimatedSprite> temporarySprites2        = __instance.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite2 = new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Microsoft.Xna.Framework.Rectangle(524, 230, 34, 10), new Vector2(FarmState.shippingCrateLocation.X, FarmState.shippingCrateLocation.Y - 1) * 64f + new Vector2(0.0f, 17f) * 4f, false, 0.0f, Color.White);

            temporaryAnimatedSprite2.interval           = 100f;
            temporaryAnimatedSprite2.totalNumberOfLoops = 1;
            temporaryAnimatedSprite2.animationLength    = 3;
            temporaryAnimatedSprite2.pingPong           = true;
            temporaryAnimatedSprite2.scale      = 4f;
            temporaryAnimatedSprite2.layerDepth = ((FarmState.shippingCrateLocation.Y + 1) * 64 + 1f) / 10000f;
            double num4 = (double)num1;

            temporaryAnimatedSprite2.id = (float)num4;
            int num5 = num1;

            temporaryAnimatedSprite2.extraInfoForEndBehavior = num5;
            temporarySprites2.Add(temporaryAnimatedSprite2);
            List <TemporaryAnimatedSprite> temporarySprites3        = __instance.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite3 = new TemporaryAnimatedSprite("Maps\\springobjects", Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, (int)((NetFieldBase <int, NetInt>)o.parentSheetIndex), 16, 16), new Vector2(FarmState.shippingCrateLocation.X, FarmState.shippingCrateLocation.Y - 1) * 64f + new Vector2((float)(8 + Game1.random.Next(6)), 2f) * 4f, false, 0.0f, Color.White);

            temporaryAnimatedSprite3.interval   = 9999f;
            temporaryAnimatedSprite3.scale      = 4f;
            temporaryAnimatedSprite3.alphaFade  = 0.045f;
            temporaryAnimatedSprite3.layerDepth = ((FarmState.shippingCrateLocation.Y + 1) * 64 + 1f) / 10000f;
            Vector2 vector2_1 = new Vector2(0.0f, 0.3f);

            temporaryAnimatedSprite3.motion = vector2_1;
            Vector2 vector2_2 = new Vector2(0.0f, 0.2f);

            temporaryAnimatedSprite3.acceleration = vector2_2;
            double num6 = -0.0500000007450581;

            temporaryAnimatedSprite3.scaleChange = (float)num6;
            temporarySprites3.Add(temporaryAnimatedSprite3);
            return(false);
        }
Пример #17
0
 public virtual void turnOffTV()
 {
     screen        = null;
     screenOverlay = null;
 }
Пример #18
0
        public static void PerformGraphics(GameLocation gameLocation, TemporaryAnimatedSprite animatedSprites)
        {
            Multiplayer multiplayer = Util.Helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue();

            multiplayer.broadcastSprites(gameLocation, animatedSprites);
        }
Пример #19
0
        public static bool UpdateCharcoalKilnInput(ref StardewObject __instance, ref bool __result, ref Item dropInItem, ref bool probe, ref Farmer who)
        {
            try
            {
                if (__instance.name.Equals("Charcoal Kiln"))
                {
                    if (__instance.isTemporarilyInvisible)
                    {
                        __result = false;
                        return(false);
                    }

                    if (dropInItem is not StardewObject)
                    {
                        __result = false;
                        return(false);
                    }

                    StardewObject dropIn = dropInItem as StardewObject;

                    if (dropInItem is Wallpaper)
                    {
                        __result = false;
                        return(false);
                    }

                    if (__instance.heldObject.Value != null)
                    {
                        __result = false;
                        return(false);
                    }

                    if (dropIn != null && dropIn.bigCraftable.Value)
                    {
                        __result = false;
                        return(false);
                    }

                    if (__instance.bigCraftable.Value && !probe && dropIn != null && __instance.heldObject.Value == null)
                    {
                        __instance.scale.X = 5f;
                    }

                    if (probe && __instance.MinutesUntilReady > 0)
                    {
                        __result = false;
                        return(false);
                    }

                    int consumeCount = -1;

                    switch (dropIn.ParentSheetIndex)
                    {
                    case DriftwoodID:
                        if (mod.Config.DriftwoodMultiplier > 0 && dropIn.Stack >= CountWithMultiplier(mod.Config.CharcoalKilnWoodNeeded, mod.Config.DriftwoodMultiplier))
                        {
                            consumeCount = CountWithMultiplier(mod.Config.CharcoalKilnWoodNeeded, mod.Config.DriftwoodMultiplier);
                        }

                        break;

                    case WoodID:
                        if (dropIn.Stack >= mod.Config.CharcoalKilnWoodNeeded)
                        {
                            consumeCount = mod.Config.CharcoalKilnWoodNeeded;
                        }

                        break;

                    case HardwoodID:
                        if (mod.Config.HardwoodMultiplier > 0 && dropIn.Stack >= CountWithMultiplier(mod.Config.CharcoalKilnWoodNeeded, mod.Config.HardwoodMultiplier))
                        {
                            consumeCount = CountWithMultiplier(mod.Config.CharcoalKilnWoodNeeded, mod.Config.HardwoodMultiplier);
                        }

                        break;

                    default:
                        break;
                    }

                    if (who.IsLocalPlayer && consumeCount == -1)
                    {
                        if (!probe && who.IsLocalPlayer && StardewObject.autoLoadChest == null)
                        {
                            Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Object.cs.12783"));
                        }

                        __result = false;
                        return(false);
                    }

                    if (__instance.heldObject.Value == null && consumeCount != -1)
                    {
                        if (!probe)
                        {
                            __instance.ConsumeInventoryItem(who, dropIn, consumeCount);
                            who.currentLocation.playSound("openBox", NetAudio.SoundContext.Default);
                            DelayedAction.playSoundAfterDelay("fireball", 50, null, -1);
                            __instance.showNextIndex.Value = true;

                            var multiplayer = (Multiplayer)AccessTools.Field(typeof(Game1), "multiplayer").GetValue(null);

                            var tempSprite = new TemporaryAnimatedSprite(27, (__instance.TileLocation * 64f) + new Vector2(-16f, -128f), Color.White, 4, false, 50f, 10, 64, ((__instance.TileLocation.Y + 1f) * 64f / 10000f) + 0.0001f, -1, 0)
                            {
                                alphaFade = 0.005f
                            };

                            multiplayer.broadcastSprites(who.currentLocation, new TemporaryAnimatedSprite[] { tempSprite });

                            __instance.heldObject.Value  = new StardewObject(CoalID, 1, false, -1, 0);
                            __instance.MinutesUntilReady = mod.Config.CharcoalKilnTimeNeeded;
                        }
                        else
                        {
                            __instance.heldObject.Value = new StardewObject();

                            __result = true;
                            return(false);
                        }
                    }

                    __result = false;
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                mod.ErrorLog("There was an exception in a patch", e);
                return(true);
            }
        }
Пример #20
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            base.receiveLeftClick(x, y, !this.destroyItemOnClick);

            if (this.heldItem == null)
            {
                for (int i = 0; i < tabs.Count(); i++)
                {
                    ClickableComponent t = this.tabs[i];
                    int w = (int)Game1.smallFont.MeasureString(t.name).Y;
                    if (t.bounds.Contains(x, y))
                    {
                        tab = i;
                        Game1.exitActiveMenu();
                        ItemInventoryMenu.scrollIndex = 0;
                        Open();
                        break;
                    }
                }

                if (sortButton.bounds.Contains(x, y))
                {
                    sortID++;
                    if (sortID > 2)
                    {
                        sortID = 0;
                    }
                    Open();
                }

                if (qualityButton.bounds.Contains(x, y))
                {
                    quality++;
                    if (quality > 2)
                    {
                        quality = 0;
                    }
                    Open();
                }

                if (this.upArrow.bounds.Contains(x, y))
                {
                    if (this.ItemsToGrabMenu != null)
                    {
                        this.ItemsToGrabMenu.receiveScrollWheelAction(1);
                    }
                }

                if (this.downArrow.bounds.Contains(x, y))
                {
                    if (this.ItemsToGrabMenu != null)
                    {
                        this.ItemsToGrabMenu.receiveScrollWheelAction(-1);
                    }
                }
            }

            if (this.heldItem == null && this.showReceivingMenu)
            {
                this.heldItem = this.ItemsToGrabMenu.leftClick(x, y, this.heldItem, false);
                if (this.heldItem is StardewValley.Object && (this.heldItem as StardewValley.Object).parentSheetIndex == 326)
                {
                    this.heldItem = (Item)null;
                    Game1.player.canUnderstandDwarves = true;
                    this.poof = new TemporaryAnimatedSprite(Game1.animations, new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2((float)(x - x % Game1.tileSize + Game1.tileSize / 4), (float)(y - y % Game1.tileSize + Game1.tileSize / 4)), false, false);
                    Game1.playSound("fireball");
                }
                else if (this.heldItem is StardewValley.Object && (this.heldItem as StardewValley.Object).parentSheetIndex == 102)
                {
                    this.heldItem = (Item)null;
                    Game1.player.foundArtifact(102, 1);
                    this.poof = new TemporaryAnimatedSprite(Game1.animations, new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2((float)(x - x % Game1.tileSize + Game1.tileSize / 4), (float)(y - y % Game1.tileSize + Game1.tileSize / 4)), false, false);
                    Game1.playSound("fireball");
                }
                else if (this.heldItem is StardewValley.Object && (this.heldItem as StardewValley.Object).isRecipe)
                {
                    string key = this.heldItem.Name.Substring(0, this.heldItem.Name.IndexOf("Recipe") - 1);
                    try {
                        if ((this.heldItem as StardewValley.Object).category == -7)
                        {
                            Game1.player.cookingRecipes.Add(key, 0);
                        }
                        else
                        {
                            Game1.player.craftingRecipes.Add(key, 0);
                        }
                        this.poof = new TemporaryAnimatedSprite(Game1.animations, new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2((float)(x - x % Game1.tileSize + Game1.tileSize / 4), (float)(y - y % Game1.tileSize + Game1.tileSize / 4)), false, false);
                        Game1.playSound("newRecipe");
                    } catch (Exception ex) {
                    }
                    this.heldItem = (Item)null;
                }
                else if (Game1.player.addItemToInventoryBool(this.heldItem, false))
                {
                    this.heldItem = (Item)null;
                    Game1.playSound("coin");
                }
            }
            else if (this.reverseGrab)
            {
                if (this.destroyItemOnClick)
                {
                    this.heldItem = (Item)null;
                    return;
                }
            }
            if (this.heldItem == null || this.isWithinBounds(x, y) || !this.heldItem.canBeTrashed())
            {
                return;
            }
            Game1.playSound("throwDownITem");
            Game1.createItemDebris(this.heldItem, Game1.player.getStandingPosition(), Game1.player.FacingDirection);
            this.heldItem = (Item)null;
        }
        internal override void show(TV tv)
        {
            WorldDate today = Utilities.Now();
            List <Mining.Prediction> predictions = Mining.ListFloorsForDate(today);

            TemporaryAnimatedSprite background = loadBackground(tv, 0);
            TemporaryAnimatedSprite marlon     = loadPortrait(tv, "Marlon");
            TemporaryAnimatedSprite gil        = loadPortrait(tv, "Gil");

            // Opening scene: Marlon greets the viewer.
            queueScene(new Scene(Helper.Translation.Get((predictions.Count == 0)
                                ? "mining.opening.none" : "mining.opening"),
                                 background, marlon)
            {
                musicTrack = "MarlonsTheme"
            });

            // Marlon or Gil reports on each type of special floor.
            string joiner = CultureInfo.CurrentCulture.TextInfo.ListSeparator + " ";

            foreach (Mining.FloorType type in predictions
                     .Select((p) => p.type).Distinct().ToList())
            {
                List <int> floors = predictions
                                    .Where((p) => p.type == type)
                                    .Select((p) => p.floor)
                                    .ToList();
                string floorsText;
                if (floors.Count == 1)
                {
                    floorsText = Helper.Translation.Get("mining.floor",
                                                        new { num = floors[0] });
                }
                else
                {
                    int lastNum = floors[floors.Count - 1];
                    floors.RemoveAt(floors.Count - 1);
                    floorsText = Helper.Translation.Get("mining.floors",
                                                        new { nums = string.Join(joiner, floors), lastNum = lastNum });
                }

                queueScene(new Scene(Helper.Translation.Get($"mining.prediction.{type}",
                                                            new { floors = floorsText, }),
                                     loadBackground(tv, (int)type + 1),
                                     GilTypes.Contains(type) ? gil : marlon)
                {
                    musicTrack = "MarlonsTheme"
                });
            }

            // Closing scene: Marlon signs off.
            bool progress = Mining.IsProgressDependent;

            queueScene(new Scene
                           (Helper.Translation.Get($"mining.closing.{(progress? "progress" : "standard")}"),
                           background, marlon)
            {
                musicTrack = "MarlonsTheme"
            });

            runProgram(tv);
        }
Пример #22
0
        public override void receiveRightClick(int x, int y, bool playSound = true)
        {
            int  num1     = this.heldItem != null ? this.heldItem.Stack : 0;
            Item heldItem = this.heldItem;

            if (this.isWithinBounds(x, y))
            {
                base.receiveRightClick(x, y);
                if (this.itemChangeBehavior == null && heldItem == null && (this.heldItem != null && Game1.oldKBState.IsKeyDown(Keys.LeftShift)))
                {
                    this.heldItem = this.ItemsToGrabMenu.tryToAddItem(this.heldItem, "Ship");
                }
            }
            if (!this.ItemsToGrabMenu.isWithinBounds(x, y))
            {
                return;
            }
            this.heldItem = this.ItemsToGrabMenu.rightClick(x, y, this.heldItem, false);
            if (this.heldItem != null && heldItem == null || this.heldItem != null && heldItem != null && !this.heldItem.Equals((object)heldItem) || this.heldItem != null && heldItem != null && (this.heldItem.Equals((object)heldItem) && this.heldItem.Stack != num1))
            {
                if (this.itemChangeBehavior != null)
                {
                    int num2 = this.itemChangeBehavior(this.heldItem, this.ItemsToGrabMenu.getInventoryPositionOfClick(x, y), heldItem, this, true) ? 1 : 0;
                }
                Game1.playSound("dwop");
            }
            if (this.heldItem == null && heldItem != null || this.heldItem != null && heldItem != null && !this.heldItem.Equals((object)heldItem))
            {
                if (this.itemChangeBehavior != null)
                {
                    int num2 = this.itemChangeBehavior(heldItem, this.ItemsToGrabMenu.getInventoryPositionOfClick(x, y), this.heldItem, this) ? 1 : 0;
                }
                Game1.playSound("Ship");
            }
            if (this.heldItem is StardewValley.Object && (this.heldItem as StardewValley.Object).IsRecipe)
            {
                string key = this.heldItem.Name.Substring(0, this.heldItem.Name.IndexOf("Recipe") - 1);
                try
                {
                    if ((this.heldItem as StardewValley.Object).Category == -7)
                    {
                        Game1.player.cookingRecipes.Add(key, 0);
                    }
                    else
                    {
                        Game1.player.craftingRecipes.Add(key, 0);
                    }
                    this.poof = new TemporaryAnimatedSprite(Game1.animationsName, new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2((float)(x - x % Game1.tileSize + Game1.tileSize / 4), (float)(y - y % Game1.tileSize + Game1.tileSize / 4)), false, false);
                    Game1.playSound("newRecipe");
                }
                catch
                {
                }
                this.heldItem = (Item)null;
            }
            else
            {
                if (!Game1.oldKBState.IsKeyDown(Keys.LeftShift) || !Game1.player.addItemToInventoryBool(this.heldItem))
                {
                    return;
                }
                this.heldItem = (Item)null;
                Game1.playSound("coin");
                if (this.itemChangeBehavior == null)
                {
                    return;
                }
                int num2 = this.itemChangeBehavior(this.heldItem, this.ItemsToGrabMenu.getInventoryPositionOfClick(x, y), heldItem, this, true) ? 1 : 0;
            }
        }
Пример #23
0
        private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
        {
            var api = Helper.ModRegistry.GetApi <PlatoTK.APIs.IContentPatcher>("Pathoschild.ContentPatcher");

            api.RegisterToken(ModManifest, "Channel", new CustomTVChannelToken());
            api.RegisterToken(ModManifest, "Screen", new CustomTVScreenToken());

            PlatoHelper.Events.QuestionRaised += (q, p) =>
            {
                if (p.IsTV)
                {
                    bool added = false;

                    foreach (string channel in CustomTVChannelToken.Channels.Keys.ToList())
                    {
                        Dictionary <string, string> channelData = Helper.Content.Load <Dictionary <string, string> >($"{CustomTVChannelToken.ChannelDataPrefix}{channel}", ContentSource.GameContent);

                        if (channelData.ContainsKey("@Active") && channelData["@Active"].ToLower() == "false")
                        {
                            continue;
                        }

                        if (CustomTVChannelToken.Channels[channel] == null)
                        {
                            added = true;
                            CustomTVChannelToken.Channels[channel] = new TVChannel()
                            {
                                Id    = channel,
                                Name  = channelData.ContainsKey("@Name") ? channelData["@Name"] : "Missing Name",
                                Intro = "Missing Intro",
                            };


                            if (channelData.ContainsKey("@Intro"))
                            {
                                GetShowData(channelData["@Intro"], out string text, out string screen, out string overlay, out string music);

                                CustomTVChannelToken.Channels[channel].Intro      = text;
                                CustomTVChannelToken.Channels[channel].IntroMusic = music;

                                if (!string.IsNullOrEmpty(screen) && CustomTVChannelToken.GetScreenId(channel, screen) is string screenId &&
                                    CustomTVChannelToken.Screens.ContainsKey(screenId) &&
                                    CustomTVChannelToken.Screens[screenId] is TVScreen tvs)
                                {
                                    CustomTVChannelToken.Channels[channel].IntroScreen =
                                        new TemporaryAnimatedSprite(
                                            tvs.Path,
                                            new Rectangle(tvs.SourceBounds[0], tvs.SourceBounds[1], tvs.SourceBounds[2], tvs.SourceBounds[3]),
                                            tvs.FrameDuration, tvs.Frames, int.MaxValue, Vector2.Zero, false, false, 0f, 0.0f, Color.White, 1f,
                                            0.0f, 0.0f, 0.0f, false);
                                }

                                if (!string.IsNullOrEmpty(overlay) && CustomTVChannelToken.GetScreenId(channel, overlay) is string overlayId &&
                                    CustomTVChannelToken.Screens.ContainsKey(overlayId) &&
                                    CustomTVChannelToken.Screens[overlayId] is TVScreen os)
                                {
                                    CustomTVChannelToken.Channels[channel].IntroOverlay =
                                        new TemporaryAnimatedSprite(
                                            os.Path,
                                            new Rectangle(os.SourceBounds[0], os.SourceBounds[1], os.SourceBounds[2], os.SourceBounds[3]),
                                            os.FrameDuration, os.Frames, int.MaxValue, Vector2.Zero, false, false, 0f, 0.0f, Color.White, 1f,
                                            0.0f, 0.0f, 0.0f, false);
                                }
                            }


                            if (channelData.ContainsKey("@Seasons"))
                            {
                                CustomTVChannelToken.Channels[channel].Seasons = channelData["@Seasons"].Split(' ');
                            }

                            if (channelData.ContainsKey("@Days"))
                            {
                                CustomTVChannelToken.Channels[channel].Days = channelData["@Days"].Split(' ');
                            }

                            if (channelData.ContainsKey("@Order"))
                            {
                                CustomTVChannelToken.Channels[channel].Random = channelData["@Order"].ToLower() == "random";
                            }
                        }

                        if (CustomTVChannelToken.Channels[channel] is TVChannel tvc && tvc.Seasons.Any(s => s.ToLower() == Game1.currentSeason.ToLower()) &&
                            tvc.Days.Any(d => d.ToLower() == Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth).ToLower()))
                        {
                            p.AddResponse(new Response(channel, CustomTVChannelToken.Channels[channel].Name));
                        }
                    }

                    if (added)
                    {
                        p.PaginateResponses();
                    }
                }
            };

            PlatoHelper.Events.TVChannelSelected += (s, p) =>
            {
                if (CustomTVChannelToken.Channels.ContainsKey(p.ChannelName) &&
                    CustomTVChannelToken.Channels[p.ChannelName] is TVChannel channel &&
                    Helper.Content.Load <Dictionary <string, string> >($"{CustomTVChannelToken.ChannelDataPrefix}{p.ChannelName}", ContentSource.GameContent) is Dictionary <string, string> channelData
                    )
                {
                    if (TryPickShow(channelData, p.ChannelName, out string text, out string screen, out string overlay, out string music, channel.Random))
                    {
                        if (channel.IntroScreen != null)
                        {
                            channel.IntroScreen.Position = new Vector2(
                                p.ScreenPosition.X + (channel.IntroScreenOffset[0] * p.Scale),
                                p.ScreenPosition.Y + (channel.IntroScreenOffset[1] * p.Scale));
                            channel.IntroScreen.layerDepth = p.ScreenLayerDepth;
                            channel.IntroScreen.scale      = p.Scale;
                        }

                        if (channel.IntroOverlay != null)
                        {
                            channel.IntroOverlay.Position = new Vector2(
                                p.ScreenPosition.X + (channel.IntroOverlayOffset[0] * p.Scale),
                                p.ScreenPosition.Y + (channel.IntroOverlayOffset[1] * p.Scale));
                            channel.IntroOverlay.layerDepth = p.OverlayLayerDepth;
                            channel.IntroOverlay.scale      = p.Scale;
                        }

                        string cMusic      = Game1.getMusicTrackName();
                        bool   changeMusic = false;
                        if (!string.IsNullOrEmpty(channel.IntroMusic) && channel.IntroMusic != "none")
                        {
                            changeMusic = true;
                            try
                            {
                                Game1.changeMusicTrack(channel.IntroMusic);
                            }
                            catch
                            {
                            }
                        }

                        p.ShowScene(channel.IntroScreen, channel.IntroOverlay, channel.Intro, () =>
                        {
                            TemporaryAnimatedSprite screenSprite  = channel.IntroScreen;
                            TemporaryAnimatedSprite overlaySprite = null;

                            if (!string.IsNullOrEmpty(screen) && CustomTVChannelToken.GetScreenId(p.ChannelName, screen) is string screenId &&
                                CustomTVChannelToken.Screens.ContainsKey(screenId) &&
                                CustomTVChannelToken.Screens[screenId] is TVScreen tvs)
                            {
                                screenSprite =
                                    new TemporaryAnimatedSprite(
                                        tvs.Path,
                                        new Rectangle(tvs.SourceBounds[0], tvs.SourceBounds[1], tvs.SourceBounds[2], tvs.SourceBounds[3]),
                                        tvs.FrameDuration, tvs.Frames, int.MaxValue,
                                        new Vector2(p.ScreenPosition.X + (tvs.Offset[0] * p.Scale), p.ScreenPosition.Y + (tvs.Offset[1] * p.Scale))
                                        , false, false, p.ScreenLayerDepth, 0.0f, Color.White, p.Scale,
                                        0.0f, 0.0f, 0.0f, false);
                            }

                            if (!string.IsNullOrEmpty(overlay) && CustomTVChannelToken.GetScreenId(p.ChannelName, overlay) is string overlayId &&
                                CustomTVChannelToken.Screens.ContainsKey(overlayId) &&
                                CustomTVChannelToken.Screens[overlayId] is TVScreen os)
                            {
                                overlaySprite =
                                    new TemporaryAnimatedSprite(
                                        os.Path,
                                        new Rectangle(os.SourceBounds[0], os.SourceBounds[1], os.SourceBounds[2], os.SourceBounds[3]),
                                        os.FrameDuration, os.Frames, int.MaxValue,
                                        new Vector2(p.ScreenPosition.X + (os.Offset[0] * p.Scale), p.ScreenPosition.Y + (os.Offset[1] * p.Scale))
                                        , false, false, p.OverlayLayerDepth, 0.0f, Color.White, p.Scale,
                                        0.0f, 0.0f, 0.0f, false);
                            }

                            if (!string.IsNullOrEmpty(music) && music != "none")
                            {
                                changeMusic = true;
                                try
                                {
                                    Game1.changeMusicTrack(music);
                                }
                                catch
                                {
                                }
                            }

                            p.ShowScene(screenSprite, overlaySprite, text, () => {
                                try
                                {
                                    if (changeMusic)
                                    {
                                        Game1.changeMusicTrack(cMusic);
                                    }
                                }
                                catch
                                {
                                }
                                p.TurnOffTV();
                            });
                        });
                    }
Пример #24
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            this.okClicked = false;
            Item heldItem = this.heldItem;
            int  num      = heldItem != null ? heldItem.Stack : -1;

            if (this.isWithinBounds(x, y))
            {
                base.receiveLeftClick(x, y);
                if (this.itemChangeBehavior == null && heldItem == null && (this.heldItem != null && Game1.oldKBState.IsKeyDown(Keys.LeftShift)))
                {
                    this.heldItem = this.ItemsToGrabMenu.tryToAddItem(this.heldItem, "Ship");
                }
            }
            bool flag = true;

            if (this.ItemsToGrabMenu.isWithinBounds(x, y))
            {
                this.heldItem = this.ItemsToGrabMenu.leftClick(x, y, this.heldItem, false);
                if (this.heldItem != null && heldItem == null || this.heldItem != null && heldItem != null && !this.heldItem.Equals((object)heldItem))
                {
                    if (this.itemChangeBehavior != null)
                    {
                        flag = this.itemChangeBehavior(this.heldItem, this.ItemsToGrabMenu.getInventoryPositionOfClick(x, y), heldItem, this, true);
                    }
                    if (flag)
                    {
                        Game1.playSound("dwop");
                    }
                }
                if (this.heldItem == null && heldItem != null || this.heldItem != null && heldItem != null && !this.heldItem.Equals((object)heldItem))
                {
                    Item old = this.heldItem;
                    if (this.heldItem == null && this.ItemsToGrabMenu.getItemAt(x, y) != null && num < this.ItemsToGrabMenu.getItemAt(x, y).Stack)
                    {
                        old       = heldItem.getOne();
                        old.Stack = num;
                    }
                    if (this.itemChangeBehavior != null)
                    {
                        flag = this.itemChangeBehavior(heldItem, this.ItemsToGrabMenu.getInventoryPositionOfClick(x, y), old, this);
                    }
                    if (flag)
                    {
                        Game1.playSound("Ship");
                    }
                }
                if (this.heldItem is StardewValley.Object && (this.heldItem as StardewValley.Object).IsRecipe)
                {
                    string key = this.heldItem.Name.Substring(0, this.heldItem.Name.IndexOf("Recipe") - 1);
                    try
                    {
                        if ((this.heldItem as StardewValley.Object).Category == -7)
                        {
                            Game1.player.cookingRecipes.Add(key, 0);
                        }
                        else
                        {
                            Game1.player.craftingRecipes.Add(key, 0);
                        }
                        this.poof = new TemporaryAnimatedSprite(Game1.animationsName, new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2((float)(x - x % Game1.tileSize + Game1.tileSize / 4), (float)(y - y % Game1.tileSize + Game1.tileSize / 4)), false, false);
                        Game1.playSound("newRecipe");
                    }
                    catch
                    {
                    }
                    this.heldItem = (Item)null;
                }
                else if (Game1.oldKBState.IsKeyDown(Keys.LeftShift) && Game1.player.addItemToInventoryBool(this.heldItem))
                {
                    this.heldItem = (Item)null;
                    if (this.itemChangeBehavior != null)
                    {
                        flag = this.itemChangeBehavior(this.heldItem, this.ItemsToGrabMenu.getInventoryPositionOfClick(x, y), heldItem, this, true);
                    }
                    if (flag)
                    {
                        Game1.playSound("coin");
                    }
                }
            }
            if (okButton.containsPoint(x, y))
            {
                okClicked = true;
                if (readyToClose())
                {
                    Game1.playSound("bigDeSelect");
                    Game1.exitActiveMenu();
                    if (ItemsToGrabMenu.inventory.Any())
                    {
                        ModEvents.RaiseMailComposed(this, new MailComposedEventArgs()
                        {
                            ToFarmerId = toFarmerId,
                            Item       = ItemsToGrabMenu.actualInventory[0]
                        });
                    }
                }
            }
        }
Пример #25
0
        public override void receiveRightClick(int x, int y, bool playSound = true)
        {
            int  oldStack = (heldItem != null) ? heldItem.Stack : 0;
            Item old      = heldItem;

            if (isWithinBounds(x, y))
            {
                base.receiveRightClick(x, y, playSound: true);
                if (itemChangeBehavior == null && old == null && heldItem != null && Game1.oldKBState.IsKeyDown(Keys.LeftShift))
                {
                    heldItem = ItemsToGrabMenu.tryToAddItem(heldItem, "Ship");
                }
            }
            if (!ItemsToGrabMenu.isWithinBounds(x, y))
            {
                return;
            }
            heldItem = ItemsToGrabMenu.rightClick(x, y, heldItem, playSound: false);
            if ((heldItem != null && old == null) || (heldItem != null && old != null && !heldItem.Equals(old)) || (heldItem != null && old != null && heldItem.Equals(old) && heldItem.Stack != oldStack))
            {
                if (itemChangeBehavior != null)
                {
                    itemChangeBehavior(heldItem, ItemsToGrabMenu.getInventoryPositionOfClick(x, y), old, this, onRemoval: true);
                }
                Game1.playSound("dwop");
            }
            if ((heldItem == null && old != null) || (heldItem != null && old != null && !heldItem.Equals(old)))
            {
                if (itemChangeBehavior != null)
                {
                    itemChangeBehavior(old, ItemsToGrabMenu.getInventoryPositionOfClick(x, y), heldItem, this);
                }
                Game1.playSound("Ship");
            }
            if (heldItem is Object && (bool)(heldItem as Object).isRecipe)
            {
                string recipeName = heldItem.Name.Substring(0, heldItem.Name.IndexOf("Recipe") - 1);
                try
                {
                    if ((heldItem as Object).Category == -7)
                    {
                        Game1.player.cookingRecipes.Add(recipeName, 0);
                    }
                    else
                    {
                        Game1.player.craftingRecipes.Add(recipeName, 0);
                    }
                    poof = new TemporaryAnimatedSprite("TileSheets\\animations", new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2(x - x % 64 + 16, y - y % 64 + 16), flicker: false, flipped: false);
                    Game1.playSound("newRecipe");
                }
                catch (Exception)
                {
                }
                heldItem = null;
            }
            else if (Game1.oldKBState.IsKeyDown(Keys.LeftShift) && Game1.player.addItemToInventoryBool(heldItem))
            {
                heldItem = null;
                Game1.playSound("coin");
                if (itemChangeBehavior != null)
                {
                    itemChangeBehavior(heldItem, ItemsToGrabMenu.getInventoryPositionOfClick(x, y), old, this, onRemoval: true);
                }
            }
        }
Пример #26
0
        public void dumpContents(GameLocation location)
        {
            Random r = new Random((int)tileLocation.X + (int)tileLocation.Y + (int)Game1.uniqueIDForThisGame + Game1.CurrentMineLevel);

            if ((int)coins <= 0 && items.Count <= 0)
            {
                if (tileLocation.X % 7f == 0f)
                {
                    chestType.Value = "Monster";
                }
                else
                {
                    addContents(r.Next(4, Math.Max(8, Game1.CurrentMineLevel / 10 - 5)), Utility.getUncommonItemForThisMineLevel(Game1.CurrentMineLevel, new Point((int)tileLocation.X, (int)tileLocation.Y)));
                }
            }
            if (items.Count > 0 && !chestType.Equals("Monster") && items.Count >= 1 && (mutex.IsLockHeld() || !playerChest))
            {
                bool isStardrop = items[0] is Object && !(items[0] as Object).bigCraftable && (int)items[0].parentSheetIndex == 434;
                if (location is FarmHouse)
                {
                    if ((location as FarmHouse).owner.UniqueMultiplayerID != Game1.player.UniqueMultiplayerID)
                    {
                        Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\Objects:ParsnipSeedPackage_SomeoneElse"));
                        return;
                    }
                    if (!isStardrop)
                    {
                        Game1.player.addQuest(6);
                        Game1.screenOverlayTempSprites.Add(new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Rectangle(128, 208, 16, 16), 200f, 2, 30, new Vector2(Game1.dayTimeMoneyBox.questButton.bounds.Left - 16, Game1.dayTimeMoneyBox.questButton.bounds.Bottom + 8), flicker: false, flipped: false, 1f, 0f, Color.White, 4f, 0f, 0f, 0f, local: true));
                    }
                }
                if (isStardrop)
                {
                    string stardropName = (location is FarmHouse) ? "CF_Spouse" : "CF_Mines";
                    if (!Game1.player.mailReceived.Contains(stardropName))
                    {
                        Game1.player.eatObject(items[0] as Object, overrideFullness: true);
                        Game1.player.mailReceived.Add(stardropName);
                    }
                    items.Clear();
                }
                else
                {
                    Item item = items[0];
                    items[0] = null;
                    items.RemoveAt(0);
                    Game1.player.addItemByMenuIfNecessaryElseHoldUp(item);
                    ItemGrabMenu grab_menu;
                    if ((grab_menu = (Game1.activeClickableMenu as ItemGrabMenu)) != null)
                    {
                        ItemGrabMenu itemGrabMenu = grab_menu;
                        itemGrabMenu.behaviorBeforeCleanup = (Action <IClickableMenu>)Delegate.Combine(itemGrabMenu.behaviorBeforeCleanup, (Action <IClickableMenu>) delegate
                        {
                            grab_menu.DropRemainingItems();
                        });
                    }
                }
                if (Game1.mine != null)
                {
                    Game1.mine.chestConsumed();
                }
            }
            if (chestType.Equals("Monster"))
            {
                Monster monster = Game1.mine.getMonsterForThisLevel(Game1.CurrentMineLevel, (int)tileLocation.X, (int)tileLocation.Y);
                Vector2 v       = Utility.getVelocityTowardPlayer(new Point((int)tileLocation.X, (int)tileLocation.Y), 8f, Game1.player);
                monster.xVelocity = v.X;
                monster.yVelocity = v.Y;
                location.characters.Add(monster);
                location.playSound("explosion");
                Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(362, Game1.random.Next(30, 90), 6, 1, new Vector2(tileLocation.X * 64f, tileLocation.Y * 64f), flicker: false, (Game1.random.NextDouble() < 0.5) ? true : false));
                location.objects.Remove(tileLocation);
                Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Chest.cs.12531"), Color.Red, 3500f));
            }
            else
            {
                Game1.player.gainExperience(5, 25 + Game1.CurrentMineLevel);
            }
            if ((bool)giftbox)
            {
                TemporaryAnimatedSprite sprite = new TemporaryAnimatedSprite("LooseSprites\\Giftbox", new Rectangle(0, (int)giftboxIndex * 32, 16, 32), 80f, 11, 1, tileLocation.Value * 64f - new Vector2(0f, 52f), flicker: false, flipped: false, tileLocation.Y / 10000f, 0f, Color.White, 4f, 0f, 0f, 0f)
                {
                    destroyable   = false,
                    holdLastFrame = true
                };
                if (location.netObjects.ContainsKey(tileLocation) && location.netObjects[tileLocation] == this)
                {
                    Game1.multiplayer.broadcastSprites(location, sprite);
                    location.removeObject(tileLocation, showDestroyedObject: false);
                }
                else
                {
                    location.temporarySprites.Add(sprite);
                }
            }
        }
Пример #27
0
        public void addJunimoNote(int area)
        {
            Point notePosition = this.getNotePosition(area);

            if (notePosition.Equals((object)Vector2.Zero))
            {
                return;
            }
            StaticTile[] junimoNoteTileFrames = this.getJunimoNoteTileFrames(area);
            string       layerId = area == 5 ? "Front" : "Buildings";

            this.map.GetLayer(layerId).Tiles[notePosition.X, notePosition.Y] = (Tile) new AnimatedTile(this.map.GetLayer(layerId), junimoNoteTileFrames, 70L);
            Game1.currentLightSources.Add(new LightSource(4, new Vector2((float)(notePosition.X * Game1.tileSize), (float)(notePosition.Y * Game1.tileSize)), 1f));
            List <TemporaryAnimatedSprite> temporarySprites1        = this.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite1 = new TemporaryAnimatedSprite(6, new Vector2((float)(notePosition.X * Game1.tileSize), (float)(notePosition.Y * Game1.tileSize)), Color.White, 8, false, 100f, 0, -1, -1f, -1, 0);

            temporaryAnimatedSprite1.layerDepth = 1f;
            temporaryAnimatedSprite1.interval   = 50f;
            Vector2 vector2_1 = new Vector2(1f, 0.0f);

            temporaryAnimatedSprite1.motion = vector2_1;
            Vector2 vector2_2 = new Vector2(-0.005f, 0.0f);

            temporaryAnimatedSprite1.acceleration = vector2_2;
            temporarySprites1.Add(temporaryAnimatedSprite1);
            List <TemporaryAnimatedSprite> temporarySprites2        = this.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite2 = new TemporaryAnimatedSprite(6, new Vector2((float)(notePosition.X * Game1.tileSize - Game1.pixelZoom * 3), (float)(notePosition.Y * Game1.tileSize - Game1.pixelZoom * 3)), Color.White, 8, false, 100f, 0, -1, -1f, -1, 0);

            temporaryAnimatedSprite2.scale      = 0.75f;
            temporaryAnimatedSprite2.layerDepth = 1f;
            temporaryAnimatedSprite2.interval   = 50f;
            Vector2 vector2_3 = new Vector2(1f, 0.0f);

            temporaryAnimatedSprite2.motion = vector2_3;
            Vector2 vector2_4 = new Vector2(-0.005f, 0.0f);

            temporaryAnimatedSprite2.acceleration = vector2_4;
            int num1 = 50;

            temporaryAnimatedSprite2.delayBeforeAnimationStart = num1;
            temporarySprites2.Add(temporaryAnimatedSprite2);
            List <TemporaryAnimatedSprite> temporarySprites3        = this.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite3 = new TemporaryAnimatedSprite(6, new Vector2((float)(notePosition.X * Game1.tileSize - Game1.pixelZoom * 3), (float)(notePosition.Y * Game1.tileSize + Game1.pixelZoom * 3)), Color.White, 8, false, 100f, 0, -1, -1f, -1, 0);

            temporaryAnimatedSprite3.layerDepth = 1f;
            temporaryAnimatedSprite3.interval   = 50f;
            Vector2 vector2_5 = new Vector2(1f, 0.0f);

            temporaryAnimatedSprite3.motion = vector2_5;
            Vector2 vector2_6 = new Vector2(-0.005f, 0.0f);

            temporaryAnimatedSprite3.acceleration = vector2_6;
            int num2 = 100;

            temporaryAnimatedSprite3.delayBeforeAnimationStart = num2;
            temporarySprites3.Add(temporaryAnimatedSprite3);
            List <TemporaryAnimatedSprite> temporarySprites4        = this.temporarySprites;
            TemporaryAnimatedSprite        temporaryAnimatedSprite4 = new TemporaryAnimatedSprite(6, new Vector2((float)(notePosition.X * Game1.tileSize), (float)(notePosition.Y * Game1.tileSize)), Color.White, 8, false, 100f, 0, -1, -1f, -1, 0);

            temporaryAnimatedSprite4.layerDepth = 1f;
            temporaryAnimatedSprite4.scale      = 0.75f;
            temporaryAnimatedSprite4.interval   = 50f;
            Vector2 vector2_7 = new Vector2(1f, 0.0f);

            temporaryAnimatedSprite4.motion = vector2_7;
            Vector2 vector2_8 = new Vector2(-0.005f, 0.0f);

            temporaryAnimatedSprite4.acceleration = vector2_8;
            int num3 = 150;

            temporaryAnimatedSprite4.delayBeforeAnimationStart = num3;
            temporarySprites4.Add(temporaryAnimatedSprite4);
        }
Пример #28
0
        public override void update(GameTime time)
        {
            base.update(time);
            for (int j = fluffSprites.Count - 1; j >= 0; j--)
            {
                if (fluffSprites[j].update(time))
                {
                    fluffSprites.RemoveAt(j);
                }
            }
            if (alertTimer > 0)
            {
                alertTimer -= time.ElapsedGameTime.Milliseconds;
            }
            if (geodeAnimationTimer <= 0)
            {
                return;
            }
            Game1.changeMusicTrack("none");
            geodeAnimationTimer -= time.ElapsedGameTime.Milliseconds;
            if (geodeAnimationTimer <= 0)
            {
                geodeDestructionAnimation = null;
                geodeSpot.item            = null;
                if (geodeTreasure != null && Utility.IsNormalObjectAtParentSheetIndex(geodeTreasure, 73))
                {
                    Game1.netWorldState.Value.GoldenCoconutCracked.Value = true;
                }
                Game1.player.addItemToInventoryBool(geodeTreasure);
                geodeTreasure  = null;
                yPositionOfGem = 0;
                fluffSprites.Clear();
                delayBeforeShowArtifactTimer = 0f;
                return;
            }
            int frame = clint.currentFrame;

            clint.animateOnce(time);
            if (clint.currentFrame == 11 && frame != 11)
            {
                if (geodeSpot.item != null && (int)geodeSpot.item.parentSheetIndex == 275)
                {
                    Game1.playSound("hammer");
                    Game1.playSound("woodWhack");
                }
                else
                {
                    Game1.playSound("hammer");
                    Game1.playSound("stoneCrack");
                }
                Game1.stats.GeodesCracked++;
                int geodeDestructionYOffset = 448;
                if (geodeSpot.item != null)
                {
                    switch ((int)(geodeSpot.item as Object).parentSheetIndex)
                    {
                    case 536:
                        geodeDestructionYOffset += 64;
                        break;

                    case 537:
                        geodeDestructionYOffset += 128;
                        break;
                    }
                    geodeDestructionAnimation = new TemporaryAnimatedSprite("TileSheets\\animations", new Rectangle(0, geodeDestructionYOffset, 64, 64), 100f, 8, 0, new Vector2(geodeSpot.bounds.X + 392 - 32, geodeSpot.bounds.Y + 192 - 32), flicker: false, flipped: false);
                    if (geodeSpot.item != null && (int)geodeSpot.item.parentSheetIndex == 275)
                    {
                        geodeDestructionAnimation = new TemporaryAnimatedSprite
                        {
                            texture               = Game1.temporaryContent.Load <Texture2D>("LooseSprites//temporary_sprites_1"),
                            sourceRect            = new Rectangle(388, 123, 18, 21),
                            sourceRectStartingPos = new Vector2(388f, 123f),
                            animationLength       = 6,
                            position              = new Vector2(geodeSpot.bounds.X + 380 - 32, geodeSpot.bounds.Y + 192 - 32),
                            holdLastFrame         = true,
                            interval              = 100f,
                            id    = 777f,
                            scale = 4f
                        };
                        for (int i = 0; i < 6; i++)
                        {
                            fluffSprites.Add(new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Rectangle(372, 1956, 10, 10), new Vector2(geodeSpot.bounds.X + 392 - 32 + Game1.random.Next(21), geodeSpot.bounds.Y + 192 - 16), flipped: false, 0.002f, new Color(255, 222, 198))
                            {
                                alphaFade                 = 0.02f,
                                motion                    = new Vector2((float)Game1.random.Next(-20, 21) / 10f, (float)Game1.random.Next(5, 20) / 10f),
                                interval                  = 99999f,
                                layerDepth                = 0.9f,
                                scale                     = 3f,
                                scaleChange               = 0.01f,
                                rotationChange            = (float)Game1.random.Next(-5, 6) * (float)Math.PI / 256f,
                                delayBeforeAnimationStart = i * 20
                            });
                            fluffSprites.Add(new TemporaryAnimatedSprite
                            {
                                texture               = Game1.temporaryContent.Load <Texture2D>("LooseSprites//temporary_sprites_1"),
                                sourceRect            = new Rectangle(499, 132, 5, 5),
                                sourceRectStartingPos = new Vector2(499f, 132f),
                                motion             = new Vector2((float)Game1.random.Next(-30, 31) / 10f, Game1.random.Next(-7, -4)),
                                acceleration       = new Vector2(0f, 0.25f),
                                totalNumberOfLoops = 1,
                                interval           = 1000f,
                                alphaFade          = 0.015f,
                                animationLength    = 1,
                                layerDepth         = 1f,
                                scale                     = 4f,
                                rotationChange            = (float)Game1.random.Next(-5, 6) * (float)Math.PI / 256f,
                                delayBeforeAnimationStart = i * 10,
                                position                  = new Vector2(geodeSpot.bounds.X + 392 - 32 + Game1.random.Next(21), geodeSpot.bounds.Y + 192 - 16)
                            });
                            delayBeforeShowArtifactTimer = 500f;
                        }
                    }
                    if (geodeTreasureOverride != null)
                    {
                        geodeTreasure         = geodeTreasureOverride;
                        geodeTreasureOverride = null;
                    }
                    else
                    {
                        geodeTreasure = Utility.getTreasureFromGeode(geodeSpot.item);
                    }
                    if ((int)geodeSpot.item.parentSheetIndex == 275)
                    {
                        Game1.player.foundArtifact(geodeTreasure.parentSheetIndex, 1);
                    }
                    else if (geodeTreasure is Object && (geodeTreasure as Object).Type.Contains("Mineral"))
                    {
                        Game1.player.foundMineral(geodeTreasure.parentSheetIndex);
                    }
                    else if (geodeTreasure is Object && (geodeTreasure as Object).Type.Contains("Arch") && !Game1.player.hasOrWillReceiveMail("artifactFound"))
                    {
                        geodeTreasure = new Object(390, 5);
                    }
                }
            }
            if (geodeDestructionAnimation != null && ((geodeDestructionAnimation.id != 777f && geodeDestructionAnimation.currentParentTileIndex < 7) || (geodeDestructionAnimation.id == 777f && geodeDestructionAnimation.currentParentTileIndex < 5)))
            {
                geodeDestructionAnimation.update(time);
                if (delayBeforeShowArtifactTimer > 0f)
                {
                    delayBeforeShowArtifactTimer -= (float)time.ElapsedGameTime.TotalMilliseconds;
                    if (delayBeforeShowArtifactTimer <= 0f)
                    {
                        fluffSprites.Add(geodeDestructionAnimation);
                        fluffSprites.Reverse();
                        geodeDestructionAnimation = new TemporaryAnimatedSprite
                        {
                            interval        = 100f,
                            animationLength = 6,
                            alpha           = 0.001f,
                            id = 777f
                        };
                    }
                }
                else
                {
                    if (geodeDestructionAnimation.currentParentTileIndex < 3)
                    {
                        yPositionOfGem--;
                    }
                    yPositionOfGem--;
                    if ((geodeDestructionAnimation.currentParentTileIndex == 7 || (geodeDestructionAnimation.id == 777f && geodeDestructionAnimation.currentParentTileIndex == 5)) && (!(geodeTreasure is Object) || (int)(geodeTreasure as Object).price > 75))
                    {
                        sparkle = new TemporaryAnimatedSprite("TileSheets\\animations", new Rectangle(0, 640, 64, 64), 100f, 8, 0, new Vector2(geodeSpot.bounds.X + 392 - 32, geodeSpot.bounds.Y + 192 + yPositionOfGem - 32), flicker: false, flipped: false);
                        Game1.playSound("discoverMineral");
                    }
                    else if ((geodeDestructionAnimation.currentParentTileIndex == 7 || (geodeDestructionAnimation.id == 777f && geodeDestructionAnimation.currentParentTileIndex == 5)) && geodeTreasure is Object && (int)(geodeTreasure as Object).price <= 75)
                    {
                        Game1.playSound("newArtifact");
                    }
                }
            }
            if (sparkle != null && sparkle.update(time))
            {
                sparkle = null;
            }
        }
Пример #29
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            base.receiveLeftClick(x, y, !this.destroyItemOnClick);
            if (ItemsToGrabMenu.isWithinBounds(x, y) == false)
            {
                //Log.AsyncC("AWESOME");
                bool f = Util.isInventoryFull(this.ItemsToGrabMenu.actualInventory);
                if (f == false)
                {
                    this.heldItem = this.ItemsToGrabMenu.leftClick(x, y, this.heldItem, false);
                    Util.addItemToOtherInventory(this.ItemsToGrabMenu.actualInventory, this.heldItem);
                    Log.AsyncG("not full");
                }
                else
                {
                    // this.heldItem = this.ItemsToGrabMenu.leftClick(x, y, this.heldItem, false);
                    // Util.addItemToInventorySilently(this.heldItem);
                }
                // this.ItemsToGrabMenu.inventory.Add(new ClickableComponent(new Rectangle(ItemsToGrabMenu.xPositionOnScreen + ItemsToGrabMenu.actualInventory.Count-1 % (this.capacity / this.ItemsToGrabMenu.rows) * Game1.tileSize + this.ItemsToGrabMenu.horizontalGap * (ItemsToGrabMenu.actualInventory.Count-1 % (this.capacity / this.ItemsToGrabMenu.rows)), ItemsToGrabMenu.yPositionOnScreen + ItemsToGrabMenu.actualInventory.Count-1 / (this.capacity / this.ItemsToGrabMenu.rows) * (Game1.tileSize + this.ItemsToGrabMenu.verticalGap) + (ItemsToGrabMenu.actualInventory.Count-1 / (this.capacity / this.ItemsToGrabMenu.rows) - 1) * Game1.pixelZoom -  (Game1.tileSize / 5), Game1.tileSize, Game1.tileSize), string.Concat(ItemsToGrabMenu.actualInventory.Count-1)));
                if (this.okButton.containsPoint(x, y) == false && this.organizeButton.containsPoint(x, y) == false && f == false)
                {
                    //
                    Game1.activeClickableMenu = new ItemGrabMenu(this.ItemsToGrabMenu.actualInventory, this.Rows, false, true, new InventoryMenu.highlightThisItem(InventoryMenu.highlightAllItems), this.behaviorFunction, null, this.behaviorOnItemGrab, false, true, true, true, true, this.source, this.sourceItem);
                    Game1.playSound("Ship");
                }
                if (this.organizeButton.containsPoint(x, y))
                {
                    ItemGrabMenu.organizeItemsInList(this.ItemsToGrabMenu.actualInventory);
                }
            }
            else
            {
                if (Util.isInventoryFull(this.ItemsToGrabMenu.actualInventory) == true)
                {
                    Item i = new StardewValley.Object();
                    Item j = new StardewValley.Object();
                    j = this.ItemsToGrabMenu.leftClick(x, y, this.heldItem, false);
                    i = this.heldItem;


                    Util.addItemToInventorySilently(j);
                    // this.heldItem = null;

                    foreach (ClickableComponent current in ItemsToGrabMenu.inventory)
                    {
                        if (current.containsPoint(x, y))
                        {
                            int num = Convert.ToInt32(current.name);
                            //   Log.AsyncO(num);
                            this.ItemsToGrabMenu.actualInventory.RemoveAt(num);
                            //  Log.AsyncO("Remaining " + ItemsToGrabMenu.actualInventory.Count);
                        }
                    }
                    //   j=  this.ItemsToGrabMenu.leftClick(x, y, this.heldItem, false);
                    Util.addItemToOtherInventory(this.ItemsToGrabMenu.actualInventory, i);
                    Log.AsyncG("item swap");
                    Game1.activeClickableMenu = new ItemGrabMenu(this.ItemsToGrabMenu.actualInventory, this.Rows, false, true, new InventoryMenu.highlightThisItem(InventoryMenu.highlightAllItems), this.behaviorFunction, null, this.behaviorOnItemGrab, false, true, true, true, true, this.source, this.sourceItem);
                    Game1.playSound("Ship");
                    this.heldItem = null;
                    return;
                }



                this.heldItem = this.ItemsToGrabMenu.leftClick(x, y, this.heldItem, false);
                Util.addItemToInventoryElseDrop(this.heldItem);
                this.heldItem = null;

                foreach (ClickableComponent current in ItemsToGrabMenu.inventory)
                {
                    if (current.containsPoint(x, y))
                    {
                        int num = Convert.ToInt32(current.name);
                        //   Log.AsyncO(num);
                        this.ItemsToGrabMenu.actualInventory.RemoveAt(num);
                        //  Log.AsyncO("Remaining " + ItemsToGrabMenu.actualInventory.Count);
                    }
                }
                Game1.activeClickableMenu = new ItemGrabMenu(this.ItemsToGrabMenu.actualInventory, this.Rows, false, true, new InventoryMenu.highlightThisItem(InventoryMenu.highlightAllItems), this.behaviorFunction, null, this.behaviorOnItemGrab, false, true, true, true, true, this.source, this.sourceItem);
                Game1.playSound("Ship");
            }
            return;

            if (this.shippingBin && this.lastShippedHolder.containsPoint(x, y))
            {
                if (Game1.getFarm().lastItemShipped != null && Game1.player.addItemToInventoryBool(Game1.getFarm().lastItemShipped, false))
                {
                    Game1.playSound("coin");
                    Game1.getFarm().shippingBin.Remove(Game1.getFarm().lastItemShipped);
                    Game1.getFarm().lastItemShipped = null;
                    if (Game1.player.ActiveObject != null)
                    {
                        Game1.player.showCarrying();
                        Game1.player.Halt();
                    }
                }
                return;
            }
            if (this.chestColorPicker != null)
            {
                this.chestColorPicker.receiveLeftClick(x, y, true);
                if (this.sourceItem != null && this.sourceItem is Chest)
                {
                    (this.sourceItem as Chest).playerChoiceColor = this.chestColorPicker.getColorFromSelection(this.chestColorPicker.colorSelection);
                }
            }
            if (this.colorPickerToggleButton != null && this.colorPickerToggleButton.containsPoint(x, y))
            {
                Game1.player.showChestColorPicker = !Game1.player.showChestColorPicker;
                this.chestColorPicker.visible     = Game1.player.showChestColorPicker;
                Game1.soundBank.PlayCue("drumkit6");
            }
            if (this.heldItem == null && this.showReceivingMenu)
            {
                this.heldItem = this.ItemsToGrabMenu.leftClick(x, y, this.heldItem, false);
                //  Log.AsyncC("YAY");



                if (this.heldItem != null && this.behaviorOnItemGrab != null)
                {
                    this.behaviorOnItemGrab(this.heldItem, Game1.player);
                    if (Game1.activeClickableMenu != null && Game1.activeClickableMenu is ItemGrabMenu)
                    {
                        (Game1.activeClickableMenu as ItemGrabMenu).setSourceItem(this.sourceItem);
                    }
                }
                if (this.heldItem is StardewValley.Object && (this.heldItem as StardewValley.Object).parentSheetIndex == 326)
                {
                    this.heldItem = null;
                    Game1.player.canUnderstandDwarves = true;
                    this.poof = new TemporaryAnimatedSprite(Game1.animations, new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2((float)(x - x % Game1.tileSize + Game1.tileSize / 4), (float)(y - y % Game1.tileSize + Game1.tileSize / 4)), false, false);
                    Game1.playSound("fireball");
                }
                else if (this.heldItem is StardewValley.Object && (this.heldItem as StardewValley.Object).parentSheetIndex == 102)
                {
                    this.heldItem = null;
                    Game1.player.foundArtifact(102, 1);
                    this.poof = new TemporaryAnimatedSprite(Game1.animations, new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2((float)(x - x % Game1.tileSize + Game1.tileSize / 4), (float)(y - y % Game1.tileSize + Game1.tileSize / 4)), false, false);
                    Game1.playSound("fireball");
                }
                else if (this.heldItem is StardewValley.Object && (this.heldItem as StardewValley.Object).isRecipe)
                {
                    string key = this.heldItem.Name.Substring(0, this.heldItem.Name.IndexOf("Recipe") - 1);
                    try
                    {
                        if ((this.heldItem as StardewValley.Object).category == -7)
                        {
                            Game1.player.cookingRecipes.Add(key, 0);
                        }
                        else
                        {
                            Game1.player.craftingRecipes.Add(key, 0);
                        }
                        this.poof = new TemporaryAnimatedSprite(Game1.animations, new Rectangle(0, 320, 64, 64), 50f, 8, 0, new Vector2((float)(x - x % Game1.tileSize + Game1.tileSize / 4), (float)(y - y % Game1.tileSize + Game1.tileSize / 4)), false, false);
                        Game1.playSound("newRecipe");
                    }
                    catch (Exception)
                    {
                    }
                    this.heldItem = null;
                }
                else if (Game1.player.addItemToInventoryBool(this.heldItem, false))
                {
                    this.heldItem = null;
                    Game1.playSound("coin");
                }
            }
            else if ((this.reverseGrab || this.behaviorFunction != null) && this.isWithinBounds(x, y))
            {
                this.behaviorFunction(this.heldItem, Game1.player);
                if (Game1.activeClickableMenu != null && Game1.activeClickableMenu is ItemGrabMenu)
                {
                    (Game1.activeClickableMenu as ItemGrabMenu).setSourceItem(this.sourceItem);
                }
                if (this.destroyItemOnClick)
                {
                    this.heldItem = null;
                    return;
                }
            }
            if (this.organizeButton != null && this.organizeButton.containsPoint(x, y))
            {
                ItemGrabMenu.organizeItemsInList(this.ItemsToGrabMenu.actualInventory);
                Game1.activeClickableMenu = new ItemGrabMenu(this.ItemsToGrabMenu.actualInventory, this.Rows, false, true, new InventoryMenu.highlightThisItem(InventoryMenu.highlightAllItems), this.behaviorFunction, null, this.behaviorOnItemGrab, false, true, true, true, true, this.source, this.sourceItem);
                Game1.playSound("Ship");
                return;
            }
            if (this.heldItem != null && !this.isWithinBounds(x, y) && this.heldItem.canBeTrashed())
            {
                Game1.playSound("throwDownITem");
                Game1.createItemDebris(this.heldItem, Game1.player.getStandingPosition(), Game1.player.FacingDirection);
                this.heldItem = null;
            }
        }
Пример #30
0
        public EndgameBundlePage(int bundleIndex, EndgameBundle bundle, Point position, string textureName, EndgameBundleMenu menu)
            : base(new Rectangle(position.X, position.Y, 64, 64), "")
        {
            this.bundle = bundle;

            this.bundleIndex = bundleIndex;
            //string[] split = rawBundleInfo.Split('/');
            name  = bundle.Name;
            label = bundle.Name;

            if (LocalizedContentManager.CurrentLanguageCode != 0)
            {
                // TODO: Localization
                label = bundle.Name;
            }

            //rewardDescription = split[1];

            //TODO: Localization support for the images

            /*if (split.Length > 5 && (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.en || split.Length > 6))
             * {
             *      string bundle_image_override = split[5];
             *
             *      try
             *      {
             *              if (bundle_image_override.Contains(':'))
             *              {
             *                      string[] bundle_image_parts = bundle_image_override.Split(':');
             *                      bundleTextureOverride = Game1.content.Load<Texture2D>(bundle_image_parts[0]);
             *                      bundleTextureIndexOverride = int.Parse(bundle_image_parts[1]);
             *              }
             *              else
             *              {
             *                      bundleTextureIndexOverride = int.Parse(bundle_image_override);
             *              }
             *      }
             *      catch (Exception)
             *      {
             *              bundleTextureOverride = null;
             *              bundleTextureIndexOverride = -1;
             *      }
             * }*/

            // What's this part?

            /*string[] ingredientsSplit = split[2].Split(' ');
             * complete = true;
             * ingredients = new List<BundleIngredientDescription>();
             * int tally = 0;
             *
             * for (int i = 0; i < ingredientsSplit.Length; i += 3)
             * {
             *      ingredients.Add(new BundleIngredientDescription(Convert.ToInt32(ingredientsSplit[i]), Convert.ToInt32(ingredientsSplit[i + 1]), Convert.ToInt32(ingredientsSplit[i + 2]), completedIngredientsList[i / 3]));
             *
             *      if (!completedIngredientsList[i / 3])
             *      {
             *              complete = false;
             *      }
             *      else
             *      {
             *              tally++;
             *      }
             * }*/

            Random random = new Random();

            bundleColor = random.Next(0, 7);
            //bundleColor = Convert.ToInt32(split[3]);

            /*int count = 4;
             *
             * if (LocalizedContentManager.CurrentLanguageCode != 0)
             * {
             *      count = 5;
             * }*/

            //numberOfIngredientSlots = (split.Length > count) ? Convert.ToInt32(split[4]) : ingredients.Count;
            numberOfIngredientSlots = bundle.Ingredients.Count > bundle.MinRequiredAmount && bundle.MinRequiredAmount != -1 ? bundle.MinRequiredAmount : bundle.Ingredients.Count;

            /*if (tally >= numberOfIngredientSlots)
             * {
             *      complete = true;
             * }*/

            sprite = new TemporaryAnimatedSprite(textureName, new Rectangle(bundleColor * 256 % 512, 244 + bundleColor * 256 / 512 * 16, 16, 16), 70f, 3, 99999, new Vector2(bounds.X, bounds.Y), flicker: false, flipped: false, 0.8f, 0f, Color.White, 4f, 0f, 0f, 0f)
            {
                pingPong = true,
                paused   = true
            };

            sprite.sourceRect.X += sprite.sourceRect.Width;

            if (name.ToLower().Contains(Game1.currentSeason) && !complete)
            {
                Shake();
            }

            if (complete)
            {
                CompletionAnimation(menu, playSound: false);
            }
        }