private void OnApplicationQuit() { if (_session != null) { _client.Disconnect(); } }
void OnApplicationQuit() { // If no matchmaking active just disconnect. if (_matchmakeTicket == null) { // Lets gracefully disconnect from the server. _client.Disconnect(); return; } // If matchmaking active stop matchmaking then disconnect. var message = NMatchmakeRemoveMessage.Default(_matchmakeTicket); _client.Send(message, (bool done) => { // The user is now removed from the matchmaker pool. Debug.Log("Matchmaking stopped."); // Lets gracefully disconnect from the server. _client.Disconnect(); }, (INError error) => { Debug.LogErrorFormat("Send error: code '{1}' with '{0}'.", error.Message, error.Code); // Lets gracefully disconnect from the server. _client.Disconnect(); }); }
private void OnMatchData(INMatchData msg) { switch (msg.OpCode) { case 99L: // game is full so disconnect string userHandle = System.Text.Encoding.UTF8.GetString(msg.Data); if (userHandle == self.Handle) { client.Disconnect(); } break; default: nvp_EventManager_scr.INSTANCE.InvokeEvent(GameEvents.OnGameMessageReceived, this, msg); break; } }
void OnApplicationQuit() { if (client1Connected) { client1.Disconnect(); } if (client2Connected) { client2.Disconnect(); } }
public void GetServerTime_Valid() { ManualResetEvent evt = new ManualResetEvent(false); long serverTime = 0; string id = TestContext.CurrentContext.Random.GetString(); INClient client = NClient.Default(DefaultServerKey); var message = NAuthenticateMessage.Device(id); client.Register(message, (INSession session) => { client.Connect(session); Thread.Sleep(500); serverTime = client.ServerTime; evt.Set(); }, (INError _) => { evt.Set(); }); evt.WaitOne(1000, false); Assert.That(serverTime, Is.Not.EqualTo(0)); client.Disconnect(); }
public void Connect_Valid() { ManualResetEvent evt = new ManualResetEvent(false); var connected = false; string id = TestContext.CurrentContext.Random.GetString(); INClient client = NClient.Default(DefaultServerKey); var message = NAuthenticateMessage.Device(id); client.Register(message, (INSession session) => { client.Connect(session, (bool _) => { connected = true; evt.Set(); }); }, (INError _) => { evt.Set(); }); evt.WaitOne(500, false); Assert.IsTrue(connected); client.Disconnect(); }
void OnApplicationQuit() { if (client1Connected) { client1.Disconnect(); } if (client2Connected) { client2.Disconnect(); } // Release button handlers RegisterButtonPlayer1.onClick.RemoveListener(Player1RegisterClick); LoginButtonPlayer1.onClick.RemoveListener(Player1LoginClick); ConnectPlayer1.onClick.RemoveListener(Player1Connect); RegisterButtonPlayer2.onClick.RemoveListener(Player2RegisterClick); LoginButtonPlayer2.onClick.RemoveListener(Player2LoginClick); ConnectPlayer2.onClick.RemoveListener(Player2Connect); JoinTopicPlayer1.onClick.RemoveListener(Player1JoinTopic); JoinTopicPlayer2.onClick.RemoveListener(Player2JoinTopic); SendChatPlayer1.onClick.RemoveListener(Player1SendChatMessage); SendChatPlayer2.onClick.RemoveListener(Player2SendChatMessage); }
public void TearDown() { client.Disconnect(); }
public void TearDown() { client1.Disconnect(); client2.Disconnect(); }
void OnApplicationQuit() { client.Disconnect(); }
private void OnApplicationQuit() { _doReconnect = false; _client.Disconnect(); }