private void OnDisconnected(object sender, EventArgs eventArgs) { UpdateRunner.RemoveUpdate(this); Status = ClientNetworkStatus.Disconnected; m_ClientSocket.OnConnect -= OnConnected; m_ClientSocket.OnReceive -= OnReceived; m_ClientSocket.OnDisconnect -= OnDisconnected; m_ClientSocket = null; }
public bool Disconnect() { if (m_ClientSocket != null && (Status == ClientNetworkStatus.Connecting || Status == ClientNetworkStatus.Connected)) { UpdateRunner.RemoveUpdate(this); Status = ClientNetworkStatus.Disconnecting; m_ClientSocket.Disconnect(); return(true); } return(false); }
public void Dispose() { eventHandlerDic.Clear(); if (delayEvents.Count > 0) { UpdateRunner.RemoveUpdate(this); } for (int i = delayEvents.Count - 1; i >= 0; --i) { eventDataPool.Release(delayEvents[i]); } delayEvents.Clear(); }
public void Disconnect() { if (m_serverSocket != null) { UpdateRunner.RemoveUpdate(this); m_serverSocket.OnClientConnect -= OnClientConnected; m_serverSocket.OnClientDisconnect -= OnClientDisconnected; m_serverSocket.OnReceive -= OnReceived; m_serverSocket.OnDisconnect -= OnDisconnected; if (m_serverSocket.IsConnected) { m_serverSocket.Disconnect(); } m_serverSocket = null; } }
public void DoUpdate(float deltaTime, float unscaleDeltaTime) { for (int i = delayEvents.Count - 1; i >= 0; --i) { EventData eventData = delayEvents[i]; eventData.DelayTime -= unscaleDeltaTime; if (eventData.DelayTime <= 0) { TriggerEvent(eventData.Sender, eventData.EventID, -1.0f, eventData.Values); delayEvents.RemoveAt(i); eventDataPool.Release(eventData); } } if (delayEvents.Count == 0) { UpdateRunner.RemoveUpdate(this); } }