private static async Task PrepareReplay(Game.StartProperties properties, IGameUi ui, CancellationToken cancellation) { var replayProperties = properties.ReplayProperties; if (replayProperties != null) { var replayFilename = replayProperties.Filename ?? Path.Combine(AcPaths.GetReplaysDirectory(), replayProperties.Name); ui.OnProgress("Checking replay for fake cars…"); var fakes = await FakeCarsHelper.GetFakeCarsIds(replayFilename); if (fakes.Count > 0) { Logging.Debug("Fakes found: " + fakes.Select(x => $"{x.FakeId} ({x.SourceId})").JoinToString(", ")); foreach (var fake in fakes) { var car = CarsManager.Instance.GetById(fake.SourceId); if (car != null) { FakeCarsHelper.CreateFakeCar(car, fake.FakeId, null); } else { Logging.Warning("Original not found: " + fake.SourceId); } } } } }
public ConwaysLife(int width, int height, IGameUi ui) { this.width = width; this.height = height; this.ui = ui; cellAge = new int[width, height]; }
public ConwaysLife(int width, int height, IGameUi ui) { this.width = width; this.height = height; this.ui = ui; cellAge = new int[width, height]; }
public static Game DoGameStep(Game game, IGameUi ui) { var stepResult = game.Step(); var newGame = stepResult.NextState; foreach (var changedCell in stepResult.ChangedCells) { ui.UpdateCell(changedCell.X, changedCell.Y, changedCell.IsAlive); } return(newGame); }
public ProgressHandler(IGameUi ui) { _ui = ui; }
public Program(Game game, IGameUi ui) { this.game = game; this.ui = ui; }
public Game(IGameEngine gameEngine, IGameUi gameUi) { _gameEngine = gameEngine; _gameUi = gameUi; }
public void Setup() { _battleship = Freeze <IBattleshipGrid>(); _ui = Freeze <IGameUi>(); }
public Game(IBattleshipGrid battleshipGrid, IGameUi ui) { _battleshipGrid = battleshipGrid; _ui = ui; }