/// <summary> /// Registers a given <see cref="DataStoreModel{SingleComponentDataStore}"/> and generates a <see cref="IEditorDrawable"/> /// view for the model. /// </summary> /// <param name="model">Model to register.</param> /// <returns>A new view setup to push messages back to the model.</returns> public IEditorDrawable RegisterModel(DataStoreModel <SingleComponentDataStore> model) { SingleView view = new SingleView(() => model.SerializedObject?.StoredComponent, model.DataType, model.SerializedName); view.OnEditorValueChanged += (s, args) => model.Update(args.ChangedValue); return(view); }
/// <summary> /// Registers a given <see cref="DataStoreModel{CollectionComponentDataStore}"/> and generates a <see cref="IEditorDrawable"/> /// view for the model. /// </summary> /// <param name="model">Model to register.</param> /// <returns>A new view setup to push messages back to the model.</returns> public IEditorDrawable RegisterModel(DataStoreModel <CollectionComponentDataStore> model) { //create the view for lists CollectionView view = new CollectionView(model.SerializedObject.dataStoreCollection, model.SerializedName, model.DataType); //setup the view to send updates back to the model view.OnEditorValueChanged += (s, args) => model.Update(args.ChangedValue); return(view); }