Пример #1
0
        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);
                        }
                    }
                }
            }
        }
Пример #2
0
 public ConwaysLife(int width, int height, IGameUi ui)
 {
     this.width = width;
     this.height = height;
     this.ui = ui;
     cellAge = new int[width, height];
 }
Пример #3
0
 public ConwaysLife(int width, int height, IGameUi ui)
 {
     this.width  = width;
     this.height = height;
     this.ui     = ui;
     cellAge     = new int[width, height];
 }
Пример #4
0
        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);
        }
Пример #5
0
 public ProgressHandler(IGameUi ui)
 {
     _ui = ui;
 }
Пример #6
0
 public Program(Game game, IGameUi ui)
 {
     this.game = game;
     this.ui   = ui;
 }
Пример #7
0
 public Game(IGameEngine gameEngine, IGameUi gameUi)
 {
     _gameEngine = gameEngine;
     _gameUi     = gameUi;
 }
Пример #8
0
 public void Setup()
 {
     _battleship = Freeze <IBattleshipGrid>();
     _ui         = Freeze <IGameUi>();
 }
Пример #9
0
 public Game(IBattleshipGrid battleshipGrid, IGameUi ui)
 {
     _battleshipGrid = battleshipGrid;
     _ui             = ui;
 }