예제 #1
0
        // SciptableObject.OnDisable
        protected void OnDisable()
        {
            // Clean up scene references not longer in use
            var sceneRefs = AssetDatabase.LoadAllAssetsAtPath(DATA_PATH)
                            .OfType <ShelfSceneReference>()
                            .ToList();

            for (int i = sceneRefs.Count - 1; i >= 0; i--)
            {
                foreach (var layer in Data.layers)
                {
                    foreach (var item in layer.objects)
                    {
                        if (item == sceneRefs[i])
                        {
                            goto ContinueWithNextRef;
                        }
                    }
                }

                // Screne reference not found on any shelf
                DestroyImmediate(sceneRefs[i], true);

ContinueWithNextRef:
                continue;
            }

            editorInstance = null;
            EditorUtility.SetDirty(Data);

            Undo.undoRedoPerformed -= OnUndoRedo;
        }
예제 #2
0
        // SciptableObject.OnEnable
        protected void OnEnable()
        {
            editorInstance = this;

            // Setup reorderable list
            if (reorderable.objectReferencesCallback != ObjectReferences)
            {
                reorderable.emptyListItemHeight      = SHELF_ITEM_HEIGHT;
                reorderable.undoTarget               = Data;
                reorderable.objectReferencesCallback = ObjectReferences;
                reorderable.listItemNameCallback     = ListItemName;
                reorderable.listItemContentCallback  = ListItemContent;
                reorderable.listItemDrawCallback     = DrawListItem;
                reorderable.listItemClickEvent      += ListItemClick;
            }

            Undo.undoRedoPerformed += OnUndoRedo;
        }
예제 #3
0
 void Present_SubWindow()
 {
     EditorGUILayout.BeginVertical(VerticalStyle);
     if (LocalConfig.Ins.FoldSubWindow = EditorGUILayout.Foldout(LocalConfig.Ins.FoldSubWindow, "窗口", true))
     {
         if (GUILayout.Button("Shelf"))
         {
             ShelfEditor.ShowWindow();
         }
         else if (GUILayout.Button("Prefs"))
         {
             PrefsWindow.ShowWindow();
         }
         else if (GUILayout.Button("GUIStyle"))
         {
             GUIStyleWindow.ShowWindow();
         }
         else if (GUILayout.Button("Template"))
         {
             TemplateSettingsWindow.ShowWindow();
         }
         else if (GUILayout.Button("ColorPicker"))
         {
             ColorPickerWindow.ShowWindow();
         }
         else if (GUILayout.Button("DebugOptions"))
         {
             ShowOptionWindow();
         }
         else if (GUILayout.Button("Dependencies"))
         {
             DependencyWindow.ShowWindow();
         }
         else if (GUILayout.Button("ParticleScaler"))
         {
             ParticleScalerWindow.ShowWindow();
         }
         else if (GUILayout.Button("UnityTexture"))
         {
             UnityTextureWindow.ShowWindow();
         }
     }
     EditorGUILayout.EndVertical();
 }