Пример #1
0
 /// <summary>
 /// 取消某一类型消息的注册
 /// </summary>
 /// <param name="eventType"></param>
 public void UnRegister(Client.GameEventID eventType)
 {
     if (eventDic.ContainsKey(eventType))
     {
         eventDic.Remove(eventType);
     }
 }
Пример #2
0
    /// <summary>
    /// 分发消息
    /// </summary>
    /// <param name="eventType">小心类型</param>
    public void Dispatch(Client.GameEventID eventType, object data = null)
    {
        UIGlobalEventDelegate eventDlg = null;

        if (eventDic.TryGetValue(eventType, out eventDlg) && null != eventDlg)
        {
            eventDlg.Invoke(eventType, data);
        }
    }
Пример #3
0
    /// <summary>
    /// 取消注册某一小心类型的单个回调
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="callback"></param>
    public void UnRegister(Client.GameEventID eventType, UIGlobalEventDelegate callback)
    {
        if (null == callback)
        {
            return;
        }
        UIGlobalEventDelegate eventDlg = null;

        eventDic.TryGetValue(eventType, out eventDlg);
        if (null != eventDlg)
        {
            eventDlg           -= callback;
            eventDic[eventType] = eventDlg;
        }
    }