Beispiel #1
0
        private void DrawSelectedPrefabOptions(PrefabData selectedPrefabData)
        {
            EditorGUILayout.BeginVertical(GUI.skin.box, GUILayout.Height(52f), GUILayout.ExpandWidth(true));
            {
                EditorGUILayout.BeginHorizontal();
                {
                    EditorGUILayout.BeginVertical();
                    {
                        if (Selection.activeGameObject != selectedPrefabData.GameObject)
                        {
                            EditorGUILayout.Space();
                            _assetLabelGui.Draw(selectedPrefabData.GameObject);
                            selectedPrefabData.Labels = _assetLabelGui.GetLabels(selectedPrefabData.GameObject);
                        }
                    }
                    EditorGUILayout.EndVertical();

                    GUILayout.FlexibleSpace();

                    EditorGUILayout.BeginHorizontal();
                    {
                        if (!selectedPrefabData.IsSaved)
                        {
                            if (GUILayout.Button(new GUIContent("Save"), GUILayout.Width(64f), GUILayout.Height(35f)))
                            {
                                selectedPrefabData.IsSaved = true;
                                GUI.changed = true;

                                if (_showNotSaved)
                                {
                                    ResetSelection();
                                }
                            }
                        }

                        if (GUILayout.Button(new GUIContent("Remove"), GUILayout.Width(64f), GUILayout.Height(35f)))
                        {
                            if (EditorUtility.DisplayDialog(Title, string.Format("Are you sure you want to remove {0}?", _selectedPrefabData.Name), "Yes", "No"))
                            {
                                _grid.Remove(selectedPrefabData);
                                PrefabsDataStorage.Instance.Remove(selectedPrefabData);
                                GUI.changed = true;
                                ResetSelection();
                            }
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }
Beispiel #2
0
 private void OnItemDragged(PrefabData prefabData)
 {
     DragAndDrop.PrepareStartDrag();
     DragAndDrop.objectReferences = new UnityEngine.Object[] { prefabData.GameObject };
     DragAndDrop.StartDrag("Dragging prefab");
 }
Beispiel #3
0
 private void OnItemDoubleClicked(PrefabData prefabData)
 {
     Selection.activeGameObject = prefabData.GameObject;
 }
Beispiel #4
0
 private void OnItemSelected(PrefabData prefabData)
 {
     _selectedPrefabData = prefabData;
 }
Beispiel #5
0
 private void ResetSelection()
 {
     _grid.DeselectItem();
     _selectedPrefabData = null;
 }
Beispiel #6
0
 public void Remove(PrefabData data)
 {
     PrefabsData.Remove(data);
 }
Beispiel #7
0
 public void Add(PrefabData data)
 {
     PrefabsData.Add(data);
     PrefabsData.Sort((item1, item2) => string.Compare(item1.Name, item2.Name, StringComparison.Ordinal));
 }