Exemple #1
0
        private void OnTestProtoCallBack(Role role, byte[] content)
        {
            TestProto proto = TestProto.GetProto(content);

            Console.WriteLine(string.Format("Id:{0}  Name{1}", proto.Id, proto.Name));

            proto.Id   = 1002;
            proto.Name = "杨明";
            role.Client_Socket.SendMsg(proto.ToArray());
        }
        private void OnRequestTest(Role role, byte[] buffer)
        {
            Console.WriteLine("客户端请求测试协议 ");

            TestProto proto = new TestProto();

            proto.Id    = 100;
            proto.Name  = "Response";
            proto.Price = 1200;
            proto.Type  = 2;

            role.Client_Socket.SendMsg(proto.ToArray());
        }
Exemple #3
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            TestProto proto = new TestProto();
            proto.Id    = 100;
            proto.Name  = "测试协议";
            proto.Price = 66.6f;
            proto.Type  = 80;

            //发送
            NetWorkSocket.Instance.SendMsg(proto.ToArray());
        }
        if (Input.GetKeyDown(KeyCode.B))
        {
            Mail_Get_DetailProto proto = new Mail_Get_DetailProto();
            NetWorkSocket.Instance.SendMsg(proto.ToArray());
        }
    }
Exemple #4
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            TestProto proto = new TestProto();
            proto.Id    = 100;
            proto.Name  = "测试协议";
            proto.Type  = 80;
            proto.Price = 99.5f;

            NetWorkSocket.Instance.SendMsg(proto.ToArray());
        }
        //if (Input.GetKeyDown(KeyCode.S))
        //{
        //    Send("你好,S");
        //}
        //if (Input.GetKeyDown(KeyCode.D))
        //{
        //    for (int i = 0; i < 30; i++)
        //    {
        //        Send("你好循环...." + i);
        //    }
        //}
    }