Setup SwordNGun editor module

This commit is contained in:
Kevin Poretti 2022-03-30 22:32:14 -04:00
parent 1501e35ad7
commit 0eaaa562be
12 changed files with 119 additions and 2 deletions

View File

@ -8,7 +8,7 @@ public class SwordNGun : ModuleRules
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "PhysicsCore", "UnrealEd", "AssetTools" });
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "PhysicsCore"});
PrivateDependencyModuleNames.AddRange(new string[] { });

View File

@ -9,6 +9,6 @@ public class SwordNGunEditorTarget : TargetRules
{
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.AddRange( new string[] { "SwordNGun" } );
ExtraModuleNames.AddRange( new string[] { "SwordNGunEditor" } );
}
}

View File

@ -0,0 +1,23 @@
// Project Sword & Gun Copyright © 2021 Kevin Poretti
#include "ISNGModuleInterface.h"
void ISNGModuleInterface::StartupModule()
{
if(IsRunningCommandlet())
{
AddModuleListeners();
for (int32 i = 0; i < ModuleListeners.Num(); i++)
{
ModuleListeners[i]->OnStartupModule();
}
}
}
void ISNGModuleInterface::ShutdownModule()
{
for (int32 i = 0; i < ModuleListeners.Num(); i++)
{
ModuleListeners[i]->OnShutdownModule();
}
}

View File

@ -0,0 +1,23 @@
// Project Sword & Gun Copyright © 2021 Kevin Poretti
#pragma once
#include "Modules/ModuleManager.h"
class ISNGModuleListenerInterface
{
public:
virtual void OnStartupModule() {};
virtual void OnShutdownModule() {};
};
class ISNGModuleInterface : public IModuleInterface
{
public:
virtual void StartupModule() override;
virtual void ShutdownModule() override;
virtual void AddModuleListeners() {};
protected:
TArray<TSharedRef<ISNGModuleListenerInterface>> ModuleListeners;
};

View File

@ -0,0 +1,23 @@
// Project Sword & Gun Copyright © 2021 Kevin Poretti
using UnrealBuildTool;
public class SwordNGunEditor : ModuleRules
{
public SwordNGunEditor(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "PhysicsCore", "UnrealEd", "AssetTools", "SwordNGun" });
PrivateDependencyModuleNames.AddRange(new string[] { });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}

View File

@ -0,0 +1,18 @@
#include "SwordNGunEditor.h"
IMPLEMENT_GAME_MODULE(FSwordNGunEditor, SwordNGunEditor)
void FSwordNGunEditor::StartupModule()
{
ISNGModuleInterface::StartupModule();
}
void FSwordNGunEditor::ShutdownModule()
{
ISNGModuleInterface::ShutdownModule();
}
void FSwordNGunEditor::AddModuleListeners()
{
// add tools later
}

View File

@ -0,0 +1,22 @@
#pragma once
#include "ISNGModuleInterface.h"
class FSwordNGunEditor : public ISNGModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
virtual void AddModuleListeners() override;
static FSwordNGunEditor& Get()
{
return FModuleManager::LoadModuleChecked<FSwordNGunEditor>("SwordNGunEditor");
}
static bool IsAvailable()
{
return FModuleManager::Get().IsModuleLoaded("SwordNGunEditor");
}
};

View File

@ -13,6 +13,14 @@
"CoreUObject",
"UnrealEd"
]
},
{
"Name": "SwordNGunEditor",
"Type": "Editor",
"LoadingPhase": "PostEngineInit",
"AdditionalDependencies": [
"Engine"
]
}
],
"Plugins": [