public void SetPriority(IDragonStore dragonObject) { IDragonStore oldStore; _priority.TryGetValue(dragonObject.GetType(), out oldStore); if (oldStore != dragonObject) { if (Prioritize != null) { Prioritize.Invoke(dragonObject, oldStore); } _priority[dragonObject.GetType()] = dragonObject; } }
public void Destroy(IDragonStore store) { IDragonStore oldStore; _priority.TryGetValue(store.GetType(), out oldStore); if (oldStore == store) { ClearPriority(store.GetType()); } store.OnDestroyed.Invoke(); foreach (var bind in store.Bindings) { bind.DoDestroy(); } }
public void RegisterStore(IDragonStore store) { var type = store.GetType(); if (!_stores.ContainsKey(type)) { _stores[type] = new HashSet <IDragonStore>(); } _stores[type].Add(store); }