4 using System.Collections.Generic;
6 using SharpYaml.Serialization;
7 using SharpYaml.Serialization.Serializers;
9 using SiliconStudio.Core.Reflection;
10 using SiliconStudio.Core.Yaml;
11 using SiliconStudio.Paradox.Effects;
15 namespace SiliconStudio.Paradox.Assets.Serializers
17 [YamlSerializerFactory]
20 public override IYamlSerializable TryCreate(SerializerContext context,
ITypeDescriptor typeDescriptor)
22 var type = typeDescriptor.Type;
23 return CanVisit(type) ?
this : null;
26 protected override KeyValuePair<object, object> ReadDictionaryItem(ref ObjectContext objectContext, KeyValuePair<Type, Type> keyValueType)
28 var keyValue = base.ReadDictionaryItem(ref objectContext, keyValueType);
30 if (keyValue.Value != null && keyValue.GetType().IsValueType)
32 keyValue =
new KeyValuePair<object, object>(keyValue.Key, ((
ParameterKey)keyValue.Key).ConvertValue(keyValue.Value));
37 public bool CanVisit(Type type)
45 context.Visitor.VisitObject(context.Instance, context.Descriptor,
false);
Key of an effect parameter.
SharpYaml.Serialization.ITypeDescriptor ITypeDescriptor
A custom visitor used by DataVisitorBase.
Provides access members of a type.