diff --git a/examples/unrealstatus/Content/MainScreenBP.uasset b/examples/unrealstatus/Content/MainScreenBP.uasset index 34aed50..e903b53 100644 Binary files a/examples/unrealstatus/Content/MainScreenBP.uasset and b/examples/unrealstatus/Content/MainScreenBP.uasset differ diff --git a/examples/unrealstatus/Content/ShowTheUILevel.umap b/examples/unrealstatus/Content/ShowTheUILevel.umap index 3074ffe..fc9228f 100644 Binary files a/examples/unrealstatus/Content/ShowTheUILevel.umap and b/examples/unrealstatus/Content/ShowTheUILevel.umap differ diff --git a/examples/unrealstatus/Plugins/discordrpc/Source/discordrpc/Private/DiscordRpcBlueprint.cpp b/examples/unrealstatus/Plugins/discordrpc/Source/discordrpc/Private/DiscordRpcBlueprint.cpp index 9c394c3..bfd21e8 100644 --- a/examples/unrealstatus/Plugins/discordrpc/Source/discordrpc/Private/DiscordRpcBlueprint.cpp +++ b/examples/unrealstatus/Plugins/discordrpc/Source/discordrpc/Private/DiscordRpcBlueprint.cpp @@ -81,3 +81,46 @@ void UDiscordRpc::RunCallbacks() { Discord_RunCallbacks(); } + +void UDiscordRpc::UpdatePresence() +{ + DiscordRichPresence rp{}; + + auto state = StringCast(*RichPresence.state); + rp.state = state.Get(); + + auto details = StringCast(*RichPresence.details); + rp.details = details.Get(); + + auto largeImageKey = StringCast(*RichPresence.largeImageKey); + rp.largeImageKey = largeImageKey.Get(); + + auto largeImageText = StringCast(*RichPresence.largeImageText); + rp.largeImageText = largeImageText.Get(); + + auto smallImageKey = StringCast(*RichPresence.smallImageKey); + rp.smallImageKey = smallImageKey.Get(); + + auto smallImageText = StringCast(*RichPresence.smallImageText); + rp.smallImageText = smallImageText.Get(); + + auto partyId = StringCast(*RichPresence.partyId); + rp.partyId = partyId.Get(); + + auto matchSecret = StringCast(*RichPresence.matchSecret); + rp.matchSecret = matchSecret.Get(); + + auto joinSecret = StringCast(*RichPresence.joinSecret); + rp.joinSecret = joinSecret.Get(); + + auto spectateSecret = StringCast(*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; + + Discord_UpdatePresence(&rp); +} diff --git a/examples/unrealstatus/Plugins/discordrpc/Source/discordrpc/Public/DiscordRpcBlueprint.h b/examples/unrealstatus/Plugins/discordrpc/Source/discordrpc/Public/DiscordRpcBlueprint.h index 6351404..2e55598 100644 --- a/examples/unrealstatus/Plugins/discordrpc/Source/discordrpc/Public/DiscordRpcBlueprint.h +++ b/examples/unrealstatus/Plugins/discordrpc/Source/discordrpc/Public/DiscordRpcBlueprint.h @@ -14,6 +14,46 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDiscordErrored, int, errorCode, co DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordJoin, const FString&, joinSecret); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordSpectate, const FString&, spectateSecret); +/** + * Rich presence data + */ +USTRUCT(BlueprintType) +struct FDiscordRichPresence { + GENERATED_USTRUCT_BODY() + + UPROPERTY(BlueprintReadWrite) + FString state; + UPROPERTY(BlueprintReadWrite) + FString details; + // todo, timestamps are 64bit, does that even matter? + UPROPERTY(BlueprintReadWrite) + int startTimestamp; + UPROPERTY(BlueprintReadWrite) + int endTimestamp; + UPROPERTY(BlueprintReadWrite) + FString largeImageKey; + UPROPERTY(BlueprintReadWrite) + FString largeImageText; + UPROPERTY(BlueprintReadWrite) + FString smallImageKey; + UPROPERTY(BlueprintReadWrite) + FString smallImageText; + UPROPERTY(BlueprintReadWrite) + FString partyId; + UPROPERTY(BlueprintReadWrite) + int partySize; + UPROPERTY(BlueprintReadWrite) + int partyMax; + UPROPERTY(BlueprintReadWrite) + FString matchSecret; + UPROPERTY(BlueprintReadWrite) + FString joinSecret; + UPROPERTY(BlueprintReadWrite) + FString spectateSecret; + UPROPERTY(BlueprintReadWrite) + bool instance; +}; + /** * */ @@ -33,6 +73,9 @@ public: UFUNCTION(BlueprintCallable, meta = (DisplayName = "Check for callbacks", Keywords = "Discord rpc"), Category = "Discord") void RunCallbacks(); + UFUNCTION(BlueprintCallable, meta = (DisplayName = "Send presence", Keywords = "Discord rpc"), Category = "Discord") + void UpdatePresence(); + UPROPERTY(BlueprintReadOnly, meta = (DisplayName = "Is Discord connected", Keywords = "Discord rpc"), Category = "Discord") bool IsConnected; @@ -51,4 +94,6 @@ public: UPROPERTY(BlueprintAssignable, meta = (DisplayName = "When Discord user presses spectate", Keywords = "Discord rpc"), Category = "Discord") FDiscordSpectate OnSpectate; + UPROPERTY(BlueprintReadWrite, meta = (DisplayName = "Rich presence info", Keywords = "Discord rpc"), Category = "Discord") + FDiscordRichPresence RichPresence; };