public void DoDestroy() { if (_client != null) { _client.Disconnect(); _client.Connected -= OnConnected; _client = null; } _isInit = false; }
public void Connect(string ip, int port, string key = "") { _client = new ClientSocketLn(); _isInit = true; for (short i = 0; i < _allDealFuncs.Length; i++) { var func = _allDealFuncs[i]; if (func != null) { _client.SetHandler(i, func); } } _client.Connected += OnConnected; _client.Connect(ip, port, key); nextCheckConnectTimeStamp = Time.timeSinceLevelLoad + ReconnectInterval; }
public void Connect(string ip, int port, string key) { this._ip = ip; this._port = port; this._key = key; _client = new ClientSocketLn(); _isInit = true; for (short i = 0; i < _allDealFuncs.Length; i++) { var func = _allDealFuncs[i]; if (func != null) { _client.SetHandler(i, func); } } _client.Connected += OnConnected; _client.Connect(_ip, _port, _key); }