61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
// Copyright 2025 https://yuewu.dev/en All Rights Reserved.
|
|
|
|
#include "GenericMovementSystem.h"
|
|
|
|
#include "Utility/GMS_Log.h"
|
|
#if ALLOW_CONSOLE
|
|
#include "Engine/Console.h"
|
|
#endif
|
|
|
|
#if WITH_EDITOR
|
|
#include "MessageLogModule.h"
|
|
#endif
|
|
|
|
#define LOCTEXT_NAMESPACE "FGenericMovementSystemModule"
|
|
|
|
void FGenericMovementSystemModule::StartupModule()
|
|
{
|
|
#if ALLOW_CONSOLE
|
|
UConsole::RegisterConsoleAutoCompleteEntries.AddRaw(this, &FGenericMovementSystemModule::Console_OnRegisterAutoCompleteEntries);
|
|
#endif
|
|
|
|
#if WITH_EDITOR
|
|
// Register dedicated message log category for GMS.
|
|
auto& MessageLog{FModuleManager::LoadModuleChecked<FMessageLogModule>(FName{TEXTVIEW("MessageLog")})};
|
|
|
|
FMessageLogInitializationOptions MessageLogOptions;
|
|
MessageLogOptions.bShowFilters = true;
|
|
MessageLogOptions.bAllowClear = true;
|
|
MessageLogOptions.bDiscardDuplicates = true;
|
|
|
|
MessageLog.RegisterLogListing(GMSLog::MessageLogName, LOCTEXT("MessageLogLabel", "GMS"), MessageLogOptions);
|
|
#endif
|
|
}
|
|
|
|
void FGenericMovementSystemModule::ShutdownModule()
|
|
{
|
|
// 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.
|
|
}
|
|
|
|
|
|
#if ALLOW_CONSOLE
|
|
void FGenericMovementSystemModule::Console_OnRegisterAutoCompleteEntries(TArray<FAutoCompleteCommand>& AutoCompleteCommands)
|
|
{
|
|
const auto CommandColor{GetDefault<UConsoleSettings>()->AutoCompleteCommandColor};
|
|
|
|
auto* Command{&AutoCompleteCommands.AddDefaulted_GetRef()};
|
|
Command->Command = FString{TEXTVIEW("Stat GMS")};
|
|
Command->Desc = FString{TEXTVIEW("Displays GMS performance statistics.")};
|
|
Command->Color = CommandColor;
|
|
|
|
|
|
// Visual debugging will continue in 1.6
|
|
}
|
|
#endif
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|
|
|
|
IMPLEMENT_MODULE(FGenericMovementSystemModule, GenericMovementSystem)
|