Exemplo n.º 1
0
 public void UnSuscribe(OnEventDel del, GameEventType type)
 {
     if (event_delegates.ContainsKey(type))
     {
         event_delegates[type] -= del;
     }
 }
Exemplo n.º 2
0
 public void Suscribe(GameEventType type, OnEventDel callback)
 {
     if (event_delegates.ContainsKey(type))
     {
         event_delegates[type] += callback;
     }
     else
     {
         OnEventDel del = null;
         del += callback;
         event_delegates.Add(type, del);
     }
 }
Exemplo n.º 3
0
    public void SendEvent(GameEvent ev)
    {
        if (ev != null)
        {
            if (event_delegates.ContainsKey(ev.Type()))
            {
                OnEventDel del = event_delegates[ev.Type()];

                if (del != null)
                {
                    del(ev);
                }
            }
        }
    }
Exemplo n.º 4
0
    public void Suscribe(OnEventDel del)
    {
        bool found = false;

        if (OnEvent != null)
        {
            foreach (Delegate d in OnEvent.GetInvocationList())
            {
                if ((OnEventDel)d == del)
                {
                    found = true;
                    break;
                }
            }
        }

        if (!found)
        {
            OnEvent += del;
        }
    }
Exemplo n.º 5
0
 // prevent warning about unused events
 public void UseEvents()
 {
     OnEventDel?.Invoke(1, 2);
     OnEventInt?.Invoke(1);
     OnEvent?.Invoke(null, null);
 }
Exemplo n.º 6
0
 public void UnSuscribe(OnEventDel del)
 {
     OnEvent -= del;
 }
Exemplo n.º 7
0
 public void Suscribe(OnEventDel del)
 {
     OnEvent += del;
 }