Пример #1
0
        protected override void DrawElement(int i, PackageJsonCreateWindow window)
        {
            using (new EditorGUI.DisabledScope(string.IsNullOrEmpty(window.CreatePath)))
            {
                list[i].DisplayName = EditorGUILayout.TextField("DisplayName", list[i].DisplayName);
                list[i].Description = EditorGUILayout.TextField("Description", list[i].Description);
                using (new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.PrefixLabel("Path");
                    EditorGUILayout.LabelField(list[i].Path);

                    if (GUILayout.Button("Set Path"))
                    {
                        var path = EditorUtility.SaveFolderPanel("Select Save Folder", window.CreatePath, "");
                        if (!string.IsNullOrEmpty(path))
                        {
                            if (path.StartsWith(Application.dataPath))
                            {
                                var pp = path.Replace(Application.dataPath, "Assets");
                                if (pp.StartsWith(window.CreatePath))
                                {
                                    list[i].Path = pp.Replace(window.CreatePath + "/", "");
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        internal void OnGUI(PackageJsonCreateWindow window)
        {
            if (plus == null)
            {
                plus = EditorGUIUtility.TrIconContent("Toolbar Plus");
            }
            if (minus == null)
            {
                minus = EditorGUIUtility.TrIconContent("Toolbar minus");
            }
            if (button == null)
            {
                button = "RL FooterButton";
            }
            if (width == null)
            {
                width = GUILayout.Width(20);
            }

            using (new GUILayout.HorizontalScope())
            {
                EditorGUILayout.LabelField(LabelName());
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(plus, button, width))
                {
                    Add();
                }
            }

            if (Length <= 0)
            {
                return;
            }

            using (new EditorGUILayout.VerticalScope("box"))
            {
                for (var i = 0; i < Length; i++)
                {
                    using (new EditorGUILayout.VerticalScope("box"))
                    {
                        using (new GUILayout.HorizontalScope())
                        {
                            EditorGUILayout.LabelField(i.ToString(), width);
                            using (new EditorGUILayout.VerticalScope())
                            {
                                DrawElement(i, window);
                            }
                            if (GUILayout.Button("x", button, width))
                            {
                                Remove(i);
                                GUIUtility.ExitGUI();
                            }
                        }
                    }
                }
            }
        }
        internal void OnGUI(PackageJsonCreateWindow window)
        {
            if (Depend == null)
            {
                Depend = new PackageDepend();
            }
            if (Sample == null)
            {
                Sample = new PackageSample();
            }
            if (Keyword == null)
            {
                Keyword = new PackageKeyword();
            }

            Name        = RegexTextField("Name", Name, "([a-z]|[0-9]|\\.|-)");
            DisplayName = EditorGUILayout.TextField("DisplayName", DisplayName);
            Version     = RegexTextField("Version", Version, "([0-9]|\\.)*");
            Unity       = RegexTextField("UnityVersion", Unity, "([0-9]|\\.)*");
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUILayout.PrefixLabel("Description");
                Description = EditorGUILayout.TextArea(Description);
            }

            GUILayout.Space(10f);
            EditorGUILayout.LabelField("Author");
            using (new EditorGUI.IndentLevelScope())
            {
                AuthorName  = EditorGUILayout.TextField("Name", AuthorName);
                AuthorEMail = EditorGUILayout.TextField("Mail", AuthorEMail);
                AuthorURL   = EditorGUILayout.TextField("URL", AuthorURL);
            }

            GUILayout.Space(10f);
            Depend.OnGUI(window);
            GUILayout.Space(10f);
            Keyword.OnGUI(window);
            GUILayout.Space(10f);
            Sample.OnGUI(window);
        }
 protected override void DrawElement(int i, PackageJsonCreateWindow window)
 {
     list[i].PackageName = EditorGUILayout.TextField("PackageName", list[i].PackageName);
     list[i].URI         = EditorGUILayout.TextField("URI", list[i].URI);
 }
 protected override void DrawElement(int i, PackageJsonCreateWindow window)
 {
     list[i] = EditorGUILayout.TextField(list[i]);
 }
Пример #6
0
 protected abstract void DrawElement(int index, PackageJsonCreateWindow window);