Ejemplo n.º 1
0
        // for garena
        public void GetGarenaProductInfo(APMidasBaseRequest request, MidasGetLocalPriceCallback callback)
        {
            if (!mHasInited)
            {
                ULog.LogError("you should call Initialize first");
                return;
            }

            mMidasGetProductCallback = callback;
            string reqString = request.ToString();

            ULog.Log("GetGarenaProductInfo with json : " + reqString);
#if UNITY_EDITOR
            ULog.Log("use simulator");
#elif UNITY_ANDROID
            helper = new AndroidJavaClass(helperClass);
            if (helper == null)
            {
            }
            else
            {
                helper.CallStatic("GetProductInfo", reqString);
            }
#elif UNITY_IOS
            string bizType = request.GetType().Name;
            ULog.Log("PayType = " + bizType);

            midasSdkGetGrnProductInfo(bizType, "os_garena", reqString);
#endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 拉起支付
        /// </summary>
        ///
        /// <param name="req">Req.</param>
        /// <param name="callback">Callback.</param>
        public void Pay(APMidasBaseRequest req, MidasPayCallback callback)
        {
            if (!mHasInited)
            {
                Debug.LogError("you should call Initialize first");
                return;
            }
            try {
                appExtend         = req.appExtends;             //保存回调的时候,回传给游戏
                mMidasPayCallback = callback;
//				mAPMidasBasePayRequest = req;
                string bizType = req.GetType().Name;
                ULog.Log("PayType = " + bizType);
                string reqString = req.ToString();
                ULog.Log("Pay with json : " + reqString);
#if UNITY_EDITOR
                ULog.Log("Simulator Pay");
#elif UNITY_ANDROID
                helper = new AndroidJavaClass(helperClass);
                if (helper == null)
                {
                    ULog.Log("Cannot get Java helper class");
                }
                else
                {
                    helper.CallStatic("Pay", bizType, reqString);
                }
#elif UNITY_IOS
                midasSdkPay(bizType, reqString);
#endif
            }
            catch (System.Exception e) {
                ULog.LogError("catch exception : " + e.Message);
            }
        }
Ejemplo n.º 3
0
        public void GetInfo(string reqType, APMidasBaseRequest req, MidasGetInfoCallback callback)
        {
            if (!mHasInited)
            {
                Debug.LogError("you should call Initialize first");
                return;
            }
            try {
                mMidasGetInfoCallback = callback;
//				mAPMidasBasePayRequest = req;
                string bizType = req.GetType().Name;
                ULog.Log("PayType = " + bizType);
                string reqString = req.ToString();
                ULog.Log("GetInfo with json : " + reqString);

#if UNITY_EDITOR
                ULog.Log("Simulator GetInfo");
#elif UNITY_ANDROID
                helper = new AndroidJavaClass(helperClass);
                if (helper == null)
                {
                    ULog.Log("Cannot get Java helper class");
                }
                else
                {
                    helper.CallStatic("GetInfo", reqType, bizType, reqString);
                }
#elif UNITY_IOS
                // IOS bizTy=APMidasGameRequest
                midasSdkGetInfo(reqType, bizType, reqString);
#endif
            }
            catch (System.Exception e) {
                ULog.LogError("catch exception : " + e.Message);
            }
        }