Пример #1
0
        private static void CustomPreferencesGUI()
        {
            ProjectLoad();


            GUILayout.Label("Version 1.00 ");
            GUILayout.BeginHorizontal();
            GUILayout.Label("Settings: ", GUILayout.Width(120));
            viewSettings =
                (ProjectViewSettings)EditorGUILayout.ObjectField(viewSettings, typeof(ProjectViewSettings), false);
            if (viewSettings)
            {
                var path = AssetDatabase.GetAssetPath(viewSettings);
                objectGuid = AssetDatabase.AssetPathToGUID(path);
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Show Size Info: ", EditorStyles.miniLabel, GUILayout.Width(120));
            showSizeInfo = GUILayout.Toggle(EditorPrefs.GetBool("showSizeInfo"), "");
            GUILayout.EndHorizontal();

            if (!GUI.changed)
            {
                return;
            }
            EditorPrefs.SetString("objectGuid", objectGuid);
            EditorPrefs.SetBool("showSizeInfo", showSizeInfo);
        }
Пример #2
0
 private static void ProjectLoad()
 {
     if (!prefsLoaded)
     {
         objectGuid   = EditorPrefs.GetString("objectGuid");
         showSizeInfo = EditorPrefs.GetBool("showSizeInfo");
         viewSettings = LoadByGUID();
         prefsLoaded  = true;
     }
 }
Пример #3
0
        static void GUIOptions(string guid, Rect rect)
        {
            _projectViewSettings = ProjectViewPreferences.viewSettings;
            showSizeInfo         = ProjectViewPreferences.showSizeInfo;
            //return if settings is not assigned.
            if (!_projectViewSettings)
            {
                return;
            }


            string fileName = AssetDatabase.GUIDToAssetPath(guid);

            //favorites tab, draw only box
            if (string.IsNullOrEmpty(fileName))
            {
                Rect r = new Rect(rect.x - 200, rect.y, rect.width + 200, rect.height);
                DrawBox(r);
                return;
            }


            FileInfo info = new FileInfo(fileName);

            if (!string.IsNullOrEmpty(info.Extension))
            {
                //files, not folders. Draw box around them.
                return;
            }


            string[] splt       = fileName.Split('/');
            string   folderName = splt[splt.Length - 1];

            if (_projectViewSettings._pairs != null)
            {
                foreach (var VARIABLE in _projectViewSettings._pairs)
                {
                    if (string.IsNullOrEmpty(VARIABLE._folderName))
                    {
                        continue;
                    }
                    if (VARIABLE._folderName.Equals(folderName))
                    {
                        Drawer(rect, _projectViewSettings._icon, VARIABLE._color, fileName);
                        ShowFolderInfo(rect, _projectViewSettings._icon, VARIABLE._color, fileName);
                        return;
                    }
                }
            }
            ShowFolderInfo(rect, null, Color.white, fileName);
            //Drawer(rect, ProjectViewSettings._iconSize, ProjectViewSettings._folderIcon, extension, fileName);
        }