public override void resetForPlayerEntry() { base.resetForPlayerEntry(); this.lightGlows.Clear(); this.coinBuffer = LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru ? " " : (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.zh ? " " : " "); if (Game1.player.hasClubCard) { return; } Game1.currentLocation = Game1.getLocationFromName("SandyHouse"); Game1.changeMusicTrack("none"); Game1.currentLocation.resetForPlayerEntry(); NPC characterFromName = Game1.currentLocation.getCharacterFromName("Bouncer"); if (characterFromName != null) { Vector2 vector2 = new Vector2(17f, 4f); characterFromName.showTextAboveHead(Game1.content.LoadString("Strings\\Locations:Club_Bouncer_TextAboveHead" + (object)(Game1.random.Next(2) + 1)), -1, 2, 3000, 0); int num1 = Game1.random.Next(); Game1.playSound("thudStep"); List <TemporaryAnimatedSprite> temporarySprites1 = Game1.currentLocation.TemporarySprites; TemporaryAnimatedSprite temporaryAnimatedSprite1 = new TemporaryAnimatedSprite(288, 100f, 1, 24, vector2 * (float)Game1.tileSize, true, false, Game1.currentLocation, Game1.player); temporaryAnimatedSprite1.shakeIntensity = 0.5f; temporaryAnimatedSprite1.shakeIntensityChange = 1f / 500f; temporaryAnimatedSprite1.extraInfoForEndBehavior = num1; TemporaryAnimatedSprite.endBehavior endBehavior = new TemporaryAnimatedSprite.endBehavior(Game1.currentLocation.removeTemporarySpritesWithID); temporaryAnimatedSprite1.endFunction = endBehavior; temporarySprites1.Add(temporaryAnimatedSprite1); Game1.currentLocation.TemporarySprites.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(598, 1279, 3, 4), 53f, 5, 9, vector2 * (float)Game1.tileSize + new Vector2(5f, 0.0f) * (float)Game1.pixelZoom, true, false, (float)(4 * Game1.tileSize + 7) / 10000f, 0.0f, Color.Yellow, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false) { id = (float)num1 }); List <TemporaryAnimatedSprite> temporarySprites2 = Game1.currentLocation.TemporarySprites; TemporaryAnimatedSprite temporaryAnimatedSprite2 = new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(598, 1279, 3, 4), 53f, 5, 9, vector2 * (float)Game1.tileSize + new Vector2(5f, 0.0f) * (float)Game1.pixelZoom, true, true, (float)(4 * Game1.tileSize + 7) / 10000f, 0.0f, Color.Orange, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false); temporaryAnimatedSprite2.delayBeforeAnimationStart = 100; double num2 = (double)num1; temporaryAnimatedSprite2.id = (float)num2; temporarySprites2.Add(temporaryAnimatedSprite2); List <TemporaryAnimatedSprite> temporarySprites3 = Game1.currentLocation.TemporarySprites; TemporaryAnimatedSprite temporaryAnimatedSprite3 = new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(598, 1279, 3, 4), 53f, 5, 9, vector2 * (float)Game1.tileSize + new Vector2(5f, 0.0f) * (float)Game1.pixelZoom, true, false, (float)(4 * Game1.tileSize + 7) / 10000f, 0.0f, Color.White, (float)Game1.pixelZoom * 0.75f, 0.0f, 0.0f, 0.0f, false); temporaryAnimatedSprite3.delayBeforeAnimationStart = 200; double num3 = (double)num1; temporaryAnimatedSprite3.id = (float)num3; temporarySprites3.Add(temporaryAnimatedSprite3); if (Game1.fuseSound != null && !Game1.fuseSound.IsPlaying) { Game1.fuseSound = Game1.soundBank.GetCue("fuse"); Game1.fuseSound.Play(); } } Game1.player.position = new Vector2(17f, 4f) * (float)Game1.tileSize; }
public TemporaryAnimatedSprite getClone() { TemporaryAnimatedSprite temporaryAnimatedSprite = new TemporaryAnimatedSprite(); temporaryAnimatedSprite.texture = this.texture; temporaryAnimatedSprite.interval = this.interval; temporaryAnimatedSprite.currentParentTileIndex = this.currentParentTileIndex; temporaryAnimatedSprite.oldCurrentParentTileIndex = this.oldCurrentParentTileIndex; temporaryAnimatedSprite.initialParentTileIndex = this.initialParentTileIndex; temporaryAnimatedSprite.totalNumberOfLoops = this.totalNumberOfLoops; temporaryAnimatedSprite.currentNumberOfLoops = this.currentNumberOfLoops; temporaryAnimatedSprite.xStopCoordinate = this.xStopCoordinate; temporaryAnimatedSprite.yStopCoordinate = this.yStopCoordinate; temporaryAnimatedSprite.animationLength = this.animationLength; temporaryAnimatedSprite.bombRadius = this.bombRadius; temporaryAnimatedSprite.pingPongMotion = this.pingPongMotion; int num1 = this.flicker ? 1 : 0; temporaryAnimatedSprite.flicker = num1 != 0; int num2 = this.timeBasedMotion ? 1 : 0; temporaryAnimatedSprite.timeBasedMotion = num2 != 0; int num3 = this.overrideLocationDestroy ? 1 : 0; temporaryAnimatedSprite.overrideLocationDestroy = num3 != 0; int num4 = this.pingPong ? 1 : 0; temporaryAnimatedSprite.pingPong = num4 != 0; int num5 = this.holdLastFrame ? 1 : 0; temporaryAnimatedSprite.holdLastFrame = num5 != 0; int infoForEndBehavior = this.extraInfoForEndBehavior; temporaryAnimatedSprite.extraInfoForEndBehavior = infoForEndBehavior; int lightId = this.lightID; temporaryAnimatedSprite.lightID = lightId; Vector2 acceleration = this.acceleration; temporaryAnimatedSprite.acceleration = acceleration; Vector2 accelerationChange = this.accelerationChange; temporaryAnimatedSprite.accelerationChange = accelerationChange; double alpha = (double)this.alpha; temporaryAnimatedSprite.alpha = (float)alpha; double alphaFade = (double)this.alphaFade; temporaryAnimatedSprite.alphaFade = (float)alphaFade; Character attachedCharacter = this.attachedCharacter; temporaryAnimatedSprite.attachedCharacter = attachedCharacter; int num6 = this.bigCraftable ? 1 : 0; temporaryAnimatedSprite.bigCraftable = num6 != 0; Color color = this.color; temporaryAnimatedSprite.color = color; int beforeAnimationStart = this.delayBeforeAnimationStart; temporaryAnimatedSprite.delayBeforeAnimationStart = beforeAnimationStart; int num7 = this.destroyable ? 1 : 0; temporaryAnimatedSprite.destroyable = num7 != 0; TemporaryAnimatedSprite.endBehavior endFunction = this.endFunction; temporaryAnimatedSprite.endFunction = endFunction; string endSound = this.endSound; temporaryAnimatedSprite.endSound = endSound; int num8 = this.flash ? 1 : 0; temporaryAnimatedSprite.flash = num8 != 0; int num9 = this.flipped ? 1 : 0; temporaryAnimatedSprite.flipped = num9 != 0; int num10 = this.hasLit ? 1 : 0; temporaryAnimatedSprite.hasLit = num10 != 0; double id = (double)this.id; temporaryAnimatedSprite.id = (float)id; Vector2 initialPosition = this.initialPosition; temporaryAnimatedSprite.initialPosition = initialPosition; int num11 = this.light ? 1 : 0; temporaryAnimatedSprite.light = num11 != 0; int num12 = this.local ? 1 : 0; temporaryAnimatedSprite.local = num12 != 0; Vector2 motion = this.motion; temporaryAnimatedSprite.motion = motion; Farmer owner = this.owner; temporaryAnimatedSprite.owner = owner; GameLocation parent = this.parent; temporaryAnimatedSprite.parent = parent; TemporaryAnimatedSprite parentSprite = this.parentSprite; temporaryAnimatedSprite.parentSprite = parentSprite; Vector2 position = this.position; temporaryAnimatedSprite.position = position; double rotation = (double)this.rotation; temporaryAnimatedSprite.rotation = (float)rotation; double rotationChange = (double)this.rotationChange; temporaryAnimatedSprite.rotationChange = (float)rotationChange; double scale = (double)this.scale; temporaryAnimatedSprite.scale = (float)scale; double scaleChange = (double)this.scaleChange; temporaryAnimatedSprite.scaleChange = (float)scaleChange; double scaleChangeChange = (double)this.scaleChangeChange; temporaryAnimatedSprite.scaleChangeChange = (float)scaleChangeChange; double shakeIntensity = (double)this.shakeIntensity; temporaryAnimatedSprite.shakeIntensity = (float)shakeIntensity; double shakeIntensityChange = (double)this.shakeIntensityChange; temporaryAnimatedSprite.shakeIntensityChange = (float)shakeIntensityChange; Rectangle sourceRect = this.sourceRect; temporaryAnimatedSprite.sourceRect = sourceRect; Vector2 sourceRectStartingPos = this.sourceRectStartingPos; temporaryAnimatedSprite.sourceRectStartingPos = sourceRectStartingPos; string startSound = this.startSound; temporaryAnimatedSprite.startSound = startSound; int num13 = this.timeBasedMotion ? 1 : 0; temporaryAnimatedSprite.timeBasedMotion = num13 != 0; int num14 = this.verticalFlipped ? 1 : 0; temporaryAnimatedSprite.verticalFlipped = num14 != 0; int num15 = this.xPeriodic ? 1 : 0; temporaryAnimatedSprite.xPeriodic = num15 != 0; double periodicLoopTime1 = (double)this.xPeriodicLoopTime; temporaryAnimatedSprite.xPeriodicLoopTime = (float)periodicLoopTime1; double xPeriodicRange = (double)this.xPeriodicRange; temporaryAnimatedSprite.xPeriodicRange = (float)xPeriodicRange; int num16 = this.yPeriodic ? 1 : 0; temporaryAnimatedSprite.yPeriodic = num16 != 0; double periodicLoopTime2 = (double)this.yPeriodicLoopTime; temporaryAnimatedSprite.yPeriodicLoopTime = (float)periodicLoopTime2; double yPeriodicRange = (double)this.yPeriodicRange; temporaryAnimatedSprite.yPeriodicRange = (float)yPeriodicRange; int yStopCoordinate = this.yStopCoordinate; temporaryAnimatedSprite.yStopCoordinate = yStopCoordinate; int totalNumberOfLoops = this.totalNumberOfLoops; temporaryAnimatedSprite.totalNumberOfLoops = totalNumberOfLoops; return(temporaryAnimatedSprite); }
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); }
public virtual bool update(GameTime time) { if (this.paused) { return(false); } if (this.bombRadius > 0 && Game1.activeClickableMenu != null) { return(false); } if (this.delayBeforeAnimationStart > 0) { this.delayBeforeAnimationStart -= time.ElapsedGameTime.Milliseconds; if (this.delayBeforeAnimationStart <= 0 && this.startSound != null) { Game1.playSound(this.startSound); } if (this.delayBeforeAnimationStart <= 0 && this.parentSprite != null) { this.position = this.parentSprite.position + this.position; } return(false); } this.timer += (float)time.ElapsedGameTime.Milliseconds; this.totalTimer += (float)time.ElapsedGameTime.Milliseconds; this.alpha -= this.alphaFade * (float)(this.timeBasedMotion ? time.ElapsedGameTime.Milliseconds : 1); if (this.alphaFade > 0f && this.light && this.alpha < 1f && this.alpha >= 0f) { try { Utility.getLightSource(this.lightID).color.A = (byte)(255f * this.alpha); } catch (Exception) { } } this.shakeIntensity += this.shakeIntensityChange * (float)time.ElapsedGameTime.Milliseconds; this.scale += this.scaleChange * (float)(this.timeBasedMotion ? time.ElapsedGameTime.Milliseconds : 1); this.scaleChange += this.scaleChangeChange * (float)(this.timeBasedMotion ? time.ElapsedGameTime.Milliseconds : 1); this.rotation += this.rotationChange; if (this.xPeriodic) { this.position.X = this.initialPosition.X + this.xPeriodicRange * (float)Math.Sin(6.2831853071795862 / (double)this.xPeriodicLoopTime * (double)this.totalTimer); } else { this.position.X = this.position.X + this.motion.X * (float)(this.timeBasedMotion ? time.ElapsedGameTime.Milliseconds : 1); } if (this.yPeriodic) { this.position.Y = this.initialPosition.Y + this.yPeriodicRange * (float)Math.Sin(6.2831853071795862 / (double)this.yPeriodicLoopTime * (double)(this.totalTimer + this.yPeriodicLoopTime / 2f)); } else { this.position.Y = this.position.Y + this.motion.Y * (float)(this.timeBasedMotion ? time.ElapsedGameTime.Milliseconds : 1); } if (this.attachedCharacter != null) { if (this.xPeriodic) { this.attachedCharacter.position.X = this.initialPosition.X + this.xPeriodicRange * (float)Math.Sin(6.2831853071795862 / (double)this.xPeriodicLoopTime * (double)this.totalTimer); } else { Character expr_348_cp_0_cp_0 = this.attachedCharacter; expr_348_cp_0_cp_0.position.X = expr_348_cp_0_cp_0.position.X + this.motion.X * (float)(this.timeBasedMotion ? time.ElapsedGameTime.Milliseconds : 1); } if (this.yPeriodic) { this.attachedCharacter.position.Y = this.initialPosition.Y + this.yPeriodicRange * (float)Math.Sin(6.2831853071795862 / (double)this.yPeriodicLoopTime * (double)this.totalTimer); } else { Character expr_3CF_cp_0_cp_0 = this.attachedCharacter; expr_3CF_cp_0_cp_0.position.Y = expr_3CF_cp_0_cp_0.position.Y + this.motion.Y * (float)(this.timeBasedMotion ? time.ElapsedGameTime.Milliseconds : 1); } } this.motion.X = this.motion.X + this.acceleration.X * (float)(this.timeBasedMotion ? time.ElapsedGameTime.Milliseconds : 1); this.motion.Y = this.motion.Y + this.acceleration.Y * (float)(this.timeBasedMotion ? time.ElapsedGameTime.Milliseconds : 1); this.acceleration.X = this.acceleration.X + this.accelerationChange.X; this.acceleration.Y = this.acceleration.Y + this.accelerationChange.Y; if (this.xStopCoordinate != -1 || this.yStopCoordinate != -1) { if (this.xStopCoordinate != -1 && Math.Abs(this.position.X - (float)this.xStopCoordinate) <= Math.Abs(this.motion.X)) { this.motion.X = 0f; this.acceleration.X = 0f; this.xStopCoordinate = -1; } if (this.yStopCoordinate != -1 && Math.Abs(this.position.Y - (float)this.yStopCoordinate) <= Math.Abs(this.motion.Y)) { this.motion.Y = 0f; this.acceleration.Y = 0f; this.yStopCoordinate = -1; } if (this.xStopCoordinate == -1 && this.yStopCoordinate == -1) { this.rotationChange = 0f; if (this.reachedStopCoordinate != null) { this.reachedStopCoordinate(0); } } } if (!this.pingPong) { this.pingPongMotion = 1; } if (this.pulse) { this.pulseTimer -= (float)time.ElapsedGameTime.Milliseconds; if (this.originalScale == 0f) { this.originalScale = this.scale; } if (this.pulseTimer <= 0f) { this.pulseTimer = this.pulseTime; this.scale = this.originalScale * this.pulseAmount; } if (this.scale > this.originalScale) { this.scale -= this.pulseAmount / 100f * (float)time.ElapsedGameTime.Milliseconds; } } if (this.light) { if (!this.hasLit) { this.hasLit = true; this.lightID = Game1.random.Next(-2147483648, 2147483647); Game1.currentLightSources.Add(new LightSource(4, this.position + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), this.lightRadius, this.lightcolor.Equals(Color.White) ? new Color(0, 131, 255) : this.lightcolor, this.lightID)); } else { Utility.repositionLightSource(this.lightID, this.position + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2))); } } if (this.alpha <= 0f || (this.position.X < -2000f && !this.overrideLocationDestroy) || this.scale <= 0f) { this.unload(); return(this.destroyable); } if (this.timer > this.interval) { this.currentParentTileIndex += this.pingPongMotion; this.sourceRect.X = this.sourceRect.X + this.sourceRect.Width * this.pingPongMotion; if (this.Texture != null) { if (!this.pingPong && this.sourceRect.X >= this.Texture.Width) { this.sourceRect.Y = this.sourceRect.Y + this.sourceRect.Height; } if (!this.pingPong) { this.sourceRect.X = this.sourceRect.X % this.Texture.Width; } if (this.pingPong) { if ((float)this.sourceRect.X + ((float)this.sourceRect.Y - this.sourceRectStartingPos.Y) / (float)this.sourceRect.Height * (float)this.Texture.Width >= this.sourceRectStartingPos.X + (float)(this.sourceRect.Width * this.animationLength)) { this.pingPongMotion = -1; this.sourceRect.X = this.sourceRect.X - this.sourceRect.Width * 2; this.currentParentTileIndex--; if (this.sourceRect.X < 0) { this.sourceRect.X = this.Texture.Width + this.sourceRect.X; } } else if ((float)this.sourceRect.X < this.sourceRectStartingPos.X && (float)this.sourceRect.Y == this.sourceRectStartingPos.Y) { this.pingPongMotion = 1; this.sourceRect.X = (int)this.sourceRectStartingPos.X + this.sourceRect.Width; this.currentParentTileIndex++; this.currentNumberOfLoops++; if (this.endFunction != null) { this.endFunction(this.extraInfoForEndBehavior); this.endFunction = null; } if (this.currentNumberOfLoops >= this.totalNumberOfLoops) { this.unload(); return(this.destroyable); } } } else if (this.totalNumberOfLoops >= 1 && (float)this.sourceRect.X + ((float)this.sourceRect.Y - this.sourceRectStartingPos.Y) / (float)this.sourceRect.Height * (float)this.Texture.Width >= this.sourceRectStartingPos.X + (float)(this.sourceRect.Width * this.animationLength)) { this.sourceRect.X = (int)this.sourceRectStartingPos.X; this.sourceRect.Y = (int)this.sourceRectStartingPos.Y; } } this.timer = 0f; if (this.flicker) { if (this.currentParentTileIndex < 0 || this.flash) { this.currentParentTileIndex = this.oldCurrentParentTileIndex; this.flash = false; } else { this.oldCurrentParentTileIndex = this.currentParentTileIndex; if (this.bombRadius > 0) { this.flash = true; } else { this.currentParentTileIndex = -100; } } } if (this.currentParentTileIndex - this.initialParentTileIndex >= this.animationLength) { this.currentNumberOfLoops++; if (this.holdLastFrame) { this.currentParentTileIndex = this.initialParentTileIndex + this.animationLength - 1; this.setSourceRectToCurrentTileIndex(); if (this.endFunction != null) { this.endFunction(this.extraInfoForEndBehavior); this.endFunction = null; } return(false); } this.currentParentTileIndex = this.initialParentTileIndex; if (this.currentNumberOfLoops >= this.totalNumberOfLoops) { if (this.bombRadius > 0) { if (Game1.fuseSound != null) { Game1.fuseSound.Stop(AudioStopOptions.AsAuthored); Game1.fuseSound = Game1.soundBank.GetCue("fuse"); } Game1.playSound("explosion"); Game1.flashAlpha = 1f; this.parent.explode(new Vector2((float)((int)(this.position.X / (float)Game1.tileSize)), (float)((int)(this.position.Y / (float)Game1.tileSize))), this.bombRadius, this.owner); } this.unload(); return(this.destroyable); } if (this.bombRadius > 0 && this.currentNumberOfLoops == this.totalNumberOfLoops - 5) { this.interval -= this.interval / 3f; } } } return(false); }