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