Esempio n. 1
0
        public void UpdateTags(List <string> removeTags, List <string> addTags)
        {
            foreach (string removeTag in removeTags)
            {
                line_.tags_.Remove(removeTag);
                TagParent tagParent = GameContext.TagList.GetTagParent(removeTag);
                if (tagParent != null)
                {
                    tagParent.RemoveLine(line_);
                }
            }
            foreach (string addTag in addTags)
            {
                line_.tags_.Add(addTag);
                TagParent tagParent = GameContext.TagList.GetOrInstantiateTagParent(addTag);
                if (tagParent != null)
                {
                    tagParent.InstantiateTaggedLine(line_);
                }
            }

            if (line_.Field != null && line_.Field.BindedLine == line_)
            {
                line_.Field.SetHashTags(line_.tags_);
            }
        }
Esempio n. 2
0
 public void RemoveTag(string tag)
 {
     if (tags_.Contains(tag))
     {
         tags_.Remove(tag);
         if (Field != null)
         {
             Field.CaretPosision = 0;
         }
         text_ = text_.Remove(text_.LastIndexOf("#" + tag) - 1, tag.Length + 2);
         if (Field != null)
         {
             Field.SetTextDirectly(text_);
             Field.SetHashTags(tags_);
         }
         TagParent tagParent = GameContext.TagList.GetTagParent(tag);
         if (tagParent != null)
         {
             tagParent.RemoveLine(this);
         }
     }
     else if (tag == "")
     {
         text_ = text_.Remove(text_.LastIndexOf(" #"), 2);
         if (Field != null)
         {
             Field.SetTextDirectly(text_);
         }
     }
 }
Esempio n. 3
0
 protected void OnLostParent()
 {
     BackToHeap();
     if (Tree is LogTree == false)
     {
         foreach (string tag in Tags)
         {
             TagParent tagParent = GameContext.TagList.GetTagParent(tag);
             if (tagParent != null)
             {
                 tagParent.RemoveLine(this);
             }
         }
     }
     foreach (Line child in this.GetAllChildren())
     {
         child.OnLostParent();
     }
 }