public static ObjectType TypeFromNative(Type nativeType) { ObjectType type; if (TypeKeyFastMap.TryGetValue(nativeType.FullName, out type)) { return(type); } return(ObjectType.Unknown); }
public static ObjectType TypeFromNative(CrossEngineImpl.Object obj) { ObjectType type; Type nativeType = obj.GetType(); if (TypeKeyFastMap.TryGetValue(nativeType.FullName, out type)) { return(type); } return(ObjectType.Unknown); }
public static void ConstructObjectType() { try { ObjectKeyMap.Add(ObjectType.Animation, new ObjectImplPair(typeof(ArkCrossEngine.Animation), typeof(CrossEngineImpl.Animation))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Animation).FullName, ObjectType.Animation); ObjectKeyMap.Add(ObjectType.AudioClip, new ObjectImplPair(typeof(ArkCrossEngine.AudioClip), typeof(CrossEngineImpl.AudioClip))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.AudioClip).FullName, ObjectType.AudioClip); ObjectKeyMap.Add(ObjectType.AudioSource, new ObjectImplPair(typeof(ArkCrossEngine.AudioSource), typeof(CrossEngineImpl.AudioSource))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.AudioSource).FullName, ObjectType.AudioSource); ObjectKeyMap.Add(ObjectType.Camera, new ObjectImplPair(typeof(ArkCrossEngine.Camera), typeof(CrossEngineImpl.Camera))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Camera).FullName, ObjectType.Camera); ObjectKeyMap.Add(ObjectType.CharacterController, new ObjectImplPair(typeof(ArkCrossEngine.CharacterController), typeof(CrossEngineImpl.CharacterController))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.CharacterController).FullName, ObjectType.CharacterController); ObjectKeyMap.Add(ObjectType.BoxCollider, new ObjectImplPair(typeof(ArkCrossEngine.BoxCollider), typeof(CrossEngineImpl.BoxCollider))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.BoxCollider).FullName, ObjectType.BoxCollider); ObjectKeyMap.Add(ObjectType.Collider, new ObjectImplPair(typeof(ArkCrossEngine.Collider), typeof(CrossEngineImpl.Collider))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Collider).FullName, ObjectType.Collider); ObjectKeyMap.Add(ObjectType.Component, new ObjectImplPair(typeof(ArkCrossEngine.Component), typeof(CrossEngineImpl.Component))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Component).FullName, ObjectType.Component); ObjectKeyMap.Add(ObjectType.LineRenderer, new ObjectImplPair(typeof(ArkCrossEngine.LineRenderer), typeof(CrossEngineImpl.LineRenderer))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.LineRenderer).FullName, ObjectType.LineRenderer); ObjectKeyMap.Add(ObjectType.MeshRenderer, new ObjectImplPair(typeof(ArkCrossEngine.MeshRenderer), typeof(CrossEngineImpl.MeshRenderer))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.MeshRenderer).FullName, ObjectType.MeshRenderer); ObjectKeyMap.Add(ObjectType.ParticleSystem, new ObjectImplPair(typeof(ArkCrossEngine.ParticleSystem), typeof(CrossEngineImpl.ParticleSystem))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.ParticleSystem).FullName, ObjectType.ParticleSystem); ObjectKeyMap.Add(ObjectType.Renderer, new ObjectImplPair(typeof(ArkCrossEngine.Renderer), typeof(CrossEngineImpl.Renderer))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Renderer).FullName, ObjectType.Renderer); ObjectKeyMap.Add(ObjectType.Rigidbody, new ObjectImplPair(typeof(ArkCrossEngine.Rigidbody), typeof(CrossEngineImpl.Rigidbody))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Rigidbody).FullName, ObjectType.Rigidbody); ObjectKeyMap.Add(ObjectType.SkinnedMeshRenderer, new ObjectImplPair(typeof(ArkCrossEngine.SkinnedMeshRenderer), typeof(CrossEngineImpl.SkinnedMeshRenderer))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.SkinnedMeshRenderer).FullName, ObjectType.SkinnedMeshRenderer); ObjectKeyMap.Add(ObjectType.ParticleSystemRenderer, new ObjectImplPair(typeof(ArkCrossEngine.ParticleSystemRenderer), typeof(CrossEngineImpl.ParticleSystemRenderer))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.ParticleSystemRenderer).FullName, ObjectType.ParticleSystemRenderer); ObjectKeyMap.Add(ObjectType.Terrain, new ObjectImplPair(typeof(ArkCrossEngine.Terrain), typeof(CrossEngineImpl.Terrain))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Terrain).FullName, ObjectType.Terrain); ObjectKeyMap.Add(ObjectType.Transform, new ObjectImplPair(typeof(ArkCrossEngine.Transform), typeof(CrossEngineImpl.Transform))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Transform).FullName, ObjectType.Transform); ObjectKeyMap.Add(ObjectType.GameObject, new ObjectImplPair(typeof(ArkCrossEngine.GameObject), typeof(CrossEngineImpl.GameObject))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.GameObject).FullName, ObjectType.GameObject); ObjectKeyMap.Add(ObjectType.Object, new ObjectImplPair(typeof(ArkCrossEngine.Object), typeof(CrossEngineImpl.Object))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Object).FullName, ObjectType.Object); ObjectKeyMap.Add(ObjectType.Material, new ObjectImplPair(typeof(ArkCrossEngine.Material), typeof(CrossEngineImpl.Material))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Material).FullName, ObjectType.Material); ObjectKeyMap.Add(ObjectType.Mesh, new ObjectImplPair(typeof(ArkCrossEngine.Mesh), typeof(CrossEngineImpl.Mesh))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Mesh).FullName, ObjectType.Mesh); ObjectKeyMap.Add(ObjectType.MeshFilter, new ObjectImplPair(typeof(ArkCrossEngine.MeshFilter), typeof(CrossEngineImpl.MeshFilter))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.MeshFilter).FullName, ObjectType.MeshFilter); ObjectKeyMap.Add(ObjectType.Shader, new ObjectImplPair(typeof(ArkCrossEngine.Shader), typeof(CrossEngineImpl.Shader))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Shader).FullName, ObjectType.Shader); ObjectKeyMap.Add(ObjectType.Texture, new ObjectImplPair(typeof(ArkCrossEngine.Texture), typeof(CrossEngineImpl.Texture))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Texture).FullName, ObjectType.Texture); ObjectKeyMap.Add(ObjectType.Texture2D, new ObjectImplPair(typeof(ArkCrossEngine.Texture2D), typeof(CrossEngineImpl.Texture2D))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Texture2D).FullName, ObjectType.Texture2D); ObjectKeyMap.Add(ObjectType.AsyncOperation, new ObjectImplPair(typeof(ArkCrossEngine.AsyncOperation), typeof(CrossEngineImpl.AsyncOperation))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.AsyncOperation).FullName, ObjectType.AsyncOperation); ObjectKeyMap.Add(ObjectType.Resources, new ObjectImplPair(typeof(ArkCrossEngine.Resources), typeof(CrossEngineImpl.Resources))); TypeKeyFastMap.Add(typeof(CrossEngineImpl.Resources).FullName, ObjectType.Resources); } catch (System.Exception ex) { throw new Exception("Consutruct object fail : " + ex.Message); } }