Beispiel #1
0
        public void DoPurchase(TDPurchase data)
        {
            if (m_Iap == null)
            {
                Log.w("Not Find Valid IAP.");
                return;
            }

            if (data == null)
            {
                Log.i("purchase data null");
                return;
            }

            if (SecurityMgr.S.isBeHacked)
            {
                Log.i("security hacked");
                return;
            }

            if (isPurchaseBeHacked)
            {
                Log.i("purchase hacked");
                return;
            }

            //m_Adapter.DoPurchase(TDPurchaseTable.GetConfigKey(data));
            m_IsWaitPauseEvent = true;

            m_Iap.purchase(data.id);

            DataAnalysisMgr.S.CustomEvent(DataAnalysisDefine.PURCHASE_REQUEST, data.id);
        }
Beispiel #2
0
        public void OnProductPurchaseFailed(Product product)
        {
            TDPurchase data = TDPurchaseTable.GetData(product.name);

            if (data == null)
            {
                Log.e("Invalid Config Key");
                return;
            }
            DataAnalysisMgr.S.CustomEvent(DataAnalysisDefine.PURCHASE_FAILED, data.id);
        }
Beispiel #3
0
        public void OnProductPurchaseCancled(Product product, string res)
        {
            TDPurchase data = TDPurchaseTable.GetData(product.name);

            if (data == null)
            {
                Log.e("Invalid Config Key");
                return;
            }
            DataAnalysisMgr.S.CustomEvent(DataAnalysisDefine.PURCHASE_CANCEL, res);
        }
Beispiel #4
0
        public static string GetConfigKey(TDPurchase data)
        {
#if UNITY_ANDROID
            string configKey = data.androidKey;
#elif UNITY_IOS
            string configKey = data.iOSKey;
#else
            string configKey = data.androidKey;
#endif
            return(configKey);
        }
Beispiel #5
0
 private static void OnAddRow(TDPurchase memberInstance)
 {
     string key = memberInstance.id;
     if (m_DataCache.ContainsKey(key))
     {
         Log.e(string.Format("Invaild,  TDPurchaseTable Id already exists {0}", key));
     }
     else
     {
         m_DataCache.Add(key, memberInstance);
         m_DataList.Add(memberInstance);
     }
 }    
Beispiel #6
0
            public bool Execute()
            {
                TDPurchase data = TDPurchaseTable.GetData(m_Product.name);

                if (data == null)
                {
                    Log.e("Invalid Config Key");
                    return(true);
                }
                DataAnalysisMgr.S.Pay((float)data.price / 100, data.itemNum);
                DataAnalysisMgr.S.CustomEvent(DataAnalysisDefine.PURCHASE_SUCCESS, data.id);
                EventSystem.S.Send(SDKEventID.OnPurchaseSuccess, data);
                return(true);
            }
Beispiel #7
0
        public void OnProductRequestSuccess(Product[] products)
        {
            m_IsPurchaseReady = true;
            for (int i = 0; i < products.Length; ++i)
            {
                TDPurchase data = TDPurchaseTable.GetData(products[i].name);
                if (data == null)
                {
                    Log.w("Purchase Table Config InValid.");
                    continue;
                }

                data.localPriceString = products[i].price;
            }
        }
Beispiel #8
0
     public static void Parse(byte[] fileData)
     {
         m_DataCache.Clear();
         m_DataList.Clear();
         DataStreamReader dataR = new DataStreamReader(fileData);
         int rowCount = dataR.GetRowCount();
         int[] fieldIndex = dataR.GetFieldIndex(TDPurchase.GetFieldHeadIndex());
 #if (UNITY_STANDALONE_WIN) || UNITY_EDITOR || UNITY_STANDALONE_OSX
         dataR.CheckFieldMatch(TDPurchase.GetFieldHeadIndex(), "PurchaseTable");
 #endif
         for (int i = 0; i < rowCount; ++i)
         {
             TDPurchase memberInstance = new TDPurchase();
             memberInstance.ReadRow(dataR, fieldIndex);
             OnAddRow(memberInstance);
             memberInstance.Reset();
             CompleteRowAdd(memberInstance);
         }
         Log.i(string.Format("Parse Success TDPurchase"));
     }
Beispiel #9
0
 public void Pay(TDPurchase data)
 {
     Pay(data.price, data.itemNum);
 }
Beispiel #10
0
 static void CompleteRowAdd(TDPurchase tdData)
 {
 }