public virtual void Shocker(GraphicElements child) { if (this.WasMouseIn()) { if (this.OwnerMover) { if (this.HasOwner && this.Owner != null) { if (this.Owner.Movements != ElementMovements.NoMovements) { child.LastPoint = this.LastPoint = M_Manager.Point.ToVector2(); this.Owner.Shocker(this); } } } if (this.Movements != ElementMovements.NoMovements) { if (this.MoveManager != null) { if (this.MoveManager.Enabled) { child.LastPoint = this.LastPoint = M_Manager.Point.ToVector2(); this.MoveManager?.Shocker(child); } } } } }
//------------------------------------------------- #region Get Method's Region public bool Exists(GraphicElements _e) { // check if the passed-by graphic element is an sandbox or not. if (_e is SandBoxBase _s) { // check if the passed-by sandbox is // an error sandbox or not. if (_s.IsErrorSandBox()) { // check if this element manager is owned by // some graphic element or not. if (HasOwner) { // NOTICE: // only the Element Manager of the GameClient // should have the error sandbox, // so if you are looking for an error sandbox // in here, then you are in a wrong place! return(false); } if (this.LowErrorSandBox != null) { if (LowErrorSandBox.Equals(_s)) { return(true); } } if (TopMostErrorSandBox != null) { if (TopMostErrorSandBox.Equals(_s)) { return(true); } } //return LowErrorSandBox.Equals(_s) || TopMostErrorSandBox.Equals(_s); return(false); } else { // if the passed-by value is not an error sandbox, // but just an ordinary sandbox, then it doesn't matter // if this manager is owned by only an ordinary sandbox or element, // you still can get the list of the sandboxes in this manager // and search for the passed by element. // for example, this manager is owned by a HallSandBox // (or not even a sandbox), and it has a sandbox on it, // so long as the passed-by value is not an error sandbox, // it's okay to try for searching for it. return(GetList(_s.SandBoxPriority).Exists(_s)); } } // it means the passed-by graphic element is just an ordinary // element, so you can get the list using it's priority. return(GetList(_e.Priority).Exists(_e)); }
public bool ContainsChild(GraphicElements _e) { // check if the passed-by graphic element is an sandbox or not. if (_e is SandBoxBase _s) { // check if the passed-by sandbox is // an error sandbox or not. if (_s.IsErrorSandBox()) { // check if this element manager is owned by // some graphic element or not. if (HasOwner) { // NOTICE: // only the Element Manager of the GameClient // should have the error sandbox, // so if you are looking for an error sandbox // in here, then you are in a wrong place! return(false); } // check if the sand box you are looking for is // one of the low error sand boxes or their child or not. return(LowErrorSandBox.ContainsChild(_s) || TopMostErrorSandBox.ContainsChild(_s)); } else { // if the passed-by value is not an error sandbox, // but just an ordinary sandbox, then it doesn't matter // if this manager is owned by only an ordinary sandbox or element, // you still can get the list of the sandboxes in this manager // and search for the passed by element. // for example, this manager is owned by a HallSandBox // (or not even a sandbox), and it has a sandbox on it, // so long as the passed-by value is not an error sandbox, // it's okay to try for searching for it. // check if the low sandboxes list is null or not. if (this.LowSandBoxes != null) { // check if the sandbox you are looking for is // one the low sandboxes or their child or not. if (this.LowSandBoxes.ContainsChild(_s)) { // it means the sandbox is one the low sandboxes // or their child. return(true); } } // check if the top most sandboxes list is null or not. if (this.TopMostSandBoxes != null) { // check if the sandbox you are looking for is // one the top most sandboxes or their child or not. if (this.TopMostSandBoxes.ContainsChild(_s)) { // it means the sandbox is one the top most sandboxes // or their child. return(true); } } // huh? we are sure that the passed-by value was a sandbox, // but it is not in our lists, so it means you should // return false. return(false); } } // using a loop for searching in the elements. for (int i = 0; i < Elements.Length; i++) { // check if the current elment list is null or not. if (this.Elements[i] != null) { // check if the current element list contains this element // or not. if (this.Elements[i].ContainsChild(_e)) { // it means the current element list contans the element, // so you should return true. return(true); } } } // it means the passed-by graphic element is just an ordinary // element, so you can get the list using it's priority. return(false); }