public void Register(IDragonStore store, Events eventCode, Action <JObject> action) { _subscribers[eventCode].Add(action); store.OnDestroyed += () => { _subscribers[eventCode].Remove(action); }; }
public void RegisterStore(IDragonStore store) { var type = store.GetType(); if (!_stores.ContainsKey(type)) { _stores[type] = new HashSet <IDragonStore>(); } _stores[type].Add(store); }
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 static void Destroy(IDragonStore store) { Dragon.Instance.Destroy(store); }
protected void BindWith(IDragonStore store) { store.BindWith(this); }