Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. void Start()
  2.         {
  3.            
  4.             if (m_StoreController == null)
  5.             {
  6.                 InitializePurchasing();
  7.             }
  8.  
  9.             checkProd(YEAR_SUB);
  10.         }
  11.  
  12.         public void checkProd(string prodId)
  13.         {
  14. #if UNITY_EDITOR
  15. #elif UNITY_ANDROID
  16.             StartCoroutine("checkProduct", prodId);        
  17.         #endif
  18.         }
  19.  
  20.         IEnumerator checkProduct(string prodId)
  21.         {
  22.             yield return new WaitForSeconds(5);
  23.             Product cproduct = m_StoreController.products.WithID(prodId);
  24.             if (cproduct != null && cproduct.hasReceipt)
  25.             {
  26.                 if (prodId == YEAR_SUB)
  27.                 {
  28.                     PlayerPrefs.SetInt("isSubscr", 1);
  29.                 }
  30.             }
  31.             else
  32.             {
  33.                 if (prodId == YEAR_SUB)
  34.                 {
  35.                     PlayerPrefs.SetInt("isSubscr", 0);
  36.                 }
  37.             }
  38.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement