예제 #1
0
 public void ReturnPlayerStamina(int stamToReturn)
 {
     var playerRepository = new PlayerRepository();
     var player = playerRepository.GetPlayer();
     player.Stam.Current += stamToReturn;
     playerRepository.SavePlayer(player);
 }
        public void OnDungeonSelected(object sender, GestureEventArgs e)
        {
            var selectedGrid = sender as Grid;
            var dungeonId = (int)selectedGrid.Tag;
            _selectedDungeon = GetDungeon(dungeonId);

            var heroRepository = new HeroRepository();
            _heroesOwnedByPlayer = heroRepository.GetHeroesOwnedByPlayer().Count;

            var playerRepository = new PlayerRepository();
            _player = playerRepository.GetPlayer();

            if (PlayerCanEnterDungeon())
            {
                _player.Stam.Current = _player.Stam.Current - _selectedDungeon.StaminaCost;
                playerRepository.SavePlayer(_player);
                MessageBus.Default.Notify("EnterDungeon", new Object(), new NotificationEventArgs(dungeonId.ToString()));
            }
            else
            {
                var errorModalControl = GetErrorMessage();
                var errorModal = new ModalContainer(errorModalControl);
                errorModal.Show();
            }
        }
예제 #3
0
        private void StatBars(object sender, RoutedEventArgs e)
        {
            _playerRepository = new PlayerRepository();
            _player = _playerRepository.GetPlayer();

            UpdateStamina(_player);
            ColorStatBars(_player);
        }