Play-SDK-CSharp
Public Member Functions | Public Attributes | Properties | Events | List of all members
LeanCloud.Play.Client Class Reference

Public Member Functions

 Client (string appId, string appKey, string userId, bool ssl=true, string gameVersion="0.0.1", string playServer=null)
 Client 构造方法 More...
 
async Task< ClientConnect ()
 连接 More...
 
async Task JoinLobby ()
 加入大厅,会接收到大厅房间列表更新的事件 More...
 
async Task< RoomCreateRoom (string roomName=null, RoomOptions roomOptions=null, List< string > expectedUserIds=null)
 创建房间 More...
 
async Task< RoomJoinRoom (string roomName, List< string > expectedUserIds=null)
 加入房间 More...
 
async Task< RoomRejoinRoom (string roomName)
 返回房间 More...
 
async Task< RoomJoinOrCreateRoom (string roomName, RoomOptions roomOptions=null, List< string > expectedUserIds=null)
 加入或创建房间,如果房间 Id 存在,则加入;否则根据 roomOptions 和 expectedUserIds 创建新的房间 More...
 
async Task< RoomJoinRandomRoom (PlayObject matchProperties=null, List< string > expectedUserIds=null)
 随机加入房间 More...
 
async Task< RoomReconnectAndRejoin ()
 重连并返回上一个加入的房间 More...
 
async Task< LobbyRoomMatchRandom (string piggybackUserId, PlayObject matchProperties=null, List< string > expectedUserIds=null)
 匹配房间(不加入) More...
 
async Task LeaveRoom ()
 离开房间 More...
 
async Task< bool > SetRoomOpen (bool open)
 设置房间开启 / 关闭 More...
 
async Task< bool > SetRoomVisible (bool visible)
 设置房间可见性 More...
 
async Task< int > SetRoomMaxPlayerCount (int count)
 设置房间最大玩家数量 More...
 
async Task< List< string > > SetRoomExpectedUserIds (List< string > expectedUserIds)
 设置期望用户 More...
 
async Task ClearRoomExpectedUserIds ()
 清空期望用户 Id 列表 More...
 
async Task< List< string > > AddRoomExpectedUserIds (List< string > expectedUserIds)
 增加期望用户 More...
 
async Task< List< string > > RemoveRoomExpectedUserIds (List< string > expectedUserIds)
 删除期望用户 More...
 
async Task< PlayerSetMaster (int newMasterId)
 设置房主 More...
 
async Task KickPlayer (int actorId, int code=0, string reason=null)
 将玩家踢出房间 More...
 
Task SendEvent (byte eventId, PlayObject eventData=null, SendEventOptions options=null)
 发送自定义事件 More...
 
async Task SetRoomCustomProperties (PlayObject properties, PlayObject expectedValues=null)
 设置房间自定义属性 More...
 
async Task SetPlayerCustomProperties (int actorId, PlayObject properties, PlayObject expectedValues=null)
 设置玩家自定义属性 More...
 
void PauseMessageQueue ()
 暂停消息队列 More...
 
void ResumeMessageQueue ()
 恢复消息队列 More...
 
void Close ()
 关闭服务 More...
 
void _Disconnect ()
 

Public Attributes

List< LobbyRoomLobbyRoomList
 大厅房间列表 More...
 

Properties

string AppId [get]
 LeanCloud App Id More...
 
string AppKey [get]
 LeanCloud App Key More...
 
string UserId [get]
 用户唯一 Id More...
 
bool Ssl [get]
 是否启用 SSL More...
 
string GameVersion [get]
 客户端版本号,不同的版本号的玩家不会匹配到相同的房间 More...
 
Room Room [get]
 当前房间对象 More...
 
Player Player [get, set]
 当前玩家对象 More...
 

Events

Action< List< LobbyRoom > > OnLobbyRoomListUpdated
 大厅房间列表更新事件 More...
 
Action< PlayerOnPlayerRoomJoined
 有玩家加入房间事件 More...
 
Action< PlayerOnPlayerRoomLeft
 有玩家离开房间事件 More...
 
Action< PlayerOnMasterSwitched
 房主切换事件 More...
 
Action< PlayObjectOnRoomCustomPropertiesChanged
 房间自定义属性更新事件 More...
 
Action< PlayObjectOnRoomSystemPropertiesChanged
 房间系统属性更新事件,目前包括:房间开关,可见性,最大玩家数量,预留玩家 Id 列表 More...
 
Action< Player, PlayObjectOnPlayerCustomPropertiesChanged
 玩家自定义属性更新事件 More...
 
Action< PlayerOnPlayerActivityChanged
 玩家在线 / 离线变化事件 More...
 
Action< byte, PlayObject, int > OnCustomEvent
 用户自定义事件 More...
 
Action< int?, string > OnRoomKicked
 被踢出房间事件 More...
 
Action OnDisconnected
 断线事件 More...
 
Action< int, string > OnError
 错误事件 More...
 

Constructor & Destructor Documentation

LeanCloud.Play.Client.Client ( string  appId,
string  appKey,
string  userId,
bool  ssl = true,
string  gameVersion = "0.0.1",
string  playServer = null 
)
inline

Client 构造方法

Parameters
appIdLeanCloud App Id
appKeyLeanCloud App Key
userId用户唯一 Id
ssl是否启用 SSL
gameVersion游戏版本号
playServer游戏服务器地址

Member Function Documentation

void LeanCloud.Play.Client._Disconnect ( )
inline
async Task<List<string> > LeanCloud.Play.Client.AddRoomExpectedUserIds ( List< string >  expectedUserIds)
inline

增加期望用户

Returns
The room expected user identifiers.
Parameters
expectedUserIds增加的期望用户 Id 列表
async Task LeanCloud.Play.Client.ClearRoomExpectedUserIds ( )
inline

清空期望用户 Id 列表

Returns
The room expected user identifiers.
void LeanCloud.Play.Client.Close ( )
inline

关闭服务

async Task<Client> LeanCloud.Play.Client.Connect ( )
inline

连接

Returns
The connect.
async Task<Room> LeanCloud.Play.Client.CreateRoom ( string  roomName = null,
RoomOptions  roomOptions = null,
List< string >  expectedUserIds = null 
)
inline

创建房间

Returns
The room.
Parameters
roomName房间唯一 Id
roomOptions创建房间选项
expectedUserIds期望用户 Id 列表
async Task LeanCloud.Play.Client.JoinLobby ( )
inline

加入大厅,会接收到大厅房间列表更新的事件

Returns
The lobby.
async Task<Room> LeanCloud.Play.Client.JoinOrCreateRoom ( string  roomName,
RoomOptions  roomOptions = null,
List< string >  expectedUserIds = null 
)
inline

加入或创建房间,如果房间 Id 存在,则加入;否则根据 roomOptions 和 expectedUserIds 创建新的房间

Returns
The or create room.
Parameters
roomName房间 Id
roomOptions创建房间选项
expectedUserIds期望用户 Id 列表
async Task<Room> LeanCloud.Play.Client.JoinRandomRoom ( PlayObject  matchProperties = null,
List< string >  expectedUserIds = null 
)
inline

随机加入房间

Returns
The random room.
Parameters
matchProperties匹配属性
expectedUserIds期望用户 Id 列表
async Task<Room> LeanCloud.Play.Client.JoinRoom ( string  roomName,
List< string >  expectedUserIds = null 
)
inline

加入房间

Returns
The room.
Parameters
roomName房间 Id
expectedUserIds期望用户 Id 列表
async Task LeanCloud.Play.Client.KickPlayer ( int  actorId,
int  code = 0,
string  reason = null 
)
inline

将玩家踢出房间

Returns
The player.
Parameters
actorId玩家的 Actor Id
code附加码
reason附加消息
async Task LeanCloud.Play.Client.LeaveRoom ( )
inline

离开房间

Returns
The room.
async Task<LobbyRoom> LeanCloud.Play.Client.MatchRandom ( string  piggybackUserId,
PlayObject  matchProperties = null,
List< string >  expectedUserIds = null 
)
inline

匹配房间(不加入)

Returns
The random.
Parameters
piggybackUserId占位用户 Id
matchProperties匹配属性
void LeanCloud.Play.Client.PauseMessageQueue ( )
inline

暂停消息队列

async Task<Room> LeanCloud.Play.Client.ReconnectAndRejoin ( )
inline

重连并返回上一个加入的房间

Returns
The and rejoin.
async Task<Room> LeanCloud.Play.Client.RejoinRoom ( string  roomName)
inline

返回房间

Returns
The room.
Parameters
roomName房间 Id
async Task<List<string> > LeanCloud.Play.Client.RemoveRoomExpectedUserIds ( List< string >  expectedUserIds)
inline

删除期望用户

Returns
The room expected user identifiers.
Parameters
expectedUserIds删除的期望用户 Id 列表
void LeanCloud.Play.Client.ResumeMessageQueue ( )
inline

恢复消息队列

Task LeanCloud.Play.Client.SendEvent ( byte  eventId,
PlayObject  eventData = null,
SendEventOptions  options = null 
)
inline

发送自定义事件

Returns
The event.
Parameters
eventId事件 Id
eventData事件参数
options事件选项
async Task<Player> LeanCloud.Play.Client.SetMaster ( int  newMasterId)
inline

设置房主

Returns
The master.
Parameters
newMasterId新房主的 Actor Id
async Task LeanCloud.Play.Client.SetPlayerCustomProperties ( int  actorId,
PlayObject  properties,
PlayObject  expectedValues = null 
)
inline

设置玩家自定义属性

Returns
The player custom properties.
Parameters
actorId玩家 Actor Id
properties自定义属性
expectedValues用于 CAS 的期望属性
async Task LeanCloud.Play.Client.SetRoomCustomProperties ( PlayObject  properties,
PlayObject  expectedValues = null 
)
inline

设置房间自定义属性

Returns
The room custom properties.
Parameters
properties自定义属性
expectedValues用于 CAS 的期望属性
async Task<List<string> > LeanCloud.Play.Client.SetRoomExpectedUserIds ( List< string >  expectedUserIds)
inline

设置期望用户

Returns
The room expected user identifiers.
Parameters
expectedUserIds期望用户 Id 列表
async Task<int> LeanCloud.Play.Client.SetRoomMaxPlayerCount ( int  count)
inline

设置房间最大玩家数量

Returns
The room max player count.
Parameters
count数量
async Task<bool> LeanCloud.Play.Client.SetRoomOpen ( bool  open)
inline

设置房间开启 / 关闭

Returns
The room open.
Parameters
open是否开启
async Task<bool> LeanCloud.Play.Client.SetRoomVisible ( bool  visible)
inline

设置房间可见性

Returns
The room visible.
Parameters
visible是否可见

Member Data Documentation

List<LobbyRoom> LeanCloud.Play.Client.LobbyRoomList

大厅房间列表

Property Documentation

string LeanCloud.Play.Client.AppId
get

LeanCloud App Id

The app identifier.

string LeanCloud.Play.Client.AppKey
get

LeanCloud App Key

The app key.

string LeanCloud.Play.Client.GameVersion
get

客户端版本号,不同的版本号的玩家不会匹配到相同的房间

The game version.

Player LeanCloud.Play.Client.Player
getset

当前玩家对象

The player.

Room LeanCloud.Play.Client.Room
get

当前房间对象

The room.

bool LeanCloud.Play.Client.Ssl
get

是否启用 SSL

true if ssl; otherwise, false.

string LeanCloud.Play.Client.UserId
get

用户唯一 Id

The user identifier.

Event Documentation

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 列表


The documentation for this class was generated from the following file: