private void RoundStartedHandler(RoundStartedEvent e)
 {
     DOTween.Sequence()
     .AppendCallback(() => GameCanvasManager.Singleton.InvokeClientRpcOnEveryone(GameCanvasManager.Singleton.TriggerGameStateText, true, GameStateMessages.Go()))
     .AppendInterval(1f)
     .AppendCallback(() => GameCanvasManager.Singleton.InvokeClientRpcOnEveryone(GameCanvasManager.Singleton.TriggerGameStateText, false, ""));
 }
Example #2
0
        public void Handle(RoundStartedEvent roundStartedEvent, GameState gameState)
        {
            var playerShowScores = new List<PlayerScoreShow>(gameState.PlayerIds.Select(player => new PlayerScoreShow { CribScore = null, HasShowed = false, Player = player, PlayerCountedShowScore = 0, ShowScore = 0 }));

            var currentRound = gameState.Rounds.Count == 0 ? 0 : gameState.GetCurrentRound().Round;

            int cribPlayerId;
            if (gameState.OpeningRound.Complete && gameState.Rounds.Count != 0)
            {
                cribPlayerId = gameState.PlayerIds.NextOf(gameState.PlayerIds.Single(sp => gameState.Rounds.Single(r => r.Round == currentRound).PlayerCrib == sp));
            }
            else
            {
                cribPlayerId = gameState.OpeningRound.WinningPlayerCut.Value;
            }

            var roundState = new RoundState
            {
                Crib = new List<Card>(),
                DealtCards = new List<PlayerIdHand>(),
                Complete = false,
                PlayerCrib = cribPlayerId,
                Hands = new List<PlayerIdHand>(),
                ThePlay = new List<List<PlayerPlayItem>> { new List<PlayerPlayItem>() },
                Round = currentRound + 1,
                ShowScores = playerShowScores
            };

            gameState.Rounds.Add(roundState);
        }