autoformat missed these before?
This commit is contained in:
parent
4cf8ca5670
commit
8bceae0a3a
7 changed files with 79 additions and 58 deletions
|
@ -9,7 +9,8 @@
|
||||||
|
|
||||||
void FdiscordrpcModule::StartupModule()
|
void FdiscordrpcModule::StartupModule()
|
||||||
{
|
{
|
||||||
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
// This code will execute after your module is loaded into memory; the exact timing is specified
|
||||||
|
// in the .uplugin file per-module
|
||||||
|
|
||||||
// Get the base directory of this plugin
|
// Get the base directory of this plugin
|
||||||
FString BaseDir = IPluginManager::Get().FindPlugin("discordrpc")->GetBaseDir();
|
FString BaseDir = IPluginManager::Get().FindPlugin("discordrpc")->GetBaseDir();
|
||||||
|
@ -17,22 +18,26 @@ void FdiscordrpcModule::StartupModule()
|
||||||
// Add on the relative location of the third party dll and load it
|
// Add on the relative location of the third party dll and load it
|
||||||
FString LibraryPath;
|
FString LibraryPath;
|
||||||
#if PLATFORM_WINDOWS
|
#if PLATFORM_WINDOWS
|
||||||
LibraryPath = FPaths::Combine(*BaseDir, TEXT("Binaries/ThirdParty/discordrpcLibrary/Win64/discord-rpc.dll"));
|
LibraryPath = FPaths::Combine(
|
||||||
|
*BaseDir, TEXT("Binaries/ThirdParty/discordrpcLibrary/Win64/discord-rpc.dll"));
|
||||||
#elif PLATFORM_MAC
|
#elif PLATFORM_MAC
|
||||||
LibraryPath = FPaths::Combine(*BaseDir, TEXT("Source/ThirdParty/discordrpcLibrary/Mac/Release/libdiscord-rpc.dylib"));
|
LibraryPath = FPaths::Combine(
|
||||||
|
*BaseDir, TEXT("Source/ThirdParty/discordrpcLibrary/Mac/Release/libdiscord-rpc.dylib"));
|
||||||
#endif // PLATFORM_WINDOWS
|
#endif // PLATFORM_WINDOWS
|
||||||
|
|
||||||
DiscordLibraryHandle = !LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath) : nullptr;
|
DiscordLibraryHandle =
|
||||||
|
!LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath) : nullptr;
|
||||||
|
|
||||||
if (!DiscordLibraryHandle)
|
if (!DiscordLibraryHandle) {
|
||||||
{
|
FMessageDialog::Open(
|
||||||
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("ThirdPartyLibraryError", "Failed to load discord-rpc library"));
|
EAppMsgType::Ok, LOCTEXT("ThirdPartyLibraryError", "Failed to load discord-rpc library"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FdiscordrpcModule::ShutdownModule()
|
void FdiscordrpcModule::ShutdownModule()
|
||||||
{
|
{
|
||||||
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
|
// This function may be called during shutdown to clean up your module. For modules that
|
||||||
|
// support dynamic reloading,
|
||||||
// we call this function before unloading the module.
|
// we call this function before unloading the module.
|
||||||
|
|
||||||
// Free the dll handle
|
// Free the dll handle
|
||||||
|
|
|
@ -9,8 +9,16 @@
|
||||||
DECLARE_LOG_CATEGORY_EXTERN(Discord, Log, All);
|
DECLARE_LOG_CATEGORY_EXTERN(Discord, Log, All);
|
||||||
|
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FDiscordConnected);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FDiscordConnected);
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDiscordDisconnected, int, errorCode, const FString&, errorMessage);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDiscordDisconnected,
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDiscordErrored, int, errorCode, const FString&, errorMessage);
|
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(FDiscordJoin, const FString&, joinSecret);
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordSpectate, const FString&, spectateSecret);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDiscordSpectate, const FString&, spectateSecret);
|
||||||
|
|
||||||
|
@ -58,42 +66,62 @@ struct FDiscordRichPresence {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
UCLASS(BlueprintType, meta = (DisplayName = "Discord RPC"), Category = "Discord")
|
UCLASS(BlueprintType, meta = (DisplayName = "Discord RPC"), Category = "Discord")
|
||||||
class DISCORDRPC_API UDiscordRpc : public UObject
|
class DISCORDRPC_API UDiscordRpc : public UObject {
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
UFUNCTION(BlueprintCallable,
|
||||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Initialize connection", Keywords = "Discord rpc"), Category = "Discord")
|
meta = (DisplayName = "Initialize connection", Keywords = "Discord rpc"),
|
||||||
|
Category = "Discord")
|
||||||
void Initialize(const FString& applicationId, bool autoRegister);
|
void Initialize(const FString& applicationId, bool autoRegister);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Shut down connection", Keywords = "Discord rpc"), Category = "Discord")
|
UFUNCTION(BlueprintCallable,
|
||||||
|
meta = (DisplayName = "Shut down connection", Keywords = "Discord rpc"),
|
||||||
|
Category = "Discord")
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Check for callbacks", Keywords = "Discord rpc"), Category = "Discord")
|
UFUNCTION(BlueprintCallable,
|
||||||
|
meta = (DisplayName = "Check for callbacks", Keywords = "Discord rpc"),
|
||||||
|
Category = "Discord")
|
||||||
void RunCallbacks();
|
void RunCallbacks();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Send presence", Keywords = "Discord rpc"), Category = "Discord")
|
UFUNCTION(BlueprintCallable,
|
||||||
|
meta = (DisplayName = "Send presence", Keywords = "Discord rpc"),
|
||||||
|
Category = "Discord")
|
||||||
void UpdatePresence();
|
void UpdatePresence();
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadOnly, meta = (DisplayName = "Is Discord connected", Keywords = "Discord rpc"), Category = "Discord")
|
UPROPERTY(BlueprintReadOnly,
|
||||||
|
meta = (DisplayName = "Is Discord connected", Keywords = "Discord rpc"),
|
||||||
|
Category = "Discord")
|
||||||
bool IsConnected;
|
bool IsConnected;
|
||||||
|
|
||||||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "On connection", Keywords = "Discord rpc"), Category = "Discord")
|
UPROPERTY(BlueprintAssignable,
|
||||||
|
meta = (DisplayName = "On connection", Keywords = "Discord rpc"),
|
||||||
|
Category = "Discord")
|
||||||
FDiscordConnected OnConnected;
|
FDiscordConnected OnConnected;
|
||||||
|
|
||||||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "On disconnection", Keywords = "Discord rpc"), Category = "Discord")
|
UPROPERTY(BlueprintAssignable,
|
||||||
|
meta = (DisplayName = "On disconnection", Keywords = "Discord rpc"),
|
||||||
|
Category = "Discord")
|
||||||
FDiscordDisconnected OnDisconnected;
|
FDiscordDisconnected OnDisconnected;
|
||||||
|
|
||||||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "On error message", Keywords = "Discord rpc"), Category = "Discord")
|
UPROPERTY(BlueprintAssignable,
|
||||||
|
meta = (DisplayName = "On error message", Keywords = "Discord rpc"),
|
||||||
|
Category = "Discord")
|
||||||
FDiscordErrored OnErrored;
|
FDiscordErrored OnErrored;
|
||||||
|
|
||||||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "When Discord user presses join", Keywords = "Discord rpc"), Category = "Discord")
|
UPROPERTY(BlueprintAssignable,
|
||||||
|
meta = (DisplayName = "When Discord user presses join", Keywords = "Discord rpc"),
|
||||||
|
Category = "Discord")
|
||||||
FDiscordJoin OnJoin;
|
FDiscordJoin OnJoin;
|
||||||
|
|
||||||
UPROPERTY(BlueprintAssignable, meta = (DisplayName = "When Discord user presses spectate", Keywords = "Discord rpc"), Category = "Discord")
|
UPROPERTY(BlueprintAssignable,
|
||||||
|
meta = (DisplayName = "When Discord user presses spectate", Keywords = "Discord rpc"),
|
||||||
|
Category = "Discord")
|
||||||
FDiscordSpectate OnSpectate;
|
FDiscordSpectate OnSpectate;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite, meta = (DisplayName = "Rich presence info", Keywords = "Discord rpc"), Category = "Discord")
|
UPROPERTY(BlueprintReadWrite,
|
||||||
|
meta = (DisplayName = "Rich presence info", Keywords = "Discord rpc"),
|
||||||
|
Category = "Discord")
|
||||||
FDiscordRichPresence RichPresence;
|
FDiscordRichPresence RichPresence;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,10 +4,8 @@
|
||||||
|
|
||||||
#include "ModuleManager.h"
|
#include "ModuleManager.h"
|
||||||
|
|
||||||
class FdiscordrpcModule : public IModuleInterface
|
class FdiscordrpcModule : public IModuleInterface {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** IModuleInterface implementation */
|
/** IModuleInterface implementation */
|
||||||
virtual void StartupModule() override;
|
virtual void StartupModule() override;
|
||||||
virtual void ShutdownModule() override;
|
virtual void ShutdownModule() override;
|
||||||
|
|
|
@ -3,4 +3,3 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
#include "unrealstatusGameModeBase.h"
|
#include "unrealstatusGameModeBase.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UNREALSTATUS_API AunrealstatusGameModeBase : public AGameModeBase
|
class UNREALSTATUS_API AunrealstatusGameModeBase : public AGameModeBase {
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue