Ejemplo n.º 1
0
        internal static void Draw(SpriteBatch sb)
        {
            if (SubText != null)
            {
                if (!SubText.update(Game1.currentGameTime))
                {
                    SubText.draw(sb, SubPos);
                }
                else
                {
                    SubText = null;
                }
            }

            if (BoxedTimer > Game1.currentGameTime.TotalGameTime.TotalMilliseconds &&
                !String.IsNullOrEmpty(BoxedText))
            {
                SpriteFont font   = Game1.smallFont;
                int        margin = Game1.tileSize * 1 / 3;
                var        box    = font.MeasureString(BoxedText);
                int        width  = (int)box.X + 2 * margin;
                //60 is "cornerSize" * 3 on SDV source
                int height = Math.Max(60, (int)box.Y + 2 * margin);

                IClickableMenu.drawTextureBox(sb, (int)BoxedlPos.X, (int)BoxedlPos.Y, width, height, Color.White);

                Vector2 tPos = new Vector2(BoxedlPos.X + margin, BoxedlPos.Y + margin + 4);
                sb.DrawString(font, BoxedText, tPos + new Vector2(2, 2), Game1.textShadowColor);
                sb.DrawString(font, BoxedText, tPos, Game1.textColor);
            }
        }
Ejemplo n.º 2
0
        private void Input_ButtonPressed(object sender, StardewModdingAPI.Events.ButtonPressedEventArgs e)
        {
            if (e.Button == SButton.MouseRight && Context.IsWorldReady && Context.CanPlayerMove && (Game1.player.CurrentTool is FishingRod))
            {
                if (hereFishying)
                {
                    if (canPerfect)
                    {
                        perfect       = true;
                        sparklingText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\UI:BobberBar_Perfect"), Color.Yellow, Color.White, false, 0.1, 1500, -1, 500, 1f);
                        Game1.playSound("jingle1");
                    }
                    return;
                }

                try
                {
                    Vector2 mousePos = Game1.currentCursorTile;
                    if (Game1.player.currentLocation.waterTiles != null && Game1.player.currentLocation.waterTiles[(int)mousePos.X, (int)mousePos.Y])
                    {
                        context.Monitor.Log($"here fishy fishy {mousePos.X},{mousePos.Y}");
                        HereFishyFishy(Game1.player, (int)mousePos.X * 64, (int)mousePos.Y * 64);
                    }
                }
                catch
                {
                    context.Monitor.Log($"error getting water tile");
                }
            }
        }
Ejemplo n.º 3
0
        public static void playerCaughtFishEndFunction(int extraData)
        {
            context.Monitor.Log($"caught fish end");
            fishCaught  = true;
            fishQuality = Game1.random.Next(0, 5);
            lastUser.Halt();
            lastUser.armOffset = Vector2.Zero;

            recordSize = lastUser.caughtFish(whichFish, fishSize, false, caughtDoubleFish ? 2 : 1);
            lastUser.faceDirection(2);
            if (FishingRod.isFishBossFish(whichFish))
            {
                Game1.showGlobalMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:FishingRod.cs.14068"));
                string name = Game1.objectInformation[whichFish].Split(new char[]
                {
                    '/'
                })[4];
                context.Helper.Reflection.GetField <Multiplayer>(Game1.game1, "multiplayer").GetValue().globalChatInfoMessage("CaughtLegendaryFish", new string[]
                {
                    Game1.player.Name,
                    name
                });
                return;
            }
            if (recordSize)
            {
                sparklingText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:FishingRod.cs.14069"), Color.LimeGreen, Color.Azure, false, 0.1, 2500, -1, 500, 1f);
                lastUser.currentLocation.localSound("newRecord");
                return;
            }
            lastUser.currentLocation.localSound("fishSlap");
        }
        public NewSaveGameMenuV2()
        {
            this.saveText             = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:SaveGameMenu.cs.11378"), Color.LimeGreen, Color.Black * (1f / 1000f), false, 0.1, 1500, 32, 500, 1f);
            this._hasSentFarmhandData = false;

            Type      type = typeof(Game1);
            FieldInfo info = type.GetField("multiplayer", BindingFlags.NonPublic | BindingFlags.Static);

            this.multiplayer = (Multiplayer)info.GetValue(StardewValley.Program.gamePtr);

            //this.multiplayer = SaveAnywhere.ModHelper.Reflection.GetField<Multiplayer>(, "multiplayer", true).GetValue();
        }
Ejemplo n.º 5
0
        public NewSaveGameMenu()
        {
            //Log.Async("New save menu created");

            /*if ( Multiplayer.mode == Mode.Host )
             * {
             *  //Multiplayer.server.playing = false;
             * }
             * else if ( Multiplayer.mode == Mode.Client )
             * {
             *  Multiplayer.client.stage = Client.NetStage.Waiting;
             *  //Multiplayer.sendFunc(new ClientFarmerDataPacket(Util.serialize<Farmer>(Game1.player)));
             *  Multiplayer.sendFunc(new NextDayPacket());
             * }*/
            this.waitingText = new SparklingText(Game1.dialogueFont, "Waiting on host", Color.DodgerBlue, Color.Black * 0.001f, false, 0.1, 1500, Game1.tileSize / 2, 500);
            this.saveText    = new SparklingText(Game1.dialogueFont, "Your progress has been saved.", Color.LimeGreen, Color.Black * 0.001f, false, 0.1, 1500, Game1.tileSize / 2, 500);
        }
Ejemplo n.º 6
0
        public NewSaveGameMenu()
        {
            ////////////////////////////////////////
            //Log.Async("New save menu created");

            /*if ( Multiplayer.mode == Mode.Host )
             * {
             *  //Multiplayer.server.playing = false;
             * }
             * else if ( Multiplayer.mode == Mode.Client )
             * {
             *  Multiplayer.client.stage = Client.NetStage.Waiting;
             *  //Multiplayer.sendFunc(new ClientFarmerDataPacket(Util.serialize<SFarmer>(Game1.player)));
             *  Multiplayer.sendFunc(new NextDayPacket());
             * }*/
            this.waitingText = new SparklingText(Game1.dialogueFont, "Waiting on host", Color.DodgerBlue, Color.Black * 0.001f, false, 0.1, 1500, Game1.tileSize / 2, 500);
            ////////////////////////////////////////
            this.saveText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:SaveGameMenu.cs.11378", new object[0]), Color.LimeGreen, Color.Black * 0.001f, false, 0.1, 1500, Game1.tileSize / 2, 500);
        }
Ejemplo n.º 7
0
 private void GameLoop_UpdateTicking(object sender, StardewModdingAPI.Events.UpdateTickingEventArgs e)
 {
     for (int i = animations.Count - 1; i >= 0; i--)
     {
         if (animations[i].update(Game1.currentGameTime))
         {
             animations.RemoveAt(i);
         }
     }
     if (sparklingText != null && sparklingText.update(Game1.currentGameTime))
     {
         sparklingText = null;
     }
     if (fishCaught)
     {
         lastUser.addItemToInventoryBool(new Object(whichFish, caughtDoubleFish ? 2 : 1, false, -1, fishQuality), false);
         fishCaught = false;
     }
 }
Ejemplo n.º 8
0
 public override void update(GameTime time)
 {
     if (sparkleText != null && sparkleText.update(time))
     {
         sparkleText = null;
     }
     if (everythingShakeTimer > 0f)
     {
         everythingShakeTimer -= time.ElapsedGameTime.Milliseconds;
         everythingShake       = new Vector2((float)Game1.random.Next(-10, 11) / 10f, (float)Game1.random.Next(-10, 11) / 10f);
         if (everythingShakeTimer <= 0f)
         {
             everythingShake = Vector2.Zero;
         }
     }
     if (fadeIn)
     {
         scale += 0.05f;
         if (scale >= 1f)
         {
             scale  = 1f;
             fadeIn = false;
         }
     }
     else if (fadeOut)
     {
         if (everythingShakeTimer > 0f || sparkleText != null)
         {
             return;
         }
         scale -= 0.05f;
         if (scale <= 0f)
         {
             scale   = 0f;
             fadeOut = false;
             int  bait         = (Game1.player.CurrentTool != null && Game1.player.CurrentTool is FishingRod && (Game1.player.CurrentTool as FishingRod).attachments[0] != null) ? ((int)(Game1.player.CurrentTool as FishingRod).attachments[0].parentSheetIndex) : (-1);
             bool caughtDouble = !bossFish && bait == 774 && Game1.random.NextDouble() < 0.25 + Game1.player.DailyLuck / 2.0;
             if (distanceFromCatching > 0.9f && Game1.player.CurrentTool is FishingRod)
             {
                 (Game1.player.CurrentTool as FishingRod).pullFishFromWater(whichFish, fishSize, fishQuality, (int)difficulty, treasureCaught, perfect, fromFishPond, caughtDouble);
             }
             else
             {
                 Game1.player.completelyStopAnimatingOrDoingAction();
                 if (Game1.player.CurrentTool != null && Game1.player.CurrentTool is FishingRod)
                 {
                     (Game1.player.CurrentTool as FishingRod).doneFishing(Game1.player, consumeBaitAndTackle: true);
                 }
             }
             Game1.exitActiveMenu();
             Game1.setRichPresence("location", Game1.currentLocation.Name);
         }
     }
     else
     {
         if (Game1.random.NextDouble() < (double)(difficulty * (float)((motionType != 2) ? 1 : 20) / 4000f) && (motionType != 2 || bobberTargetPosition == -1f))
         {
             float spaceBelow = 548f - bobberPosition;
             float spaceAbove = bobberPosition;
             float percent    = Math.Min(99f, difficulty + (float)Game1.random.Next(10, 45)) / 100f;
             bobberTargetPosition = bobberPosition + (float)Game1.random.Next(-(int)spaceAbove, (int)spaceBelow) * percent;
         }
         if (motionType == 4)
         {
             floaterSinkerAcceleration = Math.Max(floaterSinkerAcceleration - 0.01f, -1.5f);
         }
         else if (motionType == 3)
         {
             floaterSinkerAcceleration = Math.Min(floaterSinkerAcceleration + 0.01f, 1.5f);
         }
         if (Math.Abs(bobberPosition - bobberTargetPosition) > 3f && bobberTargetPosition != -1f)
         {
             bobberAcceleration = (bobberTargetPosition - bobberPosition) / ((float)Game1.random.Next(10, 30) + (100f - Math.Min(100f, difficulty)));
             bobberSpeed       += (bobberAcceleration - bobberSpeed) / 5f;
         }
         else if (motionType != 2 && Game1.random.NextDouble() < (double)(difficulty / 2000f))
         {
             bobberTargetPosition = bobberPosition + (float)((Game1.random.NextDouble() < 0.5) ? Game1.random.Next(-100, -51) : Game1.random.Next(50, 101));
         }
         else
         {
             bobberTargetPosition = -1f;
         }
         if (motionType == 1 && Game1.random.NextDouble() < (double)(difficulty / 1000f))
         {
             bobberTargetPosition = bobberPosition + (float)((Game1.random.NextDouble() < 0.5) ? Game1.random.Next(-100 - (int)difficulty * 2, -51) : Game1.random.Next(50, 101 + (int)difficulty * 2));
         }
         bobberTargetPosition = Math.Max(-1f, Math.Min(bobberTargetPosition, 548f));
         bobberPosition      += bobberSpeed + floaterSinkerAcceleration;
         if (bobberPosition > 532f)
         {
             bobberPosition = 532f;
         }
         else if (bobberPosition < 0f)
         {
             bobberPosition = 0f;
         }
         bobberInBar = (bobberPosition + 12f <= bobberBarPos - 32f + (float)bobberBarHeight && bobberPosition - 16f >= bobberBarPos - 32f);
         if (bobberPosition >= (float)(548 - bobberBarHeight) && bobberBarPos >= (float)(568 - bobberBarHeight - 4))
         {
             bobberInBar = true;
         }
         bool num = buttonPressed;
         buttonPressed = (Game1.oldMouseState.LeftButton == ButtonState.Pressed || Game1.isOneOfTheseKeysDown(Game1.oldKBState, Game1.options.useToolButton) || (Game1.options.gamepadControls && (Game1.oldPadState.IsButtonDown(Buttons.X) || Game1.oldPadState.IsButtonDown(Buttons.A))));
         if (!num && buttonPressed)
         {
             Game1.playSound("fishingRodBend");
         }
         float gravity = buttonPressed ? (-0.25f) : 0.25f;
         if (buttonPressed && gravity < 0f && (bobberBarPos == 0f || bobberBarPos == (float)(568 - bobberBarHeight)))
         {
             bobberBarSpeed = 0f;
         }
         if (bobberInBar)
         {
             gravity *= ((whichBobber == 691) ? 0.3f : 0.6f);
             if (whichBobber == 691)
             {
                 if (bobberPosition + 16f < bobberBarPos + (float)(bobberBarHeight / 2))
                 {
                     bobberBarSpeed -= 0.2f;
                 }
                 else
                 {
                     bobberBarSpeed += 0.2f;
                 }
             }
         }
         float oldPos = bobberBarPos;
         bobberBarSpeed += gravity;
         bobberBarPos   += bobberBarSpeed;
         if (bobberBarPos + (float)bobberBarHeight > 568f)
         {
             bobberBarPos   = 568 - bobberBarHeight;
             bobberBarSpeed = (0f - bobberBarSpeed) * 2f / 3f * ((whichBobber == 692) ? 0.1f : 1f);
             if (oldPos + (float)bobberBarHeight < 568f)
             {
                 Game1.playSound("shiny4");
             }
         }
         else if (bobberBarPos < 0f)
         {
             bobberBarPos   = 0f;
             bobberBarSpeed = (0f - bobberBarSpeed) * 2f / 3f;
             if (oldPos > 0f)
             {
                 Game1.playSound("shiny4");
             }
         }
         bool treasureInBar = false;
         if (treasure)
         {
             float oldTreasureAppearTimer = treasureAppearTimer;
             treasureAppearTimer -= time.ElapsedGameTime.Milliseconds;
             if (treasureAppearTimer <= 0f)
             {
                 if (treasureScale < 1f && !treasureCaught)
                 {
                     if (oldTreasureAppearTimer > 0f)
                     {
                         treasurePosition = ((bobberBarPos > 274f) ? Game1.random.Next(8, (int)bobberBarPos - 20) : Game1.random.Next(Math.Min(528, (int)bobberBarPos + bobberBarHeight), 500));
                         Game1.playSound("dwop");
                     }
                     treasureScale = Math.Min(1f, treasureScale + 0.1f);
                 }
                 treasureInBar = (treasurePosition + 12f <= bobberBarPos - 32f + (float)bobberBarHeight && treasurePosition - 16f >= bobberBarPos - 32f);
                 if (treasureInBar && !treasureCaught)
                 {
                     treasureCatchLevel += 0.0135f;
                     treasureShake       = new Vector2(Game1.random.Next(-2, 3), Game1.random.Next(-2, 3));
                     if (treasureCatchLevel >= 1f)
                     {
                         Game1.playSound("newArtifact");
                         treasureCaught = true;
                     }
                 }
                 else if (treasureCaught)
                 {
                     treasureScale = Math.Max(0f, treasureScale - 0.1f);
                 }
                 else
                 {
                     treasureShake      = Vector2.Zero;
                     treasureCatchLevel = Math.Max(0f, treasureCatchLevel - 0.01f);
                 }
             }
         }
         if (bobberInBar)
         {
             distanceFromCatching += 0.002f;
             reelRotation         += (float)Math.PI / 8f;
             fishShake.X           = (float)Game1.random.Next(-10, 11) / 10f;
             fishShake.Y           = (float)Game1.random.Next(-10, 11) / 10f;
             barShake              = Vector2.Zero;
             Rumble.rumble(0.1f, 1000f);
             if (unReelSound != null)
             {
                 unReelSound.Stop(AudioStopOptions.Immediate);
             }
             if (Game1.soundBank != null && (reelSound == null || reelSound.IsStopped || reelSound.IsStopping))
             {
                 reelSound = Game1.soundBank.GetCue("fastReel");
             }
             if (reelSound != null && !reelSound.IsPlaying && !reelSound.IsStopping)
             {
                 reelSound.Play();
             }
         }
         else if (!treasureInBar || treasureCaught || whichBobber != 693)
         {
             if (!fishShake.Equals(Vector2.Zero))
             {
                 Game1.playSound("tinyWhip");
                 perfect = false;
                 Rumble.stopRumbling();
             }
             fishSizeReductionTimer -= time.ElapsedGameTime.Milliseconds;
             if (fishSizeReductionTimer <= 0)
             {
                 fishSize = Math.Max(minFishSize, fishSize - 1);
                 fishSizeReductionTimer = 800;
             }
             if ((Game1.player.fishCaught != null && Game1.player.fishCaught.Count() != 0) || Game1.currentMinigame != null)
             {
                 distanceFromCatching -= ((whichBobber == 694 || beginnersRod) ? 0.002f : 0.003f);
             }
             float distanceAway = Math.Abs(bobberPosition - (bobberBarPos + (float)(bobberBarHeight / 2)));
             reelRotation -= (float)Math.PI / Math.Max(10f, 200f - distanceAway);
             barShake.X    = (float)Game1.random.Next(-10, 11) / 10f;
             barShake.Y    = (float)Game1.random.Next(-10, 11) / 10f;
             fishShake     = Vector2.Zero;
             if (reelSound != null)
             {
                 reelSound.Stop(AudioStopOptions.Immediate);
             }
             if (Game1.soundBank != null && (unReelSound == null || unReelSound.IsStopped))
             {
                 unReelSound = Game1.soundBank.GetCue("slowReel");
                 unReelSound.SetVariable("Pitch", 600);
             }
             if (unReelSound != null && !unReelSound.IsPlaying && !unReelSound.IsStopping)
             {
                 unReelSound.Play();
             }
         }
         distanceFromCatching = Math.Max(0f, Math.Min(1f, distanceFromCatching));
         if (Game1.player.CurrentTool != null)
         {
             Game1.player.CurrentTool.tickUpdate(time, Game1.player);
         }
         if (distanceFromCatching <= 0f)
         {
             fadeOut = true;
             everythingShakeTimer = 500f;
             Game1.playSound("fishEscape");
             handledFishResult = true;
             if (unReelSound != null)
             {
                 unReelSound.Stop(AudioStopOptions.Immediate);
             }
             if (reelSound != null)
             {
                 reelSound.Stop(AudioStopOptions.Immediate);
             }
         }
         else if (distanceFromCatching >= 1f)
         {
             everythingShakeTimer = 500f;
             Game1.playSound("jingle1");
             fadeOut           = true;
             handledFishResult = true;
             if (unReelSound != null)
             {
                 unReelSound.Stop(AudioStopOptions.Immediate);
             }
             if (reelSound != null)
             {
                 reelSound.Stop(AudioStopOptions.Immediate);
             }
             if (perfect)
             {
                 sparkleText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\UI:BobberBar_Perfect"), Color.Yellow, Color.White, rainbow: false, 0.1, 1500);
                 if (Game1.isFestival())
                 {
                     Game1.CurrentEvent.perfectFishing();
                 }
             }
             else if (fishSize == maxFishSize)
             {
                 fishSize--;
             }
         }
     }
     if (bobberPosition < 0f)
     {
         bobberPosition = 0f;
     }
     if (bobberPosition > 548f)
     {
         bobberPosition = 548f;
     }
 }
Ejemplo n.º 9
0
 public SaveGameMenu()
 {
     this.saveText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:SaveGameMenu.cs.11378", new object[0]), Color.LimeGreen, Color.Black * 0.001f, false, 0.1, 1500, Game1.tileSize / 2, 500);
 }
 public NewSaveGameMenu()
 {
     this.saveText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:SaveGameMenu.cs.11378"), Color.LimeGreen, new Color((int)(Color.Black.R * (1.0 / 1000.0)), (int)(Color.Black.G * (1.0 / 1000.0)), (int)(Color.Black.B * (1.0 / 1000.0)), 255), false, 0.1, 1500, 32, 500);
 }
Ejemplo n.º 11
0
 public void AddSparklingText(SparklingText text, Vector2 position)
 {
     sparklingTexts.Add(Tuple.Create(text, position));
 }
Ejemplo n.º 12
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if (fadeTimer > 0)
            {
                return;
            }
            Item oldItem = heldItem;

            if (!holdingMuseumPiece)
            {
                int inventory_index = inventory.getInventoryPositionOfClick(x, y);
                if (heldItem == null)
                {
                    if (inventory_index >= 0 && inventory_index < inventory.actualInventory.Count && inventory.highlightMethod(inventory.actualInventory[inventory_index]))
                    {
                        heldItem = inventory.actualInventory[inventory_index].getOne();
                        inventory.actualInventory[inventory_index].Stack--;
                        if (inventory.actualInventory[inventory_index].Stack <= 0)
                        {
                            inventory.actualInventory[inventory_index] = null;
                        }
                    }
                }
                else
                {
                    heldItem = inventory.leftClick(x, y, heldItem);
                }
            }
            if (oldItem == null && heldItem != null && Game1.isAnyGamePadButtonBeingPressed())
            {
                receiveGamePadButton(Buttons.DPadUp);
            }
            if (oldItem != null && heldItem != null && (y < Game1.viewport.Height - (height - (IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 192)) || menuMovingDown))
            {
                int mapXTile2 = (int)(Utility.ModifyCoordinateFromUIScale(x) + (float)Game1.viewport.X) / 64;
                int mapYTile2 = (int)(Utility.ModifyCoordinateFromUIScale(y) + (float)Game1.viewport.Y) / 64;
                if ((Game1.currentLocation as LibraryMuseum).isTileSuitableForMuseumPiece(mapXTile2, mapYTile2) && (Game1.currentLocation as LibraryMuseum).isItemSuitableForDonation(heldItem))
                {
                    int objectID     = heldItem.parentSheetIndex;
                    int rewardsCount = (Game1.currentLocation as LibraryMuseum).getRewardsForPlayer(Game1.player).Count;
                    (Game1.currentLocation as LibraryMuseum).museumPieces.Add(new Vector2(mapXTile2, mapYTile2), (heldItem as Object).parentSheetIndex);
                    Game1.playSound("stoneStep");
                    if ((Game1.currentLocation as LibraryMuseum).getRewardsForPlayer(Game1.player).Count > rewardsCount && !holdingMuseumPiece)
                    {
                        sparkleText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:NewReward"), Color.MediumSpringGreen, Color.White);
                        Game1.playSound("reward");
                        globalLocationOfSparklingArtifact = new Vector2((float)(mapXTile2 * 64 + 32) - sparkleText.textWidth / 2f, mapYTile2 * 64 - 48);
                    }
                    else
                    {
                        Game1.playSound("newArtifact");
                    }
                    Game1.player.completeQuest(24);
                    heldItem.Stack--;
                    if (heldItem.Stack <= 0)
                    {
                        heldItem = null;
                    }
                    int pieces = (Game1.currentLocation as LibraryMuseum).museumPieces.Count();
                    if (!holdingMuseumPiece)
                    {
                        Game1.stats.checkForArchaeologyAchievements();
                        switch (pieces)
                        {
                        case 95:
                            Game1.multiplayer.globalChatInfoMessage("MuseumComplete", Game1.player.farmName);
                            break;

                        case 40:
                            Game1.multiplayer.globalChatInfoMessage("Museum40", Game1.player.farmName);
                            break;

                        default:
                            Game1.multiplayer.globalChatInfoMessage("donation", Game1.player.name, "object:" + objectID);
                            break;
                        }
                    }
                    ReturnToDonatableItems();
                }
            }
            else if (heldItem == null && !inventory.isWithinBounds(x, y))
            {
                int           mapXTile = (int)(Utility.ModifyCoordinateFromUIScale(x) + (float)Game1.viewport.X) / 64;
                int           mapYTile = (int)(Utility.ModifyCoordinateFromUIScale(y) + (float)Game1.viewport.Y) / 64;
                Vector2       v        = new Vector2(mapXTile, mapYTile);
                LibraryMuseum location = Game1.currentLocation as LibraryMuseum;
                if (location.museumPieces.ContainsKey(v))
                {
                    heldItem = new Object(location.museumPieces[v], 1);
                    location.museumPieces.Remove(v);
                    holdingMuseumPiece = !location.museumAlreadyHasArtifact(heldItem.parentSheetIndex);
                }
            }
            if (heldItem != null && oldItem == null)
            {
                menuMovingDown = true;
                reOrganizing   = false;
            }
            if (okButton != null && okButton.containsPoint(x, y) && readyToClose())
            {
                if (fadeTimer <= 0)
                {
                    Game1.playSound("bigDeSelect");
                }
                state         = 2;
                fadeTimer     = 800;
                fadeIntoBlack = true;
            }
        }
Ejemplo n.º 13
0
 public static void OnScreen(string message, int x, int y, float timeout = 1.5f)
 {
     SubPos  = new Vector2(x, y) / Game1.options.zoomLevel;
     SubText = new SparklingText(Game1.dialogueFont, message,
                                 Color.Yellow, Color.Transparent, false, 0.1, (int)(timeout * 1000), 16, 1000);
 }
Ejemplo n.º 14
0
        public override void update(GameTime time)
        {
            base.update(time);
            if (this.sparkleText != null && this.sparkleText.update(time))
            {
                this.sparkleText = null;
            }
            if (this.fadeTimer > 0)
            {
                this.fadeTimer -= time.ElapsedGameTime.Milliseconds;
                if (this.fadeIntoBlack)
                {
                    this.blackFadeAlpha = 0f + (1500f - (float)this.fadeTimer) / 1500f;
                }
                else
                {
                    this.blackFadeAlpha = 1f - (1500f - (float)this.fadeTimer) / 1500f;
                }
                if (this.fadeTimer <= 0)
                {
                    switch (this.state)
                    {
                    case 0:
                        this.state              = 1;
                        Game1.viewportFreeze    = true;
                        Game1.viewport.Location = new Location(18 * Game1.tileSize, 2 * Game1.tileSize);
                        Game1.clampViewportToGameMap();
                        this.fadeTimer     = 800;
                        this.fadeIntoBlack = false;
                        break;

                    case 2:
                        Game1.viewportFreeze = false;
                        this.fadeIntoBlack   = false;
                        this.fadeTimer       = 800;
                        this.state           = 3;
                        break;

                    case 3:
                        Game1.exitActiveMenu();
                        break;
                    }
                }
            }
            if (this.menuMovingDown && this.menuPositionOffset < this.height / 3)
            {
                this.menuPositionOffset += 8;
                base.movePosition(0, 8);
            }
            else if (!this.menuMovingDown && this.menuPositionOffset > 0)
            {
                this.menuPositionOffset -= 8;
                base.movePosition(0, -8);
            }
            int num  = Game1.getOldMouseX() + Game1.viewport.X;
            int num2 = Game1.getOldMouseY() + Game1.viewport.Y;

            if (num - Game1.viewport.X < Game1.tileSize)
            {
                Game1.panScreen(-4, 0);
            }
            else if (num - (Game1.viewport.X + Game1.viewport.Width) >= -Game1.tileSize)
            {
                Game1.panScreen(4, 0);
            }
            if (num2 - Game1.viewport.Y < Game1.tileSize)
            {
                Game1.panScreen(0, -4);
            }
            else if (num2 - (Game1.viewport.Y + Game1.viewport.Height) >= -Game1.tileSize)
            {
                Game1.panScreen(0, 4);
                if (this.menuMovingDown)
                {
                    this.menuMovingDown = false;
                }
            }
            Keys[] pressedKeys = Game1.oldKBState.GetPressedKeys();
            for (int i = 0; i < pressedKeys.Length; i++)
            {
                Keys key = pressedKeys[i];
                this.receiveKeyPress(key);
            }
        }
Ejemplo n.º 15
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (this.fadeTimer <= 0)
     {
         Item heldItem = this.heldItem;
         if (!this.holdingMuseumPiece)
         {
             this.heldItem = this.inventory.leftClick(x, y, this.heldItem, true);
         }
         if (heldItem != null && this.heldItem != null && (y < Game1.viewport.Height - (this.height - (IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 3 * Game1.tileSize)) || this.menuMovingDown))
         {
             int num  = (x + Game1.viewport.X) / Game1.tileSize;
             int num2 = (y + Game1.viewport.Y) / Game1.tileSize;
             if ((Game1.currentLocation as LibraryMuseum).isTileSuitableForMuseumPiece(num, num2) && (Game1.currentLocation as LibraryMuseum).isItemSuitableForDonation(this.heldItem))
             {
                 int count = (Game1.currentLocation as LibraryMuseum).getRewardsForPlayer(Game1.player).Count;
                 (Game1.currentLocation as LibraryMuseum).museumPieces.Add(new Vector2((float)num, (float)num2), (this.heldItem as StardewValley.Object).parentSheetIndex);
                 Game1.playSound("stoneStep");
                 this.holdingMuseumPiece = false;
                 if ((Game1.currentLocation as LibraryMuseum).getRewardsForPlayer(Game1.player).Count > count)
                 {
                     this.sparkleText = new SparklingText(Game1.dialogueFont, "New Reward!", Color.MediumSpringGreen, Color.White, false, 0.1, 2500, -1, 500);
                     Game1.playSound("reward");
                     this.globalLocationOfSparklingArtifact = new Vector2((float)(num * Game1.tileSize + Game1.tileSize / 2) - this.sparkleText.textWidth / 2f, (float)(num2 * Game1.tileSize - Game1.tileSize * 3 / 4));
                 }
                 else
                 {
                     Game1.playSound("newArtifact");
                 }
                 Game1.player.completeQuest(24);
                 Item expr_1DE = this.heldItem;
                 int  stack    = expr_1DE.Stack;
                 expr_1DE.Stack = stack - 1;
                 if (this.heldItem.Stack <= 0)
                 {
                     this.heldItem = null;
                 }
                 this.menuMovingDown = false;
                 int count2 = (Game1.currentLocation as LibraryMuseum).museumPieces.Count;
                 if (count2 >= 95)
                 {
                     Game1.getAchievement(5);
                 }
                 else if (count2 >= 40)
                 {
                     Game1.getAchievement(28);
                 }
             }
         }
         else if (this.heldItem == null)
         {
             int     num3 = (x + Game1.viewport.X) / Game1.tileSize;
             int     num4 = (y + Game1.viewport.Y) / Game1.tileSize;
             Vector2 key  = new Vector2((float)num3, (float)num4);
             if ((Game1.currentLocation as LibraryMuseum).museumPieces.ContainsKey(key))
             {
                 this.heldItem = new StardewValley.Object((Game1.currentLocation as LibraryMuseum).museumPieces[key], 1, false, -1, 0);
                 (Game1.currentLocation as LibraryMuseum).museumPieces.Remove(key);
                 this.holdingMuseumPiece = true;
             }
         }
         if (this.heldItem != null && heldItem == null)
         {
             this.menuMovingDown = true;
         }
         if (this.okButton != null && this.okButton.containsPoint(x, y) && this.readyToClose())
         {
             this.state         = 2;
             this.fadeTimer     = 800;
             this.fadeIntoBlack = true;
             Game1.playSound("bigDeSelect");
         }
     }
 }
Ejemplo n.º 16
0
		public override void update(GameTime time)
		{
			base.update(time);
			if (timerBeforeStart <= 0)
			{
				double oldVelocity = arrowRotationVelocity;
				arrowRotationVelocity += arrowRotationDeceleration;
				if (arrowRotationVelocity <= Math.PI / 80.0 && oldVelocity > Math.PI / 80.0)
				{
					bool colorChoiceGreen2 = Game1.currentLocation.currentEvent.specialEventVariable2;
					if (arrowRotation > Math.PI / 2.0 && arrowRotation <= 4.3196898986859651 && Game1.random.NextDouble() < (double)((float)Game1.player.LuckLevel / 15f))
					{
						if (colorChoiceGreen2)
						{
							arrowRotationVelocity = Math.PI / 48.0;
							Game1.playSound("dwop");
						}
					}
					else if ((arrowRotation + Math.PI) % (Math.PI * 2.0) <= 4.3196898986859651 && !colorChoiceGreen2 && Game1.random.NextDouble() < (double)((float)Game1.player.LuckLevel / 20f))
					{
						arrowRotationVelocity = Math.PI / 48.0;
						Game1.playSound("dwop");
					}
				}
				if (arrowRotationVelocity <= 0.0 && !doneSpinning)
				{
					doneSpinning = true;
					arrowRotationDeceleration = 0.0;
					arrowRotationVelocity = 0.0;
					bool colorChoiceGreen = Game1.currentLocation.currentEvent.specialEventVariable2;
					bool won = false;
					if (arrowRotation > Math.PI / 2.0 && arrowRotation <= 4.71238898038469)
					{
						if (!colorChoiceGreen)
						{
							won = true;
						}
					}
					else if (colorChoiceGreen)
					{
						won = true;
					}
					if (won)
					{
						Game1.playSound("reward");
						resultText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:WheelSpinGame.cs.11829"), Color.Lime, Color.White);
						Game1.player.festivalScore += wager;
					}
					else
					{
						resultText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:WheelSpinGame.cs.11830"), Color.Red, Color.Transparent);
						Game1.playSound("fishEscape");
						Game1.player.festivalScore -= wager;
					}
				}
				double num = arrowRotation;
				arrowRotation += arrowRotationVelocity;
				if (num % (Math.PI / 2.0) > arrowRotation % (Math.PI / 2.0))
				{
					Game1.playSound("Cowboy_gunshot");
				}
				arrowRotation %= Math.PI * 2.0;
			}
			else
			{
				timerBeforeStart -= time.ElapsedGameTime.Milliseconds;
				if (timerBeforeStart <= 0)
				{
					Game1.playSound("cowboy_monsterhit");
				}
			}
			if (resultText != null && resultText.update(time))
			{
				resultText = null;
			}
			if (doneSpinning && resultText == null)
			{
				Game1.exitActiveMenu();
				Game1.player.canMove = true;
			}
		}
Ejemplo n.º 17
0
 public override void update(GameTime time)
 {
     base.update(time);
     if (this.timerBeforeStart <= 0)
     {
         double rotationVelocity = this.arrowRotationVelocity;
         this.arrowRotationVelocity = this.arrowRotationVelocity + this.arrowRotationDeceleration;
         if (this.arrowRotationVelocity <= Math.PI / 80.0 && rotationVelocity > Math.PI / 80.0)
         {
             bool specialEventVariable2 = Game1.currentLocation.currentEvent.specialEventVariable2;
             if (this.arrowRotation > Math.PI / 2.0 && this.arrowRotation <= 11.0 * Math.PI / 8.0 && Game1.random.NextDouble() < (double)Game1.player.LuckLevel / 15.0)
             {
                 if (specialEventVariable2)
                 {
                     this.arrowRotationVelocity = Math.PI / 48.0;
                     Game1.playSound("dwop");
                 }
             }
             else if ((this.arrowRotation + Math.PI) % (2.0 * Math.PI) <= 11.0 * Math.PI / 8.0 && !specialEventVariable2 && Game1.random.NextDouble() < (double)Game1.player.LuckLevel / 20.0)
             {
                 this.arrowRotationVelocity = Math.PI / 48.0;
                 Game1.playSound("dwop");
             }
         }
         if (this.arrowRotationVelocity <= 0.0 && !this.doneSpinning)
         {
             this.doneSpinning = true;
             this.arrowRotationDeceleration = 0.0;
             this.arrowRotationVelocity     = 0.0;
             bool specialEventVariable2 = Game1.currentLocation.currentEvent.specialEventVariable2;
             bool flag = false;
             if (this.arrowRotation > Math.PI / 2.0 && this.arrowRotation <= 3.0 * Math.PI / 2.0)
             {
                 if (!specialEventVariable2)
                 {
                     flag = true;
                 }
             }
             else if (specialEventVariable2)
             {
                 flag = true;
             }
             if (flag)
             {
                 Game1.playSound("reward");
                 this.resultText             = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:WheelSpinGame.cs.11829"), Color.Lime, Color.White, false, 0.1, 2500, -1, 500);
                 Game1.player.festivalScore += this.wager;
             }
             else
             {
                 this.resultText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:WheelSpinGame.cs.11830"), Color.Red, Color.Transparent, false, 0.1, 2500, -1, 500);
                 Game1.playSound("fishEscape");
                 Game1.player.festivalScore -= this.wager;
             }
         }
         double arrowRotation = this.arrowRotation;
         this.arrowRotation = this.arrowRotation + this.arrowRotationVelocity;
         double num = Math.PI / 2.0;
         if (arrowRotation % num > this.arrowRotation % (Math.PI / 2.0))
         {
             Game1.playSound("Cowboy_gunshot");
         }
         this.arrowRotation = this.arrowRotation % (2.0 * Math.PI);
     }
     else
     {
         this.timerBeforeStart = this.timerBeforeStart - time.ElapsedGameTime.Milliseconds;
         if (this.timerBeforeStart <= 0)
         {
             Game1.playSound("cowboy_monsterhit");
         }
     }
     if (this.resultText != null && this.resultText.update(time))
     {
         this.resultText = (SparklingText)null;
     }
     if (!this.doneSpinning || this.resultText != null)
     {
         return;
     }
     Game1.exitActiveMenu();
     Game1.player.canMove = true;
 }
Ejemplo n.º 18
0
 public SaveGameMenu()
 {
     saveText             = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:SaveGameMenu.cs.11378"), Color.LimeGreen, Color.Black * 0.001f, rainbow: false, 0.1, 1500, 32);
     _hasSentFarmhandData = false;
 }
Ejemplo n.º 19
0
        public override void update(GameTime time)
        {
            base.update(time);
            if (this.sparkleText != null && this.sparkleText.update(time))
            {
                this.sparkleText = (SparklingText)null;
            }
            if (this.fadeTimer > 0)
            {
                this.fadeTimer      = this.fadeTimer - time.ElapsedGameTime.Milliseconds;
                this.blackFadeAlpha = !this.fadeIntoBlack ? (float)(1.0 - (1500.0 - (double)this.fadeTimer) / 1500.0) : (float)(0.0 + (1500.0 - (double)this.fadeTimer) / 1500.0);
                if (this.fadeTimer <= 0)
                {
                    switch (this.state)
                    {
                    case 0:
                        this.state              = 1;
                        Game1.viewportFreeze    = true;
                        Game1.viewport.Location = new Location(18 * Game1.tileSize, 2 * Game1.tileSize);
                        Game1.clampViewportToGameMap();
                        this.fadeTimer     = 800;
                        this.fadeIntoBlack = false;
                        break;

                    case 2:
                        Game1.viewportFreeze = false;
                        this.fadeIntoBlack   = false;
                        this.fadeTimer       = 800;
                        this.state           = 3;
                        break;

                    case 3:
                        Game1.exitActiveMenu();
                        break;
                    }
                }
            }
            if (this.menuMovingDown && this.menuPositionOffset < this.height / 3)
            {
                this.menuPositionOffset = this.menuPositionOffset + 8;
                this.movePosition(0, 8);
            }
            else if (!this.menuMovingDown && this.menuPositionOffset > 0)
            {
                this.menuPositionOffset = this.menuPositionOffset - 8;
                this.movePosition(0, -8);
            }
            int num1 = Game1.getOldMouseX() + Game1.viewport.X;
            int num2 = Game1.getOldMouseY() + Game1.viewport.Y;

            if (num1 - Game1.viewport.X < Game1.tileSize)
            {
                Game1.panScreen(-4, 0);
            }
            else if (num1 - (Game1.viewport.X + Game1.viewport.Width) >= -Game1.tileSize)
            {
                Game1.panScreen(4, 0);
            }
            if (num2 - Game1.viewport.Y < Game1.tileSize)
            {
                Game1.panScreen(0, -4);
            }
            else if (num2 - (Game1.viewport.Y + Game1.viewport.Height) >= -Game1.tileSize)
            {
                Game1.panScreen(0, 4);
                if (this.menuMovingDown)
                {
                    this.menuMovingDown = false;
                }
            }
            foreach (Keys pressedKey in Game1.oldKBState.GetPressedKeys())
            {
                this.receiveKeyPress(pressedKey);
            }
        }
Ejemplo n.º 20
0
        public override void update(GameTime time)
        {
            base.update(time);
            if (sparkleText != null && sparkleText.update(time))
            {
                sparkleText = null;
            }
            if (fadeTimer > 0)
            {
                fadeTimer -= time.ElapsedGameTime.Milliseconds;
                if (fadeIntoBlack)
                {
                    blackFadeAlpha = 0f + (1500f - (float)fadeTimer) / 1500f;
                }
                else
                {
                    blackFadeAlpha = 1f - (1500f - (float)fadeTimer) / 1500f;
                }
                if (fadeTimer <= 0)
                {
                    switch (state)
                    {
                    case 0:
                        state = 1;
                        Game1.viewportFreeze    = true;
                        Game1.viewport.Location = new Location(1152, 128);
                        Game1.clampViewportToGameMap();
                        fadeTimer     = 800;
                        fadeIntoBlack = false;
                        break;

                    case 2:
                        Game1.viewportFreeze = false;
                        fadeIntoBlack        = false;
                        fadeTimer            = 800;
                        state = 3;
                        break;

                    case 3:
                        exitThisMenuNoSound();
                        break;
                    }
                }
            }
            if (menuMovingDown && menuPositionOffset < height / 3)
            {
                menuPositionOffset += 8;
                movePosition(0, 8);
            }
            else if (!menuMovingDown && menuPositionOffset > 0)
            {
                menuPositionOffset -= 8;
                movePosition(0, -8);
            }
            int mouseX = Game1.getOldMouseX(ui_scale: false) + Game1.viewport.X;
            int mouseY = Game1.getOldMouseY(ui_scale: false) + Game1.viewport.Y;

            if ((!Game1.options.SnappyMenus && Game1.lastCursorMotionWasMouse && mouseX - Game1.viewport.X < 64) || Game1.input.GetGamePadState().ThumbSticks.Right.X < 0f)
            {
                Game1.panScreen(-4, 0);
                if (Game1.input.GetGamePadState().ThumbSticks.Right.X < 0f)
                {
                    snapCursorToCurrentMuseumSpot();
                }
            }
            else if ((!Game1.options.SnappyMenus && Game1.lastCursorMotionWasMouse && mouseX - (Game1.viewport.X + Game1.viewport.Width) >= -64) || Game1.input.GetGamePadState().ThumbSticks.Right.X > 0f)
            {
                Game1.panScreen(4, 0);
                if (Game1.input.GetGamePadState().ThumbSticks.Right.X > 0f)
                {
                    snapCursorToCurrentMuseumSpot();
                }
            }
            if ((!Game1.options.SnappyMenus && Game1.lastCursorMotionWasMouse && mouseY - Game1.viewport.Y < 64) || Game1.input.GetGamePadState().ThumbSticks.Right.Y > 0f)
            {
                Game1.panScreen(0, -4);
                if (Game1.input.GetGamePadState().ThumbSticks.Right.Y > 0f)
                {
                    snapCursorToCurrentMuseumSpot();
                }
            }
            else if ((!Game1.options.SnappyMenus && Game1.lastCursorMotionWasMouse && mouseY - (Game1.viewport.Y + Game1.viewport.Height) >= -64) || Game1.input.GetGamePadState().ThumbSticks.Right.Y < 0f)
            {
                Game1.panScreen(0, 4);
                if (Game1.input.GetGamePadState().ThumbSticks.Right.Y < 0f)
                {
                    snapCursorToCurrentMuseumSpot();
                }
            }
            Keys[] pressedKeys = Game1.oldKBState.GetPressedKeys();
            foreach (Keys key in pressedKeys)
            {
                receiveKeyPress(key);
            }
        }
Ejemplo n.º 21
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if (this.fadeTimer > 0)
            {
                return;
            }
            Item heldItem = this.heldItem;

            if (!this.holdingMuseumPiece)
            {
                this.heldItem = this.inventory.leftClick(x, y, this.heldItem, true);
            }
            if (heldItem != null && this.heldItem != null && (y < Game1.viewport.Height - (this.height - (IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 3 * Game1.tileSize)) || this.menuMovingDown))
            {
                int x1 = (x + Game1.viewport.X) / Game1.tileSize;
                int y1 = (y + Game1.viewport.Y) / Game1.tileSize;
                if ((Game1.currentLocation as LibraryMuseum).isTileSuitableForMuseumPiece(x1, y1) && (Game1.currentLocation as LibraryMuseum).isItemSuitableForDonation(this.heldItem))
                {
                    int count1 = (Game1.currentLocation as LibraryMuseum).getRewardsForPlayer(Game1.player).Count;
                    (Game1.currentLocation as LibraryMuseum).museumPieces.Add(new Vector2((float)x1, (float)y1), (this.heldItem as Object).parentSheetIndex);
                    Game1.playSound("stoneStep");
                    this.holdingMuseumPiece = false;
                    if ((Game1.currentLocation as LibraryMuseum).getRewardsForPlayer(Game1.player).Count > count1)
                    {
                        this.sparkleText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:NewReward"), Color.MediumSpringGreen, Color.White, false, 0.1, 2500, -1, 500);
                        Game1.playSound("reward");
                        this.globalLocationOfSparklingArtifact = new Vector2((float)(x1 * Game1.tileSize + Game1.tileSize / 2) - this.sparkleText.textWidth / 2f, (float)(y1 * Game1.tileSize - Game1.tileSize * 3 / 4));
                    }
                    else
                    {
                        Game1.playSound("newArtifact");
                    }
                    Game1.player.completeQuest(24);
                    --this.heldItem.Stack;
                    if (this.heldItem.Stack <= 0)
                    {
                        this.heldItem = (Item)null;
                    }
                    this.menuMovingDown = false;
                    int count2 = (Game1.currentLocation as LibraryMuseum).museumPieces.Count;
                    if (count2 >= 95)
                    {
                        Game1.getAchievement(5);
                    }
                    else if (count2 >= 40)
                    {
                        Game1.getAchievement(28);
                    }
                }
            }
            else if (this.heldItem == null && !this.inventory.isWithinBounds(x, y))
            {
                Vector2 key = new Vector2((float)((x + Game1.viewport.X) / Game1.tileSize), (float)((y + Game1.viewport.Y) / Game1.tileSize));
                if ((Game1.currentLocation as LibraryMuseum).museumPieces.ContainsKey(key))
                {
                    this.heldItem = (Item) new Object((Game1.currentLocation as LibraryMuseum).museumPieces[key], 1, false, -1, 0);
                    (Game1.currentLocation as LibraryMuseum).museumPieces.Remove(key);
                    this.holdingMuseumPiece = true;
                }
            }
            if (this.heldItem != null && heldItem == null)
            {
                this.menuMovingDown = true;
            }
            if (this.okButton == null || !this.okButton.containsPoint(x, y) || !this.readyToClose())
            {
                return;
            }
            this.state         = 2;
            this.fadeTimer     = 800;
            this.fadeIntoBlack = true;
            Game1.playSound("bigDeSelect");
        }
Ejemplo n.º 22
0
 public override void update(GameTime time)
 {
     if (this.sparkleText != null && this.sparkleText.update(time))
     {
         this.sparkleText = null;
     }
     if (this.everythingShakeTimer > 0f)
     {
         this.everythingShakeTimer -= (float)time.ElapsedGameTime.Milliseconds;
         this.everythingShake       = new Vector2((float)Game1.random.Next(-10, 11) / 10f, (float)Game1.random.Next(-10, 11) / 10f);
         if (this.everythingShakeTimer <= 0f)
         {
             this.everythingShake = Vector2.Zero;
         }
     }
     if (this.fadeIn)
     {
         this.scale += 0.05f;
         if (this.scale >= 1f)
         {
             this.scale  = 1f;
             this.fadeIn = false;
         }
     }
     else if (this.fadeOut)
     {
         if (this.everythingShakeTimer > 0f || this.sparkleText != null)
         {
             return;
         }
         this.scale -= 0.05f;
         if (this.scale <= 0f)
         {
             this.scale   = 0f;
             this.fadeOut = false;
             if (this.distanceFromCatching > 0.9f && Game1.player.CurrentTool is FishingRod)
             {
                 (Game1.player.CurrentTool as FishingRod).pullFishFromWater(this.whichFish, this.fishSize, this.fishQuality, (int)this.difficulty, this.treasureCaught, this.perfect);
             }
             else
             {
                 if (Game1.player.CurrentTool != null && Game1.player.CurrentTool is FishingRod)
                 {
                     (Game1.player.CurrentTool as FishingRod).doneFishing(Game1.player, true);
                 }
                 Game1.player.completelyStopAnimatingOrDoingAction();
             }
             Game1.exitActiveMenu();
             Game1.setRichPresence("location", Game1.currentLocation.Name);
         }
     }
     else
     {
         if (Game1.random.NextDouble() < (double)(this.difficulty * (float)((this.motionType == 2) ? 20 : 1) / 4000f) && (this.motionType != 2 || this.bobberTargetPosition == -1f))
         {
             float num  = 548f - this.bobberPosition;
             float num2 = this.bobberPosition;
             float num3 = Math.Min(99f, this.difficulty + (float)Game1.random.Next(10, 45)) / 100f;
             this.bobberTargetPosition = this.bobberPosition + (float)Game1.random.Next(-(int)num2, (int)num) * num3;
         }
         if (this.motionType == 4)
         {
             this.floaterSinkerAcceleration = Math.Max(this.floaterSinkerAcceleration - 0.01f, -1.5f);
         }
         else if (this.motionType == 3)
         {
             this.floaterSinkerAcceleration = Math.Min(this.floaterSinkerAcceleration + 0.01f, 1.5f);
         }
         if (Math.Abs(this.bobberPosition - this.bobberTargetPosition) > 3f && this.bobberTargetPosition != -1f)
         {
             this.bobberAcceleration = (this.bobberTargetPosition - this.bobberPosition) / ((float)Game1.random.Next(10, 30) + (100f - Math.Min(100f, this.difficulty)));
             this.bobberSpeed       += (this.bobberAcceleration - this.bobberSpeed) / 5f;
         }
         else if (this.motionType != 2 && Game1.random.NextDouble() < (double)(this.difficulty / 2000f))
         {
             this.bobberTargetPosition = this.bobberPosition + (float)((Game1.random.NextDouble() < 0.5) ? Game1.random.Next(-100, -51) : Game1.random.Next(50, 101));
         }
         else
         {
             this.bobberTargetPosition = -1f;
         }
         if (this.motionType == 1 && Game1.random.NextDouble() < (double)(this.difficulty / 1000f))
         {
             this.bobberTargetPosition = this.bobberPosition + (float)((Game1.random.NextDouble() < 0.5) ? Game1.random.Next(-100 - (int)this.difficulty * 2, -51) : Game1.random.Next(50, 101 + (int)this.difficulty * 2));
         }
         this.bobberTargetPosition = Math.Max(-1f, Math.Min(this.bobberTargetPosition, 548f));
         this.bobberPosition      += this.bobberSpeed + this.floaterSinkerAcceleration;
         if (this.bobberPosition > 532f)
         {
             this.bobberPosition = 532f;
         }
         else if (this.bobberPosition < 0f)
         {
             this.bobberPosition = 0f;
         }
         this.bobberInBar = (this.bobberPosition + 16f <= this.bobberBarPos - 32f + (float)this.bobberBarHeight && this.bobberPosition - 16f >= this.bobberBarPos - 32f);
         if (this.bobberPosition >= (float)(548 - this.bobberBarHeight) && this.bobberBarPos >= (float)(568 - this.bobberBarHeight - 4))
         {
             this.bobberInBar = true;
         }
         bool arg_580_0 = this.buttonPressed;
         this.buttonPressed = (Game1.oldMouseState.LeftButton == ButtonState.Pressed || Game1.isOneOfTheseKeysDown(Game1.oldKBState, Game1.options.useToolButton) || (Game1.options.gamepadControls && (Game1.oldPadState.IsButtonDown(Buttons.X) || Game1.oldPadState.IsButtonDown(Buttons.A))));
         if (!arg_580_0 && this.buttonPressed)
         {
             Game1.playSound("fishingRodBend");
         }
         float num4 = this.buttonPressed ? -0.25f : 0.25f;
         if (this.buttonPressed && num4 < 0f && (this.bobberBarPos == 0f || this.bobberBarPos == (float)(568 - this.bobberBarHeight)))
         {
             this.bobberBarSpeed = 0f;
         }
         if (this.bobberInBar)
         {
             num4 *= ((this.whichBobber == 691) ? 0.3f : 0.6f);
             if (this.whichBobber == 691)
             {
                 if (this.bobberPosition + 16f < this.bobberBarPos + (float)(this.bobberBarHeight / 2))
                 {
                     this.bobberBarSpeed -= 0.2f;
                 }
                 else
                 {
                     this.bobberBarSpeed += 0.2f;
                 }
             }
         }
         float num5 = this.bobberBarPos;
         this.bobberBarSpeed += num4;
         this.bobberBarPos   += this.bobberBarSpeed;
         if (this.bobberBarPos + (float)this.bobberBarHeight > 568f)
         {
             this.bobberBarPos   = (float)(568 - this.bobberBarHeight);
             this.bobberBarSpeed = -this.bobberBarSpeed * 2f / 3f * ((this.whichBobber == 692) ? 0.1f : 1f);
             if (num5 + (float)this.bobberBarHeight < 568f)
             {
                 Game1.playSound("shiny4");
             }
         }
         else if (this.bobberBarPos < 0f)
         {
             this.bobberBarPos   = 0f;
             this.bobberBarSpeed = -this.bobberBarSpeed * 2f / 3f;
             if (num5 > 0f)
             {
                 Game1.playSound("shiny4");
             }
         }
         bool flag = false;
         if (this.treasure)
         {
             float num6 = this.treasureAppearTimer;
             this.treasureAppearTimer -= (float)time.ElapsedGameTime.Milliseconds;
             if (this.treasureAppearTimer <= 0f)
             {
                 if (this.treasureScale < 1f && !this.treasureCaught)
                 {
                     if (num6 > 0f)
                     {
                         this.treasurePosition = (float)((this.bobberBarPos > 274f) ? Game1.random.Next(8, (int)this.bobberBarPos - 20) : Game1.random.Next(Math.Min(528, (int)this.bobberBarPos + this.bobberBarHeight), 500));
                         Game1.playSound("dwop");
                     }
                     this.treasureScale = Math.Min(1f, this.treasureScale + 0.1f);
                 }
                 flag = (this.treasurePosition + 16f <= this.bobberBarPos - 32f + (float)this.bobberBarHeight && this.treasurePosition - 16f >= this.bobberBarPos - 32f);
                 if (flag && !this.treasureCaught)
                 {
                     this.treasureCatchLevel += 0.0135f;
                     this.treasureShake       = new Vector2((float)Game1.random.Next(-2, 3), (float)Game1.random.Next(-2, 3));
                     if (this.treasureCatchLevel >= 1f)
                     {
                         Game1.playSound("newArtifact");
                         this.treasureCaught = true;
                     }
                 }
                 else if (this.treasureCaught)
                 {
                     this.treasureScale = Math.Max(0f, this.treasureScale - 0.1f);
                 }
                 else
                 {
                     this.treasureShake      = Vector2.Zero;
                     this.treasureCatchLevel = Math.Max(0f, this.treasureCatchLevel - 0.01f);
                 }
             }
         }
         if (this.bobberInBar)
         {
             this.distanceFromCatching += 0.002f;
             this.reelRotation         += 0.3926991f;
             this.fishShake.X           = (float)Game1.random.Next(-10, 11) / 10f;
             this.fishShake.Y           = (float)Game1.random.Next(-10, 11) / 10f;
             this.barShake              = Vector2.Zero;
             Rumble.rumble(0.1f, 1000f);
             if (BobberBar.unReelSound != null)
             {
                 BobberBar.unReelSound.Stop(AudioStopOptions.Immediate);
             }
             if (Game1.soundBank != null && (BobberBar.reelSound == null || BobberBar.reelSound.IsStopped || BobberBar.reelSound.IsStopping))
             {
                 BobberBar.reelSound = Game1.soundBank.GetCue("fastReel");
             }
             if (BobberBar.reelSound != null && !BobberBar.reelSound.IsPlaying && !BobberBar.reelSound.IsStopping)
             {
                 BobberBar.reelSound.Play();
             }
         }
         else if (!flag || this.treasureCaught || this.whichBobber != 693)
         {
             if (!this.fishShake.Equals(Vector2.Zero))
             {
                 Game1.playSound("tinyWhip");
                 this.perfect = false;
                 Rumble.stopRumbling();
             }
             this.fishSizeReductionTimer -= time.ElapsedGameTime.Milliseconds;
             if (this.fishSizeReductionTimer <= 0)
             {
                 this.fishSize = Math.Max(this.minFishSize, this.fishSize - 1);
                 this.fishSizeReductionTimer = 800;
             }
             if ((Game1.player.fishCaught != null && Game1.player.fishCaught.Count != 0) || Game1.currentMinigame != null)
             {
                 this.distanceFromCatching -= ((this.whichBobber == 694) ? 0.002f : 0.003f);
             }
             float num7 = Math.Abs(this.bobberPosition - (this.bobberBarPos + (float)(this.bobberBarHeight / 2)));
             this.reelRotation -= 3.14159274f / Math.Max(10f, 200f - num7);
             this.barShake.X    = (float)Game1.random.Next(-10, 11) / 10f;
             this.barShake.Y    = (float)Game1.random.Next(-10, 11) / 10f;
             this.fishShake     = Vector2.Zero;
             if (BobberBar.reelSound != null)
             {
                 BobberBar.reelSound.Stop(AudioStopOptions.Immediate);
             }
             if (Game1.soundBank != null && (BobberBar.unReelSound == null || BobberBar.unReelSound.IsStopped))
             {
                 BobberBar.unReelSound = Game1.soundBank.GetCue("slowReel");
                 BobberBar.unReelSound.SetVariable("Pitch", 600f);
             }
             if (BobberBar.unReelSound != null && !BobberBar.unReelSound.IsPlaying && !BobberBar.unReelSound.IsStopping)
             {
                 BobberBar.unReelSound.Play();
             }
         }
         this.distanceFromCatching = Math.Max(0f, Math.Min(1f, this.distanceFromCatching));
         if (Game1.player.CurrentTool != null)
         {
             Game1.player.CurrentTool.tickUpdate(time, Game1.player);
         }
         if (this.distanceFromCatching <= 0f)
         {
             this.fadeOut = true;
             this.everythingShakeTimer = 500f;
             Game1.playSound("fishEscape");
             if (BobberBar.unReelSound != null)
             {
                 BobberBar.unReelSound.Stop(AudioStopOptions.Immediate);
             }
             if (BobberBar.reelSound != null)
             {
                 BobberBar.reelSound.Stop(AudioStopOptions.Immediate);
             }
         }
         else if (this.distanceFromCatching >= 1f)
         {
             this.everythingShakeTimer = 500f;
             Game1.playSound("jingle1");
             this.fadeOut = true;
             if (BobberBar.unReelSound != null)
             {
                 BobberBar.unReelSound.Stop(AudioStopOptions.Immediate);
             }
             if (BobberBar.reelSound != null)
             {
                 BobberBar.reelSound.Stop(AudioStopOptions.Immediate);
             }
             if (this.perfect)
             {
                 this.sparkleText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\UI:BobberBar_Perfect", new object[0]), Color.Yellow, Color.White, false, 0.1, 1500, -1, 500);
                 if (Game1.isFestival())
                 {
                     Game1.CurrentEvent.perfectFishing();
                 }
             }
             else if (this.fishSize == this.maxFishSize)
             {
                 this.fishSize--;
             }
         }
     }
     if (this.bobberPosition < 0f)
     {
         this.bobberPosition = 0f;
     }
     if (this.bobberPosition > 548f)
     {
         this.bobberPosition = 548f;
     }
 }
Ejemplo n.º 23
0
 public override void update(GameTime time)
 {
     base.update(time);
     if (this.timerBeforeStart <= 0)
     {
         double num = this.arrowRotationVelocity;
         this.arrowRotationVelocity += this.arrowRotationDeceleration;
         if (this.arrowRotationVelocity <= 0.039269908169872414 && num > 0.039269908169872414)
         {
             bool specialEventVariable = Game1.currentLocation.currentEvent.specialEventVariable2;
             if (this.arrowRotation > 1.5707963267948966 && this.arrowRotation <= 4.3196898986859651 && Game1.random.NextDouble() < (double)((float)Game1.player.LuckLevel / 15f))
             {
                 if (specialEventVariable)
                 {
                     this.arrowRotationVelocity = 0.065449846949787352;
                     Game1.playSound("dwop");
                 }
             }
             else if ((this.arrowRotation + 3.1415926535897931) % 6.2831853071795862 <= 4.3196898986859651 && !specialEventVariable && Game1.random.NextDouble() < (double)((float)Game1.player.LuckLevel / 20f))
             {
                 this.arrowRotationVelocity = 0.065449846949787352;
                 Game1.playSound("dwop");
             }
         }
         if (this.arrowRotationVelocity <= 0.0 && !this.doneSpinning)
         {
             this.doneSpinning = true;
             this.arrowRotationDeceleration = 0.0;
             this.arrowRotationVelocity     = 0.0;
             bool specialEventVariable2 = Game1.currentLocation.currentEvent.specialEventVariable2;
             bool flag = false;
             if (this.arrowRotation > 1.5707963267948966 && this.arrowRotation <= 4.71238898038469)
             {
                 if (!specialEventVariable2)
                 {
                     flag = true;
                 }
             }
             else if (specialEventVariable2)
             {
                 flag = true;
             }
             if (flag)
             {
                 Game1.playSound("reward");
                 this.resultText             = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:WheelSpinGame.cs.11829", new object[0]), Color.Lime, Color.White, false, 0.1, 2500, -1, 500);
                 Game1.player.festivalScore += this.wager;
             }
             else
             {
                 this.resultText = new SparklingText(Game1.dialogueFont, Game1.content.LoadString("Strings\\StringsFromCSFiles:WheelSpinGame.cs.11830", new object[0]), Color.Red, Color.Transparent, false, 0.1, 2500, -1, 500);
                 Game1.playSound("fishEscape");
                 Game1.player.festivalScore -= this.wager;
             }
         }
         double arg_292_0 = this.arrowRotation;
         this.arrowRotation += this.arrowRotationVelocity;
         if (arg_292_0 % 1.5707963267948966 > this.arrowRotation % 1.5707963267948966)
         {
             Game1.playSound("Cowboy_gunshot");
         }
         this.arrowRotation %= 6.2831853071795862;
     }
     else
     {
         this.timerBeforeStart -= time.ElapsedGameTime.Milliseconds;
         if (this.timerBeforeStart <= 0)
         {
             Game1.playSound("cowboy_monsterhit");
         }
     }
     if (this.resultText != null && this.resultText.update(time))
     {
         this.resultText = null;
     }
     if (this.doneSpinning && this.resultText == null)
     {
         Game1.exitActiveMenu();
         Game1.player.canMove = true;
     }
 }