//付费成功回调 private void RechargePayCallback(int payid, bool issucceed) { GuiExtendButtonGroup buttonGroup = currentCallui.GetComponent <GuiExtendButtonGroup>(); if (buttonGroup != null) { buttonGroup.IsWorkDo = true; } if (!issucceed) { //充值失败 //重新调整充值策略 IGamerProfile.Instance.AjustDefBuyItemId(payid); //删除对象 UnityEngine.Object.DestroyObject(this.gameObject); //回调充值失败 currentPayMoneyData.callbackFun(currentPayMoneyData, false); return; } //给用户加钱 IGamerProfile.Instance.playerdata.playerMoney += IGamerProfile.gameBaseDefine.jewelData.buyJewelList[rechargeId].jewel; IGamerProfile.Instance.SaveGamerProfileToServer(); //删除对象 UnityEngine.Object.DestroyObject(this.gameObject); //重新尝试付款 IGamerProfile.Instance.PayMoney(currentPayMoneyData, currentCallui); }
//进行一次收费 public void PayMoney(PayMoneyData paydata, GuiUiSceneBase callui) { //检测钱够不够 if (playerdata.playerMoney < paydata.money) { //激活收费框 GuiExtendButtonGroup buttonGroup = callui.GetComponent <GuiExtendButtonGroup>(); if (buttonGroup != null) { buttonGroup.IsWorkDo = false; } #if _GameType_BaoYue UiSceneNotEnoughMoney em = callui.LoadResource_UIPrefabs("notenougmoney.prefab").GetComponent <UiSceneNotEnoughMoney>(); em.Initialization(paydata, callui); #else UiSceneRechargeAsk recharge = callui.LoadResource_UIPrefabs("rechargeask.prefab").GetComponent <UiSceneRechargeAsk>(); recharge.Initialization(paydata, callui); #endif // _GameType_BaoYue return; } //扣除钱 playerdata.playerMoney -= paydata.money; //回调扣钱成功的函数 paydata.callbackFun(paydata, true); }