跳到主要内容

Client InstantChat API Reference

Instant Chat is used for instant text chatting among multiple people. All players who join a given channel can chat with each other. When all the players in a chat leave the channel or go offline, the channel is automatically deleted.

API List

APIDescription
JoinInstantChatJoin a text channel chat.
LeaveInstantChatLeave a text channel chat.
SendInstantChatTextMsgSend instant text chat message.
SendInstantChatCustomMsgSend instant custom chat message.
GetInstantChatMembersGet all players in a channel.
GetInstantChatMemberIDsGet all player IDs in a channel.
GetInstantChatMemberCountGet the num of players in a channel.

Event List

EventDescription
OnReceiveInstantChatMsgThe event will be triggered when receive channel chat message.
OnInstantChatMemberJoinedThe event will be triggered when new players joined the chat channel.
OnInstantChatMemberLeftThe event will be triggered when player left the chat channel.

API Details

JoinInstantChat

Join a text channel chat.

/// <summary>Join a text channel chat.</summary>
/// <param name="chat_channel_id">A custom unique ID used to identify the channel (in game scope), must be 127 characters or less, can use battle-session-id which base on UUID with 36 characters.</param>
public void JoinInstantChat(string chat_channel_id, InstantChatDelegate0 callback);

Parameters:

ParamTypeDescription
chat_channel_idstringA custom unique ID used to identify the channel (in game scope), must be 127 characters or less, can use battle-session-id which base on UUID with 36 characters.
callbackInstantChatDelegate0

Return: void

LeaveInstantChat

Leave a text channel chat.

/// <summary>Leave a text channel chat.</summary>
/// <param name="chat_channel_id">The chat channel id to leave.</param>
public void LeaveInstantChat(string chat_channel_id, InstantChatDelegate1 callback);

Parameters:

ParamTypeDescription
chat_channel_idstringThe chat channel id to leave.
callbackInstantChatDelegate1

Return: void

SendInstantChatTextMsg

Send instant text chat message.

/// <summary>Send instant text chat message.</summary>
/// <param name="pgos_params">Request struct for sending instant chat message.</param>
public void SendInstantChatTextMsg(SendInstantChatMsgParams pgos_params, InstantChatDelegate2 callback);

Parameters:

ParamTypeDescription
pgos_paramsSendInstantChatMsgParamsRequest struct for sending instant chat message.
callbackInstantChatDelegate2

Return: void

SendInstantChatCustomMsg

Send instant custom chat message.

/// <summary>Send instant custom chat message.</summary>
/// <param name="pgos_params">Request struct for sending instant chat message.</param>
public void SendInstantChatCustomMsg(SendInstantChatMsgParams pgos_params, InstantChatDelegate2 callback);

Parameters:

ParamTypeDescription
pgos_paramsSendInstantChatMsgParamsRequest struct for sending instant chat message.
callbackInstantChatDelegate2

Return: void

GetInstantChatMembers

Get all players in a channel.

/// <summary>Get all players in a channel.</summary>
/// <param name="chat_channel_id">The chat channel id.</param>
public void GetInstantChatMembers(string chat_channel_id, InstantChatDelegate3 callback);

Parameters:

ParamTypeDescription
chat_channel_idstringThe chat channel id.
callbackInstantChatDelegate3

Return: void

GetInstantChatMemberIDs

Get all player IDs in a channel.

/// <summary>Get all player IDs in a channel.</summary>
/// <param name="chat_channel_id">The chat channel id.</param>
public void GetInstantChatMemberIDs(string chat_channel_id, InstantChatDelegate4 callback);

Parameters:

ParamTypeDescription
chat_channel_idstringThe chat channel id.
callbackInstantChatDelegate4

Return: void

GetInstantChatMemberCount

Get the num of players in a channel.

/// <summary>Get the num of players in a channel.</summary>
/// <param name="chat_channel_id">The chat channel id.</param>
public void GetInstantChatMemberCount(string chat_channel_id, InstantChatDelegate5 callback);

Parameters:

ParamTypeDescription
chat_channel_idstringThe chat channel id.
callbackInstantChatDelegate5

Return: void

Event Details

OnReceiveInstantChatMsg

The event will be triggered when receive channel chat message.

/// <summary>The event will be triggered when receive channel chat message.</summary>
public event InstantChatDelegate6 OnReceiveInstantChatMsg;

Type Reference:

OnInstantChatMemberJoined

The event will be triggered when new players joined the chat channel.

/// <summary>The event will be triggered when new players joined the chat channel.</summary>
public event InstantChatDelegate7 OnInstantChatMemberJoined;

Type Reference:

OnInstantChatMemberLeft

The event will be triggered when player left the chat channel.

/// <summary>The event will be triggered when player left the chat channel.</summary>
public event InstantChatDelegate8 OnInstantChatMemberLeft;

Type Reference:

All Delegates

public delegate void InstantChatDelegate0(PgosResult a0, JoinInstantChatResult a1);
public delegate void InstantChatDelegate1(PgosResult a0);
public delegate void InstantChatDelegate2(PgosResult a0, ChatMsgInfo a1);
public delegate void InstantChatDelegate3(PgosResult a0, GetInstantChatMembersResult a1);
public delegate void InstantChatDelegate4(PgosResult a0, GetInstantChatMemberIDsResult a1);
public delegate void InstantChatDelegate5(PgosResult a0, GetInstantChatMemberCountResult a1);
public delegate void InstantChatDelegate6(ReceiveInstantChatMsgEvt a0);
public delegate void InstantChatDelegate7(InstantChatMemberJoinedEvt a0);
public delegate void InstantChatDelegate8(InstantChatMemberLeftEvt a0);

Type Reference: