コード例 #1
0
        protected override void DrawChangeableElements()
        {
            if (collectionView == null)
            {
                collectionView = (target as Component).gameObject.GetComponentInParent <ICollectionViewItem>();
            }

            if (collectionView == null)
            {
                GUIUtils.Message("No CollectionView in Parent", MessageType.Error);
            }
            else
            {
                var modelType = collectionView.ModelType;

                EditorGUILayout.BeginHorizontal();

                EditorGUILayout.LabelField("Src Model", GUIUtils.labelOptions);

                EditorGUILayout.LabelField(modelType.Name);

                if (UnityEngine.GUILayout.Button("Open"))
                {
                    var str   = AssetDatabase.FindAssets(modelType.Name).FirstOrDefault();
                    var path  = AssetDatabase.GUIDToAssetPath(str);
                    var asset = EditorGUIUtility.Load(path);
                    AssetDatabase.OpenAsset(asset);
                }

                EditorGUILayout.EndHorizontal();

                GUIUtils.BindingField("Source Property", _srcNames, _srcPaths);
            }

            GUIUtils.ObjectField("Dst View", _dstViewProp);

            GUIUtils.BindingField("Dest Property", _dstNames, _dstPaths);

            GUIUtils.ObjectField("Converter", _converterProp);
        }
コード例 #2
0
        protected override void CollectPropertyLists()
        {
            if (collectionView == null)
            {
                collectionView = (target as Component).gameObject.GetComponentInParent <ICollectionViewItem>();
            }

            _srcNames.Clear();
            _srcPaths.Clear();
            _dstNames.Clear();
            _dstPaths.Clear();

            var dstView = _dstViewProp.objectReferenceValue as Component;

            if (dstView)
            {
                _dstNames.Values = dstView.GetBindablePropertyList(needsGetter: false);
                _dstPaths.Values = dstView.GetPropertiesAndFieldsList(_dstNames.Value);
            }
            else
            {
                _dstNames.Value = null;
                _dstPaths.Value = null;
            }

            if (collectionView != null)
            {
                var modelType = collectionView.ModelType;
                _srcNames.Values = modelType.GetBindablePropertyNames(needsSetter: false);

                var propType = modelType.GetProperty(_srcNames.Value).PropertyType;
                if (propType != null)
                {
                    _srcPaths.Values = propType.GetNestedFields();
                }
            }
        }
コード例 #3
0
 public bool Equals(ICollectionViewItem other)
 {
     return(other.Model.Equals(Model));
 }