コード例 #1
0
ファイル: ShelfEditor.cs プロジェクト: chengyimingvb/CYMUni
        // 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
ファイル: ShelfEditor.cs プロジェクト: chengyimingvb/CYMUni
        // 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
ファイル: BuildWindow.cs プロジェクト: chengyimingvb/CYMUni
 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();
 }