#pragma once #include "src/Core/Core.h" #include "src/Scene/Entities/Entity.h" #include "src/Scripting/NetModules/NetAPIModule.h" namespace Coral { class HostInstance; class Type; } #include namespace Nuake { class Project; class ScriptingEngineNet { private: const std::string m_Scope = "Nuake.Net"; const std::string m_EngineAssemblyName = "NuakeNet.dll"; const std::string m_NetDirectory = ".net"; const std::string m_ContextName = "NuakeEngineContext"; bool m_IsInitialized = false; Coral::HostInstance* m_HostInstance; Coral::AssemblyLoadContext m_LoadContext; std::unordered_map m_LoadedAssemblies; std::vector> m_Modules; Coral::ManagedAssembly m_NuakeAssembly; // Nuake DLL Coral::ManagedAssembly m_GameAssembly; // Game DLL // This is a map of all the entity scripts detected in the game's assembly. // This is filled when loading the game's assembly. // This is a map that contains all the instances of entity scripts. std::unordered_map m_GameEntityTypes; std::unordered_map m_EntityToManagedObjects; ScriptingEngineNet(); ~ScriptingEngineNet(); public: static ScriptingEngineNet& Get(); void Initialize(); void Uninitialize(); void BuildProjectAssembly(Ref project); void LoadProjectAssembly(Ref project); void RegisterEntityScript(Entity& entity); Coral::ManagedObject GetEntityScript(const Entity& entity); bool HasEntityScriptInstance(const Entity& entity); void CopyNuakeNETAssemblies(const std::string& path); void GenerateSolution(const std::string& path, const std::string& projectName); void CreateEntityScript(const std::string& path, const std::string& entityName); std::string FindClassNameInScript(const std::string& filePath); }; }