Example #1
0
        void OnToVessel(MerchantItem item)
        {
            double increment = stackSize.Increment;

            increment -= item.vesselResource.Transfer(increment);
            BookCredits(-increment * item.buyPrice);
            merchantItems.Update(item);
        }
 public MerchantItemView Item(MerchantItem item)
 {
     this.item = item;
     resourceName.Text(item.name);
     sell.Info($"{item.sellPrice:F2}");
     buy.Info($"{item.buyPrice:F2}");
     transferButtons.fromVesselInteractable = item.canSell;
     transferButtons.toVesselInteractable   = item.canBuy;
     if (item.vesselResource != null)
     {
         transferButtons.SetActive(true);
         vessel.SetActive(true);
         vessel.Info($"{item.vesselResource.amount:F2} / {item.vesselResource.maxAmount:F2}");
     }
     else
     {
         transferButtons.SetActive(false);
         vessel.SetActive(false);
     }
     return(this);
 }