private void UpdatePlayerView(
            Func <PlayerView> getPlayerViewFunc,
            Action <PlayerView> setPlayerViewAction,
            Vector3 position,
            IList <byte> handRaw
            )
        {
            GameObject playerViewGO;

            if (getPlayerViewFunc() == null)
            {
                playerViewGO = Instantiate(this.PrefabsContainer.PlayerViewPrefab, this.GameField);
                setPlayerViewAction(playerViewGO.GetComponent <PlayerView>());
            }
            else
            {
                playerViewGO = getPlayerViewFunc().gameObject;
            }

            playerViewGO.GetComponent <RectTransform>().anchoredPosition = position;

            Card[] hand = handRaw.Select(cardIndex => new Card(cardIndex)).ToArray();
            getPlayerViewFunc().SetCards(hand, this.PrefabsContainer);

            int softScore, hardScore;

            BlackjackRules.CalculateHandScore(hand, out softScore, out hardScore);

            string scoreText = softScore == hardScore?softScore.ToString() : softScore + "/" + hardScore;

            getPlayerViewFunc().UIContainer.HandScore.text  = scoreText;
            getPlayerViewFunc().UIContainer.HandScore.color = hardScore > 21 ? Color.red : Color.black;
            getPlayerViewFunc().UIContainer.BlackjackLabelContainer.SetActive(hand.Length == 2 && hardScore == 21);
        }
        private void UpdatePlayerView(
            Func <PlayerView> getPlayerViewFunc,
            Action <PlayerView> setPlayerViewAction,
            Vector3 position,
            GameState.PlayerState playerState,
            string playerName,
            bool isDealer
            )
        {
            GameObject playerViewGO;

            if (getPlayerViewFunc() == null)
            {
                playerViewGO = Instantiate(this.PrefabsContainer.PlayerViewPrefab, this.GameFieldContainer.transform);
                setPlayerViewAction(playerViewGO.GetComponent <PlayerView>());
            }
            else
            {
                playerViewGO = getPlayerViewFunc().gameObject;
            }

            playerViewGO.GetComponent <RectTransform>().anchoredPosition = position;
            PlayerView playerView = getPlayerViewFunc();

            if (this.GameStateController.GameState.Stage == GameStage.Ended)
            {
                playerName += $" ({FormatMonetaryValueAsRichText(playerState.Outcome)})";
            }

            playerView.UIContainer.BetContainer.SetActive(playerState.Bet > 0);
            playerView.UIContainer.BetValue.text = playerState.Bet.ToString();

            playerView.UIContainer.PlayerName.text = playerName;
            playerView.UIContainer.ActivePlayerMarker.SetActive(
                !isDealer &&
                this.GameStateController.GameState.Stage == GameStage.PlayersTurn &&
                this.GameStateController.GameState.CurrentPlayer == playerState.Address
                );
            playerView.UIContainer.SelfPlayerMarker.SetActive(
                playerState.Address == this.GameStateController.Client.Address
                );

            bool showScore = playerState.Hand != null && playerState.Hand.Length != 0;

            playerView.UIContainer.HandScoreContainer.SetActive(showScore);
            playerView.UIContainer.ReadyForNextRoundMarker.SetActive(false);
            playerView.UIContainer.NotReadyForNextRoundMarker.SetActive(false);
            if (showScore)
            {
                playerView.SetCards(playerState.Hand, this.PrefabsContainer);

                int softScore, hardScore;
                BlackjackRules.CalculateHandScore(playerState.Hand, out softScore, out hardScore);

                string scoreText = softScore == hardScore?softScore.ToString() : softScore + "/" + hardScore;

                playerView.UIContainer.HandScore.text  = scoreText;
                playerView.UIContainer.HandScore.color = hardScore > 21 ? new Color(0.65f, 0, 0) : Color.black;
                playerView.UIContainer.BlackjackLabelContainer.SetActive(playerState.Hand.Length == 2 && hardScore == 21);

                if (!isDealer && this.GameStateController.GameState.Stage == GameStage.Ended)
                {
                    playerView.UIContainer.ReadyForNextRoundMarker.SetActive(playerState.ReadyForNextRound);
                    playerView.UIContainer.NotReadyForNextRoundMarker.SetActive(!playerState.ReadyForNextRound);
                }
            }
            else
            {
                playerView.SetCards(Array.Empty <Card>(), this.PrefabsContainer);
                playerView.UIContainer.BlackjackLabelContainer.SetActive(false);
            }
        }