public static IAPProxy Instance() { if (_Instance == null) { _Instance = new IAPProxy(); } return(_Instance); }
private void ClickIsBuyOK() { #if UNITY_EDITOR PromptManager.Instance.MessageBox(PromptManager.Type.FloatingTip, "Winods环境无法进行内购"); return; #endif if (CurrentIAPGoodsID != null && CurrentIAPGoodsMoney > 0) { IAPProxy.Instance().OnSnapStartPay(CurrentIAPGoodsID, BuyCallback); AnalysisManager.Instance.OnEvent("pay_apple", null); } LoadingBG.gameObject.SetActive(true); }
public override void Open() { IAPProxy.Instance().Set(this); IsBuy = new IAPIsBuy(IsBuyParent); LastBtn.gameObject.SetActive(false); NextBtn.gameObject.SetActive(false); LoadingBG.gameObject.SetActive(false); JsonData paramObj = new JsonData(); //销售渠道id 0:apple paramObj["channel"] = 0; paramObj["uid"] = SelfPlayerData.Uuid; IAPRpcProxy.RequestGoodsInfo(paramObj, RequestGoodsInfoCallback); string logStr = "开始请求商品信息";; log(logStr); AnalysisManager.Instance.OnEvent("shopNode", null); }
/// <summary> /// 请求商品信息 /// </summary> /// <param name="rpcResultObj"></param> private void RequestGoodsInfoCallback(SnapRpcDataVO rpcResultObj) { if (CurrentIsDispose) { return; } JsonData data = rpcResultObj.data; if (rpcResultObj.code == RpcDataCode.RequestFinish) { GoodsPublisServer = new List <ServerGoodsInfo> (); for (int i = 0; i < data.Count; i++) { ServerGoodsInfo item = new ServerGoodsInfo(); item.GoodsID = (string)data[i]["appleGoodsId"]; item.GoodsSnapID = (string)data[i]["id"]; item.GoodsIconUrl = (string)data[i]["icon"]; item.GoodsLvInt = (int)data[i]["courseNum"]; item.GoodsSnapType = (int)data[i]["itemType"]; item.GoodsIsBuyed = (Boolean)data[i]["isBuy"]; GoodsPublisServer.Add(item); } IAPProxy.Instance().InitializeIAP(GoodsPublisServer, InitializeUI); string logStr = "请求商品信息成功:" + JsonMapper.ToJson(data); log(logStr); } else { PromptManager.Instance.MessageBox(PromptManager.Type.FloatingTip, "支付通信失败,请稍后重试"); string logStr = "请求商品信息失败:" + JsonMapper.ToJson(data); log(logStr); } }