autoformat missed these before?

This commit is contained in:
Chris Marsh 2017-08-29 12:42:10 -07:00
parent 4cf8ca5670
commit 8bceae0a3a
7 changed files with 79 additions and 58 deletions

View file

@ -9,37 +9,42 @@
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();
// 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
// we call this function before unloading the module. // support dynamic reloading,
// we call this function before unloading the module.
// Free the dll handle // Free the dll handle
FPlatformProcess::FreeDllHandle(DiscordLibraryHandle); FPlatformProcess::FreeDllHandle(DiscordLibraryHandle);
DiscordLibraryHandle = nullptr; DiscordLibraryHandle = nullptr;
} }
#undef LOCTEXT_NAMESPACE #undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FdiscordrpcModule, discordrpc) IMPLEMENT_MODULE(FdiscordrpcModule, discordrpc)

View file

@ -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);
@ -55,45 +63,65 @@ 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;
}; };

View file

@ -4,15 +4,13 @@
#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;
private: private:
/** Handle to the test dll we will load */ /** Handle to the test dll we will load */
void* DiscordLibraryHandle; void* DiscordLibraryHandle;
}; };

View file

@ -3,4 +3,4 @@
#include "unrealstatus.h" #include "unrealstatus.h"
#include "Modules/ModuleManager.h" #include "Modules/ModuleManager.h"
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, unrealstatus, "unrealstatus" ); IMPLEMENT_PRIMARY_GAME_MODULE(FDefaultGameModuleImpl, unrealstatus, "unrealstatus");

View file

@ -3,4 +3,3 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"

View file

@ -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"

View file

@ -7,14 +7,9 @@
#include "unrealstatusGameModeBase.generated.h" #include "unrealstatusGameModeBase.generated.h"
/** /**
* *
*/ */
UCLASS() UCLASS()
class UNREALSTATUS_API AunrealstatusGameModeBase : public AGameModeBase class UNREALSTATUS_API AunrealstatusGameModeBase : public AGameModeBase {
{ GENERATED_BODY()
GENERATED_BODY()
}; };