public ServerSupervisor( IGameStateClient gameClient, INewGameFactory newGameStrategy, INewRegionsFactory newRegionsStrategy) { _gameClient = gameClient; _gameStrategy = newGameStrategy; _regionsStrategy = newRegionsStrategy; InitializeGames(); Context.System.Scheduler.ScheduleTellRepeatedly( TimeSpan.FromSeconds(0), TimeSpan.FromMilliseconds(15), Context.Self, new PingGamesCommand(), Context.Self); Receive <PingGamesCommand>(x => { PingGames(x); return(true); }); Receive <GameEndedMessage>(x => { Context.Sender.Tell(PoisonPill.Instance); InitializeGames(); return(true); }); }
public GamePersistenceActor(IGameStateClient client) { _client = client; Receive <GameEndedMessage>(async x => { await SaveGameAsync(x); }); }