Exemplo n.º 1
0
 public void Register(IDragonStore store, Events eventCode, Action <JObject> action)
 {
     _subscribers[eventCode].Add(action);
     store.OnDestroyed += () =>
     {
         _subscribers[eventCode].Remove(action);
     };
 }
Exemplo n.º 2
0
    public void RegisterStore(IDragonStore store)
    {
        var type = store.GetType();

        if (!_stores.ContainsKey(type))
        {
            _stores[type] = new HashSet <IDragonStore>();
        }
        _stores[type].Add(store);
    }
Exemplo n.º 3
0
    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;
        }
    }
Exemplo n.º 4
0
    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();
        }
    }
Exemplo n.º 5
0
 public static void Destroy(IDragonStore store)
 {
     Dragon.Instance.Destroy(store);
 }
 protected void BindWith(IDragonStore store)
 {
     store.BindWith(this);
 }