예제 #1
0
    public static void AddTag(string tag)
    {
        if (!IsHasTag(tag))
        {
#if UNITY_5_0 || UNITY_2017
            InternalEditorUtility.AddTag(tag);
#else
            SerializedObject   tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
            SerializedProperty it         = tagManager.GetIterator();
            while (it.NextVisible(true))
            {
                if (it.name == "tags")
                {
                    for (int i = 0; i < it.arraySize; i++)
                    {
                        SerializedProperty dataPoint = it.GetArrayElementAtIndex(i);
                        if (string.IsNullOrEmpty(dataPoint.stringValue))
                        {
                            dataPoint.stringValue = tag;
                            tagManager.ApplyModifiedProperties();
                            return;
                        }
                    }
                }
            }
#endif
        }
    }
 private void NewElement(Rect buttonRect, ReorderableList list)
 {
     buttonRect.x -= 400f;
     buttonRect.y -= 13f;
     PopupWindow.Show(buttonRect, new TagManagerInspector.EnterNamePopup(this.m_Tags, delegate(string s)
     {
         InternalEditorUtility.AddTag(s);
     }), null, ShowMode.PopupMenuWithKeyboardFocus);
 }
예제 #3
0
    private static void AddUnityTag()
    {
        var type  = typeof(Tags);
        var infos = type.GetFields();

        foreach (var info in infos)
        {
            InternalEditorUtility.AddTag((string)info.GetRawConstantValue());
        }
    }
예제 #4
0
 public void AddNode(UINode node)
 {
     if (!_nodeDict.ContainsKey(node.tag))
     {
         _nodeDict.Add(node.tag, node);
         if (!InternalEditorUtility.tags.Contains(node.tag))
         {
             InternalEditorUtility.AddTag(node.tag);
         }
     }
 }
예제 #5
0
        void AddTag(string tagname)
        {
            bool[,] OldTagTirggerList = Tools.Json2Obj <bool[, ]>(Tools.Obj2Json(NewTagTirggerList));
            List <string> Oldtaglist = new List <string>();

            Oldtaglist.AddList(Newtaglist);
            //Oldtaglist = Tools.Json2Obj<List<string>>(Tools.Obj2Json(Newtaglist));
            InternalEditorUtility.AddTag(tagname);
            listclear();
            Newtaglist.Clear();
            Newtaglist.AddArray <string>(InternalEditorUtility.tags);
            CompareCreate(Oldtaglist, Newtaglist, OldTagTirggerList);
        }
예제 #6
0
        private void ImportTags(YamlSequenceNode tags)
        {
            List <string> tagValues = new List <string>();

            foreach (YamlScalarNode tag in tags)
            {
                tagValues.Add(tag.Value);
            }

            EditorUtility.DisplayProgressBar("Hold on...", "Import tags...", 0);
            int len = tagValues.Count;

            for (int i = 0; i < len; i++)
            {
                string tagValue = tagValues[i];
                EditorUtility.DisplayProgressBar("Hold on...", "Import tag " + tagValue, (i + 1f) / (float)len);
                InternalEditorUtility.AddTag(tagValue);
                //AddTag(tagValue);
            }
            EditorUtility.ClearProgressBar();
        }
 void NewElement(Rect buttonRect, ReorderableList list)
 {
     buttonRect.x -= 400;
     buttonRect.y -= 13;
     PopupWindow.Show(buttonRect, new EnterNamePopup(m_Tags, s => { InternalEditorUtility.AddTag(s); }));
 }
예제 #8
0
 void NewElement(Rect buttonRect, ReorderableList list)
 {
     buttonRect.x -= 400;
     buttonRect.y -= 13;
     PopupWindow.Show(buttonRect, new EnterNamePopup(m_Tags, s => { InternalEditorUtility.AddTag(s); }), null, ShowMode.PopupMenuWithKeyboardFocus);
 }