Ejemplo n.º 1
0
        public async Task Handle(NpcMovedEvent message, CancellationToken cancellationToken)
        {
            var npc     = message.Npc;
            var roomIn  = message.RoomIn;
            var roomOut = message.RoomOut;


            //更新当前玩家显示的npc列表
            var roomInNpcs  = (await _npcDomainService.GetAll()).Where(x => x.RoomId == roomIn.Id);
            var roomOutNpcs = (await _npcDomainService.GetAll()).Where(x => x.RoomId == roomOut.Id);

            await _mudProvider.UpdateRoomNpcList(roomIn.Id, roomInNpcs);

            await _mudProvider.UpdateRoomNpcList(roomOut.Id, roomOutNpcs);

            //输出移动信息
            await _mudProvider.ShowRoomMessage(roomOut.Id, $"[{npc.Name}] 往{roomIn.Name}离开。");

            await _mudProvider.ShowRoomMessage(roomIn.Id, $"[{npc.Name}] 从{roomOut.Name}走了过来。");
        }