Register upgrade (#2)

* Update init to take an optional Steam ID. Add register for steam game. Remove url from cmd line params to launched game.

* Start on a build script
This commit is contained in:
Chris Marsh
2017-08-30 15:17:47 -07:00
committed by GitHub
parent 8bceae0a3a
commit 794bbccd51
16 changed files with 167 additions and 33 deletions

View File

@ -53,7 +53,9 @@ static void SpectateGameHandler(const char* spectateSecret)
}
}
void UDiscordRpc::Initialize(const FString& applicationId, bool autoRegister)
void UDiscordRpc::Initialize(const FString& applicationId,
bool autoRegister,
const FString& optionalSteamId)
{
self = this;
IsConnected = false;
@ -68,7 +70,8 @@ void UDiscordRpc::Initialize(const FString& applicationId, bool autoRegister)
handlers.spectateGame = SpectateGameHandler;
}
auto appId = StringCast<ANSICHAR>(*applicationId);
Discord_Initialize((const char*)appId.Get(), &handlers, autoRegister);
auto steamId = StringCast<ANSICHAR>(*optionalSteamId);
Discord_Initialize((const char*)appId.Get(), &handlers, autoRegister, (const char*)steamId.Get());
}
void UDiscordRpc::Shutdown()

View File

@ -6,22 +6,19 @@
#include "CoreMinimal.h"
#include "DiscordRpcBlueprint.generated.h"
// unreal's header tool hates clang-format
// clang-format off
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_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);
// clang-format on
/**
* Rich presence data
*/
@ -73,7 +70,7 @@ public:
UFUNCTION(BlueprintCallable,
meta = (DisplayName = "Initialize connection", Keywords = "Discord rpc"),
Category = "Discord")
void Initialize(const FString& applicationId, bool autoRegister);
void Initialize(const FString& applicationId, bool autoRegister, const FString& optionalSteamId);
UFUNCTION(BlueprintCallable,
meta = (DisplayName = "Shut down connection", Keywords = "Discord rpc"),