示例#1
0
        private void PaintSearch()
        {
            EditorGUILayout.BeginHorizontal();

            this.search = this.searchField.OnGUI(this.search);
            GUILayoutOption[] options = new GUILayoutOption[]
            {
                GUILayout.Width(80f),
                GUILayout.Height(18f)
            };

            EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(this.search));
            string[] tags = GlobalTagsEditor.GetTagNames();
            this.tagsMask = EditorGUILayout.MaskField(
                GUIContent.none,
                this.tagsMask,
                tags,
                EditorStyles.miniButtonLeft,
                options
                );
            EditorGUI.EndDisabledGroup();

            if (GUILayout.Button("Edit Tags", EditorStyles.miniButtonRight, options))
            {
                PopupWindow.Show(this.editTagsRect, new TagsEditorWindow());
            }

            if (UnityEngine.Event.current.type == EventType.Repaint)
            {
                this.editTagsRect = GUILayoutUtility.GetLastRect();
            }

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
        }
示例#2
0
        protected override Tag[] GetReferenceTags(int index)
        {
            List <Tag> result = new List <Tag>();

            if (index >= this.instance.references.Length)
            {
                return(result.ToArray());
            }

            SOVariable reference = this.instance.references[index];

            if (reference == null)
            {
                return(result.ToArray());
            }

            int mask = reference.variable.tags;

            Tag[] tags = GlobalTagsEditor.GetTags();

            for (int i = 0; i < tags.Length; ++i)
            {
                if ((mask & 1) != 0)
                {
                    result.Add(tags[i]);
                }

                mask >>= 1;
            }

            return(result.ToArray());
        }
示例#3
0
        private void PaintTags()
        {
            if (!this.UseTags())
            {
                return;
            }
            Rect rect = GUILayoutUtility.GetRect(
                EditorGUIUtility.fieldWidth + EditorGUIUtility.fieldWidth,
                EditorGUIUtility.singleLineHeight
                );

            Rect rectLabel = new Rect(
                rect.x,
                rect.y,
                EditorGUIUtility.labelWidth,
                rect.height
                );
            Rect rectMask = new Rect(
                rect.x + rectLabel.width,
                rect.y,
                rect.width - rectLabel.width,
                rect.height
                );


            EditorGUI.PrefixLabel(rectLabel, GUICONTENT_TAGS);
            this.spVariableTags.intValue = EditorGUI.MaskField(
                rectMask,
                this.spVariableTags.intValue,
                GlobalTagsEditor.GetTagNames()
                );
        }
示例#4
0
        // INITIALIZERS: --------------------------------------------------------------------------

        public override void OnOpen()
        {
            GlobalTags instance = AssetDatabase.LoadAssetAtPath <GlobalTags>(Path.Combine(
                                                                                 GlobalTagsEditor.PATH_ASSET,
                                                                                 GlobalTagsEditor.NAME_ASSET
                                                                                 ));

            if (instance == null)
            {
                this.editorWindow.Close();
            }
            this.tagsEditor = (GlobalTagsEditor)Editor.CreateEditor(instance);
        }
示例#5
0
        public static string[] GetTagNames()
        {
            Tag[] tagInstances = GlobalTagsEditor.GetTags();
            if (tagInstances.Length == 0)
            {
                return(new string[0]);
            }

            string[] tags = new string[tagInstances.Length];
            for (int i = 0; i < tagInstances.Length; ++i)
            {
                tags[i] = tagInstances[i].name;
            }

            return(tags);
        }