コード例 #1
0
ファイル: MessageEngine.cs プロジェクト: uvbs/FullSource
        /// <summary>
        /// 分发认证消息
        /// </summary>
        /// <param name="authentication">服务器认证</param>
        /// <param name="msgBuff">消息</param>
        private void DispatchAuthentication(GameServerAuthentication authentication, byte[] msgBuff)
        {
            if (authentication == null || msgBuff == null)
            {
                return;
            }

            ProtocolDef protocalId = (ProtocolDef)BitConverter.ToUInt16(msgBuff, 0);
            IProtocol   message    = null;

            switch (protocalId)
            {
            case ProtocolDef.g2e_Authentication_def:
                message = new g2e_Authentication();
                message.FromBytes(msgBuff);
                break;
                //default:
                //throw new Exception("收到不应该在认证阶段发送的协议包");
            }

            if (message != null)
            {
                authentication.Authentication(message);
            }
        }
コード例 #2
0
ファイル: MessageEngine.cs プロジェクト: viticm/pap2
		/// <summary>
		/// 分发认证消息
		/// </summary>
		/// <param name="authentication">服务器认证</param>
		/// <param name="msgBuff">消息</param>
		private void DispatchAuthentication(GameServerAuthentication authentication, byte[] msgBuff)
		{
			if (authentication == null || msgBuff == null)
				return;

			ProtocolDef protocalId = (ProtocolDef)BitConverter.ToUInt16(msgBuff, 0);
			IProtocol message = null;
			switch (protocalId)
			{
				case ProtocolDef.g2e_Authentication_def:
					message = new g2e_Authentication();
                    message.FromBytes(msgBuff);
					break;
				//default:
				//throw new Exception("收到不应该在认证阶段发送的协议包");
			}

			if (message != null)
			{
				authentication.Authentication(message);
			}
		}