IOSPlatformSDK.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. //
  2. // IOSPlatformSDK.h
  3. // OYGameSKD
  4. //
  5. // Created by leon on 2021/1/21.
  6. // Copyright © 2021 Oujia. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. @interface IOSPlatformSDK : NSObject
  11. //****************** public Method ******************//
  12. +(instancetype)sharedInstance;
  13. -(void)startWithUrl:(NSURL*)url;
  14. //****************** ios call unity start ******************//
  15. /**
  16. * cusid:主/副设备
  17. * left:左鞋动作代码
  18. * right:右鞋动作代码
  19. */
  20. -(void)bridgingMotionAction:(int)cusid
  21. left:(int)left
  22. right:(int)right;
  23. /**
  24. * 踏步状态,频率
  25. * cusid:主/副设备
  26. * leftStatus:左鞋步频(0:停止, 1:慢,2:快)
  27. * rightStatus:右鞋步频(0:停止, 1:慢,2:快)
  28. * leftFrag:左鞋步数
  29. * rightFrag:左鞋步数
  30. */
  31. -(void)bridgingStepAction:(int)cusid
  32. leftStatus:(int)leftStatus
  33. rightStatus:(int)rightStatus
  34. leftFrag:(int)leftFrag
  35. rightFrag:(int)rightFrag;
  36. /**
  37. * 返回蓝牙设备的基本信息,用于界面上显示当前的设备状况,, app 跳转的时候传过来的
  38. * cusid:主/副设备
  39. * name:蓝牙设备名称
  40. * address:蓝牙设备mac地址
  41. * status:链接状态
  42. * electricity:蓝牙设备电量 取值范围[0 - 100] 对比左右鞋 handler较低的电量
  43. */
  44. -(void)bridgingDeviceAction:(int)cusid
  45. name:(NSString*)name
  46. address:(NSString*)address
  47. status:(int)status
  48. electricity:(int)electricity;
  49. /**
  50. *游戏首页交互动作的回调
  51. * cusid: 主副设备
  52. * code: 交互代码
  53. */
  54. -(void)bridgingInteraction:(int)cusid
  55. code:(int)code;
  56. /**
  57. *趣动通知好友邀请事件
  58. * code:
  59. * userChar:
  60. * infoChar:
  61. */
  62. -(void)bridgingInvite:(int)code
  63. userChar:(const char *)userChar
  64. infoChar:(const char *)infoChar;
  65. @end
  66. //****************** unity call ios start ******************//
  67. /**
  68. * unity获取用户信息 -->> 解析从Spotr App的传过来的RL_Seme ios返回json数据给游戏
  69. */
  70. extern "C" {
  71. extern char * GetUserInfoJson();
  72. }
  73. /**
  74. * unity获取用户好友 -->> ios端根据用户token值请求http好友列表 ios将列表json的数组数据传给unity
  75. */
  76. extern "C" {
  77. extern void GetUserFriends();
  78. }
  79. /**
  80. * Unity call ios 获取游戏榜单数据
  81. *if (type == 0) "world" else "friend"
  82. *ios 请求完数据后用 PointerGetRankHandler 回调数据给unity
  83. */
  84. extern "C" {
  85. void GetRank(int type);
  86. }
  87. /**
  88. * 主动邀请好友
  89. * friendid: 游戏好友ID
  90. */
  91. extern "C" {
  92. extern void InviteFriend(int friendid,char * info);
  93. }
  94. /**
  95. * unity界面准备好后可以申请邀请信息,回调在inviteFriendHandler
  96. * friendid: 游戏好友ID
  97. */
  98. extern "C" {
  99. extern void GetInviteInfo();
  100. }
  101. /**
  102. * Unity call ios 弹出邀请好友弹窗
  103. * 旧版游戏暂未用到
  104. */
  105. extern "C" {
  106. void ShowInviteFriend(int code, char * info);
  107. }
  108. /**
  109. * 游戏开始
  110. */
  111. extern "C" {
  112. extern void GameStart();
  113. }
  114. /**
  115. * 游戏结束
  116. * level: level
  117. * score: score
  118. * record: record
  119. * mode: mode
  120. * opponentId: opponentId
  121. */
  122. extern "C" {
  123. extern void GameEnd(int level, double score, int record, int mode, int opponentId);
  124. }
  125. /**
  126. * 搜索设备
  127. * type: 设备ID
  128. */
  129. extern "C" {
  130. extern void SearchDevice(int type);
  131. }
  132. /**
  133. * 链接设备
  134. * type: 设备ID
  135. */
  136. extern "C" {
  137. extern void ConnectDevice(int type);
  138. }
  139. /**
  140. * 链接设备
  141. * type: 设备ID
  142. */
  143. extern "C" {
  144. extern void DisConnectDevice(int type);
  145. }
  146. /**
  147. * 震动
  148. * type: 设备ID
  149. * duration: 时长 ms [100 .. 1000]
  150. leftOrRight:针对三轮车
  151. */
  152. extern "C" {
  153. extern void Vibrate(int type,int duration);
  154. }
  155. /**
  156. * 震动
  157. * type:设备ID
  158. * duration: 时长 ms [100 .. 1000]
  159. * leftOrRight: 左右鞋 针对三轮车
  160. */
  161. extern "C" {
  162. void VibrateS(int type,int duration,int leftOrRight);
  163. }
  164. /**
  165. * Unity call ios 获取鞋子角度
  166. */
  167. extern "C" {
  168. int NativeGetAttX(int cusId);
  169. }
  170. /**
  171. * 投屏
  172. */
  173. extern "C" {
  174. extern void ScreenProjection();
  175. }
  176. /**
  177. * Unity call ios 返回app
  178. */
  179. extern "C" {
  180. void OnBackPressed();
  181. }