|
LeanCloud C# SDK
|
客户端类 More...
Public Member Functions | |
| Client (string appId, string appKey, string userId, bool ssl=true, string gameVersion="0.0.1", string playServer=null) | |
| Client 构造方法 | |
| async Task< Client > | Connect () |
| 连接 | |
| async Task | JoinLobby () |
| 加入大厅,会接收到大厅房间列表更新的事件 | |
| async Task | LeaveLobby () |
| 离开大厅 | |
| async Task< Room > | CreateRoom (string roomName=null, RoomOptions roomOptions=null, List< string > expectedUserIds=null) |
| 创建房间 | |
| async Task< Room > | JoinRoom (string roomName, List< string > expectedUserIds=null) |
| 加入房间 | |
| async Task< Room > | RejoinRoom (string roomName) |
| 返回房间 | |
| async Task< Room > | JoinOrCreateRoom (string roomName, RoomOptions roomOptions=null, List< string > expectedUserIds=null) |
| 加入或创建房间,如果房间 Id 存在,则加入;否则根据 roomOptions 和 expectedUserIds 创建新的房间 | |
| async Task< Room > | JoinRandomRoom (PlayObject matchProperties=null, List< string > expectedUserIds=null) |
| 随机加入房间 | |
| async Task< Room > | ReconnectAndRejoin () |
| 重连并返回上一个加入的房间 | |
| async Task< string > | MatchRandom (string piggybackUserId, PlayObject matchProperties=null, List< string > expectedUserIds=null) |
| 匹配房间(不加入) | |
| async Task | LeaveRoom () |
| 离开房间 | |
| async Task< string > | FetchMyRoom () |
| 获取玩家当前房间 | |
| async Task< bool > | SetRoomOpen (bool open) |
| 设置房间开启 / 关闭 | |
| async Task< bool > | SetRoomVisible (bool visible) |
| 设置房间可见性 | |
| async Task< int > | SetRoomMaxPlayerCount (int count) |
| 设置房间最大玩家数量 | |
| async Task< List< string > > | SetRoomExpectedUserIds (List< string > expectedUserIds) |
| 设置期望用户 | |
| async Task | ClearRoomExpectedUserIds () |
| 清空期望用户 Id 列表 | |
| async Task< List< string > > | AddRoomExpectedUserIds (List< string > expectedUserIds) |
| 增加期望用户 | |
| async Task< List< string > > | RemoveRoomExpectedUserIds (List< string > expectedUserIds) |
| 删除期望用户 | |
| async Task< Player > | SetMaster (int newMasterId) |
| 设置房主 | |
| async Task | KickPlayer (int actorId, int code=0, string reason=null) |
| 将玩家踢出房间 | |
| Task | SendEvent (byte eventId, PlayObject eventData=null, SendEventOptions options=null) |
| 发送自定义事件 | |
| async Task | SetRoomCustomProperties (PlayObject properties, PlayObject expectedValues=null) |
| 设置房间自定义属性 | |
| async Task | SetPlayerCustomProperties (int actorId, PlayObject properties, PlayObject expectedValues=null) |
| 设置玩家自定义属性 | |
| void | PauseMessageQueue () |
| 暂停消息队列 | |
| void | ResumeMessageQueue () |
| 恢复消息队列 | |
| async Task | Close () |
| 关闭服务 | |
Public Attributes | |
| Action< List< LobbyRoom > > | OnLobbyRoomListUpdated |
| 大厅房间列表更新事件 | |
| Action< Player > | OnPlayerRoomJoined |
| 有玩家加入房间事件 | |
| Action< Player > | OnPlayerRoomLeft |
| 有玩家离开房间事件 | |
| Action< Player > | OnMasterSwitched |
| 房主切换事件 | |
| Action< PlayObject > | OnRoomCustomPropertiesChanged |
| 房间自定义属性更新事件 | |
| Action< PlayObject > | OnRoomSystemPropertiesChanged |
| 房间系统属性更新事件,目前包括:房间开关,可见性,最大玩家数量,预留玩家 Id 列表 | |
| Action< Player, PlayObject > | OnPlayerCustomPropertiesChanged |
| 玩家自定义属性更新事件 | |
| Action< Player > | OnPlayerActivityChanged |
| 玩家在线 / 离线变化事件 | |
| Action< byte, PlayObject, int > | OnCustomEvent |
| 用户自定义事件 | |
| Action< int?, string > | OnRoomKicked |
| 被踢出房间事件 | |
| Action | OnDisconnected |
| 断线事件 | |
| Action< int, string > | OnError |
| 错误事件 | |
Properties | |
| string | PlayServer [get] |
| string | AppId [get] |
| LeanCloud App Id. | |
| string | AppKey [get] |
| LeanCloud App Key. | |
| string | UserId [get] |
| 用户唯一 Id | |
| bool | Ssl [get] |
| 是否启用 SSL | |
| string | GameVersion [get] |
| 客户端版本号,不同的版本号的玩家不会匹配到相同的房间 | |
| List< LobbyRoom > | LobbyRoomList [get] |
| 大厅房间列表 | |
| Room | Room [get, set] |
| 当前房间对象 | |
| Player | Player [get] |
| 当前玩家对象 | |
客户端类
|
inline |
|
inline |
增加期望用户
| expectedUserIds | 增加的期望用户 Id 列表 |
|
inline |
清空期望用户 Id 列表
|
inline |
关闭服务
|
inline |
连接
|
inline |
创建房间
| roomName | 房间唯一 Id |
| roomOptions | 创建房间选项 |
| expectedUserIds | 期望用户 Id 列表 |
|
inline |
获取玩家当前房间
|
inline |
加入大厅,会接收到大厅房间列表更新的事件
|
inline |
加入或创建房间,如果房间 Id 存在,则加入;否则根据 roomOptions 和 expectedUserIds 创建新的房间
| roomName | 房间 Id |
| roomOptions | 创建房间选项 |
| expectedUserIds | 期望用户 Id 列表 |
|
inline |
随机加入房间
| matchProperties | 匹配属性 |
| expectedUserIds | 期望用户 Id 列表 |
|
inline |
加入房间
| roomName | 房间 Id |
| expectedUserIds | 期望用户 Id 列表 |
|
inline |
将玩家踢出房间
| actorId | 玩家的 Actor Id |
| code | 附加码 |
| reason | 附加消息 |
|
inline |
离开大厅
|
inline |
离开房间
|
inline |
匹配房间(不加入)
| piggybackUserId | 占位用户 Id |
| matchProperties | 匹配属性 |
|
inline |
暂停消息队列
|
inline |
重连并返回上一个加入的房间
|
inline |
返回房间
| roomName | 房间 Id |
|
inline |
删除期望用户
| expectedUserIds | 删除的期望用户 Id 列表 |
|
inline |
恢复消息队列
|
inline |
发送自定义事件
| eventId | 事件 Id |
| eventData | 事件参数 |
| options | 事件选项 |
|
inline |
设置房主
| newMasterId | 新房主的 Actor Id |
|
inline |
设置玩家自定义属性
| actorId | 玩家 Actor Id |
| properties | 自定义属性 |
| expectedValues | 用于 CAS 的期望属性 |
|
inline |
设置房间自定义属性
| properties | 自定义属性 |
| expectedValues | 用于 CAS 的期望属性 |
|
inline |
设置期望用户
| expectedUserIds | 期望用户 Id 列表 |
|
inline |
设置房间最大玩家数量
| count | 数量 |
|
inline |
设置房间开启 / 关闭
| open | 是否开启 |
|
inline |
设置房间可见性
| visible | 是否可见 |
| Action<byte, PlayObject, int> LeanCloud.Play.Client.OnCustomEvent |
用户自定义事件
| Action LeanCloud.Play.Client.OnDisconnected |
断线事件
| Action<int, string> LeanCloud.Play.Client.OnError |
错误事件
| Action<List<LobbyRoom> > LeanCloud.Play.Client.OnLobbyRoomListUpdated |
大厅房间列表更新事件
| Action<Player> LeanCloud.Play.Client.OnMasterSwitched |
房主切换事件
| Action<Player> LeanCloud.Play.Client.OnPlayerActivityChanged |
玩家在线 / 离线变化事件
| Action<Player, PlayObject> LeanCloud.Play.Client.OnPlayerCustomPropertiesChanged |
玩家自定义属性更新事件
| Action<Player> LeanCloud.Play.Client.OnPlayerRoomJoined |
有玩家加入房间事件
| Action<Player> LeanCloud.Play.Client.OnPlayerRoomLeft |
有玩家离开房间事件
| Action<PlayObject> LeanCloud.Play.Client.OnRoomCustomPropertiesChanged |
房间自定义属性更新事件
| Action<int?, string> LeanCloud.Play.Client.OnRoomKicked |
被踢出房间事件
| Action<PlayObject> LeanCloud.Play.Client.OnRoomSystemPropertiesChanged |
房间系统属性更新事件,目前包括:房间开关,可见性,最大玩家数量,预留玩家 Id 列表
|
get |
LeanCloud App Id.
App Id
|
get |
LeanCloud App Key.
App Key
|
get |
客户端版本号,不同的版本号的玩家不会匹配到相同的房间
游戏版本号
|
get |
大厅房间列表
可加入的房间列表
|
get |
当前玩家对象
当前玩家
|
get |
|
getset |
当前房间对象
当前房间
|
get |
是否启用 SSL
如果开启 SSL,则设为 true;否则设为 false。默认是 true
|
get |
用户唯一 Id
玩家唯一 Id