private bool RegisterPurchase(Product product) { if (product.definition.id != Button.productId || !product.hasReceipt) { return(false); } StencilPremium.Purchase(); CheckPremium(); return(true); }
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); }
// { // get // { // if (!Developers.Enabled) return null; // return PlayerPrefsX.GetBoolNullable("premium_force"); // } // set // { // PlayerPrefsX.SetBoolNullable("premium_force", value); // PlayerPrefs.Save(); // } // } private void Awake() { GetComponent <Button>().onClick.AddListener(() => { if (!Developers.Enabled) { ForceEnabled = null; return; } var force = ForceEnabled; if (force == null) { ForceEnabled = !StencilPremium.HasPremium; } else { ForceEnabled = !force; } StencilPremium.NotifyPurchase(); }); }