Skip to content

Commit

Permalink
Fix: bug when Not MasterClient leave Room
Browse files Browse the repository at this point in the history
  • Loading branch information
minsikim-42 committed Jun 27, 2024
1 parent 1e3c9dc commit fcf5656
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Assets/2Scripts/InGameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,12 @@ public void ExitInGame()
// 방장이 아닌 플레이어가 방을 나갈 경우
else // 나머지 클라이언트에게 알림
{
PV.RPC(nameof(RPC_LeaveUpdateTurn), RpcTarget.Others, PhotonNetwork.LocalPlayer.NickName);
LeaveRoom(); // 방 나가기
}
}
public void RemoveTurn(string nickName) {
PV.RPC(nameof(RPC_LeaveUpdateTurn), RpcTarget.Others, PhotonNetwork.LocalPlayer.NickName);
}

[PunRPC]
private void RPC_ExitInGame()
Expand Down
2 changes: 2 additions & 0 deletions Assets/2Scripts/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ public override void OnLeftRoom()

public override void OnPlayerLeftRoom(Player player)
{
Debug.Log("Net::OnPlayerLeftRoom" + player);
// 로비에서
if (SceneManager.GetActiveScene().name == "Lobby")
{
Expand All @@ -439,6 +440,7 @@ public override void OnPlayerLeftRoom(Player player)
{
if (InGameManager.IT.GetIsTurn(player.NickName) && PhotonNetwork.IsMasterClient)
InGameManager.IT.NextTurn(); // 다음 턴
InGameManager.IT.RemoveTurn(player.NickName);
}
}

Expand Down

0 comments on commit fcf5656

Please sign in to comment.