Esempio n. 1
0
        public void Init(out IEnumerator rcv)
        {
            handle = new TcpClientHandler();
            handle.InitSocket(out rcv);
            id_mp = new Dictionary <ushort, Proto>();
            ty_mp = new Dictionary <int, Proto>();

            Regist();
        }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        //初始化网络连接
        //tcpClient=new TcpClientHandler(); //因为tcp的类继承了monobehaviour所以不能用new,或者去掉对monobehaviour继承就可以用new
        tcpClient = gameObject.AddComponent <TcpClientHandler>();
        tcpClient.InitSocket();

        //找到cube
        cube = GameObject.Find("Cube");
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        //初始化网络连接
        //tcpClient=new TcpClientHandler(); //因为tcp的类继承了monobehaviour所以不能用new,或者去掉对monobehaviour继承就可以用new
        tcpClient = gameObject.AddComponent <TcpClientHandler>();
        tcpClient.InitSocket();

        //btn1.onClick.AddListener(() =>
        //{
        //    tcpClient.SocketSend("1");
        //    NodeCode.text = "节点编号:" + tcpClient.GetRecvStr();
        //});
        //btn2.onClick.AddListener(() =>
        //{
        //    tcpClient.SocketSend("2");
        //    LightStrength.text = "当前光强:" + tcpClient.GetRecvStr();
        //});
        InvokeRepeating("init", 1, 10);
    }
Esempio n. 4
0
 public void init(string ip, int port)
 {
     client.InitSocket(ip, port);
 }