private void DoTransactionDoneIOS(string platform_unique_id_, string currency_, string price_) { ConfCharge good = IAPTools.GetGoodsByPlatformID(platform_unique_id_); long charge_id_ = good.id; System.Collections.Generic.Dictionary <UBSParamKeyName, object> _params = new System.Collections.Generic.Dictionary <UBSParamKeyName, object>() { { UBSParamKeyName.ContentID, charge_id_ }, //{ UBSParamKeyName.ContentType, good.type}, { UBSParamKeyName.ContentType, 1 }, { UBSParamKeyName.NumItems, 1 }, { UBSParamKeyName.Currency, currency_ }, { UBSParamKeyName.Description, LocalizeModule.Instance.GetString(good.desc) } }; UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.Purchased, float.Parse(price_), _params); }
private void DoRspVerifyTransaction(object msg_) { if (msg_ is SCGooglePayChargeResponse) { var rsp = msg_ as SCGooglePayChargeResponse; if (!MsgStatusCodeUtil.OnError(rsp.ResponseStatus)) { Debugger.Log("UNITY IAP purchase rsp product id = " + rsp.ProductId); EngineCoreEvents.AudioEvents.PlayAudio.SafeInvoke(Audio.AudioType.UISound, GameCustomAudioKey.buy_cash_success.ToString()); ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null; long charge_id = null != good ? good.id : 0L; if (0 == charge_id) { TransactionTips(LocalizeModule.Instance.GetString("submit_ok"), false); return; } Debugger.Log("UNITY IAP purchase rsp charge id = " + charge_id); IAPTools.instance.RspVerifyTransaction(charge_id); string good_desc = LocalizeModule.Instance.GetString(good.desc); Debugger.Log("UNITY IAP in transction done charge_id = " + charge_id); GameEvents.NetWorkEvents.SendAsyncMsg.SafeInvoke(new CSPlayerInfoRequest()); TransactionTips(good_desc, true); GameEvents.IAPEvents.OnTransactionDone.SafeInvoke(charge_id); long giftID = CommonHelper.GetGiftID(charge_id); if (giftID > 0) { //CommonHelper.OpenGift(giftID, 1); } } else { Debugger.LogError("UNITY IAP error transction done product id = " + rsp.ProductId); ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null; if (null != good) { string good_desc = LocalizeModule.Instance.GetString(good.desc); TransactionTips(good_desc, false); IAPTools.instance.RspVerifyTransaction(good.id); } else { var pair_req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke(); if (pair_req is CSGooglePayChargeRequest) { CSGooglePayChargeRequest req_wrapper = pair_req as CSGooglePayChargeRequest; string charge_id = req_wrapper.ProductId; good = ConfCharge.Get(long.Parse(charge_id)); if (null != good) { string good_desc = LocalizeModule.Instance.GetString(good.desc); TransactionTips(good_desc, false); IAPTools.instance.RspVerifyTransaction(good.id); } } } } } else if (msg_ is SCIOSPayChargeResponse) { var rsp = msg_ as SCIOSPayChargeResponse; Debugger.Log("UNITY IAP purchase rsp platform id = " + rsp.ProductId); if (!MsgStatusCodeUtil.OnError(rsp.ResponseStatus)) { EngineCoreEvents.AudioEvents.PlayAudio.SafeInvoke(Audio.AudioType.UISound, GameCustomAudioKey.buy_cash_success.ToString()); ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null; long charge_id = null != good ? good.id : 0L; if (0 == charge_id) { TransactionTips(LocalizeModule.Instance.GetString("submit_ok"), false); return; } Debugger.Log("UNITY IAP purchase rsp charge id = " + charge_id); IAPTools.instance.RspVerifyTransaction(charge_id); string good_desc = LocalizeModule.Instance.GetString(good.desc); Debugger.Log("in transction done charge_id = " + charge_id); GameEvents.NetWorkEvents.SendAsyncMsg.SafeInvoke(new CSPlayerInfoRequest()); TransactionTips(good_desc, true); GameEvents.IAPEvents.OnTransactionDone.SafeInvoke(charge_id); //long giftID = CommonHelper.GetGiftID(charge_id); //if (giftID > 0) //{ // var gifts = PushGiftManager.Instance.GetPushInfosByTurnOnType(ENUM_PUSH_GIFT_BLOCK_TYPE.E_LOGIN); // if( null != gifts && gifts.Count > 0) // { // foreach( var gift in gifts) // { // if( giftID == gift.PushId ) // { // gift.Buyed = true; // } // } // } // //CommonHelper.OpenGift(giftID, 1); //} } else { Debugger.LogError("UNITY IAP error transction done product id = " + rsp.ProductId); ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null; if (null != good) { string good_desc = LocalizeModule.Instance.GetString(good.desc); TransactionTips(good_desc, false); IAPTools.instance.RspVerifyTransaction(good.id); } else { var pair_req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke(); if (pair_req is CSIOSPayChargeRequest) { CSIOSPayChargeRequest req_wrapper = pair_req as CSIOSPayChargeRequest; #if UNITY_IOS && PLATFROM_ID string platform_unique_id = req_wrapper.ProductId; Debug.Log("失败交易商品 platform unique id " + platform_unique_id); good = IAPTools.GetGoodsByPlatformID(platform_unique_id); #else string charge_id = req_wrapper.ProductId; Debug.Log("失败交易商品 charge id " + charge_id); good = ConfCharge.Get(long.Parse(charge_id)); #endif if (null != good) { string good_desc = LocalizeModule.Instance.GetString(good.desc); Debug.Log("失败交易商品 " + good_desc); TransactionTips(good_desc, false); IAPTools.instance.RspVerifyTransaction(good.id); } } } } } }