Exemplo n.º 1
0
        public override void DrawParameterGUI()
        {
            base.DrawParameterGUI();
            EditorGUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Load PrefabsSetInfo"))
                {
                    EditorGUIUtility.ShowObjectPicker <PrefabSetInfo>(setInfo, false, "", 0);
                }
                var pickedObj = EditorGUIUtility.GetObjectPickerObject();
                if (pickedObj != null)
                {
                    setInfo = EditorGUIUtility.GetObjectPickerObject() as PrefabSetInfo;
                    var prefs = setInfo.brushObjects.ToArray();
                    setPrefabs = prefs.ToList();
                    EditorPrefs.SetString("[Prefabshop] PrefabsSetPath", AssetDatabase.GetAssetPath(setInfo));
                    EditorWindow.GetWindow <Prefabshop>().Repaint();
                }
                GUI.enabled = false;
                if (GUILayout.Button("Save as New..."))
                {
                    //setInfo.brushObjects = setPrefabs;
                }
                GUI.enabled = setInfo != null;
                if (setInfo != null)
                {
                    GUI.backgroundColor = CheckArrays(setInfo.brushObjects.ToArray(), setPrefabs.ToArray()) ? Color.white : Color.yellow;
                }
                else
                {
                    GUI.backgroundColor = Color.white;
                }
                if (GUILayout.Button("Save Changes"))
                {
                    var prefs = setPrefabs.ToArray();
                    setInfo.brushObjects = prefs.ToList();
                    EditorUtility.SetDirty(setInfo);
                    AssetDatabase.SaveAssets();
                }
                GUI.backgroundColor = Color.white;
                GUI.enabled         = true;
            }
            EditorGUILayout.EndHorizontal();

            if (setInfo != null)
            {
                GUI.enabled = false;
                EditorGUILayout.ObjectField("Prefabs Set:", setInfo, typeof(PrefabSetInfo), false);
                GUI.enabled = true;
                DisplayPrefabs(setPrefabs);
            }
            else
            {
                DisplayPrefabs(setPrefabs);
            }
            GUILayout.Space(55f + prefabListHeight);
        }
Exemplo n.º 2
0
        public PrefabsSet(Type toolType) : base(toolType)
        {
            string path = EditorPrefs.GetString("[Prefabshop] PrefabsSetPath");

            if (path != "")
            {
                setInfo = AssetDatabase.LoadAssetAtPath(path, typeof(PrefabSetInfo)) as PrefabSetInfo;
                if (setInfo != null)
                {
                    var prefs = setInfo.brushObjects.ToArray();
                    setPrefabs = prefs.ToList();
                }
            }
        }