public virtual void ShowDialog(Transform caller, string title, string description, int minValue, int maxValue, InventoryItemBase item, ItemBuySellDialogAction action, VendorTrigger vendor, IntValDialogCallback yesCallback, IntValDialogCallback noCallback)
 {
     // Don't call base class going directly to this.ShowDialog()
     inventoryItem = item;
     this.action   = action;
     this.vendor   = vendor;
     ShowDialog(caller, string.Format(string.Format(title, item.name, item.description)), string.Format(description, item.name, item.description), minValue, maxValue, yesCallback, noCallback);
 }
 public virtual void ShowDialog(string title, string description, string yes, string no, int minValue, int maxValue, InventoryItemBase item, ItemBuySellDialogAction action, VendorTriggerer vendor, IntValDialogCallback yesCallback, IntValDialogCallback noCallback)
 {
     // Don't call base class going directly to this.ShowDialog()
     inventoryItem = item;
     this.action = action;
     this.vendor = vendor;
     ShowDialog(string.Format(string.Format(title, item.name, item.description)), string.Format(description, item.name, item.description), yes, no, minValue, maxValue, yesCallback, noCallback);
 }
Ejemplo n.º 3
0
        public virtual void BuyItemFromVendor(InventoryItemBase item, bool isBuyBack)
        {
            ItemBuySellDialogAction action = ItemBuySellDialogAction.Buying;
            uint maxAmount = removeItemAfterPurchase ? vendorUI.GetItemCount(item.ID) : maxBuyItemCount;

            if (isBuyBack)
            {
                action    = ItemBuySellDialogAction.BuyingBack;
                maxAmount = item.currentStackSize;
            }

            if (InventoryManager.instance.buySellDialog != null)
            {
                InventoryManager.instance.buySellDialog.ShowDialog(InventoryManager.instance.vendor.window.transform,
                                                                   "Buy item " + item.name, "How many items do you want to buy?", 1, (int)maxAmount, item, action,
                                                                   this, (amount) =>
                {
                    // Clicked yes!
                    if (isBuyBack)
                    {
                        BuyItemBackFromVendorNow(item, (uint)amount);
                    }
                    else
                    {
                        BuyItemFromVendorNow(item, (uint)amount);
                    }
                }, (amount) =>
                {
                    // Clicked cancel...
                });
            }
            else
            {
                if (isBuyBack)
                {
                    BuyItemBackFromVendorNow(item, 1);
                }
                else
                {
                    BuyItemFromVendorNow(item, 1);
                }
            }
        }
        public virtual void BuyItemFromVendor(InventoryItemBase item, bool isBuyBack = false)
        {
            ItemBuySellDialogAction action = ItemBuySellDialogAction.Buying;
            uint maxAmount = maxBuyItemCount;

            if (isBuyBack)
            {
                action    = ItemBuySellDialogAction.BuyingBack;
                maxAmount = item.currentStackSize;
            }

            InventorySettingsManager.instance.buySellDialog.ShowDialog("Buy item " + item.name, "How many items do you want to buy?", "Buy", "Cancel", 1, (int)maxAmount, item, action, this, (amount) =>
            {
                // Clicked yes!
                BuyItemFromVendorNow(item, (uint)amount, isBuyBack);
            }, (amount) =>
            {
                // Clicked cancel...
            });
        }