修改甘肃定西场景
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user