Пример #1
0
 private static void DrawIndoorPotObject(Object obj, SpriteBatch spriteBatch, int xNonTile, int yNonTile, float layerDepth, float alpha)
 {
     if (drawingWallPot)
     {
         yNonTile -= drawingWallPotOffset + drawingWallPotInnerOffset;
     }
     obj.draw(spriteBatch, xNonTile, yNonTile, layerDepth, alpha);
 }
Пример #2
0
        public static bool Prefix(StardewValley.Object __instance, SpriteBatch spriteBatch, GameLocation location)
        {
            if (!__instance.bigCraftable.Value)
            {
                return(true);
            }
            var entry = Mod.entries.SingleOrDefault(cle => cle.Name == __instance.Name);

            if (entry == null)
            {
                return(true);
            }

            int x = (int)Game1.GetPlacementGrabTile().X * 64;
            int y = (int)Game1.GetPlacementGrabTile().Y * 64;

            Game1.isCheckingNonMousePlacement = !Game1.IsPerformingMousePlacement();
            if (Game1.isCheckingNonMousePlacement)
            {
                Vector2 placementPosition = Utility.GetNearbyValidPlacementPosition(Game1.player, location, (Item)__instance, x, y);
                x = ( int )placementPosition.X;
                y = ( int )placementPosition.Y;
            }
            bool flag = Utility.playerCanPlaceItemHere(location, (Item)__instance, x, y, Game1.player) || Utility.isThereAnObjectHereWhichAcceptsThisItem(location, (Item)__instance, x, y) && Utility.withinRadiusOfPlayer(x, y, 1, Game1.player);

            Game1.isCheckingNonMousePlacement = false;
            for (int ix = 0; ix < entry.Width; ++ix)
            {
                for (int iy = 0; iy < entry.Length; ++iy)
                {
                    int iOffset = ix + (entry.Length - 1 - iy) * entry.Width;
                    spriteBatch.Draw(Game1.mouseCursors, new Vector2(( float )(x / 64 * 64 + ix * 64 - Game1.viewport.X), ( float )(y / 64 * 64 + iy * 64 - Game1.viewport.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(flag ? 194 : 210, 388, 16, 16)), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.01f);
                    var oldI = __instance.ParentSheetIndex;
                    if (ix == 0 && iy == entry.Length - 1)
                    {
                        __instance.draw(spriteBatch, x / 64 + ix, y / 64 + iy, 0.5f);
                    }
                }
            }

            return(false);
        }
Пример #3
0
        private static bool Before_DrawPlacementBounds(SObject __instance, SpriteBatch spriteBatch, GameLocation location)
        {
            if (!__instance.bigCraftable.Value)
            {
                return(true);
            }
            var entry = Mod.Entries.SingleOrDefault(cle => cle.Name == __instance.Name);

            if (entry == null)
            {
                return(true);
            }

            int x = (int)Game1.GetPlacementGrabTile().X * 64;
            int y = (int)Game1.GetPlacementGrabTile().Y * 64;

            Game1.isCheckingNonMousePlacement = !Game1.IsPerformingMousePlacement();
            if (Game1.isCheckingNonMousePlacement)
            {
                Vector2 placementPosition = Utility.GetNearbyValidPlacementPosition(Game1.player, location, __instance, x, y);
                x = (int)placementPosition.X;
                y = (int)placementPosition.Y;
            }
            bool flag = Utility.playerCanPlaceItemHere(location, __instance, x, y, Game1.player) || Utility.isThereAnObjectHereWhichAcceptsThisItem(location, __instance, x, y) && Utility.withinRadiusOfPlayer(x, y, 1, Game1.player);

            Game1.isCheckingNonMousePlacement = false;
            for (int ix = 0; ix < entry.Width; ++ix)
            {
                for (int iy = 0; iy < entry.Length; ++iy)
                {
                    spriteBatch.Draw(Game1.mouseCursors, new Vector2(x / 64 * 64 + ix * 64 - Game1.viewport.X, y / 64 * 64 + iy * 64 - Game1.viewport.Y), new Rectangle(flag ? 194 : 210, 388, 16, 16), Color.White, 0.0f, Vector2.Zero, 4f, SpriteEffects.None, 0.01f);
                    if (ix == 0 && iy == entry.Length - 1)
                    {
                        __instance.draw(spriteBatch, x / 64 + ix, y / 64 + iy, 0.5f);
                    }
                }
            }

            return(false);
        }