First commit of EventCenterPlugin (not working, wip)

This commit is contained in:
Brandon Thomas committed 2021-02-15 23:31:25 -05:00
commit 5d00a246f5
6 files changed
+257

No files matched your search

@@ -0,0 +1,62 @@
#include "EventSourceActor.h"
#include "UObject/Object.h"
DEFINE_LOG_CATEGORY(EventSourceLog);
AEventSourceActor::AEventSourceActor()
{
// Set this actor to call Tick() every frame.
// You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
//redis = NewObject<URedisObject>(this, TEXT("RedisObject"));
redis = CreateDefaultSubobject<URedisObject>(TEXT("RedisObject"));
//RootComponent = redis;
}
AEventSourceActor::~AEventSourceActor()
{
// TODO: Memory leak (somehow placing a BP derivation into the editor causes the below lines to segfault)
//delete redis;
//redis = nullptr;
}
void AEventSourceActor::BeginPlay()
{
UE_LOG(EventSourceLog, Log, TEXT("BeginPlay()"));
Super::BeginPlay();
UE_LOG(EventSourceLog, Log, TEXT("BeginPlay(): Redis is null? %b"), redis != nullptr);
//UE_LOG(EventSourceLog, Log, TEXT("BeginPlay(): Redis host: %s"), redisHost);
UE_LOG(EventSourceLog, Log, TEXT("BeginPlay(): Redis port: %d"), redisPort);
//UE_LOG(EventSourceLog, Log, TEXT("BeginPlay(): Redis password (no secrets): %s"), redisPassword);
//redis->Init(redisHost, redisPort, redisPassword);
}
void AEventSourceActor::BeginDestroy()
{
Super::BeginDestroy();
}
void AEventSourceActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
// NB: Handled by RedisObject internal delegate
//redis->Tick(DeltaTime);
}
void AEventSourceActor::Subscribe(const FString& Channel)
{
redis->Subscribe(Channel);
}
void AEventSourceActor::Unsubscribe(const FString& Channel)
{
redis->Unsubscribe(Channel);
}