修改甘肃定西场景

This commit is contained in:
ZYT
2026-03-14 14:47:44 +08:00
parent cdc555d3ae
commit 44bbc763b5
9 changed files with 566 additions and 194 deletions

View File

@@ -140,4 +140,36 @@ public class MRNetworkManager : NetworkRoomManager
return -1;
}
}
/// <summary>
/// 当玩家断开连接时调用(仅在服务器端)
/// </summary>
public override void OnServerDisconnect(NetworkConnectionToClient conn)
{
// 获取断开连接的玩家索引
if (conn.identity != null)
{
Player player = conn.identity.GetComponent<Player>();
if (player != null)
{
Debug.Log($"玩家 {player.index} 断开连接,清理数据");
// 移除玩家数据
if (GameManager.Ins != null)
{
GameManager.Ins.RemovePlayerData(player.index);
}
}
}
base.OnServerDisconnect(conn);
}
/// <summary>
/// 当客户端断开连接时调用(仅在客户端)
/// </summary>
public override void OnClientDisconnect()
{
Debug.Log("从机断开连接");
base.OnClientDisconnect();
}
}