Example #1
0
        public EditorSession(BehaviourManifest manifest, JObject instance, string type, JsonSerializer jsonSerializer)
        {
            Manifest       = manifest;
            JsonSerializer = jsonSerializer;
            Instance       = instance;
            features       = new List <object>();

            var typeInformation = Manifest.GetTypeInformation(type);

            if (typeInformation == null)
            {
                throw new InvalidOperationException($"Failed to find type for {type}");
            }

            Root = new EditorObject(this, typeInformation, instance);
        }
Example #2
0
        public EditorSession(BehaviourManifest manifest, object instance, JsonSerializer jsonSerializer)
        {
            Manifest       = manifest;
            JsonSerializer = jsonSerializer;
            features       = new List <object>();

            var    rootJson        = JObject.FromObject(instance, JsonSerializer);
            string type            = instance.GetType().Name;
            var    typeInformation = Manifest.GetTypeInformation(type);

            if (typeInformation == null)
            {
                throw new InvalidOperationException($"Failed to find type for {type}");
            }

            Instance = rootJson;
            Root     = new EditorObject(this, typeInformation, rootJson);
        }