public void SetTagEnabledState(UCL_ConsoleTag tag, bool state)
 {
     if (state)
     {
         if (!m_enabledTags.Contains(tag.Name))
         {
             m_enabledTags.Add(tag.Name);
         }
     }
     else
     {
         m_enabledTags.Remove(tag.Name);
     }
 }
        public bool IsTagEnabled(UCL_ConsoleTag tag)
        {
            // if Tag is not enabled and not docked in same time
            // we assume such tag as enabled, since in this case we can miss
            // an important logs messages

            /*
             * if (!IsTagDocked(tag)) {
             *  if (!m_enabledTags.Contains(tag.Name)) {
             *      m_enabledTags.Add(tag.Name);
             *      return true;
             *  }
             *
             * }*/

            return(m_enabledTags.Contains(tag.Name));
        }
        public UCL_ConsoleTag GetTag(string tagName)
        {
            foreach (var tag in Tags)
            {
                if (tag.Name.Equals(tagName))
                {
                    return(tag);
                }
            }

            var newTag = new UCL_ConsoleTag();

            newTag.Name = tagName;
            newTag.Icon = Resources.Load("icons/tag") as Texture2D;
            m_tags.Add(newTag);

            SaveSettings();

            return(newTag);
        }
 public bool IsTagDocked(UCL_ConsoleTag tag)
 {
     return(IsTagDocked(tag.Name));
 }
        public override void OnGUI()
        {
            EditorGUILayout.Space();
            EditorGUILayout.HelpBox(DESCRIBTION, MessageType.Info);

            using (new SA_WindowBlockWithIndent(new GUIContent("Defined tags"))) {
                EditorGUILayout.BeginVertical(GUILayout.ExpandWidth(true));
                {
                    //workaround
                    foreach (var tag in UCL_Settings.Instance.Tags)
                    {
                        if (tag == null)
                        {
                            UCL_Settings.Instance.Tags.Remove(tag);
                            var newTag = new UCL_ConsoleTag();
                            newTag.Name = "new_tag";
                            newTag.Icon = Resources.Load("icons/tag") as Texture2D;
                            UCL_Settings.Instance.Tags.Add(newTag);
                            break;
                        }
                    }

                    ReorderableListGUI.ListField(UCL_Settings.Instance.Tags,
                                                 (Rect position, UCL_ConsoleTag tag) => {
                        position.x -= 12;


                        Rect iconRect  = new Rect(position);
                        iconRect.width = 200;
                        iconRect.y    += 88;

                        if (tag == null)
                        {
                            return(tag);
                        }

                        if (tag.Name.Equals(UCL_Settings.MESSAGE_TAG_NAME) ||
                            tag.Name.Equals(UCL_Settings.WARNING_TAG_NAME) ||
                            tag.Name.Equals(UCL_Settings.ERROR_TAG_NAME))
                        {
                            GUI.enabled = false;
                        }

                        using (new SA_GuiBeginArea(iconRect)) {
                            tag.Icon = (Texture2D)EditorGUILayout.ObjectField(tag.Icon, typeof(Texture2D), false, new GUILayoutOption[] { GUILayout.Width(iconRect.width), GUILayout.Height(15) });
                        }

                        Rect labelRect  = new Rect(position);
                        labelRect.x     = iconRect.x + iconRect.width;
                        labelRect.width = position.width - iconRect.width;
                        tag.Name        = EditorGUI.TextField(labelRect, tag.Name);

                        GUI.enabled = true;
                        return(tag);
                    },
                                                 () => {
                    }
                                                 );
                }
                EditorGUILayout.EndVertical();

                bool restore = GUILayout.Button("Restore Defaults", GUILayout.Width(140));
                if (restore)
                {
                    UCL_Settings.Instance.Tags.Clear();
                }
            }
        }