mirror of
https://github.com/yuzu-emu/discord-rpc.git
synced 2024-11-30 16:54:14 +01:00
Expose all the callback events, hook up connect/disconnect events in example
This commit is contained in:
parent
bd995f047d
commit
432166ef1d
Binary file not shown.
@ -11,13 +11,16 @@ static void ReadyHandler() {
|
||||
UE_LOG(Discord, Log, TEXT("Discord connected"));
|
||||
if (self) {
|
||||
self->IsConnected = true;
|
||||
self->OnConnected.Broadcast();
|
||||
}
|
||||
}
|
||||
|
||||
static void DisconnectHandler(int errorCode, const char* message) {
|
||||
UE_LOG(Discord, Log, TEXT("Discord disconnected (%d): %s"), errorCode, message);
|
||||
auto msg = FString(message);
|
||||
UE_LOG(Discord, Log, TEXT("Discord disconnected (%d): %s"), errorCode, *msg);
|
||||
if (self) {
|
||||
self->IsConnected = false;
|
||||
self->OnDisconnected.Broadcast(errorCode, msg);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -8,6 +8,12 @@
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(Discord, Log, All);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FDiscordConnected);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDiscordDisconnected, int, errorCode, const FString&, errorMessage);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDiscordErrored, int, errorCode, const FString&, errorMessage);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordJoin, const FString&, joinSecret);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordSpectate, const FString&, spectateSecret);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -18,15 +24,31 @@ class DISCORDRPC_API UDiscordRpc : public UObject
|
||||
|
||||
public:
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Discord initialize connection", Keywords = "Discord rpc"), Category = "Discord")
|
||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Initialize connection", Keywords = "Discord rpc"), Category = "Discord")
|
||||
void Initialize(const FString& applicationId, bool autoRegister);
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Discord shut down connection", Keywords = "Discord rpc"), Category = "Discord")
|
||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Shut down connection", Keywords = "Discord rpc"), Category = "Discord")
|
||||
void Shutdown();
|
||||
|
||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Discord check for callbacks", Keywords = "Discord rpc"), Category = "Discord")
|
||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Check for callbacks", Keywords = "Discord rpc"), Category = "Discord")
|
||||
void RunCallbacks();
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, meta = (DisplayName = "Discord connected", Keywords = "Discord rpc"), Category = "Discord")
|
||||
UPROPERTY(BlueprintReadOnly, meta = (DisplayName = "Is Discord connected", Keywords = "Discord rpc"), Category = "Discord")
|
||||
bool IsConnected;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "On connection", Keywords = "Discord rpc"), Category = "Discord")
|
||||
FDiscordConnected OnConnected;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "On disconnection", Keywords = "Discord rpc"), Category = "Discord")
|
||||
FDiscordDisconnected OnDisconnected;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "On error message", Keywords = "Discord rpc"), Category = "Discord")
|
||||
FDiscordErrored OnErrored;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "When Discord user presses join", Keywords = "Discord rpc"), Category = "Discord")
|
||||
FDiscordJoin OnJoin;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "When Discord user presses spectate", Keywords = "Discord rpc"), Category = "Discord")
|
||||
FDiscordSpectate OnSpectate;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user