DO-62 [Feat] 선후공 추가
This commit is contained in:
parent
cdf197b358
commit
4ef5a83cc6
@ -26,7 +26,6 @@ public abstract class BasePlayerState
|
||||
|
||||
if (_isMultiplay)
|
||||
{
|
||||
Debug.Log("row: " + row + "col: " + col);
|
||||
_multiplayManager.SendPlayerMove(_roomId, new Vector2Int(row, col));
|
||||
}
|
||||
|
||||
@ -73,6 +72,7 @@ public class PlayerState : BasePlayerState
|
||||
public PlayerState(bool isFirstPlayer, MultiplayManager multiplayManager, JoinRoomData data)
|
||||
: this(isFirstPlayer)
|
||||
{
|
||||
_isFirstPlayer = isFirstPlayer;
|
||||
_multiplayManager = multiplayManager;
|
||||
_roomId = data.roomId;
|
||||
_isMultiplay = true;
|
||||
@ -81,6 +81,7 @@ public class PlayerState : BasePlayerState
|
||||
public PlayerState(bool isFirstPlayer, MultiplayManager multiplayManager, string roomId)
|
||||
: this(isFirstPlayer)
|
||||
{
|
||||
_isFirstPlayer = isFirstPlayer;
|
||||
_multiplayManager = multiplayManager;
|
||||
_roomId = roomId;
|
||||
_isMultiplay = true;
|
||||
@ -341,13 +342,21 @@ public class GameLogic : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: 선공, 후공 처리
|
||||
if (joinRoomData.isBlack)
|
||||
{
|
||||
}
|
||||
// 선공, 후공 처리
|
||||
bool isFirstPlayer = joinRoomData.isBlack;
|
||||
|
||||
if (isFirstPlayer)
|
||||
{
|
||||
Debug.Log("해당 플레이어가 선공 입니다");
|
||||
firstPlayerState = new PlayerState(true, _multiplayManager, joinRoomData.roomId);
|
||||
secondPlayerState = new MultiPlayerState(false, _multiplayManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("해당 플레이어가 후공 입니다");
|
||||
firstPlayerState = new MultiPlayerState(true, _multiplayManager);
|
||||
secondPlayerState = new PlayerState(false, _multiplayManager, joinRoomData);
|
||||
}
|
||||
|
||||
// 메인 스레드에서 실행 - UI 업데이트는 메인 스레드에서 실행 필요
|
||||
UnityMainThreadDispatcher.Instance().Enqueue(() =>
|
||||
@ -379,13 +388,21 @@ public class GameLogic : MonoBehaviour
|
||||
Debug.Log("Start Game 응답값이 null 입니다");
|
||||
return;
|
||||
}
|
||||
// 선공, 후공 처리
|
||||
isFirstPlayer = startGameData.isBlack;
|
||||
|
||||
// TODO: 선공, 후공 처리
|
||||
if (startGameData.isBlack)
|
||||
if (isFirstPlayer)
|
||||
{
|
||||
}
|
||||
Debug.Log("해당 플레이어가 선공 입니다");
|
||||
firstPlayerState = new PlayerState(true, _multiplayManager, _roomId);
|
||||
secondPlayerState = new MultiPlayerState(false, _multiplayManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("해당 플레이어가 후공 입니다");
|
||||
firstPlayerState = new MultiPlayerState(true, _multiplayManager);
|
||||
secondPlayerState = new PlayerState(false, _multiplayManager, _roomId);
|
||||
}
|
||||
|
||||
// 메인 스레드에서 실행 - UI 업데이트는 메인 스레드에서 실행 필요
|
||||
UnityMainThreadDispatcher.Instance().Enqueue(() =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user