示例#1
0
 private bool RegisterPurchase(Product product)
 {
     if (product.definition.id != Button.productId || !product.hasReceipt)
     {
         return(false);
     }
     StencilPremium.Purchase();
     CheckPremium();
     return(true);
 }
示例#2
0
        private bool _CanShowPremium()
        {
            Debug.Log("Show Premium: Check");
            if (StencilPremium.IgnorePremium)
            {
                var ret = CanShowPremium?.Invoke() != false;
                Debug.Log($"Show Premium: {ret} [ignore + custom predicate or null]");
                return(ret);
            }

            if (StencilPremium.HasPremium)
            {
                Debug.Log("Show Premium: false [already bought]");
                return(false);
            }

            if (!StencilIap.IsReady())
            {
                Debug.Log("Show Premium: false [not ready]");
                return(false);
            }

            if (_product == null)
            {
                _product = Button.GetProduct();
            }

            if (_product == null)
            {
                Debug.Log("Show Premium: false [product error]");
                return(false);
            }

            if (!_product.hasReceipt)
            {
                var ret = CanShowPremium?.Invoke() != false;
                Debug.Log($"Show Premium: {ret} [custom predicate or null]");
                return(ret);
            }

            if (!_purchased)
            {
                _purchased = true;
                Debug.Log("Show Premium: Receipt found for premium.");
                StencilPremium.Purchase();
            }

            Debug.Log("Show Premium: false [fallthrough]");
            return(false);
        }