Update Unreal Example to include Ask to Join (#125)

This commit is contained in:
Mason Sciotti 2018-02-12 13:47:38 -08:00 committed by GitHub
parent 453222075b
commit f5f2d69a72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
/.vscode/
/thirdparty/
.vs/
.DS_Store

View file

@ -59,7 +59,7 @@ static void JoinRequestHandler(const DiscordJoinRequest* request)
jr.username = ANSI_TO_TCHAR(request->username);
jr.discriminator = ANSI_TO_TCHAR(request->discriminator);
jr.avatar = ANSI_TO_TCHAR(request->avatar);
UE_LOG(Discord, Log, TEXT("Discord join request from %s#%s"), *jr.username, *jr.discriminator);
UE_LOG(Discord, Log, TEXT("Discord join request from %s - %s#%s"), *jr.userId, *jr.username, *jr.discriminator);
if (self) {
self->OnJoinRequest.Broadcast(jr);
}
@ -134,9 +134,6 @@ void UDiscordRpc::UpdatePresence()
auto spectateSecret = StringCast<ANSICHAR>(*RichPresence.spectateSecret);
rp.spectateSecret = spectateSecret.Get();
rp.startTimestamp = RichPresence.startTimestamp;
rp.endTimestamp = RichPresence.endTimestamp;
rp.partySize = RichPresence.partySize;
rp.partyMax = RichPresence.partyMax;
rp.instance = RichPresence.instance;
@ -148,3 +145,10 @@ void UDiscordRpc::ClearPresence()
{
Discord_ClearPresence();
}
void UDiscordRpc::Respond(const FString& userId, int reply)
{
UE_LOG(Discord, Log, TEXT("Responding %d to join request from %s"), reply, *userId);
FTCHARToUTF8 utf8_userid(*userId);
Discord_Respond(utf8_userid.Get(), reply);
}

View file

@ -111,6 +111,11 @@ public:
Category = "Discord")
void ClearPresence();
UFUNCTION(BlueprintCallable,
meta = (DisplayName = "Respond to join request", Keywords = "Discord rpc"),
Category = "Discord")
void Respond(const FString& userId, int reply);
UPROPERTY(BlueprintReadOnly,
meta = (DisplayName = "Is Discord connected", Keywords = "Discord rpc"),
Category = "Discord")