public void QuizTimeUpOrAnswered() { QuizTimer.Change(Timeout.Infinite, Timeout.Infinite); if (Parent.GetType() != typeof(WaitingRoom)) { SQuestion.Add(new SessionQuestion() { QuestionId = Questions.Peek().Id, SessionId = this.GetIdentifier() }); } if (!PlayerManager.IfThereStillPlayer()) { new Task(() => EndGame()).Start(); return; } var selectAnswerAck = new SelectAnswerAck() { Rewards = RewardManager.GetRewards().ToArray() }; Broadcast(selectAnswerAck.CreatePacket()); RewardManager.Flush(); var cycleAck = new InitializeCycleAck() { PlayerSequence = PlayerManager.GetSequence() }; //game.Broadcast(cycleAck.CreatePacket()); Broadcast(cycleAck.CreatePacket(), 5000); var startTurnAck = new StartPlayerTurnAck() { Duration = 60, Token = PlayerManager.GetCurrentPlayer().GetIdentifier() }; // Send the start turn ack to the current player only BroadcastCurrentPlayer(startTurnAck.CreatePacket(), 5000); Broadcast(new NotifyPlayerTurnAck() { Duration = 60, CurrentPlayer = PlayerManager.GetCurrentPlayer().GetIdentifier() }.CreatePacket(), 5000, PlayerManager.GetCurrentPlayer().Client); TurnTimer.Change(Timeout.Infinite, 75000); }
private void NextTurn() { Board.Unlock(); var startPlayerTurnAck = new StartPlayerTurnAck() { Token = PlayerManager.GetCurrentPlayer().GetIdentifier(), Duration = 60 }; // Broadcast to all player except current player Broadcast(new NotifyPlayerTurnAck() { Duration = 60, CurrentPlayer = PlayerManager.GetCurrentPlayer().GetIdentifier() }.CreatePacket(), PlayerManager.GetCurrentPlayer().Client); // Broadcast to current player BroadcastCurrentPlayer(startPlayerTurnAck.CreatePacket()); StartTurnTimer(); }