Пример #1
0
    // 使用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);
    }