2024-04-12 23:31:49 -07:00
|
|
|
|
#include "GasaLibrary.h"
|
|
|
|
|
|
|
|
|
|
#include "GasaDevOptions.h"
|
2024-04-13 02:32:52 -07:00
|
|
|
|
#include "Game/GasaLevelScriptActor.h"
|
2024-04-12 23:31:49 -07:00
|
|
|
|
#include "Engine/LevelScriptActor.h"
|
2024-04-13 02:32:52 -07:00
|
|
|
|
#include "Game/GasaGameInstance.h"
|
|
|
|
|
#include "Game/GasaGameMode.h"
|
|
|
|
|
#include "Game/GasaGameState.h"
|
|
|
|
|
#include "Game/GasaPlayerController.h"
|
|
|
|
|
#include "Kismet/KismetSystemLibrary.h"
|
2024-04-12 23:31:49 -07:00
|
|
|
|
|
2024-04-13 02:32:52 -07:00
|
|
|
|
#pragma region Game
|
|
|
|
|
UGasaDevOptions* UGasaLib::GetGasaDevOptions(UObject* Context) {
|
2024-04-12 23:31:49 -07:00
|
|
|
|
return Gasa::GetMutDevOptions();
|
|
|
|
|
}
|
2024-04-13 02:32:52 -07:00
|
|
|
|
|
|
|
|
|
UGasaGameInstance* UGasaLib::GetGasaGameInstance(UObject* Context) {
|
|
|
|
|
return Gasa::GetGameInstance(Context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AGasaGameMode* UGasaLib::GetGasaGameMode(UObject* Context) {
|
|
|
|
|
return Gasa::GetGameMode(Context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AGasaGameState* UGasaLib::GetGasaGameState(UObject* Context) {
|
|
|
|
|
return Gasa::GetGameState(Context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AGasaLevelScriptActor* UGasaLib::GetGasaLevelActor(UObject* Context) {
|
|
|
|
|
return Gasa::GetLevelActor(Context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AGasaPlayerController* UGasaLib::GetPrimaryGasaPlayerController(UObject* Context) {
|
|
|
|
|
return Gasa::GetPrimaryPlayerController(Context);
|
|
|
|
|
}
|
|
|
|
|
#pragma endregion Game
|
|
|
|
|
|
|
|
|
|
#pragma region Logging
|
2024-04-13 07:19:45 -07:00
|
|
|
|
DEFINE_LOG_CATEGORY_STATIC(LogGasaBP, Log, All);
|
|
|
|
|
|
2024-04-13 02:32:52 -07:00
|
|
|
|
void UGasaLib::Log(UObject* Context, FString Message, EGasaVerbosity Verbosity, bool bPrintToScreen)
|
|
|
|
|
{
|
2024-04-13 07:19:45 -07:00
|
|
|
|
#if !UE_BUILD_SHIPPING && !NO_LOGGING
|
|
|
|
|
{
|
|
|
|
|
ELogVerbosity::Type EngineVerbosity = (ELogVerbosity::Type) Verbosity;
|
|
|
|
|
|
|
|
|
|
static UE::Logging::Private::FStaticBasicLogDynamicData LOG_Dynamic;
|
|
|
|
|
static UE::Logging::Private::FStaticBasicLogRecord
|
|
|
|
|
LOG_Static(TEXT("%s -- %s"), __builtin_FILE(), __builtin_LINE(), EngineVerbosity, LOG_Dynamic);
|
|
|
|
|
|
|
|
|
|
if ((EngineVerbosity & ELogVerbosity::VerbosityMask) <= ELogVerbosity::COMPILED_IN_MINIMUM_VERBOSITY)
|
|
|
|
|
{
|
|
|
|
|
if ((EngineVerbosity & ELogVerbosity::VerbosityMask) <= LogGasaBP.GetVerbosity())
|
|
|
|
|
{
|
|
|
|
|
if ( ! LogGasaBP.IsSuppressed(EngineVerbosity))
|
|
|
|
|
{
|
|
|
|
|
BasicLog( LogGasaBP, &LOG_Static, *Message, *Context->GetName() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2024-04-13 02:32:52 -07:00
|
|
|
|
if (bPrintToScreen)
|
|
|
|
|
{
|
|
|
|
|
if (GAreScreenMessagesEnabled)
|
|
|
|
|
{
|
|
|
|
|
if (GConfig && printToScreenDuration < 0)
|
|
|
|
|
{
|
|
|
|
|
GConfig->GetFloat(TEXT("Kismet"), TEXT("PrintStringDuration"), printToScreenDuration, GEngineIni);
|
|
|
|
|
}
|
|
|
|
|
GEngine->AddOnScreenDebugMessage((uint64)-1, printToScreenDuration, logRegularColor.ToFColor(true), Message);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
UE_LOG(LogBlueprint, VeryVerbose, TEXT("Screen messages disabled (!GAreScreenMessagesEnabled). Cannot print to screen."));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Protected
|
|
|
|
|
|
|
|
|
|
const FLinearColor UGasaLib::logRegularColor = FLinearColor(0.0, 0.66, 1.0);
|
|
|
|
|
float UGasaLib::printToScreenDuration = 10.0f;
|
|
|
|
|
#pragma endregion Logging
|
|
|
|
|
|
|
|
|
|
#pragma region Timing
|
|
|
|
|
// Protected
|
|
|
|
|
|
|
|
|
|
float UGasaLib::timingRate_Std = UGasaLib::_60Hz;
|
|
|
|
|
#pragma endregion Timing
|