ScriptCore: Cleanup and refactoring

A bit of nullable stuff
This commit is contained in:
Simon Lübeß
2024-01-07 23:56:44 +01:00
parent bfc9d4a0a5
commit 86139f870c
7 changed files with 216 additions and 214 deletions
+5 -22
View File
@@ -196,7 +196,9 @@ static class ScriptGlue
for (uint i < length)
{
MonoReflectionType* reflectionType = Mono.mono_array_get<MonoReflectionType*>(componentTypes, i);
Entity_AddComponent(entityId, reflectionType);
if (reflectionType != null)
Entity_AddComponent(entityId, reflectionType);
}
}
@@ -286,6 +288,8 @@ static class ScriptGlue
return scriptComponent.Instance.MonoInstance;
}
Log.EngineLogger.AssertDebug(false, "Failed to set script.");
return null;
}
@@ -528,27 +532,6 @@ static class ScriptGlue
id = UUID.Create();
}
[RegisterCall("ScriptGlue::Print_Decimal")]
static void Print_Decimal(MonoDecimal monoDecimal)
{
Log.ClientLogger.Info(scope $"{monoDecimal}");
}
[RegisterCall("ScriptGlue::Get_Decimal")]
static void Get_Decimal(MonoString* string, out MonoDecimal monoDecimal)
{
char8* str = Mono.mono_string_to_utf8(string);
Result<MonoDecimal> decimalo = MonoDecimal.Parse(StringView(str));
if (!(decimalo case .Ok(out monoDecimal)))
{
monoDecimal = default;
}
Mono.mono_free(str);
}
#region Application
[RegisterCall("ScriptGlue::Application_IsEditor")]