跳到主要内容

Instant Chat

1. Instant Chat

PGOS Overlay currently provides different Instant chat features for a range of purposes.

Note: The first 3 instant chats are based on the party/lobby/battle services provided by PGOS. You should create parties/lobbies/battles via PGOS SDK module features, then deploy the PGOS Overlay port to create instant chat channels. Customized instant chat is recommended for developers who want to directly customize this operating logic independently.

1.1 Instant Chat For Team

Create a team via PGOS SDK port (Reference Docs) and deploy the following port to create a instant chat after obtaining the FClientPartyInfo data structure:

void UPgosBlueprintFunctionLibrary::SetCurrentParty(const FClientPartyInfo& PartyInfo);

Deploy UPgosBlueprintFunctionLibrary::SetCurrentParty(FClientPartyInfo()); to close the channel.

1.2 instant Chat For Lobby

Create a lobby via PGOS SDK port (Reference Docs) and deploy the following port to create a instant chat after obtaining the FClientLobbyDetailInfo data structure:

void UPgosBlueprintFunctionLibrary::SetCurrentLobby(const FClientLobbyDetailInfo& LobbyInfo);

Deploy UPgosBlueprintFunctionLibrary::SetCurrentLobby(FClientLobbyDetailInfo()); to close the channel.

1.3 instant Chat For Battle

Create a battle via PGOS SDK port, battles can be created via lobbies and match-making services, refer to (lobby docs/matchmaking docs/battle session docs for more information.

Deploy the following port to create a instant chat after obtaining the FClientBattleSessionInfo data structure:

void UPgosBlueprintFunctionLibrary::SetCurrentBattle(const FClientBattleSessionInfo& BattleSessionInfo, const FString& BattleTeamName, const int32 BattleTeamId);

Deploy UPgosBlueprintFunctionLibrary::SetCurrentBattle(FClientBattleSessionInfo(), FString()); to close the channel.

1.4 Customized Channels

Customized channels are for cases where developers want to process instant chat member structures on their own, for example in certain games with their own unique battle faction logic.

Note: Complete customized channel features are still under development. Customized channel creation features based on API are currently provided.

// Create a customized channel with a designated ID and Name (return directly if a customized channel with such an ID already exists)
UPgosChatChannel* UPgosBlueprintFunctionLibrary::CreateCustomizedChannel(const FString& ChannelID, const FString& ChannelName, bool IsSetAsCurrent);

// Obtain customized channel with designated ID (return nullptr if the customized channel doesn't exist)
UPgosChatChannel* UPgosBlueprintFunctionLibrary::GetCustomizedChannel(const FString& ChannelID, bool IsSetAsCurrent);

// Exit the channel immediately
void UPgosChatChannel::Destroy();

1.4.1 Typical Use Cases for Customized Channels

  1. Create customized channel
UPgosChatChannel* ChatChannel = UPgosBlueprintFunctionLibrary::CreateCustomizedChannel(TEXT("1001"), TEXT("Guardians"));

This channel will be created in Overlay.

Text channel

Text Chatting

Voice channel

Voice Chatting

  1. Leave customized channel
UPgosChatChannel* ChatChannel = UPgosBlueprintFunctionLibrary::GetCustomizedChannel(TEXT("1001"));
if (IsValid(ChatChannel))
{
ChatChannel->Destroy();
}