Пример #1
0
        public PlayerManagerService(IUnitOfWork UoW, IMapper <SkinEntity, Skin> skinsMapper,
                                    IMapper <WeaponEntity, Weapon> weaponsMapper, IMapper <PlayerEntity, Player> playerMapper)
        {
            this._UoW        = UoW;
            this._weaponRepo = UoW.Repository <IWeaponsRepository>();
            this._skinRepo   = UoW.Repository <ISkinsRepository>();
            this._playerRepo = UoW.Repository <IPlayerRepository>();

            this._skinsMapper   = skinsMapper;
            this._weaponsMapper = weaponsMapper;
            this._playerMapper  = playerMapper;

            characters.Add(new ElfCharacter());
            characters.Add(new GnomeCharacter());
            characters.Add(new MagicianCharacter());
            characters.Add(new WarriorCharacter());

            player = _playerMapper.Map(_playerRepo.Get(1));

            for (int i = 0; i < characters.Count; i++)
            {
                if (characters[i].GetType() == player.Character.GetType())
                {
                    characters[i] = player.Character;
                }
            }
        }
Пример #2
0
 public UnitOfWork(KnightsContext context)
 {
     _context = context;
     Knights  = new KnightsRepository(_context);
     Horses   = new HorsesRepository(_context);
     Vows     = new VowsRepository(_context);
     Weapons  = new WeaponsRepository(_context);
 }
Пример #3
0
 public UnitOfWork(NotSimpleGameDBContext dbContext, IPlayerRepository playerRepository,
                   IWeaponsRepository weaponsRepository, ISkinsRepository skinsRepository)
 {
     _dbContext = dbContext;
     _repositories.Add(typeof(IPlayerRepository), playerRepository);
     _repositories.Add(typeof(IWeaponsRepository), weaponsRepository);
     _repositories.Add(typeof(ISkinsRepository), skinsRepository);
 }