Esempio n. 1
0
        public static void RegisterHandlerFunc(RqId requestId, System.Action <MyPeer, OperationRequest> invokeFunc)
        {
            byte rqIdByte = (byte)requestId;

            if (mPeerHandlerDic.ContainsKey(rqIdByte))
            {
                LBLogger.Error(LogTag, "注册重复的事件处理 " + requestId.ToString());
                return;
            }
            mPeerHandlerDic[rqIdByte] = invokeFunc;
        }
Esempio n. 2
0
 protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
 {
     System.Action <MyPeer, OperationRequest> invokeAction;
     if (mPeerHandlerDic.TryGetValue(operationRequest.OperationCode, out invokeAction))
     {
         LBLogger.Info(LogTag, "OnOperationRequest " + ((RqId)operationRequest.OperationCode).ToString());
         invokeAction.Invoke(this, operationRequest);
     }
     else
     {
         LBLogger.Error(LogTag, "消息处理没有注册 " + operationRequest.OperationCode);
     }
 }