new public void Clear() { Dictionary <TKey, TValue> remove = new Dictionary <TKey, TValue>(this); base.Clear(); OnRemove?.Invoke(this, remove); OnDictionaryChanged?.Invoke(this); }
public new void Add(K key, V value) { OnDictionaryChanged?.Invoke(this, new DictChangedEventArgs <K, V>() { Key = key, Value = value }); base.Add(key, value); }
new public void Add(TKey key, TValue value) { base.Add(key, value); Dictionary <TKey, TValue> add = new Dictionary <TKey, TValue>(); add.Add(key, value); OnAdd?.Invoke(this, add); OnDictionaryChanged?.Invoke(this); }
public V this[K key] { get { return(mInner[key]); } set { mInner[key] = value; OnDictionaryChanged?.Invoke(this, (key, value)); } }
new public bool Remove(TKey key) { Dictionary <TKey, TValue> remove = new Dictionary <TKey, TValue>(); if (base.ContainsKey(key)) { remove.Add(key, base[key]); } bool result = base.Remove(key); OnRemove?.Invoke(this, remove); OnDictionaryChanged?.Invoke(this); return(result); }
private void HandleAddDictionaryEvent(NetworkedDictionaryEvent <TKey, TValue> dictionaryEvent) { if (NetworkingManager.Singleton.IsServer) { if (NetworkingManager.Singleton.ConnectedClients.Count > 0) { dirtyEvents.Add(dictionaryEvent); } OnDictionaryChanged?.Invoke(dictionaryEvent); } else { dirtyEvents.Add(dictionaryEvent); } }
new public TValue this[TKey key] { set { if (!base.ContainsKey(key)) { throw new AquaFrameworkException("Invalid key."); } Dictionary <TKey, TValue> remove = new Dictionary <TKey, TValue>(); Dictionary <TKey, TValue> add = new Dictionary <TKey, TValue>(); remove.Add(key, base[key]); base[key] = value; add.Add(key, value); OnRemove?.Invoke(this, remove); OnAdd?.Invoke(this, add); OnDictionaryChanged?.Invoke(this); } get { return(base[key]); } }
/// <summary> /// Remove element from dictionary /// </summary> /// <param name="key"></param> public new void Remove(TKey key) { base.Remove(key); OnDictionaryChanged?.Invoke(this, new DictionaryChangedEventArgs <TKey, TValue>(key, default, DictionaryActionType.RemoveItem));
/// <summary> /// Add new element to dictionary /// </summary> /// <param name="key"></param> /// <param name="value"></param> public new void Add(TKey key, TValue value) { base.Add(key, value); OnDictionaryChanged?.Invoke(this, new DictionaryChangedEventArgs <TKey, TValue>(key, value, DictionaryActionType.RemoveItem)); }