public override void SetRoleData(RoleData roleData) { //注意这里 在登录的时候获取到值后 后面支付参数才有值 this.roleData = roleData; #if UNITY_ANDROID XinkuaiSDK.SetRoleData(roleData.code, roleData.roleGid, roleData.roleId, roleData.roleName, roleData.roleLevel, roleData.serverId, roleData.serverName, roleData.coinNum, ""); #endif #if UNITY_IPHONE XinkuaiSDK.SetRoleData(roleData.serverId, roleData.roleName, roleData.roleLevel.ToString(), roleData.serverName, roleData.roleId, roleData.code.ToString(), roleData.coinNum, ""); #endif }
public override void Pay(EB.IAP.Item item, EB.IAP.Transaction transaction, System.Action <int> callback) { EB.Debug.Log("XinkuaiSDKManager.Pay"); if (item == null || transaction == null) { EB.Debug.LogError("XinkuaiSDKManager.Pay: item == null || transaction == null!!!"); callback?.Invoke(XinkuaiSDKResultCode.Failed); return; } if (!mInitialized) { EB.Debug.LogError("XinkuaiSDKManager.Pay: not initialized!!!"); callback?.Invoke(XinkuaiSDKResultCode.Failed); return; } mPayCallback += callback; object extraInfo = EB.JSON.Parse(transaction.payload); int price = Mathf.FloorToInt(item.cost * 100f); string productId = item.productId; string productName = item.longName; string productDesc = item.localizedDesc; string orderId = transaction.transactionId; string roleId = roleData.roleId; string roleName = roleData.roleName; int roleLevel = roleData.roleLevel; string serverId = roleData.serverId; string serverName = roleData.serverName; #if UNITY_IPHONE string extension = EB.Dot.String("callbackInfo", extraInfo, "0"); #else string extension = EB.Dot.String("callbackInfo", extraInfo, string.Empty); #endif EB.Debug.Log("XinkuaiSDKManager.Pay: roleId = {0},roleName = {1},roleLevel = {2},serverId = {3},serverName = {4},CurHCCount = {5}", roleId, roleName, roleLevel, serverId, serverName, CurHCCount); #if UNITY_ANDROID //price, productId, productName, productDesc, orderId, roleId, roleName, roleLevel, serverId, serverName, coinNum, payNotifyUrl, extension XinkuaiSDK.Pay(price, productId, productName, productDesc, orderId, roleId, roleName, roleLevel, serverId, serverName, CurHCCount, mNotifyUrl, extension); #endif #if UNITY_IPHONE //rmb 充值金额 单位元 //productID iTunes 苹果后台配置的内购物品的产品ID //name 商品名 //charid 角色ID //serverid 服务器ID //info 扩展信息 //cporderid 游戏商订单ID // string payInfo = cost + ";" // + transaction.productId + ";" // + name + ";" // + charId + ";" // + serverId + ";" // + callbackInfo + ";" // + cporderId; // Debug.LogError("支付内容:payInfo:" + payInfo); EB.Debug.Log("XinkuaiSDKManager.Pay: productName = {0},productDesc = {1},orderId = {2},productId = {3},price = {4},extension = {5}", productName, productDesc, orderId, productId, price, extension); XinkuaiSDK.Pay(productName, productDesc, orderId, productId, serverId, price, extension /*, mNotifyUrl*/); #endif }