@@ -120,6 +120,15 @@ private void DrawInfo(Rect inRect)
120120 Widgets . Label ( inRect , Multiplayer . session . gameName ) ;
121121 inRect . yMin += Text . CalcHeight ( Multiplayer . session . gameName , inRect . width ) + 10f ;
122122
123+ if ( Prefs . DevMode )
124+ {
125+ var rect = new Rect ( inRect ) . Height ( 25f ) . Width ( 80f ) ;
126+ if ( Widgets . ButtonText ( rect , "Net info" ) )
127+ Find . WindowStack . Add ( new DebugTextWindow ( NetInfoText ( ) ) ) ;
128+
129+ inRect . yMin += rect . height + 10f ;
130+ }
131+
123132 DrawList (
124133 "MpChatPlayers" . Translate ( Multiplayer . session . players . Count ) ,
125134 Multiplayer . session . players ,
@@ -350,9 +359,7 @@ public void SendMsg()
350359
351360 if ( currentMsg . NullOrEmpty ( ) ) return ;
352361
353- if ( MpVersion . IsDebug && currentMsg == "/netinfo" )
354- Find . WindowStack . Add ( new DebugTextWindow ( NetInfoText ( ) ) ) ;
355- else if ( Multiplayer . Client == null )
362+ if ( Multiplayer . Client == null )
356363 Multiplayer . session . AddMsg ( Multiplayer . username + ": " + currentMsg ) ;
357364 else
358365 Multiplayer . Client . Send ( ClientChatPacket . Create ( currentMsg ) ) ;
@@ -366,21 +373,13 @@ private string NetInfoText()
366373
367374 var text = new StringBuilder ( ) ;
368375
369- void LogNetData ( string name , NetStatistics stats )
376+ if ( Multiplayer . Client is ClientLiteNetConnection conn )
370377 {
371- text . AppendLine ( name ) ;
372- text . AppendLine ( $ "Bytes received: { stats . BytesReceived } ") ;
373- text . AppendLine ( $ "Bytes sent: { stats . BytesSent } ") ;
374- text . AppendLine ( $ "Packets received: { stats . PacketsReceived } ") ;
375- text . AppendLine ( $ "Packets sent: { stats . PacketsSent } ") ;
376- text . AppendLine ( $ "Packet loss: { stats . PacketLoss } ") ;
377- text . AppendLine ( $ "Packet loss percent: { stats . PacketLossPercent } ") ;
378+ text . AppendLine ( "Client" ) ;
379+ text . AppendLine ( conn . peer . Statistics . ToDebugString ( ) ) ;
378380 text . AppendLine ( ) ;
379381 }
380382
381- if ( Multiplayer . Client is ClientLiteNetConnection conn )
382- LogNetData ( "Client" , conn . peer . Statistics ) ;
383-
384383 if ( Multiplayer . LocalServer != null )
385384 {
386385 foreach ( var man in Multiplayer . LocalServer . netManagers )
@@ -406,16 +405,19 @@ void LogNetData(string name, NetStatistics stats)
406405 text . AppendLine ( $ "Connecting: { state . m_bConnecting } ") ;
407406 text . AppendLine ( $ "Error: { state . m_eP2PSessionError } ") ;
408407 text . AppendLine ( $ "Using relay: { state . m_bUsingRelay } ") ;
409- text . AppendLine ( $ "Bytes to send: { state . m_nBytesQueuedForSend } ") ;
410- text . AppendLine ( $ "Packets to send: { state . m_nPacketsQueuedForSend } ") ;
411- text . AppendLine ( $ "Remote IP: { state . m_nRemoteIP } ") ;
412- text . AppendLine ( $ "Remote port: { state . m_nRemotePort } ") ;
408+ text . AppendLine ( $ "Send queue: { state . m_nBytesQueuedForSend } B { state . m_nPacketsQueuedForSend } packets") ;
409+ text . AppendLine ( $ "Remote IP: { state . m_nRemoteIP } :{ state . m_nRemotePort } ") ;
413410 }
414411 else
415412 {
416413 text . AppendLine ( "No connection" ) ;
417414 }
418415
416+ foreach ( var pending in Multiplayer . session . pendingSteam )
417+ {
418+ text . AppendLine ( $ "Steam pending { pending } :{ SteamFriends . GetFriendPersonaName ( remote ) } ") ;
419+ }
420+
419421 text . AppendLine ( ) ;
420422 }
421423
0 commit comments