PottingMobileiOS.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics.CodeAnalysis;
  4. using System.Runtime.InteropServices;
  5. using PottingMobileSDK.MiniJSON;
  6. using UnityEngine;
  7. #if UNITY_IOS
  8. public class PottingMobileiOS : PottingMobileBase
  9. {
  10. [DllImport("__Internal")]
  11. private static extern void InitUnityAdSdk(string adUnitsJson, string appAppleId, string umengId, string appsFlyerKey,string umengChannel, string pangleAppID);
  12. [DllImport("__Internal")]
  13. private static extern void IsDebug(bool isDebug);
  14. ///开启定时自动加载广告
  15. [DllImport("__Internal")]
  16. private static extern void AutoLoadAd();
  17. //广告相关函数
  18. //加载和显示Banner广告,adPostion-Banner的位置,可传规定的字符串:TopLeft, TopCenter, TopRight, Centered, BottomLeft, BottomCenter, BottomRight
  19. [DllImport("__Internal")]
  20. private static extern void LoadAndShowBannerAd(string adPostion, int adSize);
  21. //隐藏Banner广告
  22. [DllImport("__Internal")]
  23. private static extern void HideBannerAd();
  24. //加载Interstitial广告
  25. [DllImport("__Internal")]
  26. private static extern void LoadInterstitialAd();
  27. //显示Interstitial广告
  28. [DllImport("__Internal")]
  29. private static extern void ShowInterstitialAd();
  30. //加载RewardedVideo广告
  31. [DllImport("__Internal")]
  32. private static extern void LoadRewardedVideoAd();
  33. //是否有加载完成的激励视频广告
  34. [DllImport("__Internal")]
  35. private static extern bool HasRewardedVideo();
  36. [DllImport("__Internal")]
  37. private static extern bool hasRewardedVideo(string adId);
  38. //显示激励视频广告
  39. [DllImport("__Internal")]
  40. private static extern void ShowRewardedVideoAd();
  41. [DllImport("__Internal")]
  42. private static extern void consentInformationReset();
  43. [DllImport("__Internal")]
  44. private static extern void showRewardedVideoAd(string adId);
  45. //加载插屏式激励视频广告
  46. [DllImport("__Internal")]
  47. private static extern void LoadRewardedInterstitialAd();
  48. //显示插屏式激励视频广告
  49. [DllImport("__Internal")]
  50. private static extern void ShowRewardedInterstitialAd();
  51. //加载开屏广告
  52. [DllImport("__Internal")]
  53. private static extern void LoadAppOpenAd();
  54. //显示开屏广告
  55. [DllImport("__Internal")]
  56. private static extern void ShowAppOpenAd();
  57. //统计相关函数
  58. [DllImport("__Internal")]
  59. private static extern void CustomEvent(string key, string dicJson);
  60. //设置用户等级 (由于友盟SDK限制,现改方法已经弃用,调用无效果,如需要请自行到友盟后台自定义该事件)
  61. //[DllImport("__Internal")]
  62. //private static extern void SetUserLevelId(int level);
  63. //充值购买虚拟货币(金币、宝石、金票等), cash-现金数额,source-购买渠道,coin-虚拟货币数额
  64. [DllImport("__Internal")]
  65. private static extern void Pay(double cash, int source, double coin);
  66. //充值购买虚拟道具, cash-现金数额,source-购买渠道,coin-虚拟货币数额
  67. [DllImport("__Internal")]
  68. private static extern void PayItem(double cash, int source, string itemName, int amount, double price);
  69. //游戏内部货币购买道具操作,itemName-道具名称,amount-数量,price-价格
  70. [DllImport("__Internal")]
  71. private static extern void Buy(string itemName, int amount, double price);
  72. //游戏内消耗道具操作,itemName-道具名称,amount-数量,price-价格
  73. [DllImport("__Internal")]
  74. private static extern void Use(string itemName, int amount, double price);
  75. //开始关卡,levelName-关卡名称
  76. [DllImport("__Internal")]
  77. private static extern void StartLevel(string levelName);
  78. //关卡完成,levelName-关卡名称
  79. [DllImport("__Internal")]
  80. private static extern void FinishLevel(string levelName);
  81. //关卡失败,levelName-关卡名称
  82. [DllImport("__Internal")]
  83. private static extern void FailLevel(string levelName);
  84. //得到虚拟货币奖励,coin-虚拟货币数额,source-获取渠道(例:游戏奖励、玩家赠送、节日赠送、打怪掉落等)
  85. [DllImport("__Internal")]
  86. private static extern void Bonus(double coin, int source);
  87. //得到道具奖励,itemName-道具名称,amount-数量,price-价格,source-奖励方法
  88. [DllImport("__Internal")]
  89. private static extern void BonusItem(string itemName, int amount, double price, int source);
  90. [DllImport("__Internal")]
  91. private static extern void buyProduct(double price,string productId);
  92. [DllImport("__Internal")]
  93. private static extern void Restore();
  94. [DllImport("__Internal")]
  95. private static extern void querySkuDetail(string prdIdsStr);
  96. [DllImport("__Internal")]
  97. private static extern void SetRepeatTime(int time);
  98. [DllImport("__Internal")]
  99. private static extern void InitApplePaySharedSecretKey(string sharedSecret);
  100. // 本地推送-设置一个seconds秒后发出的推送
  101. [DllImport("__Internal")]
  102. private static extern void SetLocalNotification(int id, string titleStr, string bodyStr, int seconds);
  103. // 本地推送-移除某一个指定的通知
  104. [DllImport("__Internal")]
  105. private static extern void CancleLocalNotification(int id);
  106. // 本地推送-移除所有本地通知
  107. [DllImport("__Internal")]
  108. private static extern void CancleAllLocalNotification();
  109. [DllImport("__Internal")]
  110. private static extern void shareText(string text);
  111. [DllImport("__Internal")]
  112. private static extern void LoginUseAppleSign();
  113. [DllImport("__Internal")]
  114. private static extern void LoginUseFacebook();
  115. [DllImport("__Internal")]
  116. private static extern void FacebookLogOut();
  117. [DllImport("__Internal")]
  118. private static extern void InitServicesIsDebug(string gameId, string gameSecret, bool isdebug);
  119. [DllImport("__Internal")]
  120. private static extern void InitServices(string gameId, string gameSecret, string baseUrl);
  121. [DllImport("__Internal")]
  122. private static extern void FeedBackSubmit(string msg, string connect, string docInfo);
  123. //传入链接,弹出WebView视图
  124. [DllImport("__Internal")]
  125. private static extern void ShowWebView(string url);
  126. //显示游戏推荐webview
  127. [DllImport("__Internal")]
  128. private static extern void ShowGameRecommend();
  129. //显示反馈客服webview
  130. [DllImport("__Internal")]
  131. private static extern void ShowFeedBackHtml(string data);
  132. //GameCenter 登录
  133. [DllImport("__Internal")]
  134. private static extern void GameCenterLogin();
  135. //上传默认存档
  136. [DllImport("__Internal")]
  137. private static extern void UploadAcrive(string data);
  138. //下载单个默认的存档
  139. [DllImport("__Internal")]
  140. private static extern void DownloadOneSavedAcrive();
  141. //上传指定名称存档
  142. [DllImport("__Internal")]
  143. private static extern void UploadAcriveHasName(string name, string data);
  144. //下载指定名称存档
  145. [DllImport("__Internal")]
  146. private static extern void DownloadOneSavedAcriveHasName(string name);
  147. //删除指定名称存档
  148. [DllImport("__Internal")]
  149. private static extern void DeleteOneSavedAcrive(string name);
  150. //获取该游戏所有iCloud存档
  151. [DllImport("__Internal")]
  152. private static extern void DownloadAllSavedAcrive();
  153. //解决指定名称存档冲突的情况
  154. [DllImport("__Internal")]
  155. private static extern void ResolveConflictingSavedGames(string name, string data);
  156. // 保存高分至某一个存档
  157. [DllImport("__Internal")]
  158. private static extern void SaveHighScore(string leaderboardId, long score);
  159. ///显示系统排行榜 可以跳转到自定的 game 排行榜 和 跳转到那个时间段
  160. [DllImport("__Internal")]
  161. private static extern void ShowSystomGameCenter(string leaderboardId, int time);
  162. ///获取排行榜信息 下载game center 某一排行榜中的分数及排名情况
  163. [DllImport("__Internal")]
  164. private static extern void DownLoadHighScore(int timeType, string leaderboardId);
  165. [DllImport("__Internal")]
  166. private static extern void DownLoadMyHighScore(int timeType, string leaderboardId);
  167. //显示游戏论坛webview 游戏ID加用户ID
  168. [DllImport("__Internal")]
  169. private static extern void ShowGameForumUserID(string gameId, string userId);
  170. //显示游戏论坛webview 游戏ID加email
  171. [DllImport("__Internal")]
  172. private static extern void ShowGameForumEmail(string gameId, string email);
  173. //去App Store中撰写评论
  174. [DllImport("__Internal")]
  175. private static extern void GotoAppStoreWriteReview(string appID);
  176. //调起系统自带应用内评分提示框
  177. [DllImport("__Internal")]
  178. private static extern void ShowSysReview();
  179. [DllImport("__Internal")]
  180. private static extern void AppsflyerValidate(string skuId, string transactionId);
  181. [DllImport("__Internal")]
  182. private static extern void ShareToFacebook(string imagePath);
  183. [DllImport("__Internal")]
  184. private static extern void InternalPayActive(string productId, string activeId);
  185. [DllImport("__Internal")]
  186. private static extern void UmengCustomEvent(string key, string dicJson);
  187. [DllImport("__Internal")]
  188. private static extern void FireBaseCustomEvent(string key, string dicJson);
  189. [DllImport("__Internal")]
  190. private static extern void AppsFlyerCustomEvent(string key, string dicJson);
  191. [DllImport("__Internal")]
  192. private static extern void FacebookCustomEvent(string key, string dicJson);
  193. [DllImport("__Internal")]
  194. private static extern void FacebookCustomEventSum(string key, double valueToSum, string dicJson);
  195. [DllImport("__Internal")]
  196. private static extern void UploadPhoto(string imagePath, string title);
  197. [DllImport("__Internal")]
  198. private static extern void UploadVideo(string imagePath ,string title);
  199. [DllImport("__Internal")]
  200. private static extern void OpenFriendFinderDeepLink();
  201. static PottingMobileiOS()
  202. {
  203. InitManager();
  204. }
  205. public static void _AppsflyerValidate(string skuId,string transactionId) {
  206. AppsflyerValidate(skuId,transactionId);
  207. }
  208. /// <summary>
  209. /// 显示webview
  210. /// </summary>
  211. /// <param name="url"></param>
  212. public static void _ShowWebView(string url)
  213. {
  214. ShowWebView(url);
  215. }
  216. /// <summary>
  217. /// 打开bbs
  218. /// </summary>
  219. /// <param name="bbsId">论坛id</param>
  220. /// <param name="userId">用户唯一标识</param>
  221. public static void _Showbbs(string bbsId, string userId)
  222. {
  223. ShowGameForumUserID(bbsId, userId);
  224. }
  225. /// <summary>
  226. /// 打开bbs
  227. /// </summary>
  228. /// <param name="bbsId">论坛id</param>
  229. /// <param name="emial">用户邮箱</param>
  230. public static void _ShowBBSWithEmail(string bbsId, string emial)
  231. {
  232. ShowGameForumEmail(bbsId,emial);
  233. }
  234. /// <summary>
  235. /// 显示推荐界面
  236. /// </summary>
  237. public static void _ShowGameRecommendView()
  238. {
  239. ShowGameRecommend();
  240. }
  241. /// <summary>
  242. /// 提交反馈接口
  243. /// </summary>
  244. /// <param name="msg">反馈信息</param>
  245. /// <param name="connect">联系方式</param>
  246. /// <param name="docInfo">存档</param>
  247. public static void _FeedBackSubmit(string msg, string connect, string docInfo)
  248. {
  249. FeedBackSubmit(msg, connect, docInfo);
  250. }
  251. public static void _LoginUseFacebook()
  252. {
  253. LoginUseFacebook();
  254. }
  255. /// <summary>
  256. /// Facebook退出登录
  257. /// </summary>
  258. public static void _LogOutFacebook()
  259. {
  260. FacebookLogOut();
  261. }
  262. /// <summary>
  263. /// 谷歌登录
  264. /// </summary>
  265. public static void _LoginUseGoogle()
  266. {
  267. }
  268. public static new void _LoginUseAppleSign()
  269. {
  270. LoginUseAppleSign();
  271. }
  272. public static void _querySkuDetail(string[] skus)
  273. {
  274. var jsonString = Json.Serialize(skus);
  275. querySkuDetail(jsonString);
  276. }
  277. public static void _GetADID(){
  278. }
  279. public static void _buyProductEvent(double price,string productId)
  280. {
  281. buyProduct(price, productId);
  282. }
  283. public static void InitializeSdk(string jsonAds, string facebookid, string app_flyers_id, string umengId,string umengChannel, string pangleAppID)
  284. {
  285. SetRepeatTime(AdManagerSettings.Instance.RepeatTime);
  286. InitUnityAdSdk(jsonAds, app_flyers_id, umengId, PottingMobileContent.APPSFLYER_DEV_KEY, umengChannel, pangleAppID);
  287. InitServices(PottingMobileContent.GameId, PottingMobileContent.GameSecret, PottingMobileContent.baseUrl);
  288. }
  289. /// <summary>
  290. /// 初始化sdk
  291. /// </summary>
  292. public static void InitializeSdk()
  293. {
  294. InitializeSdk(PottingMobileContent.AdJsonString, PottingMobileContent.FacebookAppid, PottingMobileContent.AppsFlyerAppid, PottingMobileContent.UmengAppid, PottingMobileContent.umengChannel, PottingMobileContent.PangleAppID);
  295. }
  296. /// <summary>
  297. /// 设置debug日志开关
  298. /// </summary>
  299. /// <param name="isDebug"></param>
  300. public static void withLogDebug(bool isDebug)
  301. {
  302. IsDebug(isDebug);
  303. }
  304. /// <summary>
  305. /// 开启定时自动加载广告
  306. /// </summary>
  307. public static void autoLoadAd()
  308. {
  309. AutoLoadAd();
  310. }
  311. /// <summary>
  312. /// 重置同意的链接
  313. /// </summary>
  314. public static void _consentInformationReset()
  315. {
  316. consentInformationReset();
  317. PottingLog("ios_consentInformationReset");
  318. }
  319. public static void _LoadAppOpenAd()
  320. {
  321. LoadAppOpenAd();
  322. PottingLog("ios_LoadAppOpenAd");
  323. }
  324. public static void _ShowAppOpenAd()
  325. {
  326. ShowAppOpenAd();
  327. PottingLog("ios_ShowAppOpenAd");
  328. }
  329. public static void _ShowInterstitialAd()
  330. {
  331. ShowInterstitialAd();
  332. PottingLog("ios_LoadRewardedVideoAd");
  333. }
  334. public static void _LoadInterstitialAd()
  335. {
  336. LoadInterstitialAd();
  337. PottingLog("ios_LoadRewardedVideoAd");
  338. }
  339. public static void _LoadRewardedInterstitialAd()
  340. {
  341. LoadRewardedInterstitialAd();
  342. PottingLog("ios_LoadRewardedInterstitialAd");
  343. }
  344. public static void _ShowRewardedInterstitialAd()
  345. {
  346. ShowRewardedInterstitialAd();
  347. PottingLog("ios_ShowRewardedInterstitialAd");
  348. }
  349. public static void _LoadRewardedVideoAd()
  350. {
  351. LoadRewardedVideoAd();
  352. PottingLog("ios_LoadRewardedVideoAd");
  353. }
  354. public static void _ShowRewardedVideoAd(string adid)
  355. {
  356. showRewardedVideoAd(adid);
  357. }
  358. public static void _ShowRewardedVideoAd()
  359. {
  360. ShowRewardedVideoAd();
  361. PottingLog("ios_ShowRewardedVideoAd");
  362. }
  363. public static bool _HasRewardedVideo()
  364. {
  365. return HasRewardedVideo();
  366. }
  367. public static bool _HasRewardedVideo(string adId)
  368. {
  369. return hasRewardedVideo(adId);
  370. }
  371. public static void _LoadAndShowBannerAd(AdPosition adPostion)
  372. {
  373. _LoadAndShowBannerAd(adPostion, AdSize.H_50);
  374. }
  375. public static void _LoadAndShowBannerAd(AdPosition adPostion, AdSize adSize)
  376. {
  377. LoadAndShowBannerAd(adPostion.ToString(), (int)adSize);
  378. }
  379. public static void _HideBannerAd()
  380. {
  381. HideBannerAd();
  382. }
  383. //充值购买虚拟货币(金币、宝石、金票等), cash-现金数额,source-购买渠道,coin-虚拟货币数额
  384. public static void _Pay(double cash, int source, double coin)
  385. {
  386. Pay(cash, source, coin);
  387. PottingLog("_Pay");
  388. }
  389. //充值购买虚拟道具, cash-现金数额,source-购买渠道,coin-虚拟货币数额
  390. public static void _PayItem(double cash, int source, string itemName, int amount, double price)
  391. {
  392. PayItem(cash, source, itemName, amount, price);
  393. PottingLog("_PayItem");
  394. }
  395. //游戏内部货币购买道具操作,itemName-道具名称,amount-数量,price-价格
  396. public static void _Buy(string itemName, int amount, double price)
  397. {
  398. Buy(itemName, amount, price);
  399. PottingLog("_Buy");
  400. }
  401. //游戏内消耗道具操作,itemName-道具名称,amount-数量,price-价格
  402. public static void _Use(string itemName, int amount, double price)
  403. {
  404. Use(itemName, amount, price);
  405. PottingLog("_Use");
  406. }
  407. //开始关卡,levelName-关卡名称
  408. public static void _StartLevel(string levelName)
  409. {
  410. StartLevel(levelName);
  411. PottingLog("_StartLevel");
  412. }
  413. //关卡完成,levelName-关卡名称
  414. public static void _FinishLevel(string levelName)
  415. {
  416. FinishLevel(levelName);
  417. PottingLog("_FinishLevel");
  418. }
  419. //关卡失败,levelName-关卡名称
  420. public static void _FailLevel(string levelName)
  421. {
  422. FailLevel(levelName);
  423. PottingLog("_FailLevel");
  424. }
  425. //得到虚拟货币奖励,coin-虚拟货币数额,source-获取渠道(例:游戏奖励、玩家赠送、节日赠送、打怪掉落等)
  426. public static void _Bonus(double coin, int source)
  427. {
  428. Bonus(coin, source);
  429. PottingLog("_Bonus");
  430. }
  431. //得到道具奖励,itemName-道具名称,amount-数量,price-价格,source-奖励方法
  432. public static void _BonusItem(string itemName, int amount, double price, int source)
  433. {
  434. BonusItem(itemName, amount, price, source);
  435. PottingLog("_BonusItem");
  436. }
  437. //内购相关函数
  438. //调起内购,productId-内购产品ID
  439. public static void _InternalPay(string productId, string actId = "",string accountId = "youloft", string profileId
  440. = "youloft")
  441. {
  442. InternalPayActive(productId,actId);
  443. }
  444. public static void _LoginUseGoogleInClient(string clientId )
  445. {
  446. }
  447. public static void _InitApplePaySharedSecretKey(string sharedSecret)
  448. {
  449. InitApplePaySharedSecretKey(sharedSecret);
  450. }
  451. //恢复购买相关函数
  452. public static void _Restore()
  453. {
  454. Restore();
  455. }
  456. public static void Subscription(string productId,string actId = "")
  457. {
  458. InternalPayActive(productId,actId);
  459. }
  460. public static void CheckPurchases(string skuType)
  461. {
  462. }
  463. public static void QueryPurchases(string skuType)
  464. {
  465. }
  466. public static void QueryHistoryPurchases(string skuType)
  467. {
  468. }
  469. public static void _CustomEvent(string key, Dictionary<string, string> lable)
  470. {
  471. var jsonString = Json.Serialize(lable);
  472. CustomEvent(key, jsonString);
  473. PottingLog("_CustomEvent-" + key);
  474. }
  475. /// <summary>
  476. /// facebook自定义埋点
  477. /// </summary>
  478. /// <param name="key">事件名字</param>
  479. /// <param name="lable">事件参数</param>
  480. public static void _CustomEventFacebook(string key, Dictionary<string, string> lable)
  481. {
  482. var jsonString = Json.Serialize(lable);
  483. FacebookCustomEvent(key, jsonString);
  484. PottingLog("_CustomEvent-" + key);
  485. }
  486. public static void _CustomLogEventFacebook(string key, double valueToSum, Dictionary<string, string> lable)
  487. {
  488. var jsonString = Json.Serialize(lable);
  489. FacebookCustomEventSum(key, valueToSum, jsonString);
  490. PottingLog("_CustomEvent-" + key);
  491. }
  492. /// <summary>
  493. /// firebase自定义埋点
  494. /// </summary>
  495. /// <param name="key">事件名字</param>
  496. /// <param name="lable">事件参数</param>
  497. public static void _CustomEventFirebase(string key, Dictionary<string, string> lable)
  498. {
  499. var jsonString = Json.Serialize(lable);
  500. FireBaseCustomEvent(key, jsonString);
  501. PottingLog("_CustomEvent-" + key);
  502. }
  503. /// <summary>
  504. /// appsflyer自定义埋点
  505. /// </summary>
  506. /// <param name="key">事件名字</param>
  507. /// <param name="lable">事件参数</param>
  508. public static void _CustomEventAppsflyer(string key, Dictionary<string, string> lable)
  509. {
  510. var jsonString = Json.Serialize(lable);
  511. AppsFlyerCustomEvent(key, jsonString);
  512. PottingLog("_CustomEvent-" + key);
  513. }
  514. /// <summary>
  515. /// umeng自定义埋点
  516. /// </summary>
  517. /// <param name="key">事件名字</param>
  518. /// <param name="lable">事件参数</param>
  519. public static void _CustomEventUmeng(string key, Dictionary<string, string> lable)
  520. {
  521. var jsonString = Json.Serialize(lable);
  522. UmengCustomEvent(key, jsonString);
  523. PottingLog("_CustomEvent-" + key);
  524. }
  525. //本地推送
  526. public static void _SetLocalNotification(int identifier, string title, string body, int seconds)
  527. {
  528. SetLocalNotification(identifier, title, body, seconds);
  529. }
  530. public static void _CancelLocalNotification(int noticeId)
  531. {
  532. CancleLocalNotification(noticeId);
  533. }
  534. public static void _CancelAllLocalNotification()
  535. {
  536. CancleAllLocalNotification();
  537. }
  538. public static void _ShareText(string extraText)
  539. {
  540. shareText(extraText);
  541. }
  542. /// <summary>
  543. /// 游戏登录
  544. /// </summary>
  545. public static void _GameLogin()
  546. {
  547. Social.localUser.Authenticate(b => { });
  548. GameCenterLogin();
  549. }
  550. /// <summary>
  551. /// 加载默认名称存档
  552. /// </summary>
  553. public static void _LoadGame()
  554. {
  555. DownloadOneSavedAcrive();
  556. }
  557. /// <summary>
  558. /// 上传默认名称存档
  559. /// </summary>
  560. /// <param name="data">存档数据</param>
  561. public static void _SavedGame(string data)
  562. {
  563. UploadAcrive(data);
  564. }
  565. public static void _LoadGame(string name)
  566. {
  567. DownloadOneSavedAcriveHasName(name);
  568. }
  569. public static void _SavedGame(string name, string data)
  570. {
  571. UploadAcriveHasName(name, data);
  572. }
  573. public static void _DeleteGame(string name)
  574. {
  575. DeleteOneSavedAcrive(name);
  576. }
  577. public static void _LoadAllGame()
  578. {
  579. DownloadAllSavedAcrive();
  580. }
  581. /// <summary>
  582. /// 解决存档冲突,将同名的多个存档变为一个存档解决冲突,需要程序做判断使用那一份存档或让用户选择一份存档
  583. /// </summary>
  584. /// <param name="name">冲突的存档名称</param>
  585. /// <param name="data">确认需要保存的存档</param>
  586. public static void _ResolveConflictGame(string name, string data)
  587. {
  588. ResolveConflictingSavedGames(name, data);
  589. }
  590. /// <summary>
  591. /// 显示排行榜
  592. /// </summary>
  593. ///
  594. public static void _ShowLeaderBoard()
  595. {
  596. ShowSystomGameCenter(null, (int)TimeSpan.TIME_SPAN_ALL_TIME);
  597. }
  598. /// <summary>
  599. /// 显示指定排行榜
  600. /// </summary>
  601. /// <param name="id">排行榜id</param>
  602. public static void _ShowLeaderBoard(string id, TimeSpan timeSpan)
  603. {
  604. ShowSystomGameCenter(id,(int)timeSpan);
  605. }
  606. /// <summary>
  607. /// 拉取排行榜个人信息
  608. /// </summary>
  609. /// <param name="id">排行榜id</param>
  610. public static void _LoadLeaderBoard(string id, TimeSpan timeSpan)
  611. {
  612. DownLoadMyHighScore((int)timeSpan, id);
  613. }
  614. /// <summary>
  615. /// 提交排行榜分数
  616. /// </summary>
  617. /// <param name="id">排行榜id</param>
  618. /// <param name="score">分数</param>
  619. public static void _SubmitLeaderBoardScore(string id, long score)
  620. {
  621. SaveHighScore(id,score);
  622. }
  623. /// <summary>
  624. /// 打开谷歌应用内评论
  625. /// </summary>
  626. public static void launchReview()
  627. {
  628. ShowSysReview();
  629. }
  630. public static void _YouLoftGameInfo(Dictionary<string, string> lable)
  631. {
  632. _CustomEvent("youloftgameinfo",lable);
  633. }
  634. public static void _ShareImgByFacebook(string path)
  635. {
  636. ShareToFacebook(path);
  637. }
  638. /// <summary>
  639. /// 邀请Facebook好友
  640. /// </summary>
  641. public static void _openFriendFinderDeepLink()
  642. {
  643. OpenFriendFinderDeepLink();
  644. }
  645. /// <summary>
  646. /// 上传到facebook
  647. /// </summary>
  648. /// <param name="path"></param>
  649. public static void _uploadPhoto(string path)
  650. {
  651. UploadPhoto(path, "");
  652. }
  653. /// <summary>
  654. /// 上传到facebook
  655. /// </summary>
  656. /// <param name="path"></param>
  657. public static void _uploadVideo(string path)
  658. {
  659. UploadVideo(path, "");
  660. }
  661. /// <summary>
  662. /// 打开客服反馈页面
  663. /// </summary>
  664. public static void _showFeedBackHtml(Dictionary<string, string> lable = null)
  665. {
  666. var jsonString = Json.Serialize(lable);
  667. ShowFeedBackHtml(jsonString);
  668. }
  669. /// <summary>
  670. /// /谷歌退出登录
  671. /// </summary>
  672. public static void _LogOutGoogle()
  673. {
  674. }
  675. public static void _hideLoading()
  676. {
  677. }
  678. public static void _checkLicense()
  679. {
  680. }
  681. }
  682. #endif