mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
ScriptEngine work and cleanup
This commit is contained in:
@@ -372,10 +372,6 @@ struct EngineFunctions
|
||||
|
||||
static class ScriptGlue
|
||||
{
|
||||
/*private static Dictionary<MonoType*, function void(Entity entityId)> s_AddComponentMethods = new .() ~ delete _;
|
||||
private static Dictionary<MonoType*, function bool(Entity entityId)> s_HasComponentMethods = new .() ~ delete _;
|
||||
private static Dictionary<MonoType*, function void(Entity entityId)> s_RemoveComponentMethods = new .() ~ delete _;*/
|
||||
|
||||
/* Adding this attribute to a method will log method entry and returned Result<T> errors */
|
||||
[AttributeUsage(.Method)]
|
||||
struct RegisterMethodAttribute : Attribute, IOnMethodInit
|
||||
@@ -408,9 +404,6 @@ static class ScriptGlue
|
||||
|
||||
public static Event<delegate void()> OnRegisterNativeCalls ~ _.Dispose();
|
||||
|
||||
/*private function void SetEngineFunctions(EngineFunctions* engineFunctions);
|
||||
private static SetEngineFunctions _setEngineFunctions;*/
|
||||
|
||||
private function void SetEngineFunctions(EngineFunctions* engineFunctions);
|
||||
private static SetEngineFunctions _setEngineFunctions;
|
||||
|
||||
@@ -423,17 +416,13 @@ static class ScriptGlue
|
||||
|
||||
RegisterCalls();
|
||||
|
||||
//RegisterMathFunctions();
|
||||
RegisterManagedComponents();
|
||||
}
|
||||
|
||||
public static void RegisterManagedComponents()
|
||||
{
|
||||
Debug.Profiler.ProfileFunction!();
|
||||
|
||||
/*s_AddComponentMethods.Clear();
|
||||
s_HasComponentMethods.Clear();
|
||||
s_RemoveComponentMethods.Clear();*/
|
||||
|
||||
RegisterComponent<TransformComponent>();
|
||||
RegisterComponent<Rigidbody2DComponent>();
|
||||
RegisterComponent<CameraComponent>();
|
||||
@@ -459,12 +448,10 @@ static class ScriptGlue
|
||||
|
||||
private static void RegisterComponent<T>() where T : struct, new
|
||||
{
|
||||
Log.EngineLogger.Error("ScriptGlue::RegisterComponent not updated yet.");
|
||||
|
||||
String fullComponentTypeName = scope String();
|
||||
typeof(T).GetFullName(fullComponentTypeName);
|
||||
|
||||
CoreClrHelper.RegisterComponent(fullComponentTypeName,
|
||||
CoreClrHelper.RegisterComponent(fullComponentTypeName..EnsureNullTerminator(),
|
||||
addComponent: (entityId) => {
|
||||
Entity entity = GetEntitySafe(entityId);
|
||||
entity.AddComponent<T>();
|
||||
@@ -1550,6 +1537,8 @@ static class ScriptGlue
|
||||
|
||||
Log.EngineLogger.AssertDebug(context != null);
|
||||
|
||||
Log.EngineLogger.Trace(StringView(fieldName));
|
||||
|
||||
context.AddField(StringView(fieldName), type, valueObject, StringView(fullTypeName));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user