storage optimized, end screen fixed, multi touch error fixed, error logs on server, fixes...

This commit is contained in:
2026-05-16 23:49:09 +05:30
parent 22e1a8cf50
commit 5d2eb3aaea
2589 changed files with 19080 additions and 267645 deletions
+84
View File
@@ -1,3 +1,4 @@
using System;
using System.Collections;
using UnityEngine;
using Mirror;
@@ -16,6 +17,87 @@ public class NetManager : NetworkManager
static bool s_IntentionalClientDisconnect;
public override void Awake()
{
base.Awake();
Transport.active.OnClientError += OnTransportClientError;
}
void OnDestroy()
{
if (Transport.active != null)
Transport.active.OnClientError -= OnTransportClientError;
}
static void OnTransportClientError(TransportError error, string reason)
{
Logger.Log($"Transport client error ({error}): {reason}");
}
public override void OnStartServer()
{
base.OnStartServer();
Application.logMessageReceived += ForwardMirrorServerLogToLogger;
Logger.Log("Mirror server exception logging enabled");
}
public override void OnServerError(NetworkConnectionToClient conn, TransportError error, string reason)
{
int connId = conn != null ? conn.connectionId : -1;
Logger.Log($"Mirror server transport error (connId={connId}, {error}): {reason}");
base.OnServerError(conn, error, reason);
}
public override void OnServerTransportException(NetworkConnectionToClient conn, Exception exception)
{
int connId = conn != null ? conn.connectionId : -1;
Logger.Log($"Mirror server transport exception (connId={connId}): {exception}");
base.OnServerTransportException(conn, exception);
}
public override void OnServerDisconnect(NetworkConnectionToClient conn)
{
if (conn != null)
Logger.Log($"Mirror server: client disconnected (connId={conn.connectionId})");
base.OnServerDisconnect(conn);
}
static void ForwardMirrorServerLogToLogger(string logString, string stackTrace, LogType type)
{
if (!NetworkServer.active)
return;
if (!ShouldForwardMirrorServerLog(logString, stackTrace, type))
return;
if (string.IsNullOrEmpty(stackTrace))
Logger.Log($"[Mirror/{type}] {logString}");
else
Logger.Log($"[Mirror/{type}] {logString}\n{stackTrace}");
}
static bool ShouldForwardMirrorServerLog(string message, string stackTrace, LogType type)
{
if (type == LogType.Exception)
return ContainsMirrorNetworkContext(message, stackTrace);
if (type != LogType.Error)
return false;
return message.Contains("Disconnecting connection:")
|| message.Contains("NetworkServer:")
|| message.Contains("because handling a message")
|| message.Contains("because reading a message")
|| message.Contains("failed to unpack and invoke")
|| message.Contains("was too short (messages should start with message id)");
}
static bool ContainsMirrorNetworkContext(string message, string stackTrace)
{
return (message != null && (message.Contains("Mirror") || message.Contains("NetworkServer")))
|| (stackTrace != null && stackTrace.Contains("Mirror"));
}
public static void MarkIntentionalClientDisconnect()
{
s_IntentionalClientDisconnect = true;
@@ -30,6 +112,8 @@ public class NetManager : NetworkManager
public override void OnStopServer()
{
Application.logMessageReceived -= ForwardMirrorServerLogToLogger;
GameManager.ReportDedicatedMatchRoomClosed();
base.OnStopServer();
}