public bool UnregisterGlobalChangedListener(ChangedCallback callback, object userData) { ChangedListener item = new ChangedListener(); item.SetCallback(callback); item.SetUserData(userData); return(this.m_globalChangedListeners.Remove(item)); }
public bool RegisterGlobalChangedListener(ChangedCallback callback, object userData) { ChangedListener item = new ChangedListener(); item.SetCallback(callback); item.SetUserData(userData); if (this.m_globalChangedListeners.Contains(item)) { return(false); } this.m_globalChangedListeners.Add(item); return(true); }
public bool RegisterChangedListener(Option option, ChangedCallback callback, object userData) { List <ChangedListener> list; ChangedListener item = new ChangedListener(); item.SetCallback(callback); item.SetUserData(userData); if (!this.m_changedListeners.TryGetValue(option, out list)) { list = new List <ChangedListener>(); this.m_changedListeners.Add(option, list); } else if (list.Contains(item)) { return(false); } list.Add(item); return(true); }
public bool UnregisterChangedListener(Option option, ChangedCallback callback, object userData) { List <ChangedListener> list; ChangedListener item = new ChangedListener(); item.SetCallback(callback); item.SetUserData(userData); if (!this.m_changedListeners.TryGetValue(option, out list)) { return(false); } if (!list.Remove(item)) { return(false); } if (list.Count == 0) { this.m_changedListeners.Remove(option); } return(true); }