123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- using System.Collections;
- using System.Collections.Generic;
- using PottingMobileSDK.MiniJSON;
- using UnityEngine;
- public class PottingMobileServicesAndroid : PottingMobileServicesBase
- {
- private static readonly AndroidJavaClass PluginClass = new AndroidJavaClass("com.youloft.api.ApiManager");
- static PottingMobileServicesAndroid()
- {
- InitManager();
- }
- /**
- * 渠道下单接口,根据不同渠道需要的数据不同
- * 返回的数据结构不同,前端需要根据情况解析
- *
- * @param channel 渠道
- * @param goodsid 商品ID
- */
- public static void _channelPayOrder(int channel, string goodsid)
- {
- PluginClass.CallStatic(
- "channelPayOrder", channel, goodsid);
- }
- /**
- * 获取当前游戏,渠道的最新版本
- * 返回结果无加密
- *
- * @param channel 渠道
- */
- public static void _channelPayGetAppVersion(int channel)
- {
- PluginClass.CallStatic(
- "channelPayGetAppVersion", channel + "");
- }
- /**
- * 获取服务器配置
- * appver:如果不需要根据版本判断可以串0
- * lastver:每次全新获取传0
- * 返回结果加密
- * @param appVer
- * @param lastVer
- */
- public static void _configSync(string appVer, int lastVer)
- {
- PluginClass.CallStatic(
- "configSync", appVer, lastVer);
- }
- /**
- * 兑换码兑换接口
- *
- * @param redeemcode 兑换码
- */
- public static void _dedeemConsume(string redeemcode)
- {
- PluginClass.CallStatic(
- "dedeemConsume", redeemcode,null);
- }
- /**
- * 登录接口
- *
- * @param id 设备ID 或者第三方登录平台的ID
- * @param type 登录类型
- * @param name 用户昵称
- * @param icon 用户头像链接
- */
- public static void _userLogin(string id, int type, string name, string icon)
- {
- PluginClass.CallStatic(
- "userLogin", id, type, name, icon);
- }
- /**
- * 获取(提交)存档到服务器
- * 1.每次启动游戏优先获取存档
- * 2.当有需要更新的存档时提交服务器
- * 提交存档时服务器会默认覆盖以前的存档不会做其他判断
- * 请求需要签名,返回数据有加密
- *
- * @param archive
- * @param archiveVersion
- */
- public static void _userSync(string archive, int archiveVersion)
- {
- PluginClass.CallStatic(
- "userSync", archive, archiveVersion);
- }
- /**
- * 心跳检测,判断当前客户端登陆是否有效
- * 请求需要签名,返回数据无加密
- */
- public static void _userHeartbeat()
- {
- PluginClass.CallStatic(
- "userHeartbeat");
- }
- /**
- * 恢复购买,查看已完成的所有订单,以及消耗状态
- * 请求需要签名,返回结果有加密
- */
- public static void _userResumepurchase()
- {
- PluginClass.CallStatic(
- "userResumepurchase");
- }
- /**
- * 订单消耗
- * 请求需要签名,返回结果有加密
- *
- * @param goodsid 商品ID
- * @param orderId 订单ID
- */
- public static void _userConsume(string goodsid, string orderId)
- {
- PluginClass.CallStatic(
- "userConsume", goodsid, orderId);
- }
- /**
- * 查询单个订单的状态
- * 用来处理非消耗性商品,判断订单是否支付完成
- * 返回结果有加密
- *
- * @param goodsid 商品ID
- * @param orderId 订单ID
- */
- public static void _userQueryOrder(string goodsid, string orderId)
- {
- PluginClass.CallStatic(
- "userQueryOrder", goodsid, orderId);
- }
- /**
- * 提交用户分数
- * 返回用户排行榜信息,返回结果无加密
- *
- * @param score 名次
- * @param info 排名信息
- * @param rankingid 排名ID
- */
- public static void _userUploadScore(int score, string info, string rankingid)
- {
- PluginClass.CallStatic(
- "userUploadScore", score, info, rankingid);
- }
- /**
- * 获取用户自己的排名
- *
- * @param rankingid 排行榜ID
- */
- public static void _userGetUserRank(string rankingid)
- {
- PluginClass.CallStatic(
- "userGetUserRank", rankingid);
- }
- public static void _getActivitiesWithChannel(string channel, string language)
- {
- PluginClass.CallStatic(
- "getActivitiesWithChannel", channel, language);
- }
- /// <summary>
- /// 获取公告
- /// </summary>
- /// <param name="channel"></param>
- /// <param name="version"></param>
- /// <param name="language"></param>
- public static void _getGameAnoncementsWithChannel(string channel, string version, string language)
- {
- PluginClass.CallStatic(
- "gameAnoncementsWithChannel", channel, version, language);
- }
- /// <summary>
- /// 根据渠道兑换码兑换接口
- /// </summary>
- /// <param name="redeemCode"></param>
- /// <param name="channel"></param>
- public static void _redeemConsume(string redeemCode, string channel)
- {
- PluginClass.CallStatic(
- "redeemConsume", redeemCode, channel);
- }
- /// <summary>
- /// 根据渠道兑换码兑换接口,需要用户登录
- /// </summary>
- /// <param name="redeemCode"></param>
- /// <param name="channel"></param>
- /// <param name="clientId"></param>
- public static void _redeemUserConsume(string redeemCode, string channel, string clientId)
- {
- PluginClass.CallStatic("redeemUserConsume", redeemCode, channel, clientId);
- }
- /// <summary>
- /// 提交反馈接口
- /// </summary>
- /// <param name="msg">反馈信息</param>
- /// <param name="connect">联系方式</param>
- /// <param name="docInfo">存档</param>
- public static void _FeedBackSubmit(string msg, string connect, string docInfo)
- {
- PluginClass.CallStatic(
- "feedbackSubmit",
- msg, connect, docInfo
- );
- }
- public static void _PayValidate(string payToken, string gporderId, string sku, string price, int skuType,
- string actId)
- {
- PluginClass.CallStatic(
- "googleValidate",
- payToken, gporderId, sku, price, skuType, actId
- );
- }
- public static void _GameInfoUpload(Dictionary<string, string> lable)
- {
- var jsonString = Json.Serialize(lable);
- PluginClass.CallStatic(
- "gameInfoUpload", jsonString);
- }
- public static void _Serverinfo()
- {
- PluginClass.CallStatic(
- "Serverinfo");
- }
- }
|