Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (!m_Destroy)
        {
            LanSocket.ClientMsgUnPack clientMsg = null;
            m_GameNet.GetMsg(ref clientMsg);
            if (null != clientMsg)
            {
                //print("Msg:" + clientMsg.GetMsgID() + " from: " + clientMsg.GetUserID());

                EventNode mNode = new EventNode();
                mNode.m_EventID = clientMsg.GetMsgID();
                mNode.msg       = clientMsg;

                MonoBehaviour.print("Update EventID " + mNode.m_EventID + " ID: " + clientMsg.GetMsgID());
                m_ClientMsg.AddEvent(mNode);
            }

            if (!"".Equals(m_Reciver.GetIP()))
            {
                m_Sender.Send();
            }

            m_ClientMsg.Proccess();
        }
    }
Ejemplo n.º 2
0
    void Action_C2S_ASK_SEND_AUDIO_END(LanSocket.ClientMsgUnPack msg)
    {
        print("audio length: " + m_AudioOffset);
        short[] decodeData = new short[m_AudioOffset / 2];
        for (int i = 0; i < decodeData.Length; ++i)
        {
            decodeData[i] = System.BitConverter.ToInt16(m_AudioData, i * 2);
        }
        //MicroPhoneInput.getInstance().PlayClipData(decodeData);

        //         string result = string.Empty;
        //         for (int i = 0; i < m_AudioOffset; i++)
        //         {
        //             result += System.Convert.ToString(m_AudioData[i], 16) + " ";
        //         }
        //         print(result);
    }
Ejemplo n.º 3
0
    void Action_C2S_ASK_SEND_AUDIO(LanSocket.ClientMsgUnPack msg)
    {
        long   userID  = msg.GetUserID();
        ushort dataLen = msg.ReadUShort();

        byte[] audioData = msg.ReadByte(dataLen);

        //         string result = string.Empty;
        //         for (int i = 0; i < dataLen; i++)
        //         {
        //             result += System.Convert.ToString(audioData[i], 16) + " ";
        //         }
        //         print(result);

        System.Buffer.BlockCopy(audioData, 0, m_AudioData, m_AudioOffset, (int)dataLen);
        m_AudioOffset += dataLen;
    }
Ejemplo n.º 4
0
 /// <summary>
 /// 获取一个数据
 /// </summary>
 public void GetMsg(ref ClientMsgUnPack msg)
 {
     if (!m_HasInit)
     {
         return;
     }
     try
     {
         Lock();
         if (0 != m_MsgOrder.Count)
         {
             int           mSlot       = m_MsgOrder.Dequeue();
             ClientConnect curPlayer   = m_ConnectPool[mSlot];
             ushort        mOnePackLen = System.BitConverter.ToUInt16(curPlayer.m_AllData, curPlayer.m_AllDataHead);
             msg = new ClientMsgUnPack(curPlayer.m_AllData, (ushort)curPlayer.m_AllDataHead, (ushort)mOnePackLen, (int)curPlayer.m_UserID);
             curPlayer.m_AllDataHead += mOnePackLen;
         }
     }
     finally
     {
         UnLock();
     }
 }
Ejemplo n.º 5
0
    void Action_123(LanSocket.ClientMsgUnPack msg)
    {
        long   userID     = msg.GetUserID();
        ushort accountLen = msg.ReadUShort();
        string account    = msg.ReadString(accountLen);
        ushort passLen    = msg.ReadUShort();
        string pass       = msg.ReadString(passLen);

        print("Action_123 account: " + account + " pass word: " + pass + " from user: "******"test account";

        sendMsg.Pack16bit((ushort)strAccount.Length);
        sendMsg.PackString(strAccount, (ushort)strAccount.Length);
        string strPass = "******";

        sendMsg.Pack16bit((ushort)strPass.Length);
        sendMsg.PackString(strPass, (ushort)strPass.Length);
        sendMsg.PackEnd();
        m_GameNet.SendTo(ref sendMsg, msg.GetUserID());
    }
Ejemplo n.º 6
0
 void Action_C2S_ASK_SEND_AUDIO_BEGIN(LanSocket.ClientMsgUnPack msg)
 {
     m_AudioOffset = 0;
     m_AudioLen    = 0;
 }