public virtual void RemoveChild(Sprite a_sp) { if (m_bLooping) { m_aChildrenToRemove.Add(a_sp); return; } if (ChildListChangedBefore != null) { ChildListChangedBefore(this, a_sp, false); } //DataRow[] rows = m_dtChildren.Select("Name = '"+a_sp.Name+"'"); DataRow[] rows = m_dtChildren.Select("Hash = '" + a_sp.GetHashCode() + "'"); if (rows.GetLength(0) > 0) { m_dtChildren.Rows.Remove(rows[0]); } int index = this._slChildrenLocZSorted.IndexOfValue(a_sp); if (index >= 0) //TODO: how can it not be..? { this._slChildrenLocZSorted.RemoveAt(index); } m_plChildrenByHash.Remove(a_sp.GetHashCode()); if (ChildListChangedAfter != null) { ChildListChangedAfter(this, a_sp, false); } }
public bool AddChild(Sprite a_sp) { if (ChildListChangedBefore != null) { if (ChildListChangedBefore(this, a_sp, true) == false) { return(false); } } //TODO: I need a sorted list class that allows duplicate keys! DataTables are slooow DataRow row = m_dtChildren.NewRow(); row["Name"] = a_sp.Name; row["LocZ"] = a_sp.LocZ; row["Hash"] = a_sp.GetHashCode(); m_dtChildren.Rows.Add(row); this._slChildrenLocZSorted.Add(a_sp.LocZ, a_sp); m_plChildrenByHash[a_sp.GetHashCode()] = a_sp; if (ChildListChangedAfter != null) { ChildListChangedAfter(this, a_sp, true); } return(true); }
protected void UpdateChildTableForChild(Sprite a_sp) { //Use when changing any one of the properties in the sprite that are used in m_dtChildren int index = this._slChildrenLocZSorted.IndexOfValue(a_sp); if (index >= 0) { this._slChildrenLocZSorted.RemoveAt(index); this._slChildrenLocZSorted.Add(a_sp.LocZ, a_sp); } DataRow[] rows = m_dtChildren.Select("Hash = '" + a_sp.GetHashCode() + "'"); if (rows.GetLength(0) > 0) { rows[0]["Name"] = a_sp.Name; rows[0]["LocZ"] = a_sp.LocZ; } }
public bool AddChild(Sprite a_sp) { if (ChildListChangedBefore!=null) { if (ChildListChangedBefore(this, a_sp, true) == false) return false; } //TODO: I need a sorted list class that allows duplicate keys! DataTables are slooow DataRow row = m_dtChildren.NewRow(); row["Name"] = a_sp.Name; row["LocZ"] = a_sp.LocZ; row["Hash"] = a_sp.GetHashCode(); m_dtChildren.Rows.Add(row); this._slChildrenLocZSorted.Add(a_sp.LocZ, a_sp); m_plChildrenByHash[a_sp.GetHashCode()] = a_sp; if (ChildListChangedAfter!=null) ChildListChangedAfter(this, a_sp, true); return true; }
protected void UpdateChildTableForChild(Sprite a_sp) { //Use when changing any one of the properties in the sprite that are used in m_dtChildren int index = this._slChildrenLocZSorted.IndexOfValue(a_sp); if (index >= 0) { this._slChildrenLocZSorted.RemoveAt(index); this._slChildrenLocZSorted.Add(a_sp.LocZ, a_sp); } DataRow[] rows = m_dtChildren.Select("Hash = '"+a_sp.GetHashCode()+"'"); if (rows.GetLength(0) > 0) { rows[0]["Name"] = a_sp.Name; rows[0]["LocZ"] = a_sp.LocZ; } }
public virtual void RemoveChild(Sprite a_sp) { if (m_bLooping) { m_aChildrenToRemove.Add(a_sp); return; } if (ChildListChangedBefore!=null) ChildListChangedBefore(this, a_sp, false); //DataRow[] rows = m_dtChildren.Select("Name = '"+a_sp.Name+"'"); DataRow[] rows = m_dtChildren.Select("Hash = '"+a_sp.GetHashCode()+"'"); if (rows.GetLength(0) > 0) m_dtChildren.Rows.Remove(rows[0]); int index = this._slChildrenLocZSorted.IndexOfValue(a_sp); if (index >= 0) //TODO: how can it not be..? this._slChildrenLocZSorted.RemoveAt(index); m_plChildrenByHash.Remove(a_sp.GetHashCode()); if (ChildListChangedAfter!=null) ChildListChangedAfter(this, a_sp, false); }