public void wxBuy() { _shopData = GetShopItem(_itemID); if (_shopData == null) { return; } int payTag = 1; if (payTag == 1 && VX_recharge == false) //微信支付先关闭 { UtilTools.ShowMessage("微信支付通道暂时关闭", TextColor.RED); return; } GameObject sceneObj = GameObject.Find("Scene"); if (sceneObj) { StartUpScene startUpMono = sceneObj.GetComponent <StartUpScene>(); if (startUpMono != null) { startUpMono.startIOSWxPay(payTag, (int)_shopData.cost_list[0].cost_num, (int)_shopData.id, TextUtils.GetString(_shopData.name), TextUtils.GetString(_shopData.name)); } } }
/// <summary> /// 苹果IAP支付 /// </summary> /// <param name="id"></param> public void buyItemIAPImpl(int id) { #if UNITY_IOS && !UNITY_EDITOR pb_shop_item shopData = GetShopItem(id); string productID = GameDataMgr.PLAYER_DATA.GetProductIDByKey((int)shopData.id); object_c.ObjectCInterface.buyItem(productID); UtilTools.ShowWaitWin(WaitFlag.AppStorePay, 20f); #endif }
private void SetShow(pb_shop_item pbData) { if (pbData == null) { return; } if (_nameLb != null) { _nameLb.text = TextUtils.GetString(pbData.name); } if (_iconSpr != null) { _iconSpr.spriteName = pbData.icon; } if (_priceLb != null) { _priceLb.text = "¥" + pbData.cost_list[0].cost_num; } }
/// <summary> /// 界面加载完成后调用 /// </summary> protected override void UICreateCallback() { _shopData = GetShopItem(_itemID); _mono = winObject.AddComponent <ShopRechargeOtherMono>(); }
private void initUI() { _bg = transform.Find("Container"); GameObject backGo = transform.Find("Container/closeBtn").gameObject; UIEventListener.Get(backGo).onClick = _ctrl.GoBack; GameObject weixinBtn = transform.Find("Container/bg/Sprite/WeiXin").gameObject; UIEventListener.Get(weixinBtn).onClick = buyItem; GameObject zhifubaoBtn = transform.Find("Container/bg/Sprite/ZhiFuBao").gameObject; UIEventListener.Get(zhifubaoBtn).onClick = buyItem; _nameLb = transform.Find <UILabel>("Container/bg/name"); _iconSpr = transform.Find <UISprite>("Container/bg/icon"); _priceLb = transform.Find <UILabel>("Container/bg/price"); if (_ctrl._shopData != null && _ctrl._shopData.cost_list.Count > 0 && _ctrl._shopData.cost_list[0].cost_type != 999) { pb_shop_item shopitem = _ctrl._shopData; SetShow(shopitem); _sCurName = TextUtils.GetString(shopitem.name); _nType = 0; _nCost = (int)shopitem.cost_list[0].cost_num; _nCurKey = (int)shopitem.id; _sCurDes = TextUtils.GetString(shopitem.name); } else if (_ctrl._shopData != null && _ctrl._shopData.cost_list.Count > 0 && _ctrl._shopData.cost_list[0].cost_type == 999) { pb_shop_item shopitem = _ctrl._shopData; SetShow(shopitem); ItemBaseConfigItem itembasedata = ConfigDataMgr.getInstance().ItemBaseConfig.GetDataByKey(shopitem.item_id); string sItemCount = ""; if (shopitem.item_num > 0) { if (shopitem.item_id != 101) { sItemCount = string.Format(GameText.GetStr("shop_count"), shopitem.item_num); } else { sItemCount = shopitem.item_num.ToString(); } } _sCurName = string.Format("{0}{1}", sItemCount, itembasedata.name); _nCost = (int)shopitem.cost_list[0].cost_num; string sPrice = ""; if (shopitem.cost_list[0].cost_type == 999) { sPrice = string.Format(GameText.GetStr("shop_rmb"), shopitem.cost_list[0].cost_num); _nType = 0; } else if (shopitem.cost_list[0].cost_type == 102) { sPrice = string.Format(GameText.GetStr("shop_yuanbao"), shopitem.cost_list[0].cost_num); _nType = 1; } else if (shopitem.cost_list[0].cost_type == 101) { sPrice = string.Format(GameText.GetStr("shop_jinbi"), shopitem.cost_list[0].cost_num); _nType = 2; } else if (shopitem.cost_list[0].cost_type == 103) { sPrice = string.Format(GameText.GetStr("shop_zuanshi"), shopitem.cost_list[0].cost_num); _nType = 3; } _nCurKey = (int)shopitem.id; _sCurDes = TextUtils.GetString(shopitem.name); } }