Skip to content
Snippets Groups Projects
Commit dd0be219 authored by Heine, Eric R's avatar Heine, Eric R
Browse files

Added a virtual function to do any cleanup necessary when an item is removed from a DynamicList.

parent be83bbb6
No related branches found
No related tags found
1 merge request!7Merge Request for Issue/13 - dynamic list item removed
......@@ -48,6 +48,7 @@ namespace Shared.SEUI {
// Remove the given item from the list (if it is in the list)
public void RemoveItem(TValueType item) {
if (listItems.ContainsKey(item)) {
OnItemRemoved(item, listItems[item]);
Destroy(listItems[item].gameObject);
listItems.Remove(item);
}
......@@ -55,6 +56,10 @@ namespace Shared.SEUI {
// --------------------------------------------------------------------------
// Implement if the list needs to do something to the DynamicListItem after it has been added to the list
protected virtual void OnItemAdded(TValueType item, TDynamicListItem itemUI) { }
protected virtual void OnItemAdded(TValueType item, TDynamicListItem itemUI) {}
// --------------------------------------------------------------------------
// Implement if the list needs to do something to the DynamicListItem after it has been removed from the list
protected virtual void OnItemRemoved(TValueType item, TDynamicListItem itemUI) {}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment