Beispiel #1
0
 private void UpdateStreamLog(GameAction gameAction, NetworkPlayer player, bool isSending)
 {
     //here we can look at the ActionType and decide if we dont want to spam the log, such as for PlayerMove
     if (gameAction.ActionType == ActionType.PlayerMove && !cbShowPlayerMove.Checked) return;
     try
     {
         lbTcpStream.Items.Add(string.Format("{0} [{1}] {2} ({3}b) {4}", isSending ? "SEND" : "RECV", player.Id, player.UserName, gameAction.DataLength, gameAction));
         if (lbTcpStream.Items.Count > MAX_STREAM_LOG_LENGTH) lbTcpStream.Items.RemoveAt(0);
         lbTcpStream.TopIndex = lbTcpStream.Items.Count - 1;
     }
     catch (Exception ex)
     {
         Misc.MessageError("Error updating server console stream: " + ex.Message);
     }
 }
Beispiel #2
0
 internal void UpdateStreamLogInvokable(GameAction gameAction, NetworkPlayer player, bool isSending)
 {
     if (!InvokeRequired) UpdateStreamLog(gameAction, player, isSending); else Invoke((MethodInvoker)(() => UpdateStreamLog(gameAction, player, isSending))); //allows other threads to update this form
 }
Beispiel #3
0
 internal static void WriteToServerStreamLog(GameAction gameAction, NetworkPlayer player, bool isSending)
 {
     _serverConsole.UpdateStreamLogInvokable(gameAction, player, isSending);
 }