public static void ReadingFromEmptyStore(IScoreStore store) { var tasks = new List <Task <IEnumerable <LeaderboardEntry> > >() { Task.Run(() => store.GetLeaderboardAsync(GameTypes.TicTacToe, Scopes.AllTime)), Task.Run(() => store.GetLeaderboardAsync(GameTypes.TicTacToe, Scopes.Weekly)), Task.Run(() => store.GetLeaderboardAsync(GameTypes.TicTacToe, Scopes.Daily)) }; Task.WaitAll(tasks.ToArray()); Assert.IsFalse(tasks[0].Result.Any() || tasks[1].Result.Any() || tasks[2].Result.Any()); }
public static void GetAllTimeLeaders(IScoreStore store) { var entries = Mocks.Older.Concat(Mocks.Today).Concat(Mocks.Yesterday); foreach (var mock in entries) { Task.Run(() => store.AddLeaderboardEntryAsync(mock)).Wait(); } var leaders = Task.Run(() => store.GetLeaderboardAsync(GameTypes.TicTacToe, Scopes.AllTime)); leaders.Wait(); Assert.IsTrue(leaders.Result.ToList().SequenceEqual(entries.ToList().OrderByDescending(l => l.Score), new LeaderboardEntryCsvComparer())); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); using (var container = new UnityContainer().LoadConfiguration()) { this._store = container.Resolve <IScoreStore>(); } _viewmodel = new CoreViewModel(); _window = new MainWindow(); _viewmodel.LaunchGame += LaunchNewGame; _viewmodel.showScoreEvent += showScore; _window.DataContext = _viewmodel; _window.Show(); }
public ScoreList(IScoreStore <T> store) => (_store, _scores) = (store, store.LoadScores());
public void GetDailyLeadersFromFileStore() { _store = new FileScoreStore(_filePath); StoreTestMethods.GetDailyLeaders(_store); }
public void ReadingFromEmptyFileStore() { _store = new FileScoreStore(_filePath); StoreTestMethods.ReadingFromEmptyStore(_store); }
public void GetDailyLeadersFromMemoryStore() { _store = new MemoryScoreStore(); StoreTestMethods.GetDailyLeaders(_store); }
public void ReadingFromEmptyMemoryStore() { _store = new MemoryScoreStore(); StoreTestMethods.ReadingFromEmptyStore(_store); }
public ScoresController(IGameManager gameManager, IScoreStore scoreStore, ILoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <ScoresController>(); _gameManager = gameManager; _scoreStore = scoreStore; }
public StateLogic(IScoreStore <PlayerScore> scoreStore) { _level.Reset(); _scoreList = new ScoreList <PlayerScore>(scoreStore); }
/* * boardSize.X is the number of columns on the Tetris board and boardSize.Y is the row count. * * The score store is responsible for loading and saving player scores between instances/sessions. * The library provides the implementation PlayerScoreFile, but it's a possible customization point. * Some front end might want to store the player score in a database on the internet and thus use another score store. */ public TetrisGame(Vec2i boardSize, IScoreStore <PlayerScore> scoreStore) { _stateLogic = new StateLogic(scoreStore); _boardLogic = new BoardLogic(boardSize, _stateLogic); }
/// <summary> /// Initializes a new instance of the <see cref="LeaderboardsController"/> class. /// </summary> /// <param name="store">Resolved store to be used.</param> public LeaderboardsController(IScoreStore store) { this._store = store; }
/// <summary> /// Initializes a new instance of the <see cref="ScoreDepedentClass"/> class. /// </summary> /// <param name="store">Resolved store object.</param> public ScoreDepedentClass(IScoreStore store) { this._store = store; }