@@ -10,40 +10,57 @@ public class OnlineGameMode : IGameModeController
private NormalPlayFieldController _playFieldController = new NormalPlayFieldController();
private GameOverPopupController _gameOverPopupController = new GameOverPopupController();

private List<PlayerState> _playerList = new List<PlayerState>(4);
private List<PlayerState> _playerList = new List<PlayerState>(PlayerGroup.kMaxPlayerCount);

private GameMatchCore _gameMatchCore;
private Action _onGameOverCallback;

private bool _isMasterClient;

public bool isMasterClient { get; set; }
private NetworkManager _networkManager;

public void Start( Action gameOverCallback)
{
_onGameOverCallback = gameOverCallback;

_setupPlayerList();
_networkManager = Singleton.instance.networkManager;
_networkManager.onCustomEvent += onCustomEvent;

CardDeck customerDeck = CardDeck.FromFile("Decks/CustomerDeck");
customerDeck.Shuffle(kRandomSeed);
CardDeck ingredientDeck = CardDeck.FromFile("Decks/IngredientDeck");
ingredientDeck.Shuffle(kRandomSeed);
_onGameOverCallback = gameOverCallback;

GameContext context = Singleton.instance.sessionFlags.gameContext;
_playerList.Clear();
_playerList.AddRange(context.playerList);

_gameMatchCore = GameMatchCore.Create(
_playerList,
isMasterClient,
customerDeck,
ingredientDeck);
context.isMasterClient,
context.customerDeck,
context.ingredientDeck);

_playFieldController.Start(_gameMatchCore.matchState);
_setupCallbacks();
_setupPlayFieldCallbacks();
}

public void CleanUp()
{
_playFieldController.RemoveView();
Singleton.instance.networkManager.Disconnect();
_networkManager.onCustomEvent -= onCustomEvent;
_networkManager.Disconnect();
}

private void onCustomEvent(byte eventCode, object content, int senderId)
{
if(eventCode == NetworkOpCodes.PLAYER_TURN_COMPLETED)
{
EndTurnRequestEvent endTurn = JsonUtility.FromJson<EndTurnRequestEvent>(content as string);
for(int i = 0; i < endTurn.moveRequestList.Length; ++i)
{
MoveRequest move = endTurn.moveRequestList[i];
Debug.Log(string.Format("End turn event: {0}, {1}, {2}", move.playerIndex, move.handSlot, move.customerSlot));
}
}
else if(eventCode == NetworkOpCodes.BEGIN_NEXT_PLAYER_TURN)
{
ChangeTurnEvent changeTurn = JsonUtility.FromJson<ChangeTurnEvent>(content as string);
Debug.Log("Active Player: " + changeTurn.activePlayerIndex);
}
}

private void onGameOver(bool gameOverPopup = true)
@@ -63,17 +80,6 @@ private void onGameOver(bool gameOverPopup = true)
});
}
}

private void _setupPlayerList()
{
GameContext context = Singleton.instance.sessionFlags.gameContext;
for (int i = 0; i < context.playerNameList.Count; ++i)
{
string pName = context.playerNameList[i];
string name = (string.IsNullOrEmpty(pName)) ? (i + 1).ToString() : pName;
_playerList.Add(PlayerState.Create(i, name));
}
}

private bool onPlayCard(int playerHandIndex, int customerIndex)
{
@@ -92,6 +98,15 @@ private bool onResolveScore(int customerIndex)

private void onEndTurn()
{
MoveRequest move1 = MoveRequest.Create(_gameMatchCore.playerGroup.activePlayer.index, 2, 3);
MoveRequest move2 = MoveRequest.Create(_gameMatchCore.playerGroup.activePlayer.index, 4, 1);
EndTurnRequestEvent endTurnRequest = EndTurnRequestEvent.Create(move1, move2);

RaiseEventOptions options = new RaiseEventOptions();
options.Receivers = ReceiverGroup.MasterClient;

string requestJson = JsonUtility.ToJson(endTurnRequest);
PhotonNetwork.RaiseEvent(NetworkOpCodes.PLAYER_TURN_COMPLETED, requestJson, true, options);
_gameMatchCore.EndPlayerTurn();
}

@@ -100,7 +115,7 @@ private bool onUndoTurn()
return _gameMatchCore.UndoLastAction();
}

private void _setupCallbacks()
private void _setupPlayFieldCallbacks()
{
_playFieldController.onPlayOnCustomer = onPlayCard;
_playFieldController.onResolveScore = onResolveScore;
@@ -18,20 +18,15 @@ public void Start(Action gameOverCallback)
{
_onGameOverCallback = gameOverCallback;

_setupPlayerList();

int randomSeed = Environment.TickCount;

CardDeck customerDeck = CardDeck.FromFile("Decks/CustomerDeck");
customerDeck.Shuffle(randomSeed);
CardDeck ingredientDeck = CardDeck.FromFile("Decks/IngredientDeck");
ingredientDeck.Shuffle(randomSeed);
GameContext context = Singleton.instance.sessionFlags.gameContext;
_playerList.Clear();
_playerList.AddRange(context.playerList);

_gameMatchCore = GameMatchCore.Create(
_playerList,
true,
customerDeck,
ingredientDeck);
context.customerDeck,
context.ingredientDeck);

_playFieldController.Start(_gameMatchCore.matchState);
_setupCallbacks();
@@ -59,17 +54,6 @@ private void onGameOver(bool gameOverPopup = true)
});
}
}

private void _setupPlayerList()
{
GameContext context = Singleton.instance.sessionFlags.gameContext;
for (int i = 0; i < context.playerNameList.Count; ++i)
{
string pName = context.playerNameList[i];
string name = (string.IsNullOrEmpty(pName)) ? (i + 1).ToString() : pName;
_playerList.Add(PlayerState.Create(i, name));
}
}

private bool onPlayCard(int playerHandIndex, int customerIndex)
{
@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class ChangeTurnEvent : System.Object
{
public int previousPlayerIndex;
public int activePlayerIndex;

public List<MoveRequest> moveRequestList;
}
@@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


[System.Serializable]
public class MoveRequest
{
public int playerIndex;
public int handSlot;
public int customerSlot;

public static MoveRequest Create(int index, int handSlot, int customerSlot)
{
MoveRequest request = new MoveRequest();
request.playerIndex = index;
request.handSlot = handSlot;
request.customerSlot = customerSlot;
return request;
}
}

// This goes from the client to the server, requesting the moves indicated
[System.Serializable]
public class EndTurnRequestEvent : System.Object
{
public MoveRequest[] moveRequestList = new MoveRequest[PlayerState.kMaxCardsPerTurn];

public static EndTurnRequestEvent Create(MoveRequest req1, MoveRequest req2)
{
var request = new EndTurnRequestEvent();
request.moveRequestList[0] = req1;
request.moveRequestList[1] = req2;
return request;
}
}
@@ -12,8 +12,6 @@

public sealed class NormalPlayFieldController : BaseController
{
const int kLocalPlayerIndex = 0; // TODO: Temporary until we have real multiplayer

private GameMatchState _matchState;

private PlayerHandView _playerHandView;
@@ -55,13 +53,13 @@ public void Start(GameMatchState matchState)

for(int i = 0; i < _matchState.playerGroup.playerCount; ++i)
{
PlayerState player = _matchState.playerGroup.GetPlayer(i);
PlayerState player = _matchState.playerGroup.GetPlayerByIndex(i);
_playfieldView.SetPlayerName(i, player.name);
_playfieldView.SetPlayerScore(i, player.score);
}

_setupActiveCustomersView(_playfieldView.staticCardLayer);
_createPlayerHandView(kLocalPlayerIndex, _playfieldView.staticCardLayer);
_createPlayerHandView(localPlayer.index, _playfieldView.staticCardLayer);
});
}

@@ -234,7 +232,10 @@ private void _onCardDropFinished()

private PlayerState localPlayer
{
get { return _matchState.playerGroup.GetPlayer(kLocalPlayerIndex); }
get
{
return _matchState.playerGroup.GetPlayerById(PhotonNetwork.player.ID);
}
}

private PlayerState activePlayer
@@ -270,7 +271,7 @@ private void _deactiveHoverFX()

private void _setupHandViewFromPlayer(int playerIndex)
{
PlayerState player = _matchState.playerGroup.GetPlayer(playerIndex);
PlayerState player = _matchState.playerGroup.GetPlayerByIndex(playerIndex);
for (int i = 0; i < PlayerState.kHandSize; ++i)
{
IngredientCardData ingredientCard = player.hand.GetCard(i);
@@ -284,7 +285,7 @@ private void _onConfirmTurnButton()
onEndTurn();

_refreshHandView(localPlayer);
_playfieldView.SetActivePlayer(localPlayer.index);
_playfieldView.SetActivePlayer(activePlayer.index);
}

private void _onUndoButton()
@@ -58,7 +58,7 @@ public void Start(GameMatchState matchState)

for(int i = 0; i < _matchState.playerGroup.playerCount; ++i)
{
PlayerState player = _matchState.playerGroup.GetPlayer(i);
PlayerState player = _matchState.playerGroup.GetPlayerByIndex(i);
_playfieldView.SetPlayerName(i, player.name);
_playfieldView.SetPlayerScore(i, player.score);
}
@@ -236,7 +236,7 @@ private void _onCardDropFinished()

private PlayerState localPlayer
{
get { return _matchState.playerGroup.GetPlayer(kLocalPlayerIndex); }
get { return _matchState.playerGroup.GetPlayerByIndex(kLocalPlayerIndex); }
}

private PlayerState activePlayer
@@ -272,7 +272,7 @@ private void _deactiveHoverFX()

private void _setupHandViewFromPlayer(int playerIndex)
{
PlayerState player = _matchState.playerGroup.GetPlayer(playerIndex);
PlayerState player = _matchState.playerGroup.GetPlayerByIndex(playerIndex);
for (int i = 0; i < PlayerState.kHandSize; ++i)
{
IngredientCardData ingredientCard = player.hand.GetCard(i);
@@ -36,12 +36,26 @@ public void SetActivePlayer(int playerIndex)
_activePlayerIndex = playerIndex;
}

public PlayerState GetPlayer(int playerIndex)
public PlayerState GetPlayerByIndex(int playerIndex)
{
_boundsAssert(playerIndex);
return _playerList[playerIndex];
}
public PlayerState GetPlayerById(int playerId)
{
int count = playerCount;
for (int i = 0; i < count; ++i)
{
if(_playerList[i].id == PhotonNetwork.player.ID)
{
return _playerList[i];
}
}

Debug.LogError("Player id not found: " + playerId);
return null;
}

public void SetNextActivePlayer()
{
int newIndex = (_activePlayerIndex + 1) % playerCount;
@@ -51,7 +65,7 @@ public void SetNextActivePlayer()
public PlayerState GetNextPlayer()
{
int newIndex = (_activePlayerIndex + 1) % playerCount;
return GetPlayer(newIndex);
return GetPlayerByIndex(newIndex);
}

private void _boundsAssert(int index)
@@ -1,34 +1,68 @@
//using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
//using UnityEngine;

//using Newtonsoft.Json;
//using Newtonsoft.Json.Linq;
//using System;

[System.Serializable]
public class SerializedPlayerList : System.Object
{
public PlayerStateSerializable[] list = new PlayerStateSerializable[PlayerGroup.kMaxPlayerCount];
}

[System.Serializable]
public class PlayerStateSerializable : System.Object
{
public int index;
public int id;
public string name;

static public PlayerStateSerializable Create(PlayerState state)
{
var serial = new PlayerStateSerializable();

serial.index = state.index;
serial.name = state.name;
serial.id = state.id;
return serial;
}

}

public class PlayerState
{
public const int kMaxCardsPerTurn = 2;
public const int kHandSize = 5;

public int index { get; private set; }
public string name { get; private set; }
public int id { get; private set; }

public int score { get; set; }
public int cardsPlayed { get; set; }

public PlayerHand hand { get; private set; }
public Stack<CustomerCardData> deadCustomerStack { get; private set; }

public static PlayerState Create(int playerIndex, string name)
public static PlayerState Create(int playerIndex, string name, int id = - 1)
{
PlayerState player = new PlayerState();
player.hand = PlayerHand.Create(kHandSize);
player.deadCustomerStack = new Stack<CustomerCardData>();
player.index = playerIndex;
player.name = name;
player.id = id;
player.score = 0;
player.cardsPlayed = 0;
return player;
}

public static PlayerState Create(PlayerStateSerializable serialState)
{
return PlayerState.Create(serialState.index, serialState.name, serialState.id);
}
}
@@ -1,8 +1,10 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
using System.Collections.Generic;
using GhostGen;
using DG.Tweening;
using System;

using Hashtable = ExitGames.Client.Photon.Hashtable;
using System.Collections;
using UnityEngine;

public class MultiplayerSetupState : IGameState
{
@@ -11,6 +13,7 @@ public class MultiplayerSetupState : IGameState

private MultiplayerLobbyController _lobbyController;
private MultiplayerRoomController _roomController;
private NetworkManager _networkManager;

public void Init( GameStateMachine stateMachine )
{
@@ -19,7 +22,9 @@ public void Init( GameStateMachine stateMachine )
_fader = Singleton.instance.gui.screenFader;
_fader.FadeIn(0.35f);

Singleton.instance.networkManager.Connect();
_networkManager = Singleton.instance.networkManager;
_networkManager.onCustomEvent += onCustomEvent;
_networkManager.Connect();

_lobbyController = new MultiplayerLobbyController();
_lobbyController.Start(onJoinRoom, onGoToMainMenu);
@@ -32,8 +37,17 @@ public void Step( float p_deltaTime )

public void Exit()
{
_lobbyController.RemoveView();
_roomController.RemoveView();
_networkManager.onCustomEvent -= onCustomEvent;

if (_lobbyController != null )
{
_lobbyController.RemoveView();
}

if(_roomController != null)
{
_roomController.RemoveView();
}
}

private void onGoToMainMenu()
@@ -56,17 +70,85 @@ private void onJoinRoom()

private void onStartGame()
{
Debug.Log("Start game or somethin'");
sendGameInitEvent();
}

List<string> pNames = _roomController.GetNameList();
GameContext context = GameContext.Create(GameMode.ONLINE, pNames, PhotonNetwork.isMasterClient);
Singleton.instance.sessionFlags.gameContext = context;
private void sendGameInitEvent()
{
int randomSeed = Environment.TickCount;

CardDeck customerDeck = CardDeck.FromFile("Decks/CustomerDeck");
customerDeck.Shuffle(randomSeed);
CardDeck ingredientDeck = CardDeck.FromFile("Decks/IngredientDeck");
ingredientDeck.Shuffle(randomSeed);


Hashtable contents = new ExitGames.Client.Photon.Hashtable();
contents.Add("customerDeck", CardDeck.ToJson(customerDeck, false));
contents.Add("ingredientDeck", CardDeck.ToJson(ingredientDeck, false));
contents.Add("playerList", getSerializablePlayerList(_roomController.GetPlayerList()));

RaiseEventOptions options = new RaiseEventOptions();
options.Receivers = ReceiverGroup.All;
PhotonNetwork.RaiseEvent(NetworkOpCodes.INITIAL_GAME_STATE, contents, true, options);
}

private string getSerializablePlayerList(PlayerState[] playerStateList)
{
if(playerStateList == null)
{
Debug.LogError("Player State list is null!");
return null;
}

_fader.FadeOut(0.35f, () =>
SerializedPlayerList list = new SerializedPlayerList();

for(int i = 0; i < playerStateList.Length; ++i)
{
_stateMachine.ChangeState(TacoTuesdayState.GAMEPLAY);
});
if(playerStateList[i] != null)
{
list.list[i] = PlayerStateSerializable.Create(playerStateList[i]);
}
else
{
list.list[i] = null;
}
}
return JsonUtility.ToJson(list);
}

private PlayerState[] getPlayerList(string serialList)
{
if (string.IsNullOrEmpty(serialList))
{
Debug.LogError("Serial State list is null!");
return null;
}

SerializedPlayerList serialPlayerList = JsonUtility.FromJson<SerializedPlayerList>(serialList);
PlayerState[] list = new PlayerState[serialPlayerList.list.Length];
for (int i = 0; i < serialPlayerList.list.Length; ++i)
{
if(serialPlayerList.list[i] != null)
{
PlayerStateSerializable serial = serialPlayerList.list[i];
list[i] = PlayerState.Create(serial);
}
else
{
list[i] = null;
}
}
return list;
}

private GameContext _createGameContext(CardDeck customerDeck, CardDeck ingredientDeck, PlayerState[] playerList)
{
GameContext context = GameContext.Create(GameMode.ONLINE, playerList);
context.isMasterClient = PhotonNetwork.isMasterClient;
context.ingredientDeck = ingredientDeck;
context.customerDeck = customerDeck;
return context;
}

private void onLeaveRoom()
@@ -76,4 +158,37 @@ private void onLeaveRoom()
_lobbyController = new MultiplayerLobbyController();
_lobbyController.Start(onJoinRoom, onGoToMainMenu);
}

private void serverSetupGame()
{

}

private void clientSetupGame()
{

}

private void onCustomEvent(byte eventCode, object content, int senderId)
{
if (eventCode == NetworkOpCodes.INITIAL_GAME_STATE)
{
Hashtable gameInfo = content as Hashtable;
string ingredientDeckJson = gameInfo["ingredientDeck"] as string;
string customerDeckJson = gameInfo["customerDeck"] as string;
var playerSerialList = gameInfo["playerList"] as string;

CardDeck ingredientDeck = CardDeck.FromJson(ingredientDeckJson);
CardDeck customerDeck = CardDeck.FromJson(customerDeckJson);
PlayerState[] playerList = getPlayerList(playerSerialList);

GameContext context = _createGameContext(customerDeck, ingredientDeck, playerList);
Singleton.instance.sessionFlags.gameContext = context;

_fader.FadeOut(0.35f, () =>
{
_stateMachine.ChangeState(TacoTuesdayState.GAMEPLAY);
});
}
}
}
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using GhostGen;
using DG.Tweening;
using System;

public class PlayerSetupState : IGameState
{
@@ -15,7 +16,7 @@ public void Init( GameStateMachine stateMachine )
_stateMachine = stateMachine;

_passPlaySetupController = new PassPlaySetupController();
_passPlaySetupController.Start(onPassSetupStart, onPassSetupCancel);
_passPlaySetupController.Start(onStartGame, onPassSetupCancel);

_fader = Singleton.instance.gui.screenFader;
_fader.FadeIn(0.35f);
@@ -31,18 +32,33 @@ public void Exit()
_passPlaySetupController.RemoveView();
}

private void onPassSetupStart()
private void onStartGame()
{
List<string> pNames = _passPlaySetupController.GetNameList();
GameContext context = GameContext.Create(GameMode.PASS_AND_PLAY, pNames, true);
Singleton.instance.sessionFlags.gameContext = context;
Singleton.instance.sessionFlags.gameContext = _createGameContext();

_fader.FadeOut(0.35f, () =>
{
_stateMachine.ChangeState(TacoTuesdayState.GAMEPLAY);
});
}

private GameContext _createGameContext()
{
int randomSeed = Environment.TickCount;

CardDeck customerDeck = CardDeck.FromFile("Decks/CustomerDeck");
customerDeck.Shuffle(randomSeed);
CardDeck ingredientDeck = CardDeck.FromFile("Decks/IngredientDeck");
ingredientDeck.Shuffle(randomSeed);

PlayerState[] playerStateList = _passPlaySetupController.GetPlayerList();
GameContext context = GameContext.Create(GameMode.PASS_AND_PLAY, playerStateList);
context.isMasterClient = true;
context.ingredientDeck = ingredientDeck;
context.customerDeck = customerDeck;
return context;
}

private void onPassSetupCancel()
{
_fader.FadeOut(0.35f, () =>
@@ -71,9 +71,9 @@ protected override void OnViewUpdate()
}

_setCustomerCard(
cardState.GetIngredientReqLeft(CardType.Meat),
cardState.GetIngredientReqLeft(CardType.Veggie),
cardState.GetIngredientReqLeft(CardType.Topping));
cardState.GetIngredientReqLeft(CardType.MEAT),
cardState.GetIngredientReqLeft(CardType.VEGGIE),
cardState.GetIngredientReqLeft(CardType.TOPPING));

}

@@ -46,11 +46,17 @@ public void Start(Action onJoinCallback, Action onBackCallback)

public override void RemoveView(bool immediately = false)
{
_lobbyView._joinButton.onClick.RemoveListener(onJoinButton);
_lobbyView._backButton.onClick.RemoveListener(onBackButton);
_lobbyView._createButton.onClick.RemoveListener(onCreateButton);
if(_lobbyView != null)
{
_lobbyView._joinButton.onClick.RemoveListener(onJoinButton);
_lobbyView._backButton.onClick.RemoveListener(onBackButton);
_lobbyView._createButton.onClick.RemoveListener(onCreateButton);
}

_roomListView.onSelectedItem -= onRoomClicked;
if(_roomListView != null)
{
_roomListView.onSelectedItem -= onRoomClicked;
}

_networkManager.onReceivedRoomListUpdate -= onReceivedRoomListUpdate;
_networkManager.onJoinedRoom -= onJoinedRoom;
@@ -6,8 +6,6 @@

public class MultiplayerRoomController : BaseController
{
const byte EVENT_READY_TOGGLE = 1;

private MultiplayerRoomView _roomView;
private NetworkManager _networkManager;
private Action _onBackCallback;
@@ -43,18 +41,30 @@ public override void RemoveView(bool immediately = false)
base.RemoveView(immediately);
}

public List<string> GetNameList()
public PlayerState[] GetPlayerList()
{
List<string> nameList = new List<string>(4);
if(!PhotonNetwork.isMasterClient)
{
Debug.LogError("Trying To call get player List when you are not the master client, thats a paddlin'");
return null;
}

PlayerState[] playerStateList = new PlayerState[PlayerGroup.kMaxPlayerCount];

PhotonPlayer[] playerList = PhotonNetwork.playerList;
int count = playerList.Length;
for(int i = 0; i < count; ++i)
for (int i = 0; i < PlayerGroup.kMaxPlayerCount; ++i)
{
nameList.Add(playerList[i].NickName + " " + i.ToString());
if(i < playerList.Length)
{
playerStateList[i] = PlayerState.Create(i, playerList[i].NickName, playerList[i].ID);
}
else
{
playerStateList[i] = null;
}
}

return nameList;
return playerStateList;
}

private void _addButtonCallbacks(bool isMaster)
@@ -96,7 +106,7 @@ private void _onReadyButton(bool isSelected)
{
RaiseEventOptions options = new RaiseEventOptions();
options.Receivers = ReceiverGroup.All;
PhotonNetwork.RaiseEvent(EVENT_READY_TOGGLE, isSelected, true, options);
PhotonNetwork.RaiseEvent(NetworkOpCodes.READY_TOGGLE, isSelected, true, options);
}

private void _onLeftRoom()
@@ -117,7 +127,7 @@ private void _onStartGameButton()

private void _onCustomEvent(byte eventCode, object content, int senderId)
{
if(eventCode == EVENT_READY_TOGGLE)
if(eventCode == NetworkOpCodes.READY_TOGGLE)
{
int index = _roomView.GetIndexForPlayerId(senderId);
if(index >= 0)
@@ -138,8 +148,13 @@ private void _viewInitialization()

private void _setupPlayers()
{
PhotonPlayer[] playerList = PhotonNetwork.playerList;
int count = playerList.Length;
List<PhotonPlayer> playerList = new List<PhotonPlayer>(PhotonNetwork.playerList);
playerList.Sort((a, b) =>
{
return a.NickName.CompareTo(b.NickName);
});

int count = playerList.Count;
for(int i = 0; i < PlayerGroup.kMaxPlayerCount; ++i)
{
if(i < count)
@@ -7,9 +7,7 @@ public class PassPlaySetupController : BaseController
private PassPlaySetupView _passPlaySetup;
private Action _onStart;
private Action _onCancel;

private List<string> _playerNames = new List<string>(PlayerGroup.kMaxPlayerCount);


public void Start(Action onStart, Action onCancel)
{
_onStart = onStart;
@@ -30,20 +28,20 @@ public void Start(Action onStart, Action onCancel)
});
}

public List<string> GetNameList()
public PlayerState[] GetPlayerList()
{
if(_passPlaySetup == null)
{
return null;
}

_playerNames.Clear();
PlayerState[] playerStateList = new PlayerState[PlayerGroup.kMaxPlayerCount];
for (int i = 0; i < PlayerGroup.kMaxPlayerCount; ++i)
{
TMPro.TMP_InputField input = _passPlaySetup.playerInputSetups[i].nameInput;
_playerNames.Add(input.text);
playerStateList[i] = PlayerState.Create(i, input.text);
}
return _playerNames;
return playerStateList;
}

private void onStartButton()