private void Deactivate(BaseTag tag) { if (tag.Active) { tag.Active = false; tag.OnDeactivate(); OnDeactivate(tag); } }
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); } }
public void Start() { if (Index == -1) { Reset(); _index = 0; if (Index >= tags.Count) { return; } Current = tags[Index]; Create(); } }
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); }
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); }
public EndTag(BaseTag referenceTag) { ReferenceTag = referenceTag; IsSingle = true; Name = null; }
internal void Add(BaseTag tag) { tags.Add(tag); }
public bool FindActive(string name, out BaseTag tag) { return(FindActive(name, out tag, true)); }