コード例 #1
0
        public static LabelWidthRestorer        Get(float width)
        {
            LabelWidthRestorer restorer;

            if (LabelWidthRestorer.cached.TryGetValue(width, out restorer) == false)
            {
                restorer = new LabelWidthRestorer(width);

                LabelWidthRestorer.cached.Add(width, restorer);
            }
            else
            {
                EditorGUIUtility.labelWidth = restorer.width;
            }

            return(restorer);
        }
コード例 #2
0
        protected virtual void  OnGUI()
        {
            ProfilesManager.OnProfilesBarGUI();
            if (ProfilesManager.IsReady == false)
            {
                return;
            }

            using (LabelWidthRestorer.Get(143F))
            {
                EditorGUI.BeginChangeCheck();
                ProfilesManager.Profile.packagePath = EditorGUILayout.TextField("Package Path", ProfilesManager.Profile.packagePath);
                Rect r = GUILayoutUtility.GetLastRect();
                r.x += 100F;
                GUI.Label(r, "Assets/");

                if (Directory.Exists("Assets/" + ProfilesManager.Profile.packagePath) == false)
                {
                    EditorGUILayout.HelpBox("Package at \"Assets/" + ProfilesManager.Profile.packagePath + "\" was not found.", MessageType.Warning);
                }
            }

            using (LabelWidthRestorer.Get(100F))
            {
                this.version = EditorGUILayout.TextField("Version", this.version);

                EditorGUILayout.BeginHorizontal();
                {
                    ProfilesManager.Profile.exportPath = EditorGUILayout.TextField("Export Path", ProfilesManager.Profile.exportPath);
                    if (GUILayout.Button("Browse", "ButtonLeft", GUILayout.Width(60F)) == true)
                    {
                        string exportPath = EditorUtility.OpenFolderPanel("Export folder", ProfilesManager.Profile.exportPath, string.Empty);

                        if (string.IsNullOrEmpty(exportPath) == false)
                        {
                            ProfilesManager.Profile.exportPath = exportPath;
                            GUI.FocusControl(null);
                        }
                    }

                    if (GUILayout.Button("Open", "ButtonRight", GUILayout.Width(50F)) == true)
                    {
                        Utility.ShowExplorer(ProfilesManager.Profile.exportPath);
                    }
                }
                EditorGUILayout.EndHorizontal();

                if (Directory.Exists(ProfilesManager.Profile.exportPath) == false)
                {
                    EditorGUILayout.HelpBox("Export path is not a folder.", MessageType.Warning);
                }

                ProfilesManager.Profile.devPrefix  = EditorGUILayout.TextField("Full Export Prefix", ProfilesManager.Profile.devPrefix);
                ProfilesManager.Profile.nameFormat = EditorGUILayout.TextField("Name Format", ProfilesManager.Profile.nameFormat);
                EditorGUILayout.HelpBox("{0} = Date of the day, {1} = Version", MessageType.Info);

                EditorGUILayout.BeginHorizontal();
                {
                    this.finalExportPath = EditorGUILayout.TextField(this.finalExportPath);
                    if (EditorGUI.EndChangeCheck() == true || string.IsNullOrEmpty(this.finalExportPath) == true)
                    {
                        this.finalExportPath = Path.Combine(ProfilesManager.Profile.exportPath, this.GetExportName());
                    }

                    if (File.Exists(this.finalExportPath) == true && GUILayout.Button("Show", GUILayout.Width(50F)) == true)
                    {
                        Utility.ShowExplorer(this.finalExportPath);
                    }
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Export Package") == true)
                {
                    this.Export();
                }

                if (GUILayout.Button("Full Export Package") == true)
                {
                    this.ExportForDev();
                }
            }
            EditorGUILayout.EndHorizontal();
        }