コード例 #1
0
        /// <summary>Raised after a game menu is opened, closed, or replaced.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void onMenuChanged( object sender, MenuChangedEventArgs e )
        {
            if (!(e.NewMenu is ShopMenu menu) || menu.portraitPerson.Name != "Pierre")
                return;

            Log.debug("Adding tent to shop");

            var forSale = menu.forSale;
            var itemPriceAndStock = menu.itemPriceAndStock;

            var item = new TentTool();
            forSale.Add(item);
            itemPriceAndStock.Add(item, new int[] { item.salePrice(), item.Stack });
        }
コード例 #2
0
        /// <summary>Raised after a game menu is opened, closed, or replaced.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void onMenuChanged(object sender, MenuChangedEventArgs e)
        {
            if (!(e.NewMenu is ShopMenu menu) || menu.portraitPerson.Name != "Pierre")
            {
                return;
            }

            Log.debug("Adding tent to shop");

            var forSale           = Helper.Reflection.GetField <List <Item> >(menu, "forSale").GetValue();
            var itemPriceAndStock = Helper.Reflection.GetField <Dictionary <Item, int[]> >(menu, "itemPriceAndStock").GetValue();

            var item = new TentTool();

            forSale.Add(item);
            itemPriceAndStock.Add(item, new int[] { item.salePrice(), item.Stack });
        }
コード例 #3
0
        private void onMenuChange(object sender, EventArgsClickableMenuChanged args)
        {
            var menu = args.NewMenu as ShopMenu;

            if (menu == null || menu.portraitPerson == null)
            {
                return;
            }

            if (menu.portraitPerson.Name == "Pierre")
            {
                Log.debug("Adding tent to shop");

                var forSale           = Helper.Reflection.GetField <List <Item> >(menu, "forSale").GetValue();
                var itemPriceAndStock = Helper.Reflection.GetField <Dictionary <Item, int[]> >(menu, "itemPriceAndStock").GetValue();

                var item = new TentTool();
                forSale.Add(item);
                itemPriceAndStock.Add(item, new int[] { item.salePrice(), item.Stack });
            }
        }