Пример #1
0
 protected override async Task OnGracefulStop()
 {
     try
     {
         if (_gamePlayer != null)
         {
             await _game.Leave(_userId);
         }
     }
     catch (Exception e)
     {
         _logger.ErrorFormat("Failed to leave game({0})", e, _game.CastToIActorRef().Path);
     }
 }
Пример #2
0
        async Task IUser.LeaveGame()
        {
            if (_enteredGame == null)
            {
                throw new InvalidOperationException();
            }

            // Let's exit from the room !

            await _enteredGame.Leave(_id);

            // Unbind an game actor from channel

            _channel.WithNoReply().UnbindActor(_enteredGame.CastToIActorRef());
            _enteredGame = null;
        }