示例#1
0
        public static bool Prefix(ref StardewValley.Menus.PurchaseAnimalsMenu __instance, ref SpriteBatch b)
        {
            var purchaseAnimalsMenu = new Decorators.PurchaseAnimalsMenu(__instance);
            var farmAnimal          = new Decorators.FarmAnimal(purchaseAnimalsMenu.GetAnimalBeingPurchased());

            if (!BellsAndWhistles.IsFaded() && purchaseAnimalsMenu.IsOnFarm())
            {
                var str = Content.FormatMoneyString(farmAnimal.GetPrice());
                var x   = Game.GetViewport().Width / 2 - Content.GetWidthOfString(str) / 2;
                var y   = (int)(18.0 * SpriteText.fontPixelZoom * 2.0);
                BellsAndWhistles.DrawScroll(b, str, x, y);
            }

            return(true);
        }
        public static bool Prefix(
            ref StardewValley.Menus.PurchaseAnimalsMenu __instance,
            ref int x,
            ref int y,
            ref bool playSound)
        {
            var moddedMenu = new Decorators.PurchaseAnimalsMenu(__instance);

            if (!IsActionable(moddedMenu) || IsClosingMenu(moddedMenu, x, y))
            {
                return(true);
            }
            var moddedPlayer = new Farmer(Game.GetPlayer());

            return(moddedMenu.IsOnFarm()
        ? HandleOnFarm(ref moddedMenu, x, y, moddedPlayer)
        : HandleStockSelection(ref moddedMenu, x, y, moddedPlayer));
        }