private void DisableButton(ICanBePurchased obj, Button btn) { if (obj.ItemPurchaseType == PurchaseType.Type.NonConsumable) { btn.interactable = false; btn.onClick.RemoveAllListeners(); } }
public void MakePurchase(ICanBePurchased obj) { for (var i = 0; i < available.objectList.Count; i++) { var availableObject = available.purchasableList[i]; if (availableObject != obj || cash.value < availableObject.Value) { continue; } cash.value -= availableObject.Value; if (!purchased.purchasableList.Contains(obj)) { purchased.purchasableList.Add(obj); } switch (obj.ItemPurchaseType) { case PurchaseType.Type.Consumable: break; case PurchaseType.Type.NonConsumable: break; case PurchaseType.Type.AutoRenewAbleSubscription: break; case PurchaseType.Type.NonRenewingSubscription: break; default: throw new ArgumentOutOfRangeException(); } // else if(obj == typeof(PurchasableObject)) // { // var newObj = obj as PurchasableObject; // newObj.UsageCount += newObj.UsagePurchase; // } // // if (obj.ItemPurchaseType == PurchaseType.Type.NonConsumable) // { // // Available.ObjectList.Remove(availableObject); // } } }