public Config(string file, WillEdit willEdit) { m_file = file; ParameterEditors = new MapConfig <ParameterType, Guid>("ParameterEditors", kvp => new KeyValuePair <string, string>(kvp.Key.Serialized(), kvp.Value.ToString()), kvp => new KeyValuePair <ParameterType, Guid>(ParameterType.Parse(kvp.Key), Guid.Parse(kvp.Value)), a => ParameterEditorCustomization.DefaultEditor(a, willEdit)); ConversationNodeRenderers = new MapConfig <Id <NodeTypeTemp>, Guid>("ConversationNodeRenderers", kvp => new KeyValuePair <string, string>(kvp.Key.Serialized(), kvp.Value.ToString()), kvp => new KeyValuePair <Id <NodeTypeTemp>, Guid>(Id <NodeTypeTemp> .Parse(kvp.Key), Guid.Parse(kvp.Value)), a => EditableUIFactory.Instance.Guid); InitParameters(); LoadRoot(file); }
public ParameterEditorCustomization(IDataSource datasource, MapConfig <ParameterType, Guid> typeMapConfig, IEnumerable <IParameterEditorFactory> allEditors) { m_typeMapConfig = typeMapConfig; m_parameters = new List <Parameter>(); foreach (var type in datasource.ParameterTypes) { var options = allEditors.Where(e => e.WillEdit(type, WillEdit.Create(datasource))).Select(e => Tuple.Create(e.Guid, e.Name)).ToList(); Guid def = m_typeMapConfig[type]; var enumeration = new ImmutableEnumeration(options, type, def); var p = new EnumParameter(datasource.GetTypeName(type), Id <Parameter> .ConvertFrom(type), enumeration, def.ToString()); m_parameters.Add(p); } }
public static Guid DefaultEditor(ParameterType type, WillEdit willEdit) { if (willEdit.IsDecimal(type)) { return(DefaultDecimalEditorFactory.StaticId); } else if (willEdit.IsDynamicEnum(type)) { return(DefaultDynamicEnumEditorFactory.StaticId); } else if (willEdit.IsLocalDynamicEnum(type)) { return(DefaultLocalDynamicEnumEditorFactory.StaticId); } else if (willEdit.IsEnum(type)) { return(DefaultEnumEditorFactory.StaticId); } else if (willEdit.IsInteger(type)) { return(DefaultIntegerEditorFactory.StaticId); } else if (type == BaseTypeBoolean.ParameterType) { return(DefaultBooleanEditorFactory.StaticId); } else if (type == BaseTypeString.ParameterType) { return(DefaultStringEditorFactory.StaticId); } else if (willEdit.IsLocalizedString(type)) { return(DefaultLocalizedStringEditorFactory.StaticId); } else if (type == BaseTypeAudio.ParameterType) { return(DefaultAudioEditorFactory.StaticId); } else if (type.IsSet) { return(DefaultSetEditorFactory.StaticId); } else { return(Guid.Empty); } }
public bool WillEdit(ParameterType type, WillEdit queries) { return(type.IsSet); }
public bool WillEdit(ParameterType type, WillEdit queries) { return(queries.IsInteger(type)); }
public bool WillEdit(ParameterType type, WillEdit queries) { return(type == BaseTypeBoolean.ParameterType); }
public bool WillEdit(ParameterType type, WillEdit queries) { return(queries.IsDynamicEnum(type)); }
public bool WillEdit(ParameterType type, WillEdit queries) { return(queries.IsLocalizedString(type)); }
public bool WillEdit(ParameterType type, WillEdit queries) { return(queries.IsDecimal(type)); }