Added CustomWidget through C# reflection with callbacks

This commit is contained in:
antopilo
2024-09-11 22:58:33 -04:00
parent 596e4a484c
commit c7621b31e0
15 changed files with 928 additions and 719 deletions

View File

@@ -5,22 +5,22 @@
void ScriptingContext::Initialize()
{
m_Modules =
modules =
{
CreateRef<EditorNetAPI>()
};
for (auto& m : m_Modules)
for (auto& m : modules)
{
m->RegisterMethods();
}
// Load Nuake assembly DLL
/*auto m_LoadContext2 = Nuake::ScriptingEngineNet::Get().GetHostInstance()->CreateAssemblyLoadContext("NuakeEditorContext");
m_NuakeAssembly = Nuake::ScriptingEngineNet::Get().ReloadEngineAPI(m_LoadContext2);
m_EditorAssembly = m_LoadContext2.LoadAssembly("EditorNet.dll");
/*auto loadContext2 = Nuake::ScriptingEngineNet::Get().GetHostInstance()->CreateAssemblyLoadContext("NuakeEditorContext");
nuakeAssembly = Nuake::ScriptingEngineNet::Get().ReloadEngineAPI(loadContext2);
m_EditorAssembly = loadContext2.LoadAssembly("EditorNet.dll");
for (const auto& netModule : m_Modules)
for (const auto& netModule : modules)
{
for (const auto& [methodName, methodPtr] : netModule->GetMethods())
{

View File

@@ -13,13 +13,13 @@ namespace Coral
class ScriptingContext
{
private:
Coral::HostInstance* m_HostInstance;
Coral::AssemblyLoadContext m_LoadContext;
Coral::HostInstance* hostInstance;
Coral::AssemblyLoadContext loadContext;
std::unordered_map<std::string, Coral::AssemblyLoadContext*> m_LoadedAssemblies;
std::vector<Ref<Nuake::NetAPIModule>> m_Modules;
std::unordered_map<std::string, Coral::AssemblyLoadContext*> loadedAssemblies;
std::vector<Ref<Nuake::NetAPIModule>> modules;
Coral::ManagedAssembly m_NuakeAssembly; // Nuake DLL
Coral::ManagedAssembly nuakeAssembly; // Nuake DLL
Coral::ManagedAssembly m_EditorAssembly; // Editor DLL
public:
static ScriptingContext& Get()