Ejemplo n.º 1
0
        /// <summary>
        /// Fires the <see cref="Finished"/> event.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="args">The event arguments.</param>
        protected virtual void FireFinished(object sender, FinishedArgs args)
        {
            this.CompetitorA.Connection.Close();
            this.CompetitorB.Connection.Close();

            if (this.Finished != null)
            {
                this.Finished(sender, args);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes the finished battle from the list.
        /// </summary>
        /// <param name="sender">The sender of the Finished event.</param>
        /// <param name="args">The event arguments.</param>
        private void Battle_Finished(object sender, FinishedArgs args)
        {
            if (this.usersInLobby.Contains(args.Loser.Connection))
            {
                this.usersInLobby.Remove(args.Loser.Connection);
            }

            if (this.usersInLobby.Contains(args.Winner.Connection))
            {
                this.usersInLobby.Remove(args.Winner.Connection);
            }

            this.Battles.Remove(args.Battle);
        }