Ejemplo 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_);
            }
        }
Ejemplo 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_);
         }
     }
 }
Ejemplo n.º 3
0
 public void Show(TagParent tagParent)
 {
     this.gameObject.SetActive(true);
     tagParent_ = tagParent;
     this.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, tagParent.GetComponent <RectTransform>().anchoredPosition.y);
     TagTitleText.text = "#" + tagParent_.Tag;
     PinCheck.gameObject.SetActive(tagParent_.IsPinned);
     RepeatCheck.gameObject.SetActive(tagParent_.IsRepeat);
 }
Ejemplo n.º 4
0
        public override bool DeleteNode()
        {
            if (CanDeleteNode && TagParent != null)
            {
                TagParent.DeleteTag(Tag);
                IsParentModified = true;
                return(Parent.Nodes.Remove(this));
            }

            return(false);
        }
Ejemplo n.º 5
0
    public void Insert(int index, Line child)
    {
        Line oldParent = child.parent_;

        if (oldParent == this)
        {
            children_.Move(child.Index, index);
        }
        else
        {
            children_.Insert(index, child);
            child.Tree    = Tree;
            child.parent_ = this;
            if (oldParent != null)
            {
                oldParent.children_.Remove(child);
            }
        }

        child.OnFoundParent();

        if (child.Tree is LogTree == false)
        {
            foreach (string tag in child.Tags)
            {
                bool      add       = (child.IsDone == false);
                TagParent tagParent = GameContext.TagList.GetTagParent(tag);
                if (tagParent == null)
                {
                    // Doneしてないタグなら生成する
                    if (add)
                    {
                        tagParent = GameContext.TagList.InstantiateTagParent(tag);
                    }
                }
                else
                {
                    // DoneしててもRepeatなら追加してよい
                    add |= tagParent.IsRepeat;
                }
                add &= tagParent != null && tagParent.FindBindedLine(child) == null;
                if (add)
                {
                    tagParent.InstantiateTaggedLine(child);
                }
            }

            if (child.Field != null)
            {
                child.Field.SetHashTags(child.tags_);
            }
        }
    }
Ejemplo n.º 6
0
    public void AddTag(string tag)
    {
        tags_.Add(tag);
        text_ = String.Format("{0} #{1}", text_, tag);
        if (Field != null)
        {
            Field.SetTextDirectly(text_);
            Field.SetHashTags(tags_);
        }
        TagParent tagParent = GameContext.TagList.GetOrInstantiateTagParent(tag);

        tagParent.InstantiateTaggedLine(this);
    }
Ejemplo n.º 7
0
        public override bool CutNode()
        {
            if (CanCutNode && TagParent != null)
            {
                NbtClipboardController.CopyToClipboard(new NbtClipboardData(NodeName, Tag));

                TagParent.DeleteTag(Tag);
                IsParentModified = true;
                Parent.Nodes.Remove(this);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 8
0
    public void Bind(Line line)
    {
        if (textComponent_ == null)
        {
            textComponent_ = GetComponentInChildren <Text>();
            strikeLine_    = textComponent_.GetComponentInChildren <UIGaugeRenderer>(includeInactive: true);
            checkMark_     = GetComponentInChildren <CheckMark>(includeInactive: true);
            listMark_      = GetComponentInChildren <Button>().GetComponentInChildren <UIMidairPrimitive>();
            tagParent_     = GetComponentInParent <TagParent>();
        }

        BindedLine = line;
        Text       = line.TextWithoutHashTags;
        IsDone     = line.IsDone;
    }
Ejemplo n.º 9
0
 // Use this for initialization
 protected override void Start()
 {
     tagParent_ = GetComponentInParent <TagParent>();
     onValueChanged.AsObservable().Subscribe(x =>
     {
         bool isFolded = !isOn;
         if (tagParent_ != null && tagParent_.IsFolded != isFolded)
         {
             tagParent_.IsFolded = isFolded;
         }
     }).AddTo(this);
     if (GameContext.Config != null)
     {
         AnimToTargetVisual();
     }
 }
Ejemplo n.º 10
0
 void ApplyTextToTaggedLine()
 {
     if (Tree is LogTree == false)
     {
         foreach (string tag in Tags)
         {
             TagParent tagParent = GameContext.TagList.GetTagParent(tag);
             if (tagParent != null)
             {
                 TaggedLine taggedline = tagParent.FindBindedLine(this);
                 if (taggedline != null)
                 {
                     taggedline.Text = TextWithoutHashTags;
                 }
             }
         }
     }
 }
Ejemplo n.º 11
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();
     }
 }