コード例 #1
0
 public CharacterService(EFContext _context)
 {
     _characterRepository      = new CharacterRepository(_context);
     _skillsRepository         = new CharacterSkillsRepository(_context);
     _statsRepository          = new CharacterStatsRepository(_context);
     _inventoryRepository      = new CharacterInventoryRepository(_context);
     _characterItemRepository  = new CharacterItemRepository(_context);
     _EnemyRepository          = new EnemyRepository(_context);
     _enemyInventoryRepository = new EnemyInventoryRepository(_context);
     _enemyItemRepository      = new EnemyItemRepository(_context);
     _ItemRepository           = new ItemRepository(_context);
 }
コード例 #2
0
ファイル: UserWindow.xaml.cs プロジェクト: K0z4cK/ZPG-D-D-
        public UserWindow(int id)
        {
            _repository       = new CharacterRepository(_context);
            _characterService = new CharacterService(_context);
            _userService      = new UserService();
            InitializeComponent();
            _idUser   = id;
            User.Text = _userService.GetUser(_idUser).Login;

            var characters = _characterService.GetCharactersByUserId(_idUser);

            foreach (var c in characters)
            {
                lvCharacters.Items.Add(c);
            }
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: K0z4cK/ZPG-D-D-
        public MainWindow(CreateCharacterModel character, string username)
        {
            _character               = character;
            _characterService        = new CharacterService(_context);
            _characterRepository     = new CharacterRepository(_context);
            _skillsRepository        = new CharacterSkillsRepository(_context);
            _statsRepository         = new CharacterStatsRepository(_context);
            _inventoryRepository     = new CharacterInventoryRepository(_context);
            _characterItemRepository = new CharacterItemRepository(_context);
            InitializeComponent();
            CreateCharacterSkills skills = new CreateCharacterSkills();
            CreateCharacterStats  stats  = new CreateCharacterStats();

            int characterId = _characterService.SetCharacter(character, skills, stats);

            _characterId = characterId;
            var charInventory = _inventoryRepository.Get().FirstOrDefault(u => u.Id == characterId).CharacterItems;

            _charInventory = charInventory;

            //this.DataContext = character;
            userName.Text      = username;
            characterName.Text = character.Name;
            classNlevel.Text   = character.Class.ToString() + " " + character.Level.ToString();
            race.Text          = character.Race.ToString();
            aligment.Text      = character.Aligment.ToString();
            background.Text    = character.Background.ToString();
            armorClassNum.Text = character.ArmorClass.ToString();
            initiativeNum.Text = character.Intitiative.ToString();
            healthPoints.Text  = character.HP.ToString() + "/" + character.HPMax.ToString();
            speedNum.Text      = character.Speed.ToString();
            experiencePt.Text  = character.Exp.ToString();

            acrobatics.Text     = "Acrobatics    " + skills.Acrobatics.ToString();
            animalHandling.Text = "Animal Handling    " + skills.AnimalHandling.ToString();
            athletics.Text      = "Athletics    " + skills.Athletics.ToString();
            medicine.Text       = "Medicine    " + skills.Medicine.ToString();
            persuasion.Text     = "Persuasion    " + skills.Persuasion.ToString();
            religion.Text       = "Religion    " + skills.Religion.ToString();
            sleightOfHand.Text  = "Sleight of hand    " + skills.SleightOfHand.ToString();
            stealth.Text        = "Stealth    " + skills.Stealth.ToString();
            survival.Text       = "Survival    " + skills.Survival.ToString();

            charismaNum.Text     = stats.Charisma.ToString();
            constitutionNum.Text = stats.Constitution.ToString();
            dexterityNum.Text    = stats.Dexterity.ToString();
            intelligenceNum.Text = stats.Intelligence.ToString();
            strengthNum.Text     = stats.Strength.ToString();
            wisdomNum.Text       = stats.Wisdom.ToString();

            coins.Text = "Coins: " + character.Coins.ToString();

            setEquipment();
            setInventory();

            timer          = new DispatcherTimer();
            timer.Tick    += Timer_Tick;
            timer.Interval = new TimeSpan(0, 0, 1);
            timer.Start();

            BackgroundWorker worker = new BackgroundWorker();

            worker.WorkerReportsProgress = true;
            worker.DoWork          += worker_DoWork;
            worker.ProgressChanged += worker_ProgressChanged;

            worker.RunWorkerAsync();
        }
コード例 #4
0
ファイル: UserService.cs プロジェクト: K0z4cK/ZPG-D-D-
 public UserService()
 {
     _repository = new UserRepository(_context);
 }