Unity 工程,封装了Unity 对接 Android 和 ios 的接口

kidd3166 ebc3fc115f update 2 anni fa
SDK Project eb1824dea2 new 2 anni fa
README.md 3f8de02c71 update 2 anni fa
test.txt ebc3fc115f update 2 anni fa

README.md

Unity SDK

介绍

封装了与 Unity 对接 Android 和 ios 的接口

编译环境

  1. Unity Hub 2.5.2+
  2. Unity 2020.1.3f1c1 (64-bit)
  3. Visual Studio 2019

Unity call sdk

1.fun setMessageChannel(channel: MessageChannel)

  • android 注入sdk to Unity 通信事件

2.fun gameStart()

  • 游戏开始事件,请在每局游戏开始调用, 通知SDK开始记录
  • (1)、初始化动作库
  • (2)、初始化计数器()

3.fun gameEnd(int level, double score, int record, int mode, int opponentId)

  • 游戏结束事件,请在每局游戏结束后, 调用通知SDK上传对战信息,并添加相关参数

4.fun getUserInfo(): String

  • 游戏开发商获取用户信息接口,获取用户基本信息,请开发商根据返回的信息创建玩家资料,做到sdk和游戏内玩家信息一致

5.fun getUserFriends()

  • 游戏开发商获取信息接口,请求好友列表,结果会在MessageChannel中回调 @see MessageChannel.userFriends(code, json)

6.fun connectDevice(int type)

  • 游戏开发商事件,重新连接蓝牙设备,当蓝牙设备异常,无法连接时可重新连接蓝牙设备

7.fun connectDevice(string address, int type)

  • 同上,替换设备

8.fun searchDevice(int type)

  • 游戏开发商事件,弹出搜索蓝牙设备的对话框
    • type: 连接设备后的类型

9.fun inviteFriend

  • 邀请好友事件

10.fun screenProjection

  • 投屏事件

11.fun vibrate

  • 震动事件