/// <summary> /// Function for determining if view mode has been toggled and, if so, activating or deactivating Character View mode. /// This function is called periodically by TaleSpire. /// </summary> void Update() { // Ensure that there is a camera controller instance if (CameraController.HasInstance) { // Ensure that there is a board session manager instance if (BoardSessionManager.HasInstance) { // Ensure that there is a board if (BoardSessionManager.HasBoardAndIsInNominalState) { // Ensure that the board is not loading if (!BoardSessionManager.IsLoading) { // Check for user input to determine if the Sync Mod Server status should be toggled server.StartOn(StartServerKey.Value.MainKey, ClientRequests); // Check to see if the Sync Mod Server has sent a notification and connect to the Sync Mod Server if one is sent if (!server.isRunning()) { client.CheckForServerNotification(ServerRequests); } // Broadcasting all server messages if (server.isRunning()) { while (_serverMessages.TryDequeue(out var message)) { Debug.Log("Sending Server Message!"); var serialized = JsonConvert.SerializeObject(message); server.Broadcast(serialized); } } // Sending all messages from client to server if (client.isConnected()) { while (_clientMessages.TryDequeue(out var message)) { UnityEngine.Debug.Log("Sending Client Message!"); var serialized = JsonConvert.SerializeObject(message); client.Send(serialized); } } } } } } }