public void RemoveItem(ILayoutable item) { int index = 0; bool found = false; for (int x = 0; x < _items.Count; x++) { index = x; found = _items[x].Key == item; if (found) { break; } } if (!found) { return; // Nothing to remove } _items.RemoveAt(index); // Only detach it if the item is still attached to this if (item.Parent == _backgroundSprite) { item.Detach(); item.OnSizeChangeHandler = null; } }
public void RemoveItem(ILayoutable item) { if (!_items.ContainsKey(item)) { return; } _items.Remove(item); // Only detach it if the item is still attached to this if (item.Parent == _backgroundSprite) { item.Detach(); item.OnSizeChangeHandler = null; } }
public void RemoveItem(ILayoutable item) { if (!_items.Contains(item)) return; _items.Remove(item); // Only detach it if the item is still attached to this if (item.Parent == _backgroundSprite) { item.Detach(); item.OnSizeChangeHandler = null; } }