void OnOrderRet(string strMsg) { int nStatus = -1; int nTradeStatus = -1; string strSpsn = new string('\0', 5); StrParse(strMsg, out nStatus, out nTradeStatus, out strSpsn); //TODO Debug.Log("------OnOrderRet strMsg=" + strMsg + " strSpsn=" + strSpsn); /* * //畅游支付,存单 * { * string strAccountid, strgpg; * GlobalSave.GetCyouStoreLossGoodInfoTemp(out strAccountid, out strgpg); * if( strAccountid != null && * strgpg != null * ) * { * Debug.Log("pllog_Cyou_strAccountid:"+strAccountid); * Debug.Log("pllog_Cyou_strgpg:"+strgpg); * * int s32Accountid = Convert.ToInt32(strAccountid); * int s32SelfAccountid = Convert.ToInt32(Obj_MyselfPlayer.GetMe().accountID); * * if(s32Accountid == s32SelfAccountid) * { * string[] info_gid_pid_gprice = strgpg.Split('|'); * string gid = info_gid_pid_gprice[0]; * string pid = info_gid_pid_gprice[1]; * string gprice = info_gid_pid_gprice[2]; * * Debug.Log("pllog_Cyou_gid:"+gid); * Debug.Log("pllog_Cyou_pid:"+pid); * Debug.Log("pllog_Cyou_gprice:"+gprice); * * JsonData cydata = new JsonData(); * cydata["ACC"] = Obj_MyselfPlayer.GetMe().accountID; * cydata["OID"] = strSpsn;//畅游渠道的订单号是由sdk自己生成的,在这里第一次从java中传出 * cydata["GID"] = gid; * cydata["PID"] = pid; * cydata["PPRICE"] = gprice; * cydata["PNAME"] = "CYProduct"; * * WebMediator.SavePayLog(cydata.ToJson()); * Debug.Log("pllog_Cyou_SavePayLog:"+cydata.ToJson()); * } * * } * GlobalSave.SOrder order = PurchaseHelper.Instance().CheckOrder(); * } */ // 订单记录 PurchaseHelper.Instance().AddCyouOrder(strSpsn); //GlobalSave.AddCyouStoreLossOrder(strSpsn, Obj_MyselfPlayer.GetMe().accountID); // 这里先行设置如果掉单,的单号 GlobalSave.SetCyouStoreLossGoodInfoTempToReal(strSpsn, Obj_MyselfPlayer.GetMe().accountID); // 将保存的临时信息转成正式信息 }
public void RefreshUI(bool bNeedMsgBox) { if (!PurchaseHelper.Instance().BeginCheckOrder(OnFinishCheckOrder)) { RequestGoodsList(bNeedMsgBox); } //refreash top user info GameObject.FindWithTag("main_controller").SendMessage("updateUserInfo"); }
private void pplog_update() { JsonData jd = GlobalSave.GetOrderTable(); if (jd != null) { int num = jd.Count; Debug.Log("pllog_update num=" + num); Debug.Log("pllog_update begin LastSendIdx=" + LastSendIdx); if (LastSendIdx >= num) { LastSendIdx = 0; } for (int i = LastSendIdx; i < num; i++) { if (jd[i] != null) { if (jd[i]["accountID"] != null) { string orderacc = (string)jd[i]["accountID"]; int orderaccint = Convert.ToInt32(orderacc); int accountIDint = Convert.ToInt32(Obj_MyselfPlayer.GetMe().accountID); if (orderaccint != accountIDint) { Debug.Log("pllog_Not_Self"); //不是自己的单 continue; } else { Debug.Log("pllog_Update_SendVarify :" + JsonMapper.ToJson(jd[i])); // 补提订单.处理丢单情况 PurchaseHelper.Instance().VarifyJavaOrder((string)jd[i]["gid"], (string)jd[i]["pid"], (string)jd[i]["goodsPrice"], (string)jd[i]["orderId"] ); LastSendIdx++; Debug.Log("pllog_update mid LastSendIdx=" + LastSendIdx); if (LastSendIdx >= num) { LastSendIdx = 0; } Debug.Log("pllog_update end LastSendIdx=" + LastSendIdx); //晕,一个逻辑帧只发一个包,在收到反馈包之前不能发第二个,所以发包不能太快。 break; } } } } } }
//选中购买项 public void PurchseItem(GameObject item) { if (AccountManager.userType != AccountManager.UserType.OldUser || (AccountManager.Instance.CurAccount != null && string.IsNullOrEmpty(AccountManager.Instance.CurAccount.email))) { #if UNITY_ANDROID //只有官网渠道才提示绑定账号 lihao_yd 2014-01-18 if (!AndroidConfig.isUCChannel() && !AndroidConfig.isThirdSDKPlatform()) { BoxManager.show(9, "您未绑定邮箱账号,为防止数据丢失请您先绑定邮箱账号", ClientConfigure.title); UIEventListener.Get(BoxManager.buttonYes).onClick += OnBindAccount; return; } #else BoxManager.show(9, "您未绑定邮箱账号,为防止数据丢失请您先绑定邮箱账号", ClientConfigure.title); UIEventListener.Get(BoxManager.buttonYes).onClick += OnBindAccount; return; #endif } PurchaseInfo product = new PurchaseInfo(); for (int i = 0; i < purchaseList.Count; i++) { if (purchaseList[i].productId == item.name) { product = purchaseList[i]; break; } } // if(AccountManager.Instance.CurAccount == null) // { // Obj_MyselfPlayer.GetMe().isPurchase=true; // mainLogic.OnBindAccount(); // AccountManager.Instance.completeDalegate += OnBindComplete; // } // else // { // PurchaseHelper.Instance().MakePurchase(product.productId,product.goodsId); // } #if UNITY_ANDROID // 防止支付取消后改BosManager一直存在,无法继续玩游戏 #else BoxManager.showProcessMessage("请稍候...");//WML MARK #endif Debug.Log("pllog_PurchseItem MakePurchase"); PurchaseHelper.Instance().MakePurchase(product, FinishPay); }
private void onPay(string jsonOrder) { Debug.Log("----onPay ----" + jsonOrder); JsonData jsonobj = JsonMapper.ToObject(jsonOrder); string orderId = (string)jsonobj["orderId"]; Debug.Log("pllog_onPay_SendVarify :" + jsonOrder); //客户单直接发送消息 PurchaseHelper.Instance().VarifyJavaOrder((string)jsonobj["gid"], (string)jsonobj["pid"], (string)jsonobj["goodsPrice"], (string)jsonobj["orderId"]); GlobalSave.SetCyouStoreLossGoodInfoTempToReal(orderId, Obj_MyselfPlayer.GetMe().accountID); // 将保存的临时信息转成正式信息 //游戏根据需要进行订单处理,一般需要把订单号传回游戏服务器,在服务器上保存 //PurchaseHelper.Instance().UCAppPayResult(0, ""); }
public void SelectPurchaseRecord(GameObject item) { foreach (PurchaseRecord purchase in purchaseList) { if (purchase.goodsId == item.name) { List <GlobalSave.SOrder> orderList = OrderManager.Instance().OrderList(); if (orderList != null) { for (int i = 0; i < orderList.Count; i++) { if (orderList[i].strOder == purchase.goodsId) { PurchaseHelper.Instance().BeginCheckOrder(orderList[i], FinishCheck); break; } } } break; } } }
private void BeginCheckGooglePay(GameObject go) { if (lossLists.Count != 0) { GlobalSave.SOrder low = lossLists[0]; //在本地没有订单的情况下;至少帮助玩家添加订单;然后进行自动验证; if (!OrderManager.Instance().HaveOrder(low.strOder)) { BoxManager.showMessage("正在进行补单,请稍后", ""); OrderManager.Instance().AddOrder(low); PurchaseHelper.Instance().BeginCheckOrder(low, FinishCheck); } GoogleIAB.consumeProduct(low.productID); lossLists.RemoveAt(0); } else { GameObject.FindWithTag("main_controller").SendMessage("updateUserInfo"); } }
public static void sendLossOrder() { return; Debug.Log("CYouPayManager::Update()..0"); Obj_MyselfPlayer.GetMe().cyou_pay_time = 0; string keytable = GlobalSave.GetCyouStoreLossTable(); if (keytable == "") { Debug.Log("CYouPayManager::Update().....1"); return; } Debug.Log("-----CYouPayManager::sendLossOrder begin-----"); keytable = keytable.Replace("[", ""); Debug.Log("CYouPayManager::Update().....1 " + keytable); string[] strSub = keytable.Split(']'); foreach (string str in strSub) { if (str == null || str == "") { Debug.Log("CYouPayManager::Update().....2"); continue; // 如果是null或空串,则都继续 } string[] str_order_account = str.Split('|'); string order = str_order_account[0]; string accountid = str_order_account[1]; if (order == null || order == "" || accountid == null || accountid == "") { // 如果分割出来的数据不对 Debug.Log("CYouPayManager::Update().....3"); continue; } if (accountid != Obj_MyselfPlayer.GetMe().accountID.ToString()) { // 账号验证不合法 Debug.Log("CYouPayManager::Update().....4"); continue; } long account = Obj_MyselfPlayer.GetMe().accountID; string keyy = GlobalSave.GetOrderKey(order, account); string info = PlayerPrefs.GetString(keyy); if (info == null || info == "") { Debug.Log("CYouPayManager::Update().....5 " + keyy); GlobalSave.DelCyouStoreLossOrder(order, account); continue; // 没有相关的掉单信息 } string[] info_gid_pid_gprice = info.Split(':'); string gid = info_gid_pid_gprice[0]; string pid = info_gid_pid_gprice[1]; string gprice = info_gid_pid_gprice[2]; if (gid == null || gid == "" || pid == null || pid == "" || gprice == null || gprice == "") { // 数据错误 Debug.Log("CYouPayManager::Update().....6"); continue; } Debug.Log("CYouPayManager::Update().....7"); PurchaseHelper.Instance().VarifyTheLossOrder(gid, pid, gprice, order); // 补提订单.处理丢单情况 } Debug.Log("-----CYouPayManager::sendLossOrder end-----"); }
void Update() { PurchaseHelper.Instance().Update(UnityEngine.Time.deltaTime); }