internal static void GetObjectField(
            DotNetObject managedObject,
            ref ScriptComponentFieldHolder scriptComponentFieldHolder,
            string fieldName,
            int type)
        {
            Managed.RglScriptFieldType rglScriptFieldType = (Managed.RglScriptFieldType)type;
            FieldInfo fieldOfClass = Managed.GetFieldOfClass(managedObject.GetType().Name, fieldName);

            switch (rglScriptFieldType)
            {
            case Managed.RglScriptFieldType.RglSftString:
                scriptComponentFieldHolder.s = (string)fieldOfClass.GetValue((object)managedObject);
                break;

            case Managed.RglScriptFieldType.RglSftDouble:
                scriptComponentFieldHolder.d = (double)Convert.ChangeType(fieldOfClass.GetValue((object)managedObject), typeof(double));
                break;

            case Managed.RglScriptFieldType.RglSftFloat:
                scriptComponentFieldHolder.f = (float)Convert.ChangeType(fieldOfClass.GetValue((object)managedObject), typeof(float));
                break;

            case Managed.RglScriptFieldType.RglSftBool:
                bool flag = (bool)fieldOfClass.GetValue((object)managedObject);
                scriptComponentFieldHolder.b = flag ? 1 : 0;
                break;

            case Managed.RglScriptFieldType.RglSftInt:
                scriptComponentFieldHolder.i = (int)Convert.ChangeType(fieldOfClass.GetValue((object)managedObject), typeof(int));
                break;

            case Managed.RglScriptFieldType.RglSftVec3:
                Vec3 c = (Vec3)fieldOfClass.GetValue((object)managedObject);
                scriptComponentFieldHolder.v3 = new Vec3(c, c.w);
                break;

            case Managed.RglScriptFieldType.RglSftEntity:
                GameEntity gameEntity = (GameEntity)fieldOfClass.GetValue((object)managedObject);
                scriptComponentFieldHolder.entityPointer = (NativeObject)gameEntity != (NativeObject)null ? (UIntPtr)Convert.ChangeType((object)gameEntity.Pointer, typeof(UIntPtr)) : (UIntPtr)0UL;
                break;

            case Managed.RglScriptFieldType.RglSftTexture:
                Texture texture = (Texture)fieldOfClass.GetValue((object)managedObject);
                scriptComponentFieldHolder.texturePointer = (NativeObject)texture != (NativeObject)null ? (UIntPtr)Convert.ChangeType((object)texture.Pointer, typeof(UIntPtr)) : (UIntPtr)0UL;
                break;

            case Managed.RglScriptFieldType.RglSftMesh:
                MetaMesh metaMesh = (MetaMesh)fieldOfClass.GetValue((object)managedObject);
                scriptComponentFieldHolder.meshPointer = (NativeObject)metaMesh != (NativeObject)null ? (UIntPtr)Convert.ChangeType((object)metaMesh.Pointer, typeof(UIntPtr)) : (UIntPtr)0UL;
                break;

            case Managed.RglScriptFieldType.RglSftEnum:
                scriptComponentFieldHolder.enumValue = fieldOfClass.GetValue((object)managedObject).ToString();
                break;

            case Managed.RglScriptFieldType.RglSftMaterial:
                Material material = (Material)fieldOfClass.GetValue((object)managedObject);
                scriptComponentFieldHolder.materialPointer = (NativeObject)material != (NativeObject)null ? (UIntPtr)Convert.ChangeType((object)material.Pointer, typeof(UIntPtr)) : (UIntPtr)0UL;
                break;

            case Managed.RglScriptFieldType.RglSftMatrixFrame:
                MatrixFrame matrixFrame = (MatrixFrame)fieldOfClass.GetValue((object)managedObject);
                scriptComponentFieldHolder.matrixFrame = matrixFrame;
                break;
            }
        }
        internal static void SetObjectField(
            DotNetObject managedObject,
            string fieldName,
            ref ScriptComponentFieldHolder scriptComponentHolder,
            int type,
            int callFieldChangeEventAsInteger)
        {
            bool flag1 = (uint)callFieldChangeEventAsInteger > 0U;

            Managed.RglScriptFieldType rglScriptFieldType = (Managed.RglScriptFieldType)type;
            FieldInfo fieldOfClass = Managed.GetFieldOfClass(managedObject.GetType().Name, fieldName);

            switch (rglScriptFieldType)
            {
            case Managed.RglScriptFieldType.RglSftString:
                fieldOfClass.SetValue((object)managedObject, (object)scriptComponentHolder.s);
                break;

            case Managed.RglScriptFieldType.RglSftDouble:
                fieldOfClass.SetValue((object)managedObject, Convert.ChangeType((object)scriptComponentHolder.d, fieldOfClass.FieldType));
                break;

            case Managed.RglScriptFieldType.RglSftFloat:
                fieldOfClass.SetValue((object)managedObject, Convert.ChangeType((object)scriptComponentHolder.f, fieldOfClass.FieldType));
                break;

            case Managed.RglScriptFieldType.RglSftBool:
                bool flag2 = scriptComponentHolder.b > 0;
                fieldOfClass.SetValue((object)managedObject, (object)flag2);
                break;

            case Managed.RglScriptFieldType.RglSftInt:
                fieldOfClass.SetValue((object)managedObject, Convert.ChangeType((object)scriptComponentHolder.i, fieldOfClass.FieldType));
                break;

            case Managed.RglScriptFieldType.RglSftVec3:
                Vec3 vec3 = new Vec3(scriptComponentHolder.v3.x, scriptComponentHolder.v3.y, scriptComponentHolder.v3.z, scriptComponentHolder.v3.w);
                fieldOfClass.SetValue((object)managedObject, (object)vec3);
                break;

            case Managed.RglScriptFieldType.RglSftEntity:
                fieldOfClass.SetValue((object)managedObject, scriptComponentHolder.entityPointer != UIntPtr.Zero ? (object)new GameEntity(scriptComponentHolder.entityPointer) : (object)(GameEntity)null);
                break;

            case Managed.RglScriptFieldType.RglSftTexture:
                fieldOfClass.SetValue((object)managedObject, scriptComponentHolder.texturePointer != UIntPtr.Zero ? (object)new Texture(scriptComponentHolder.texturePointer) : (object)(Texture)null);
                break;

            case Managed.RglScriptFieldType.RglSftMesh:
                fieldOfClass.SetValue((object)managedObject, scriptComponentHolder.meshPointer != UIntPtr.Zero ? (object)new MetaMesh(scriptComponentHolder.meshPointer) : (object)(MetaMesh)null);
                break;

            case Managed.RglScriptFieldType.RglSftEnum:
                object obj = Enum.Parse(fieldOfClass.FieldType, scriptComponentHolder.enumValue);
                fieldOfClass.SetValue((object)managedObject, obj);
                break;

            case Managed.RglScriptFieldType.RglSftMaterial:
                fieldOfClass.SetValue((object)managedObject, scriptComponentHolder.materialPointer != UIntPtr.Zero ? (object)new Material(scriptComponentHolder.materialPointer) : (object)(Material)null);
                break;

            case Managed.RglScriptFieldType.RglSftMatrixFrame:
                MatrixFrame matrixFrame = scriptComponentHolder.matrixFrame;
                fieldOfClass.SetValue((object)managedObject, (object)matrixFrame);
                break;
            }
            if (!(rglScriptFieldType != Managed.RglScriptFieldType.RglSftButton & flag1) || !(managedObject is ScriptComponentBehaviour))
            {
                return;
            }
            ((ScriptComponentBehaviour)managedObject).OnEditorVariableChanged(fieldName);
        }