// 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 }
public void LaunchWeb(APMidasBaseRequest req, MidasPayCallback callback) { if (!mHasInited) { Debug.LogError("you should call Initialize first"); return; } try { mMidasPayCallback = callback; // mAPMidasBasePayRequest = req; string reqString = req.ToString(); ULog.Log("LaunchWeb with json : " + reqString); #if UNITY_EDITOR ULog.Log("Simulator LaunchWeb"); #elif UNITY_ANDROID helper = new AndroidJavaClass(helperClass); if (helper == null) { ULog.Log("Cannot get Java helper class"); } else { helper.CallStatic("LaunchWeb", reqString); } #elif UNITY_IOS ULog.Log("IOS LaunchWeb does not support"); #endif } catch (System.Exception e) { ULog.LogError("catch exception : " + e.Message); } }
/// <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); } }
/// <summary> /// 初始化接口 /// </summary> /// /// <param name="idc">Idc.</param> /// <param name="env">Env.</param> /// <param name="req">Req.</param> /// <param name="callback">Callback.</param> public void Initialize(string idc, string env, string idcInfo, APMidasBaseRequest req, MidasInitCallback callback) { if (mHasInited) { return; } mMidasInitCallback = callback; try { #if UNITY_EDITOR ULog.Log("Emulator Initialize"); ULog.Log("MidasUnityV" + unityVersion); #elif UNITY_ANDROID //TODO:设置android版本号 ULog.Log("MidasUnityV" + unityVersion); #elif UNITY_IOS // req.iapInitExtra.Add("app_reserve_3","MidasUnityV"+unityVersion); #endif string reqString = req.ToString(); ULog.Log("Initialize req json = " + reqString); #if UNITY_EDITOR ULog.Log("Emulator Initialize"); #elif UNITY_ANDROID mHasInited = true; helper = new AndroidJavaClass(helperClass); if (helper == null) { ULog.Log("Cannot get Java helper class"); } else { helper.CallStatic("Initialize", idc, env, idcInfo, reqString); } #elif UNITY_IOS if (idc.Length == 0) { idc = "local"; } mHasInited = midasSdkInitWithIdcInfo(idc, env, idcInfo, reqString); #endif } catch (System.Exception e) { ULog.LogError("catch exception : " + e.Message); } }
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); } }