private void Start() { switch (socketType) { case SocketType.TcpClient: socket = new TcpClient(address, port); break; case SocketType.TcpServer: socket = new TcpServer(port); break; case SocketType.UdpClient: socket = new UdpClient(address, port); break; } socket.Launch(); if (openHearBeat) { hearBeat = gameObject.AddComponent <HearBeatComponent>(); hearBeat.Init(socket); } EventManager.Instance.Regist(MsgID.ConnectSuccess, ConnectSuccess); EventManager.Instance.Regist(MsgID.ConnectFailed, ConnectFailed); Application.runInBackground = true; }
public void Launch() { socket.Launch(); }