Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="message"></param>
        private void HandleCancelGame(CancelGame message)
        {
            // cancel all the pending operations (make/find move)
            this.tokenSource.Cancel();

            //
            Thread.Sleep(TimeSpan.FromSeconds(3));

            // stop this actor
            this.log.Info("Stop the game actor for game {0}", message.Guid);
            Context.Stop(this.Self);

            //
            this.tokenSource.Dispose();
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="message"></param>
        private void HandleCancelGame(CancelGame message)
        {
            this.log.Info("Cancelling game {0}", message.Guid);

            GameContext actors;

            this.games.TryGetValue(message.Guid, out actors);

            if (actors != null)
            {
                actors.GameActorRef.Tell(new CancelGame(message.Guid));

                this.games.Remove(message.Guid);
                this.log.Info("Game {0} has been removed from map.", message.Guid);

                actors.ClientActorRef.Tell(new GameCancelled(message.Guid));
            }
        }