Exemplo n.º 1
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var obj = new JObject();

            CustomResolver.WriteFields(value, obj, serializer);
            obj.WriteTo(writer);
        }
Exemplo n.º 2
0
        public override void WriteJson(JsonWriter writer, Entity value, JsonSerializer serializer)
        {
            var obj = new JObject();

            obj.Add("Name", value.name);

            CustomResolver.WriteFields(value, obj, serializer);

            var isDirty = false;

            foreach (var extensions in value.gameObject.GetComponents <Extension>().GroupBy(x => x.GetType()))
            {
                // if (ToExport.Contains(extensions.Key))
                // {
                obj.Add(extensions.Key.Name, JToken.FromObject(extensions, serializer));
                isDirty = true;
                // }
            }

            if (isDirty)
            {
                obj.WriteTo(writer);
            }
        }