// Start is called before the first frame update void Start() { lastSendTime = new DateTime(); ClientCommunication = new Communication.CAPI.API(); ClientCommunication.Initialize(); ClientCommunication.ReceiveMessage += OnReceive; ClientCommunication.ConnectServer(new IPEndPoint(IPAddress.Loopback, port)); }
void InitCommunication() { //initialize communication //communication initialization should be after parameter initialization Debug.Log("开始初始化通信"); clientCommunication = new Communication.CAPI.API(); //disable communication log if (debugLevel == 0) { Communication.Proto.Constants.Debug = new Communication.Proto.Constants.DebugFunc((_str) => { }); } clientCommunication.Initialize(); clientCommunication.ReceiveMessage += OnReceive; clientCommunication.ConnectServer(new IPEndPoint(IPAddress.Loopback, port)); Debug.Log("通信初始化完成"); }