public async Task <Unit> Handle(ShowPlayerCommand command, CancellationToken cancellationToken) { var myId = command.MyId; var me = await _playerDomainService.Get(myId); if (me == null) { return(Unit.Value); } var playerId = command.PlayerId; var playerInfo = new PlayerInfo() { Descriptions = new List <string>(), Commands = new List <PlayerCommandModel>() }; var player = await _playerDomainService.Get(playerId); if (player == null) { return(Unit.Value); } playerInfo.Id = playerId; playerInfo.Name = player.Name; string genderStr = player.Gender.ToGender(); //年龄 playerInfo.Descriptions.Add($"{genderStr}{player.Age.ToAge()}"); playerInfo.Descriptions.Add($"{genderStr}的武功看不出深浅。"); playerInfo.Descriptions.Add($"{genderStr}看起来气血充盈,并没有受伤。"); if (me.RoomId == player.RoomId) { playerInfo.Commands.Add(new PlayerCommandModel("切磋")); playerInfo.Commands.Add(new PlayerCommandModel("杀死")); } var playerRelationFrom = await _playerRelationDomainService.Get(x => x.Type == PlayerRelationTypeEnum.好友 && x.PlayerId == myId && x.RelationId == playerId); var playerRelationTo = await _playerRelationDomainService.Get(x => x.Type == PlayerRelationTypeEnum.好友 && x.PlayerId == playerId && x.RelationId == myId); if (playerRelationFrom == null) { playerInfo.Commands.Add(new PlayerCommandModel("添加好友")); } if (playerRelationFrom != null && playerRelationTo != null) { playerInfo.Commands.Add(new PlayerCommandModel("割袍断义", $"是否要与[{player.Name}]取消好友关系?")); playerInfo.Commands.Add(new PlayerCommandModel("查看武功")); } await _mudProvider.ShowPlayer(myId, playerInfo); return(Unit.Value); }