PICO Platform Unity SDK
|
Static Public Member Functions | |
static RoomOptions | GetCreatePrivateRoomOptions (Dictionary< string, string > dataStore) |
Gets the room options for create a private room. You can use it when you use RoomService.CreateAndJoinPrivate2. More... | |
static RoomOptions | GetJoinOrCreateNamedRoomOptions (Dictionary< string, string > dataStore, string name, string password) |
Gets the room options for joining or creating a named room. You can use it when you use RoomService.JoinOrCreateNamedRoom. More... | |
static Task< RoomList > | GetNamedRooms (int pageIndex, int pageSize) |
Gets the list of named rooms created for the app. More... | |
static Task< Room > | JoinOrCreateNamedRoom (RoomJoinPolicy joinPolicy, bool createIfNotExist, uint maxUsers, RoomOptions options) |
Join or create a named room. More... | |
static Task | LaunchInvitableUserFlow (UInt64 roomID) |
Launches the invitation flow to let the current user invite friends to a specified room. This launches the system default invite UI where all of the user's friends are displayed. This is intended to be a shortcut for developers not wanting to build their own invite-friends UI. More... | |
static Task< Room > | UpdateDataStore (UInt64 roomId, Dictionary< string, string > data) |
Updates the data store of the current room (the caller should be the room owner). More... | |
static Task< Room > | CreateAndJoinPrivate2 (RoomJoinPolicy policy, uint maxUsers, RoomOptions roomOptions) |
Creates a new private room and joins it. More... | |
static Task< Room > | Get (UInt64 roomId) |
Gets the information about a specified room. More... | |
static Task< Room > | GetCurrent () |
Gets the data of the room you are currently in. More... | |
static Task< Room > | GetCurrentForUser (string userId) |
Gets the current room of the specified user. More... | |
static Task< UserList > | GetInvitableUsers2 (RoomOptions roomOptions=null) |
Gets a list of members the user can invite to the room. These members are drawn from the user's friends list and recently encountered list, and filtered based on relevance and interests. More... | |
static Task< RoomList > | GetModeratedRooms (int index, int size) |
Gets the list of moderated rooms created for the application. More... | |
static Task< Room > | InviteUser (UInt64 roomId, string token) |
Invites a user to the current room. More... | |
static Task< Room > | Join2 (UInt64 roomId, RoomOptions options) |
Joins the target room and meanwhile leaves the current room. More... | |
static Task< Room > | KickUser (UInt64 roomId, string userId, int kickDuration) |
Kicks a user out of a room. For use by homeowners only. More... | |
static Task< Room > | Leave (UInt64 roomId) |
Leaves the current room. More... | |
static Task< Room > | SetDescription (UInt64 roomId, string description) |
Sets the description of a room. For use by homeowners only. More... | |
static Task< Room > | UpdateMembershipLockStatus (UInt64 roomId, RoomMembershipLockStatus membershipLockStatus) |
Locks/unlocks the membership of a room (the caller should be the room owner) to allow/disallow new members from being able to join the room. More... | |
static Task | UpdateOwner (UInt64 roomId, string userId) |
Modifies the owner of the room, this person needs to be the person in this room. More... | |
static Task< Room > | UpdatePrivateRoomJoinPolicy (UInt64 roomId, RoomJoinPolicy policy) |
Sets the join policy for a specified private room. More... | |
static void | SetRoomInviteAcceptedNotificationCallback (Message< string >.Handler handler) |
Sets the callback to get notified when the user has accepted an invitation. More... | |
static void | SetUpdateNotificationCallback (Message< Room >.Handler handler) |
Sets the callback to get notified when the current room has been updated. Use Message.Data to extract the room. More... | |
static void | SetKickUserNotificationCallback (Message< Room >.Handler handler) |
Sets the callback to get notified when the user has been kicked out of a room. Listen to this event to receive a relevant message. Use Message.Data to extract the room. More... | |
static void | SetSetDescriptionNotificationCallback (Message< Room >.Handler handler) |
Sets the callback to get notified when the room description has been updated. Listen to this event to receive a relevant message. Use Message.Data to extract the room. More... | |
static void | SetUpdateDataStoreNotificationCallback (Message< Room >.Handler handler) |
Sets the callback to get notified when the room data has been modified. Listen to this event to receive a relevant message. Use Message.Data to extract the room. More... | |
static void | SetLeaveNotificationCallback (Message< Room >.Handler handler) |
If a player is passively removed from a room (for example, if they initiate another match within the room and are subsequently removed by the system or if they are kicked out of the room), they will receive a notification. Listen to this event to receive a relevant message. Use Message.Data to extract the room. More... | |
static void | SetJoin2NotificationCallback (Message< Room >.Handler handler) |
If a player comes across network or disaster recovery problems after joining a room, they may not receive a notification confirming that they've successfully entered the room. In such cases, the server will resend the notification to ensure that the user receives it. Use Message.Data to extract the room. More... | |
static void | SetUpdateOwnerNotificationCallback (Message.Handler handler) |
When there is a change in the room owner, the new owner will receive a notification. Listen to this event to receive a relevant message. Use Message.Data to extract the room. More... | |
static void | SetUpdateMembershipLockStatusNotificationCallback (Message< Room >.Handler handler) |
Sets the callback to get notified when the membership status of a room has been changed. Listen to this event to receive a relevant message. Use Message.Data to extract the room. More... | |
|
inlinestatic |
Gets the room options for create a private room. You can use it when you use RoomService.CreateAndJoinPrivate2.
dataStore | The key/value pairs to add. |
|
inlinestatic |
Gets the room options for joining or creating a named room. You can use it when you use RoomService.JoinOrCreateNamedRoom.
dataStore | The key/value pairs to add. |
name | The name of the named room. |
password | The password of the named room. |
Gets the list of named rooms created for the app.
pageIndex | Defines which page of entries to return. The index for the first page is 0 . |
pageSize | The number of entries returned on each page. Value range: [5,20]. |
The request ID of this async function.
A message of type MessageType.Room_GetNamedRooms
will be generated in response. First call Message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type RoomList
. Extract the payload from the message handle with Message.Data
.
|
inlinestatic |
Join or create a named room.
joinPolicy | The join policy of the room. Currently only support 'RoomJoinPolicy Everyone'. |
createIfNotExist | Determines whether to create a new room if the named room does not exist:
|
maxUsers | The maximum number of users allowed in the room, including the creator. |
options | Additional room configuration for this request. |
The request ID of this async function.
A message of type MessageType.Room_JoinNamed
will be generated in response. First call Message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
. Extract the payload from the message handle with Message.Data
.
|
inlinestatic |
Launches the invitation flow to let the current user invite friends to a specified room. This launches the system default invite UI where all of the user's friends are displayed. This is intended to be a shortcut for developers not wanting to build their own invite-friends UI.
roomID | The ID of the room. |
MessageType.Room_LaunchInvitableUserFlow
will be generated in response. Call message.IsError()
to check if any error has occurred.
|
inlinestatic |
Updates the data store of the current room (the caller should be the room owner).
roomId | The ID of the room that you currently own (call Room.OwnerOptional to check). |
data | The key/value pairs to add or update. Null value will clear a given key. |
The request ID of this async function.
Error Code | Error Message |
---|---|
3006004 | change datastore failed: need room owner |
A message of type MessageType.Room_UpdateDataStore
will be generated in response. First call Message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
. Extract the payload from the message handle with Message.Data
.
|
inlinestatic |
Creates a new private room and joins it.
policy | Specifies who can join the room:
|
maxUsers | The maximum number of members allowed in the room, including the room creator. |
roomOptions | Room configuration for this request. |
Request information of type Task, including the request id, and its response message will contain data of type Room
.
Error Code | Error Message |
---|---|
3006101 | room create: unknown error |
3006114 | setting of 'room max user' is too large |
A message of type MessageType.Room_CreateAndJoinPrivate2
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
. Extract the payload from the message handle with message.Data
.
Gets the information about a specified room.
roomId | The ID of the room to get information for. |
Request information of type Task
, including the request id, and its response message will contain data of type Room
.
Error Code | Error Message |
---|---|
3006103 | invalid room |
3006301 | server error: unknown |
A message of type MessageType.Room_Get
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
. Extract the payload from the message handle with message.Data
.
Gets the data of the room you are currently in.
Request information of type Task
, including the request id, and its response message will contain data of type Room
.
Error Code | Error Message |
---|---|
3006104 | not in room |
A message of type MessageType.Room_GetCurrent
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload with of type Room
. Extract the payload from the message handle with message.Data
.
Gets the current room of the specified user.
userId | The ID of the user. |
Request information of type Task
, including the request id, and its response message will contain data of type Room
.
Error Code | Error Message |
---|---|
3006104 | not in room |
3006009 | tgt player is not in game now |
3006301 | server error: unknown |
A message of type MessageType.Room_GetCurrentForUser
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
. Extract the payload from the message handle with message.Data
.
|
inlinestatic |
Gets a list of members the user can invite to the room. These members are drawn from the user's friends list and recently encountered list, and filtered based on relevance and interests.
roomOptions | Additional configuration for this request. If you pass null , the response will return code 0 . |
Request information of type Task
, including the request id, and its response message will contain data of type UserList
.
A message of type MessageType.Room_GetInvitableUsers2
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type UserList
. Extract the payload from the message handle with message.Data
.
Gets the list of moderated rooms created for the application.
index | Start page index. |
size | Page entry number in response (should range from 5 to 20 ). |
Request information of type Task
, including the request id, and its response message will contain data of type RoomList
.
Error Code | Error Message |
---|---|
3006301 | server error: unknown |
A message of type MessageType.Room_GetModeratedRooms
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type RoomList
, the room info does not contain the UserList
info. Extract the payload from the message handle with message.Data
.
Invites a user to the current room.
MessageType.Notification_Room_InviteReceived
. roomId | The ID of the room. |
token | The user's invitation token, which is returned by RoomService.GetInvitableUsers2() . |
Request information of type Task
, including the request id, and its response message will contain data of type Room
.
A message of type MessageType.Room_InviteUser
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
. Extract the payload from the message handle with message.Data
.
|
inlinestatic |
Joins the target room and meanwhile leaves the current room.
roomId | The ID of the room to join. |
options | (Optional) Additional room configuration for this request. |
Request information of type Task
, including the request id, and its response message will contain data of type Room
.
Error Code | Error Message |
---|---|
3006401 | logic state checking failed |
3006103 | invalid room |
3006102 | duplicate join room(regarded as normal entry) |
3006106 | exceed max room player number |
3006105 | illegal enter request(Players outside the legal list enter) |
3006108 | room is locked |
A message of type MessageType.Room_Join2
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
. Extract the payload from the message handle with message.Data
.
Kicks a user out of a room. For use by homeowners only.
roomId | The ID of the room. |
userId | The ID of the user to be kicked (cannot be yourself). |
kickDuration | The Length of the ban (in seconds). |
Request information of type Task
, including the request id, and its response message will contain data of type Room
.
Error Code | Error Message |
---|---|
3006006 | kick user failed: need room owner |
3006007 | kick user failed: tgt user is not in the room |
3006008 | kick user failed: can not kick self |
A message of type MessageType.Room_KickUser
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
. Extract the payload from the message handle with message.Data
.
Leaves the current room.
roomId | The ID of the room. |
Request information of type Task
, including the request id, and its response message will contain data of type Room
.
Error Code | Error Message |
---|---|
3006401 | logic state checking failed(e.g. not in the room) |
3006301 | server error: unknown |
A message of type MessageType.Room_Leave
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
. Extract the payload from the message handle with message.Data
.
Sets the description of a room. For use by homeowners only.
roomId | The ID of the room to set description for. |
description | The new description of the room. |
Request information of type Task
, including the request id, and its response message will contain data of type Room
.
Error Code | Error Message |
---|---|
3006005 | set description failed: need room owner |
A message of type MessageType.Room_SetDescription
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
. Extract the payload from the message handle with message.Data
.
|
inlinestatic |
Locks/unlocks the membership of a room (the caller should be the room owner) to allow/disallow new members from being able to join the room.
Join2()
, invitations, etc. Users that are in the room at the time of lock will be able to rejoin.roomId | The ID of the room to lock/unlock membership for. |
membershipLockStatus | The new membership status to set for the room:
|
Request information of type Task
, including the request id, and its response message will contain data of type Room
.
Error Code | Error Message |
---|---|
3006104 | not in room |
3006109 | update membership lock: need room owner |
A message of type MessageType.Room_UpdateMembershipLockStatus
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
Extract the payload from the message handle with message.Data
.
|
inlinestatic |
Modifies the owner of the room, this person needs to be the person in this room.
roomId | The ID of the room to change ownership for. |
userId | The ID of the new user to own the room. The new user must be in the same room. |
Request information of type Task
, including the request id, and its response message does not contain data.
Error Code | Error Message |
---|---|
3006001 | change owner failed: need room owner |
3006003 | change owner failed: duplicate setting |
3006002 | change owner failed: new owner not in this room |
A message of type MessageType.Room_UpdateOwner
will be generated in response. Call message.IsError()
to check if any error has occurred.
|
inlinestatic |
Sets the join policy for a specified private room.
roomId | The ID of the room you want to set join policy for. |
policy | Specifies who can join the room:
|
Request information of type Task
, including the request id, and its response message will contain data of type Room
.
Error Code | Error Message |
---|---|
3006104 | not in room |
3006112 | update room join policy: need room owner |
A message of type MessageType.Room_UpdatePrivateRoomJoinPolicy
will be generated in response. First call message.IsError()
to check if any error has occurred. If no error has occurred, the message will contain a payload of type Room
. Extract the payload from the message handle with message.Data
.
|
inlinestatic |
Sets the callback to get notified when the user has accepted an invitation.
handler | The callback function will be called when receiving the Notification_Room_InviteAccepted message. |
Sets the callback to get notified when the current room has been updated. Use Message.Data
to extract the room.
handler | The callback function will be called when receiving the Notification_Room_RoomUpdate message. |
Sets the callback to get notified when the user has been kicked out of a room. Listen to this event to receive a relevant message. Use Message.Data
to extract the room.
handler | The callback function will be called when receiving the Room_KickUser message and the value of requestID is 0 . |
Sets the callback to get notified when the room description has been updated. Listen to this event to receive a relevant message. Use Message.Data
to extract the room.
handler | The callback function will be called when receiving the Room_SetDescription message and the value of requestID is 0 . |
Sets the callback to get notified when the room data has been modified. Listen to this event to receive a relevant message. Use Message.Data
to extract the room.
handler | The callback function will be called when receiving the Room_UpdateDataStore message and the value of requestID is 0 . |
If a player is passively removed from a room (for example, if they initiate another match within the room and are subsequently removed by the system or if they are kicked out of the room), they will receive a notification. Listen to this event to receive a relevant message. Use Message.Data
to extract the room.
handler | The callback function will be called when receiving the Room_Leave message and the value of requestID is 0 . |
If a player comes across network or disaster recovery problems after joining a room, they may not receive a notification confirming that they've successfully entered the room. In such cases, the server will resend the notification to ensure that the user receives it. Use Message.Data
to extract the room.
handler | The callback function will be called when receiving the Room_Join2 message and the value of requestID is 0 . |
|
inlinestatic |
When there is a change in the room owner, the new owner will receive a notification. Listen to this event to receive a relevant message. Use Message.Data
to extract the room.
handler | The callback function will be called when receiving the Room_UpdateOwner message and the value of requestID is 0 . |
|
inlinestatic |
Sets the callback to get notified when the membership status of a room has been changed. Listen to this event to receive a relevant message. Use Message.Data
to extract the room.
handler | The callback function will be called when receiving the "Room_UpdateMembershipLockStatus" message and the value of requestID is 0 . |