Exemplo n.º 1
0
        /// <summary>
        /// Is called when game data has been received.
        /// </summary>
        /// <param name="FromPlayer">Data came from this player.</param>
        /// <param name="Connection">Data came over this connection.</param>
        /// <param name="Packet">Data received.</param>
        protected virtual void GameDataReceived(Player FromPlayer, PeerConnection Connection, byte[] Packet)
        {
            GameDataEventHandler h = this.OnGameDataReceived;

            if (h != null)
            {
                try
                {
                    h(this, new GameDataEventArgs(FromPlayer, Connection, Packet));
                }
                catch (Exception ex)
                {
                    Events.Log.Critical(ex);
                }
            }
        }
        /// <summary>
        /// Is called when game data has been received.
        /// </summary>
        /// <param name="FromPlayer">Data came from this player.</param>
        /// <param name="Connection">Data came over this connection.</param>
        /// <param name="Packet">Data received.</param>
        protected virtual void GameDataReceived(Player FromPlayer, PeerConnection Connection, byte[] Packet)
        {
            GameDataEventHandler h = this.OnGameDataReceived;

            if (!(h is null))
            {
                try
                {
                    h(this, new GameDataEventArgs(FromPlayer, Connection, Packet));
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                    Debug.WriteLine(ex.StackTrace.ToString());
                }
            }
        }