コード例 #1
0
        public static void CreateWindow(Vector2 r, CustomIconsDatabase database, string selectedGUID, Object selectedObj)
        {
            if (w != null)
            {
                w.Close();
            }

            w = (CustomIconsWindow)DisplayWizard("Custom Asset Icon", typeof(CustomIconsWindow), "");
            CustomIconsWindow.selectedGUID = selectedGUID;
            CustomIconsWindow.selectedObj  = selectedObj;

            selectedTex    = null;
            selectedTex_16 = null;

            Vector2 size = new Vector2(300, 220);

            Rect correctedRect = new Rect(r.x, r.y, 300, 200);

            correctedRect.y -= correctedRect.size.y + 15;
            correctedRect.x -= 20;
            w.position       = correctedRect;
            w.maxSize        = size;
            w.minSize        = size;

            databaseRef   = database;
            databaseIndex = databaseRef.ContainsGUID(selectedGUID);

            if (databaseRef != null && databaseIndex != -1)
            {
                databaseRef.SetName(databaseIndex, selectedObj.name);
            }

            CreateStyles();
        }
コード例 #2
0
        static private void OpenConfigWindow(string guid, Vector2 position)
        {
            string assetPath   = AssetDatabase.GUIDToAssetPath(guid);
            Object objSelected = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object));

            var type = File.GetAttributes(assetPath);

            if ((type & FileAttributes.Directory) != FileAttributes.Directory)
            {
                EditorUtility.DisplayDialog("Not a folder", "You must select a folder", "Ok"); return;
            }

            CustomIconsWindow.CreateWindow(position, databaseRef, guid, objSelected);
        }
コード例 #3
0
        static private void ContextMenu()
        {
            if (databaseRef == null)
            {
                FindDatabaseReference(); return;
            }
            if (Selection.assetGUIDs.Length == 0)
            {
                EditorUtility.DisplayDialog("Selection Empty", "You must select a folder", "Ok"); return;
            }
            string assetPath   = AssetDatabase.GUIDToAssetPath(Selection.assetGUIDs[0]);
            Object objSelected = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object));

            var type = File.GetAttributes(assetPath);

            if ((type & FileAttributes.Directory) != FileAttributes.Directory)
            {
                EditorUtility.DisplayDialog("Not a folder", "You must select a folder", "Ok"); return;
            }

            CustomIconsWindow.CreateWindow(new Vector2(600, 600), databaseRef, Selection.assetGUIDs[0], objSelected);
        }