Exemple #1
0
        /// <summary>
        /// Converts a message into a NewTurnPacket.
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        private static Packet ToNewTurnPacket(NetIncomingMessage message)
        {
            int guesserPlayerIndex = message.ReadInt32();
            int drawerPlayerIndex  = message.ReadInt32();
            var newTurnPacket      = new NewTurnPacket(guesserPlayerIndex, drawerPlayerIndex)
            {
                Sender = message.SenderEndPoint
            };

            return(newTurnPacket);
        }
Exemple #2
0
        /// <summary>
        /// Handles a NewTurnPacket.
        /// </summary>
        /// <param name="packet"></param>
        private void HandleNewTurn(NewTurnPacket packet)
        {
            var args = new NewTurnEventArgs(packet.GuesserPlayerIndex, packet.DrawerPlayerIndex);

            OnNewTurn?.Invoke(this, args);
        }