Exemplo n.º 1
0
 public SCRequestDropRet(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 2
0
 public CSCreateRoom(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 3
0
 public SCNotifyMahjongEnd(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 4
0
 public BYTES mHuList       = new BYTES(GameDefine.MAX_HU_COUNT);   // 当有胡操作时,该数组中才会有值
 public SCAskAction(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 5
0
 public BYTE mResult = new BYTE();      // 0表示成功,1表示失败
 public SCCheckNameRet(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 6
0
 public SCStartGame(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 7
0
 public SCReadyRet(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 8
0
 public INT mPlayerGUID = new INT();                 // 离开房间的玩家GUID
 public SCOtherPlayerLeaveRoom(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 9
0
 public BYTE mResult = new BYTE();      // 0表示成功,1表示失败
 public SCCheckAccountRet(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 10
0
 public SCShowHua(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 11
0
    //------------------------------------------------------------------------------------------------------------
    protected SocketPacket createPacket(Type classType, PACKET_TYPE packetType)
    {
        SocketPacket packet = UnityUtility.createInstance <SocketPacket>(classType, packetType);

        packet.init();
        return(packet);
    }
Exemplo n.º 12
0
 public SCBackToMahjongHallRet(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 13
0
 public CSHeartBeat(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 14
0
 public CSCheckName(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
    public void sendClientPacket(SocketPacket packet)
    {
        if (mServerSocket == null || !mServerSocket.Connected || mConnectState != CONNECT_STATE.CS_CONNECTED)
        {
            mSocketFactory.destroyPacket(packet);
            return;
        }
        // 将消息包中的数据准备好,然后放入发送列表中
        // 前四个字节分别是两个short,代表消息类型和消息内容长度
        PACKET_TYPE type       = packet.getPacketType();
        ushort      packetSize = (ushort)packet.generateSize();

        byte[] packetData = getUnusedBytes(CommonDefine.PACKET_HEADER_SIZE + packetSize);
        memset(packetData, (byte)0);
        int index = 0;

        writeInt(packetData, ref index, (int)type);
        writeUShort(packetData, ref index, packetSize);
        if (packetSize > 0 && !packet.write(packetData, CommonDefine.PACKET_HEADER_SIZE))
        {
            mSocketFactory.destroyPacket(packet);
            mCollectedBytes.addToBuffer(packetData);
            logError("消息序列化失败!");
            return;
        }
        logInfo("已发送 : " + type + ", 字节数:" + packetSize, LOG_LEVEL.LL_LOW);
        // 添加到写缓冲中
        mOutputBuffer.addToBuffer(packetData);
    }
Exemplo n.º 16
0
 public CSLogin(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 17
0
 public SCLoginRet(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 18
0
 public SCJoinRoomRet(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 19
0
 public CSRequestDrop(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 20
0
 public SCOtherPlayerAskAction(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 21
0
 public SCPlayerHu(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 22
0
 public SCNotifyGetStartMahjong(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 23
0
 public SCDiceDoneRet(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 24
0
 public SCOtherPlayerPeng(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 25
0
 public CSRegister(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 26
0
    public SocketFactory registerFactory <T>(PACKET_TYPE type) where T : SocketPacket
    {
        SocketFactory factory = createFactory(typeof(T), type);

        mFactoryList.Add(factory.getType(), factory);
        return(factory);
    }
Exemplo n.º 27
0
 public SCNotifyReorderMahjong(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 28
0
 public INT mPlayerGUID = new INT();                 // 庄家ID
 public SCNotifyBanker(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 29
0
 public SCOtherPlayerContinueGame(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 30
0
 public SCAskDrop(PACKET_TYPE type)
     :
     base(type)
 {
     fillParams();
     zeroParams();
 }
Exemplo n.º 31
0
 public Google.ProtocolBuffers.IMessage HandleBuf(PACKET_TYPE packet_type, byte[] packet_buf)
 {
     Google.ProtocolBuffers.IMessage message = null;
     if (m_handlers.ContainsKey(packet_type) == true)
     {
         m_handlers[packet_type](packet_buf);
     }
     else
     {
         // Console.WriteLine("Invalid packet_type({0})", packet_type);
     }
     return message;
 }
Exemplo n.º 32
0
        public void SendProtobuf(Google.ProtocolBuffers.IMessage message, PACKET_TYPE packet_type)
        {
            if (m_socket == null || m_socket.Connected == false)
            {
                Disconnect();
                return;
            }
            byte[] type_bytes = BitConverter.GetBytes((int)packet_type);

            byte[] packet_buffer = message.ToByteArray();
            int size = packet_buffer.Length;
            byte[] size_bytes = BitConverter.GetBytes(size);

            int buf_size = packet_buffer.Length + size_bytes.Length + type_bytes.Length;
            byte[] send_buf = new byte[buf_size];
            System.Buffer.BlockCopy(size_bytes, 0, send_buf, 0, size_bytes.Length);
            System.Buffer.BlockCopy(type_bytes, 0, send_buf, size_bytes.Length, type_bytes.Length);
            System.Buffer.BlockCopy(packet_buffer, 0, send_buf, size_bytes.Length + type_bytes.Length, packet_buffer.Length);
            m_socket.Send(send_buf);
            // Console.WriteLine("Send len({0}) = header({1} + {2}) + body({3})", buf_size, size_bytes.Length, type_bytes.Length, packet_buffer.Length);
        }
Exemplo n.º 33
0
 public void AddHandle(PACKET_TYPE packet_type, Handler packet_handler)
 {
     m_handlers.Add(packet_type, packet_handler);
 }
Exemplo n.º 34
0
 public packet(PACKET_TYPE type)
 {
     m_packetID = (byte)type;
     m_data = new List<byte>();
     m_pos = 0;
 }
Exemplo n.º 35
0
        UInt16 m_pos; // used so we can read and write data

        #endregion Fields

        #region Constructors

        public scPacket(PACKET_TYPE type)
        {
            m_packetID = (byte)type;
            m_pos = 1;
            m_packetData = new List<byte>();
        }
Exemplo n.º 36
0
 public void DelHandle(PACKET_TYPE packet_type)
 {
     m_handlers.Remove(packet_type);
 }