public float DealCard(List <BigTwoGamePlayer> listPlayer) { BigTwoCommandQueue.Instance.Clear(); if (_isDoShuffleBeforeDealCard) { ShuffleDeck(); } for (int i = 0; i < listPlayer.Count; i++) { BigTwoGamePlayer player = listPlayer [i]; player.ClearPokerList(); } int pokerNumPerPlayer = _listPoker.Count / listPlayer.Count; int startIndex = 0; int endIndex = pokerNumPerPlayer; for (int i = 0; i < listPlayer.Count; i++) { BigTwoGamePlayer player = listPlayer [i]; for (int j = startIndex; j < endIndex; j++) { BigTwoPoker poker = _listPoker [j]; poker.gameObject.SetActive(true); poker.Reset(); poker.SetBackVisible(true); player.InsertPokerToHand(poker); } player.SortListPokerInHand(); startIndex += pokerNumPerPlayer; endIndex += pokerNumPerPlayer; } return(2f); }
private void NextPlayer() { _playerIndex++; // if (_playerIndex == 2) { // return; // } if (_playerIndex >= _listPlayer.Count) { _playerIndex = 0; } BigTwoGamePlayer player = _listPlayer [_playerIndex]; player.NextPlayCMD((string cmd) => { BigTwoCommandQueue.Instance.AddCMD(cmd); }); }
private void PlayAHand(List <string> listStr) { string playerStr = listStr [1]; BigTwoGamePlayer player = GetPlayerByStr(playerStr); if (null == player) { return; } player.PlayHandToSet(listStr, () => { if (player.HasPlayAll()) { _btnStart.SetActive(true); return; } NextPlayer(); _isInAction = false; }); }