MCPcopy Create free account
hub / github.com/antopilo/Nuake / LoadProjectAssembly

Method LoadProjectAssembly

Nuake/Source/Nuake/Scripting/ScriptingEngineNet.cpp:368–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366 }
367
368 void ScriptingEngineNet::LoadProjectAssembly(Ref<Project> project)
369 {
370 if (!isInitialized)
371 {
372 return;
373 }
374
375 const std::string gameAssemblyPath = GetGameAssemblyPath(project);
376 if (!FileSystem::FileExists(gameAssemblyPath))
377 {
378 Logger::Log("Couldn't load .net assembly. Did you forget to build the .net project?", ".net", CRITICAL);
379 return;
380 }
381
382 const std::string absoluteAssemblyPath = FileSystem::Root + gameAssemblyPath;
383 gameAssembly = loadContext.LoadAssembly(absoluteAssemblyPath);
384
385 prefabType = gameAssembly.GetType("Nuake.Net.Prefab");
386 auto entityScriptType = gameAssembly.GetType("Nuake.Net.Entity");
387 auto& exposedFieldAttributeType = gameAssembly.GetType("Nuake.Net.ExposedAttribute");
388 auto& brushScriptAttributeType = gameAssembly.GetType("Nuake.Net.BrushScript");
389 auto& pointScriptAttributeType = gameAssembly.GetType("Nuake.Net.PointScript");
390 auto& uiWidgetType = gameAssembly.GetType("Nuake.Net.UIWidget");
391 auto& uiWidgetExternalLayoutType = gameAssembly.GetType("Nuake.Net.ExternalHTML");
392
393 for (auto& type : gameAssembly.GetTypes())
394 {
395 // Brush
396 bool isBrushScript = false;
397 std::string brushDescription;
398 bool isTrigger = false;
399
400 // Point
401 bool isPointScript = false;
402 std::string pointDescription;
403 std::string pointBase;
404 for (auto& attribute : type->GetAttributes())
405 {
406 if (attribute.GetType() == brushScriptAttributeType)
407 {
408 brushDescription = attribute.GetFieldValue<Coral::String>("Description");
409 isTrigger = attribute.GetFieldValue<Coral::Bool32>("IsTrigger");
410 isBrushScript = true;
411 }
412
413 if (attribute.GetType() == pointScriptAttributeType)
414 {
415 pointDescription = attribute.GetFieldValue<Coral::String>("Description");
416 pointBase = attribute.GetFieldValue<Coral::String>("Base");
417 isPointScript = true;
418 }
419 }
420
421 if (type->IsSubclassOf(entityScriptType))
422 {
423 const std::string baseTypeName = std::string(type->GetBaseType().GetFullName());
424 if (baseTypeName != "Nuake.Net.Entity")
425 {

Callers 3

LoadProjectMethod · 0.80
InitMethod · 0.80
DrawTitlebarMethod · 0.80

Calls 8

LogFunction · 0.85
SplitFunction · 0.85
GetFullNameMethod · 0.80
BroadcastMethod · 0.80
GetTypeMethod · 0.45
sizeMethod · 0.45
GetNameMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected