Exemple #1
0
 public void UnReg(int eventId, GameEventDelegate.CallBack callBack)
 {
     if (mDicEvent.ContainsKey(eventId))
     {
         GameEventDelegate evt = mDicEvent[eventId];
         evt.RemoveCallBack(callBack);
     }
 }
    public void UnReg(int eventID, GameEventDelegate.CallBack callBack)
    {
        for (int i = 0; i < mCBLis.Count; i++)
        {
            MsgCBStruct msg = mCBLis[i];
            if (msg.eventID == eventID && msg.CallBack == callBack)
            {
                mCBLis.RemoveAt(i);
                break;
            }
        }

        mDispatchEvent.UnReg(eventID, callBack);
    }
    public void Reg(int eventID, GameEventDelegate.CallBack callBack)
    {
        foreach (var cb in mCBLis)
        {
            if (cb.eventID == eventID && cb.CallBack == callBack)
            {
                return;
            }
        }

        MsgCBStruct msg;

        msg.eventID  = eventID;
        msg.CallBack = callBack;

        mCBLis.Add(msg);
        mDispatchEvent.Reg(eventID, callBack);
    }
Exemple #4
0
    public void Reg(int eventId, GameEventDelegate.CallBack callBack)
    {
        GameEventDelegate evt = null;

        if (!mDicEvent.ContainsKey(eventId))
        {
            evt = new GameEventDelegate(eventId);
            mDicEvent.Add(eventId, evt);
        }
        else
        {
            evt = mDicEvent[eventId];
        }

        if (evt != null)
        {
            evt.AddCallBack(callBack);
        }
    }
 public void UnReg(ClientMsgId msgId, GameEventDelegate.CallBack callBack)
 {
     UnReg((int)msgId, callBack);
 }
 public void Reg(ClientMsgId msgID, GameEventDelegate.CallBack callBack)
 {
     Reg((int)msgID, callBack);
 }