Beispiel #1
0
 private void Deactivate(BaseTag tag)
 {
     if (tag.Active)
     {
         tag.Active = false;
         tag.OnDeactivate();
         OnDeactivate(tag);
     }
 }
Beispiel #2
0
        private void Destroy(BaseTag tag)
        {
            if (tag.Exists)
            {
                bool returnToDefault = FindActive(tag.Name, out BaseTag t, false); // If an inactive exists

                Deactivate(tag);
                tag.Exists = false;
                tag.OnDestroy(returnToDefault);
                OnDestroy(tag, returnToDefault);
            }
        }
Beispiel #3
0
        public void Start()
        {
            if (Index == -1)
            {
                Reset();

                _index = 0;
                if (Index >= tags.Count)
                {
                    return;
                }
                Current = tags[Index];
                Create();
            }
        }
Beispiel #4
0
        private bool FindActive(string name, out BaseTag tag, bool isActive
                                )
        {
            tag = null;
            if (name == null)
            {
                return(false);
            }

            for (int i = Index; i >= 0; i--)
            {
                if (Equals(tags[i].Name, name) && tags[i].Exists && (tags[i].Active ^ isActive) && !tags[i].IsSingle)
                {
                    tag = tags[i];
                    return(true);
                }
            }
            return(false);
        }
Beispiel #5
0
        public bool GetNext(bool skip = false)
        {
            if (!IsIterating)
            {
                return(false);
            }

            if (Update() && !skip)
            {
                return(false);
            }

            if (Current.IsSingle)
            {
                Destroy();
            }

            if (Current is EndTag endTag)
            {
                Destroy(endTag.ReferenceTag);
                ActivatePreviousTag(endTag.ReferenceTag.Name, true);
            }

            _index++;
            if (Index >= tags.Count)
            {
                Current = null;
                return(true);
            }

            Current = tags[Index];

            ActivatePreviousTag(Current.Name, false); // Deactivate previous
            Create();

            return(true);
        }
Beispiel #6
0
 public EndTag(BaseTag referenceTag)
 {
     ReferenceTag = referenceTag;
     IsSingle     = true;
     Name         = null;
 }
Beispiel #7
0
 internal void Add(BaseTag tag)
 {
     tags.Add(tag);
 }
Beispiel #8
0
 public bool FindActive(string name, out BaseTag tag)
 {
     return(FindActive(name, out tag, true));
 }