public virtual void draw(SpriteBatch spriteBatch, bool localPosition = false, int xOffset = 0, int yOffset = 0)
 {
     if (this.local)
     {
         localPosition = true;
     }
     if (this.currentParentTileIndex >= 0 && this.delayBeforeAnimationStart <= 0)
     {
         if (this.text != null)
         {
             spriteBatch.DrawString(Game1.dialogueFont, this.text, localPosition ? this.Position : Game1.GlobalToLocal(Game1.viewport, this.Position), this.color * this.alpha, this.rotation, Vector2.Zero, this.scale, SpriteEffects.None, this.layerDepth);
             return;
         }
         if (this.Texture != null)
         {
             spriteBatch.Draw(this.Texture, (localPosition ? this.Position : Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((int)this.Position.X + xOffset), (float)((int)this.Position.Y + yOffset)))) + new Vector2((float)(this.sourceRect.Width / 2), (float)(this.sourceRect.Height / 2)) * this.scale + new Vector2((float)((this.shakeIntensity > 0f) ? Game1.random.Next(-(int)this.shakeIntensity, (int)this.shakeIntensity + 1) : 0), (float)((this.shakeIntensity > 0f) ? Game1.random.Next(-(int)this.shakeIntensity, (int)this.shakeIntensity + 1) : 0)), new Rectangle?(this.sourceRect), this.color * this.alpha, this.rotation, new Vector2((float)(this.sourceRect.Width / 2), (float)(this.sourceRect.Height / 2)), this.scale, this.flipped ? SpriteEffects.FlipHorizontally : (this.verticalFlipped ? SpriteEffects.FlipVertically : SpriteEffects.None), (this.layerDepth >= 0f) ? this.layerDepth : ((this.Position.Y + (float)this.sourceRect.Height) / 10000f));
             return;
         }
         if (this.bigCraftable)
         {
             spriteBatch.Draw(Game1.bigCraftableSpriteSheet, localPosition ? this.Position : (Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((int)this.Position.X + xOffset), (float)((int)this.Position.Y + yOffset))) + new Vector2((float)(this.sourceRect.Width / 2), (float)(this.sourceRect.Height / 2))), new Rectangle?(Object.getSourceRectForBigCraftable(this.currentParentTileIndex)), Color.White, 0f, new Vector2((float)(this.sourceRect.Width / 2), (float)(this.sourceRect.Height / 2)), this.scale, SpriteEffects.None, (this.Position.Y + (float)(Game1.tileSize / 2)) / 10000f);
             return;
         }
         if (!this.swordswipe)
         {
             spriteBatch.Draw(Game1.objectSpriteSheet, localPosition ? this.Position : (Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((int)this.Position.X + xOffset), (float)((int)this.Position.Y + yOffset))) + new Vector2(8f, 8f) * (float)Game1.pixelZoom + new Vector2((float)((this.shakeIntensity > 0f) ? Game1.random.Next(-(int)this.shakeIntensity, (int)this.shakeIntensity + 1) : 0), (float)((this.shakeIntensity > 0f) ? Game1.random.Next(-(int)this.shakeIntensity, (int)this.shakeIntensity + 1) : 0))), new Rectangle?(Game1.currentLocation.getSourceRectForObject(this.currentParentTileIndex)), (this.flash ? (Color.LightBlue * 0.85f) : Color.White) * this.alpha, this.rotation, new Vector2(8f, 8f), (float)Game1.pixelZoom * this.scale, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.layerDepth >= 0f) ? this.layerDepth : ((this.Position.Y + (float)(Game1.tileSize / 2)) / 10000f));
         }
     }
 }
예제 #2
0
 public override void draw(SpriteBatch spriteBatch, bool localPosition = false, int xOffset = 0, int yOffset = 0)
 {
     spriteBatch.Draw(this.texture, Game1.GlobalToLocal(Game1.viewport, this.position), new Rectangle?(this.sourceRect), this.color, this.rotation, new Vector2(8f, 8f), (float)Game1.pixelZoom, SpriteEffects.None, (float)(this.groundYLevel + 1) / 10000f);
 }
 public override void draw(SpriteBatch spriteBatch, bool localPosition = false, int xOffset = 0, int yOffset = 0, float extraAlpha = 1f)
 {
     spriteBatch.Draw(texture, Game1.GlobalToLocal(Game1.viewport, base.Position), new Rectangle(currentParentTileIndex * 16, 0, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (base.Position.Y + 32f) / 10000f);
 }
예제 #4
0
 public void drawWhenPlanterBoxHeld(PlanterBox p, SpriteBatch spriteBatch, Vector2 location, float layerDepth, float alpha = 1f)
 {
     spriteBatch.Draw(this.spriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(Game1.player.GetBoundingBox().Center.X - Game1.tileSize / 2, (Game1.player.GetBoundingBox().Center.Y - Game1.tileSize * 4 / 3) - (Game1.tileSize * 2))), this.getSourceRect(this.rowInSpriteSheet), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(p.boundingBox.Bottom + 1) / 10000f);
 }
예제 #5
0
 public override void draw(SpriteBatch spriteBatch, bool localPosition = false, int xOffset = 0, int yOffset = 0, float extraAlpha = 1f)
 {
     spriteBatch.Draw(texture, Game1.GlobalToLocal(Game1.viewport, position), sourceRect, color, rotation, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)(groundYLevel + 1) / 10000f);
 }
예제 #6
0
 public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
 {
     if (Game1.eventUp && !Game1.currentLocation.IsFarm)
     {
         return;
     }
     if (!this.bigCraftable)
     {
         Rectangle sourceRectForObject = Game1.currentLocation.getSourceRectForObject(this.ParentSheetIndex);
         sourceRectForObject.Y      += 8;
         sourceRectForObject.Height /= 2;
         SpriteBatch spriteBatch1      = spriteBatch;
         Texture2D   objectSpriteSheet = Game1.objectSpriteSheet;
         Vector2     local1            = Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), (float)(y * Game1.tileSize + Game1.tileSize / 2)));
         Rectangle?  sourceRectangle1  = new Rectangle?(sourceRectForObject);
         Color       white             = Color.White;
         double      num1  = 0.0;
         Vector2     zero  = Vector2.Zero;
         Vector2     scale = this.scale;
         double      num2  = (double)this.scale.Y > 1.0 ? (double)this.getScale().Y : (double)Game1.pixelZoom;
         int         num3  = 0;
         double      num4  = (double)this.getBoundingBox(new Vector2((float)x, (float)y)).Bottom / 10000.0;
         spriteBatch1.Draw(objectSpriteSheet, local1, sourceRectangle1, white, (float)num1, zero, (float)num2, (SpriteEffects)num3, (float)num4);
         SpriteBatch spriteBatch2     = spriteBatch;
         Texture2D   mouseCursors     = Game1.mouseCursors;
         Vector2     local2           = Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize + Game1.tileSize / 2 + Game1.pixelZoom / 2), (float)(y * Game1.tileSize + Game1.tileSize / 4)));
         Rectangle?  sourceRectangle2 = new Rectangle?(new Rectangle(88, 1779, 30, 30));
         Color       color            = Color.PaleGoldenrod * (Game1.currentLocation.IsOutdoors ? 0.35f : 0.43f);
         double      num5             = 0.0;
         Vector2     origin           = new Vector2(15f, 15f);
         double      pixelZoom        = (double)Game1.pixelZoom;
         double      tileSize         = (double)Game1.tileSize;
         TimeSpan    totalGameTime    = Game1.currentGameTime.TotalGameTime;
         double      num6             = Math.Sin((totalGameTime.TotalMilliseconds + (double)(x * Game1.tileSize * 777) + (double)(y * Game1.tileSize * 9746)) % 3140.0 / 1000.0);
         double      num7             = tileSize * num6 / 50.0;
         double      num8             = pixelZoom + num7;
         int         num9             = 0;
         double      num10            = 1.0;
         spriteBatch2.Draw(mouseCursors, local2, sourceRectangle2, color, (float)num5, origin, (float)num8, (SpriteEffects)num9, (float)num10);
         // ISSUE: explicit reference operation
         // ISSUE: variable of a reference type
         Rectangle& local3 = @sourceRectForObject;
         int        num11  = 276;
         totalGameTime = Game1.currentGameTime.TotalGameTime;
         int num12 = (int)((totalGameTime.TotalMilliseconds + (double)(x * 3204) + (double)(y * 49)) % 700.0 / 100.0) * 8;
         int num13 = num11 + num12;
         // ISSUE: explicit reference operation
         (^ local3).X               = num13;
         sourceRectForObject.Y      = 1965;
         sourceRectForObject.Width  = 8;
         sourceRectForObject.Height = 8;
         spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize + Game1.tileSize / 2 + Game1.pixelZoom), (float)(y * Game1.tileSize + Game1.tileSize / 4 + Game1.pixelZoom))), new Rectangle?(sourceRectForObject), Color.White * 0.75f, 0.0f, new Vector2(4f, 4f), (float)(Game1.pixelZoom * 3 / 4), SpriteEffects.None, (float)(this.getBoundingBox(new Vector2((float)x, (float)y)).Bottom + 1) / 10000f);
         for (int index = 0; index < this.ashes.Length; ++index)
         {
             spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize + Game1.tileSize / 2) + this.ashes[index].X, (float)(y * Game1.tileSize + Game1.tileSize / 2) + this.ashes[index].Y)), new Rectangle?(new Rectangle(344 + index % 3, 53, 1, 1)), Color.White * 0.5f * (float)((-100.0 - (double)this.ashes[index].Y / 2.0) / -100.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom * 0.75f, SpriteEffects.None, (float)this.getBoundingBox(new Vector2((float)x, (float)y)).Bottom / 10000f);
         }
     }
     else
     {
         base.draw(spriteBatch, x, y, alpha);
         if (!this.isOn)
         {
             return;
         }
         if (this.parentSheetIndex == 146)
         {
             SpriteBatch spriteBatch1     = spriteBatch;
             Texture2D   mouseCursors1    = Game1.mouseCursors;
             Vector2     local1           = Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize + Game1.tileSize / 4 - Game1.pixelZoom), (float)(y * Game1.tileSize - Game1.pixelZoom * 2)));
             int         num1             = 276;
             TimeSpan    totalGameTime    = Game1.currentGameTime.TotalGameTime;
             int         num2             = (int)((totalGameTime.TotalMilliseconds + (double)(x * 3047) + (double)(y * 88)) % 400.0 / 100.0) * 12;
             Rectangle?  sourceRectangle1 = new Rectangle?(new Rectangle(num1 + num2, 1985, 12, 11));
             Color       white1           = Color.White;
             double      num3             = 0.0;
             Vector2     zero1            = Vector2.Zero;
             double      num4             = (double)(Game1.pixelZoom * 3 / 4);
             int         num5             = 0;
             double      num6             = (double)(this.getBoundingBox(new Vector2((float)x, (float)y)).Bottom - 16) / 10000.0;
             spriteBatch1.Draw(mouseCursors1, local1, sourceRectangle1, white1, (float)num3, zero1, (float)num4, (SpriteEffects)num5, (float)num6);
             SpriteBatch spriteBatch2  = spriteBatch;
             Texture2D   mouseCursors2 = Game1.mouseCursors;
             Vector2     local2        = Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize + Game1.tileSize / 2 - Game1.pixelZoom * 3), (float)(y * Game1.tileSize)));
             int         num7          = 276;
             totalGameTime = Game1.currentGameTime.TotalGameTime;
             int       num8             = (int)((totalGameTime.TotalMilliseconds + (double)(x * 2047) + (double)(y * 98)) % 400.0 / 100.0) * 12;
             Rectangle?sourceRectangle2 = new Rectangle?(new Rectangle(num7 + num8, 1985, 12, 11));
             Color     white2           = Color.White;
             double    num9             = 0.0;
             Vector2   zero2            = Vector2.Zero;
             double    num10            = (double)(Game1.pixelZoom * 3 / 4);
             int       num11            = 0;
             double    num12            = (double)(this.getBoundingBox(new Vector2((float)x, (float)y)).Bottom - 15) / 10000.0;
             spriteBatch2.Draw(mouseCursors2, local2, sourceRectangle2, white2, (float)num9, zero2, (float)num10, (SpriteEffects)num11, (float)num12);
             SpriteBatch spriteBatch3  = spriteBatch;
             Texture2D   mouseCursors3 = Game1.mouseCursors;
             Vector2     local3        = Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize + Game1.tileSize / 2 - Game1.pixelZoom * 5), (float)(y * Game1.tileSize + Game1.pixelZoom * 3)));
             int         num13         = 276;
             totalGameTime = Game1.currentGameTime.TotalGameTime;
             int       num14            = (int)((totalGameTime.TotalMilliseconds + (double)(x * 2077) + (double)(y * 98)) % 400.0 / 100.0) * 12;
             Rectangle?sourceRectangle3 = new Rectangle?(new Rectangle(num13 + num14, 1985, 12, 11));
             Color     white3           = Color.White;
             double    num15            = 0.0;
             Vector2   zero3            = Vector2.Zero;
             double    num16            = (double)(Game1.pixelZoom * 3 / 4);
             int       num17            = 0;
             double    num18            = (double)(this.getBoundingBox(new Vector2((float)x, (float)y)).Bottom - 14) / 10000.0;
             spriteBatch3.Draw(mouseCursors3, local3, sourceRectangle3, white3, (float)num15, zero3, (float)num16, (SpriteEffects)num17, (float)num18);
         }
         else
         {
             spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize + Game1.tileSize / 4 - Game1.pixelZoom * 2), (float)(y * Game1.tileSize - Game1.tileSize + Game1.pixelZoom * 2))), new Rectangle?(new Rectangle(276 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + (double)(x * 3047) + (double)(y * 88)) % 400.0 / 100.0) * 12, 1985, 12, 11)), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(this.getBoundingBox(new Vector2((float)x, (float)y)).Bottom - 16) / 10000f);
         }
     }
 }
예제 #7
0
 public override void draw(SpriteBatch spriteBatch, bool localPosition = false, int xOffset = 0, int yOffset = 0)
 {
     spriteBatch.Draw(this.texture, Game1.GlobalToLocal(Game1.viewport, this.Position), new Rectangle?(new Rectangle(this.currentParentTileIndex * Game1.tileSize, 0, Game1.tileSize, Game1.tileSize)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, (float)(((double)this.Position.Y + (double)(Game1.tileSize / 2)) / 10000.0));
 }