public void UpdateRechargeList() { GCGame.Utils.CleanGrid(m_TransRechargeGrid.gameObject); Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer; if (null == mainPlayer) { LogModule.ErrorLog("main player is not init"); return; } for (int i = 0; i < TableManager.GetRecharge().Count; i++) { Tab_Recharge curTabRecharge = TableManager.GetRechargeByID(i, 0); if (null == curTabRecharge) { continue; } if (!RechargeData.m_dicGoodInfos.ContainsKey(curTabRecharge.RegisterID)) { continue; } RechargeData.GoodInfo curGoodInfo = RechargeData.m_dicGoodInfos[curTabRecharge.RegisterID]; string iconName = ""; string goodName = curGoodInfo.goods_number + "#y"; bool bEnableTimes = false; PayActivityData payData = GameManager.gameManager.PlayerDataPool.PayActivity; if (curTabRecharge.Type == 1 && payData.IsMonthCardFlag()) { // 月卡并且已经生效 // TT9809 月卡也显示 //continue; } if (curTabRecharge.Type == 2 && (payData.IsGrowUpFlag() || mainPlayer.BaseAttr.Level >= payData.GrowUpLevel)) { // 成长基金并且已经生效或者玩家已经大于50级 continue; } else if (curTabRecharge.Type == 3) { bEnableTimes = true; } iconName = curTabRecharge.IconName; goodName = curTabRecharge.GoodName; RechargeItem.CreateItem(m_ObjRechargeItem, m_TransRechargeGrid, curGoodInfo.goods_register_id, iconName, curGoodInfo.goods_price, goodName, curTabRecharge.HotLabelTip, bEnableTimes); } UIGrid curGrid = m_TransRechargeGrid.GetComponent <UIGrid>(); if (null != curGrid) { curGrid.repositionNow = true; } }
public void OnMakePay(string id, int times) { float timeDiff = Time.time - m_lastPayTime; if (timeDiff < 3) { Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer; if (null != mainPlayer) { mainPlayer.SendNoticMsg(false, "#{1076}"); } return; } m_lastPayTime = Time.time; RechargeData.GoodInfo curGoodInfo = RechargeData.GetGoodInfo(id); if (null == curGoodInfo) { LogModule.ErrorLog(" can not find cur good info:" + id.ToString()); return; } // 遍历充值表,判断是否为月卡 for (int i = 0; i < TableManager.GetRecharge().Count; i++) { Tab_Recharge curTabRecharge = TableManager.GetRechargeByID(i, 0); if (null == curTabRecharge) { continue; } if (curTabRecharge.RegisterID == id) { if (curTabRecharge.Type == 1 && GameManager.gameManager.PlayerDataPool.PayActivity.IsMonthCardFlag()) { // 如果是月卡并且正在生效,提示不能购买 MessageBoxLogic.OpenOKBox(StrDictionary.GetClientDictionaryString("#{4636}", GameManager.gameManager.PlayerDataPool.PayActivity.GetMonthCardLeftDay())); return; } else { break; } } } if (times > 1) { curGoodInfo = curGoodInfo.GetGoodInfoWithTimes(times); } if (null == curGoodInfo) { LogModule.ErrorLog("pay stop:good info error"); return; } PlatformHelper.MakePayWithGoodInfo(curGoodInfo); }
// 使用GOODINFO方式支付 public static bool MakePayWithGoodInfo(RechargeData.GoodInfo curGoodInfo) { if (null == curGoodInfo) { LogModule.ErrorLog("goodinfo null"); return(false); } LoginData.PlayerRoleData curRole = LoginData.GetPlayerRoleData(PlayerPreferenceData.LastRoleGUID); if (null == curRole) { LogModule.ErrorLog("get role data fail"); return(false); } #if UNITY_WP8 && !UNITY_EDITOR WPSDKHelperScript.Instance().WPmakePayWithGoodInfo(string.Format("{0:X16}", curRole.guid), PlayerPreferenceData.LastServer.ToString(), curRole.name, curGoodInfo.goods_id, curGoodInfo.goods_name, curGoodInfo.goods_number, curGoodInfo.goods_price, curGoodInfo.goods_register_id); #elif UNITY_ANDROID && !UNITY_EDITOR System.Text.StringBuilder sb = new System.Text.StringBuilder(); JsonWriter writer = new JsonWriter(sb); writer.WriteObjectStart(); writer.WritePropertyName("roleID"); writer.Write(string.Format("{0:X16}", curRole.guid)); writer.WritePropertyName("serverId"); writer.Write(PlayerPreferenceData.LastServer.ToString()); writer.WritePropertyName("roleName"); writer.Write(curRole.name); writer.WritePropertyName("goodsId"); writer.Write(curGoodInfo.goods_id); writer.WritePropertyName("goodsName"); writer.Write(curGoodInfo.goods_name); writer.WritePropertyName("goodsNum"); writer.Write(curGoodInfo.goods_number); writer.WritePropertyName("goodsPrice"); writer.Write(curGoodInfo.goods_price); writer.WritePropertyName("goodsDesc"); writer.Write(curGoodInfo.goods_describe); writer.WritePropertyName("goodsRegisterId"); writer.Write(curGoodInfo.goods_register_id); writer.WritePropertyName("oid"); writer.Write(LoginData.accountData.m_oid); writer.WritePropertyName("token"); writer.Write(LoginData.accountData.m_accessToken); writer.WritePropertyName("vip"); writer.Write("0"); writer.WritePropertyName("balance"); writer.Write("0"); writer.WritePropertyName("roleLevel"); writer.Write("1"); writer.WritePropertyName("partyName"); writer.Write("partyName"); writer.WritePropertyName("pushInfo"); writer.Write("pushInfo"); writer.WriteObjectEnd(); AndroidHelper.doSdk("makePayWithGoodInfo", sb.ToString()); #elif UNITY_IPHONE && !UNITY_EDITOR IOSHelper.makePayWithGoodInfo(string.Format("{0:X16}", curRole.guid), PlayerPreferenceData.LastServer.ToString(), curRole.name, curGoodInfo.goods_id, curGoodInfo.goods_name, curGoodInfo.goods_number, curGoodInfo.goods_price, curGoodInfo.goods_register_id); #else #endif return(true); }