Пример #1
0
        public ScoresViewModel(IHighScoreService scores, IMvxNavigationService navigationService, IMvxMainThreadAsyncDispatcher dispatcher)
        {
            _scores     = scores;
            _dispatcher = dispatcher;
            //_navigationService = navigationService;

            BackCommand = new MvxCommand(() => _ = Task.Run(async() => await navigationService.Close(this)));
            CloseImage  = ImageSource.FromResource("DahlexApp.Assets.Images.Close.png");
        }
Пример #2
0
        public GameEngine(GameSettings settings, IDahlexView boardViewModel, IHighScoreService highScoreManager)
        {
            _boardView        = boardViewModel;
            _highScoreManager = highScoreManager;
            //          _highScoreManager = highScoreManager;
            _settings = settings;

            _boardSize  = _settings.BoardSize;
            _squareSize = _settings.SquareSize;
        }
Пример #3
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);

                using (var scope = serviceScopeFactory.CreateScope())
                {
                    IHighScoreService scoped = scope.ServiceProvider.GetRequiredService <IHighScoreService>();
                    await HandleHighScore(scoped);
                }
                await Task.Delay(1000, stoppingToken);
            }
        }
Пример #4
0
 public ScoresController(IHighScoreService highScore)
 {
     this.highScore = highScore;
 }
 public static Task UpdateHighScoreAsync(this IHighScoreService service, Player killer, Unit victim)
 {
     return(Task.Run(() => service.UpdateHighScore(killer, victim)));
 }
Пример #6
0
 public HighScoreController(IHighScoreService highScoreService, IMapper mapper)
 {
     _highScoreService = highScoreService;
     _mapper           = mapper;
 }
Пример #7
0
 public GamesServices(IRepository <Game> games, IRepository <User> users, IRandomProvider randomProvider, IHighScoreService highScore)
 {
     this.highScore      = highScore;
     this.games          = games;
     this.users          = users;
     this.randomProvider = randomProvider;
 }
Пример #8
0
 public HighScoreController(IHighScoreService highScoreService) => this.highScoreService = highScoreService;
 public GetMyHighScores(IHighScoreService highScoreService)
 {
     _highScoreService = highScoreService;
 }
 public ScoresController(IHighScoreService highScore)
 {
     this.highScore = highScore;
 }
Пример #11
0
        private Task HandleHighScore(IHighScoreService scoped)
        {
            // Do handling here

            return(Task.CompletedTask);
        }
Пример #12
0
 public GamesService(IHighScoreService highScore, IRepository <Game> games, IRandomProvider random)
 {
     this.highScore = highScore;
     this.games     = games;
     this.random    = random;
 }
Пример #13
0
 public YourHighScoreService(IHighScoreService highScoreService)
 {
     _highScoreService = highScoreService;
 }
Пример #14
0
        public BoardViewModel(IHighScoreService hsm, IToastPopUp toast, IMvxMainThreadAsyncDispatcher dispatcher)
        {
            _settings = GetSettings();
            _ge       = new GameEngine(_settings, this, hsm);

            _toast      = toast;
            _dispatcher = dispatcher;

            Title = "Play";
            // w411 h660
            //ShortestDimension = Math.Min((int)Application.Current.MainPage.Width, (int)Application.Current.MainPage.Height);

            ClickedTheProfCommand = new MvxCommand <Point>((p) =>
            {
                PerformRound(MoveDirection.None);
            });


            StartGameCommand = new MvxCommand(() =>
            {
                _gameTimer?.Stop();
                _elapsed = TimeSpan.Zero;

                _gameTimer          = new Timer(1000);
                _gameTimer.Elapsed += GameTimerElapsed;
                _gameTimer.Start();

                _ge.StartGame(GameMode.Random);
                UpdateUi(GameStatus.GameStarted, _ge.GetState(_elapsed));
            });

            ComingSoonCommand = new MvxCommand(() =>
            {
                _ = Task.Run(async() => await Application.Current.MainPage.DisplayAlert("Dahlex", "Coming SoOon", "Ok"));
            });

            NextLevelCommand = new MvxCommand(() =>
            {
                if (_ge != null)
                {
                    if (_ge.Status == GameStatus.LevelComplete)
                    {
                        //storyPanel.Resources.Clear();

                        _ge.StartNextLevel();

                        _gameTimer?.Start();
                    }

                    UpdateUi(_ge.Status, _ge.GetState(_elapsed));
                }
            });

            BombCommand = new MvxCommand(() =>
            {
                try
                {
                    _ = Task.Run(async() => await BlowBomb());
                }
                catch (Exception)
                {
                }
            });

            TeleCommand = new MvxCommand(() => DoTeleport());
        }
 public GamesService(IHighScoreService highScore, IRepository<Game> games, IRandomProvider random)
 {
     this.highScore = highScore;
     this.games = games;
     this.random = random;
 }