public TerrainRenderer(ITerrainMap terrainMap, IGameParameters gameParameters) { _terrainMap = terrainMap; _gameParameters = gameParameters; _terrainMap.CollectionChanged += (s, e) => _dirty = true; }
public MiniMapDelegate(ILayout trackLayout, IPixelMapper pixelMapper, ITerrainMap terrainMap) { _trackLayout = trackLayout; _pixelMapper = pixelMapper; _terrainMap = terrainMap; _pixelMapper.ViewPortChanged += (s, e) => _redraw = true; _trackLayout.CollectionChanged += (s, e) => _redraw = true; _terrainMap.CollectionChanged += (s, e) => _redraw = true; }
protected TestBase(ITestOutputHelper output) { Storage = new NullStorage(); Timer = new TestTimer(); TrackLayout = new Layout(); TerrainMap = new TerrainMap(); GameBoard = new GameBoard(TrackLayout, TerrainMap, Storage, Timer); _output = output; }
public TerrainMapRenderer(ITerrainMap terrainMap, IImageFactory imageFactory, IImageCache imageCache, IPixelMapper pixelMapper) { _terrainMap = terrainMap; _imageFactory = imageFactory; _imageCache = imageCache; _pixelMapper = pixelMapper; _terrainMap.CollectionChanged += (s, e) => _imageCache.SetDirty(this); }
public GameBoard(ITerrainMap terrainMap, IUnitList unitList, IShortestPath shortestPath, IAlliedEnemyMatrix alliedEnemyMatrix, IVictoryCalculator victoryCalculator, IEnemyPlan enemyPlan) { _terrainMap = terrainMap; _units = unitList; _shortestPath = shortestPath; _alliedEnemyMatrix = alliedEnemyMatrix; _endOfGame = victoryCalculator; _enemyPlan = enemyPlan; }
public TerrainRenderer(ITerrainMap terrainMap, IPixelMapper pixelMapper, ITrackParameters trackParameters) { _terrainMap = terrainMap; _pixelMapper = pixelMapper; _trackParameters = trackParameters; _paintBrush = new PaintBrush { Color = Colors.LightGray, StrokeWidth = 1, Style = PaintStyle.Stroke }; }
public GameBoard(ILayout trackLayout, ITerrainMap terrainMap, IGameStorage?storage, ITimer?timer) { _layout = trackLayout; _gameLoopTimer = timer; _terrainMap = terrainMap; _storage = storage; if (_gameLoopTimer != null) { _gameLoopTimer.Interval = GameLoopInterval; _gameLoopTimer.Elapsed += GameLoopTimerElapsed; _gameLoopTimer.Start(); } }
public void ComputeShortestPath(ITerrainMap terrainMap, int startCol, int startRow, int endCol, int endRow, int unitType) { _endCol = endCol; _endRow = endRow; _startCol = startCol; _startRow = startRow; _unitType = unitType; _terrainMap = terrainMap; _iterations = 0; _openList = new AStarNodeList(); _closedList = new AStarNodeList(); WayPoint = new List <Offset>(); // push the starting cell var currentNode = new AStarNode(startCol, startRow, startCol, startRow, _endCol, _endRow, 0); _openList.Push(currentNode); FindPath(); }
public void CreateDistricts(ITerrainMap terrain, Rectangle[] _districts, bool silent) { if (!silent && !(_districts.Length > 0)) { // show confirmation message string text = Core.resources["world.create_districts_prompt"].stringValue; if (!UIUtil.ConfirmMessage(text, UIMessageType.warning, UIInformLevel.normal)) { return; } } // reset map for (int y = 0; y < districtMap.GetUpperBound(1); y++) { for (int x = 0; x < districtMap.GetUpperBound(0); x++) { districtMap[x, y] = -1; } } for (int i = 0; i < _districts.Length; i++) { Rectangle r = _districts[i]; ProvisionalDistrict dist = new ProvisionalDistrict(this, terrain, r); int n = districts.Add(dist); for (int y = r.Top; y <= r.Bottom; y++) { for (int x = r.Left; x <= r.Right; x++) { if (districtMap[x, y] != -1) { throw new ArgumentException("detect overraped rectangles in districts array."); } districtMap[x, y] = n; } } } }
public BridgeFactory(ITerrainMap terrainMap) { _terrainMap = terrainMap; }
public TIntersectionFactory(ITerrainMap terrainMap) { _terrainMap = terrainMap; }
public SignalFactory(ITerrainMap terrainMap) { _terrainMap = terrainMap; }
public NatureLayoutRenderer(ILayout <Tree> layout, IRenderer <Tree> renderer, IImageFactory imageFactory, ITerrainMap terrainMap) : base(layout, renderer, imageFactory, terrainMap) { this.Name = "Nature"; this.Enabled = true; this.IsScaledByHeight = true; }
public UnitList(IBattleCalculator battleCalculator, ITerrainMap terrainMap) { _battleCalculator = battleCalculator; _terrainMap = terrainMap; }
public TrackLayoutRenderer(ILayout <Track> layout, IEnumerable <IRenderer <Track> > renderers, IImageFactory imageFactory, ITerrainMap terrainMap) : base(layout, renderers, imageFactory, terrainMap) { this.Name = "Tracks"; this.Enabled = true; }
public TreeTool(ILayout <Tree> trackLayout, ITerrainMap terrainMap, IEnumerable <IStaticEntityFactory <Tree> > entityFactories) { _entityCollection = trackLayout; _terrainMap = terrainMap; _entityFactories = entityFactories; }
public EnemyPlan(ITerrainMap map, IUnitList units, IAlliedEnemyMatrix alliedEnemyMatrix) { _map = map; _units = units; _alliedEnemyMatrix = alliedEnemyMatrix; }
public CachableLayoutRenderer(ILayout <T> layout, IEnumerable <IRenderer <T> > renderers, IImageFactory imageFactory, ITerrainMap terrainMap) : base(layout, renderers, imageFactory, terrainMap) { layout.CollectionChanged += (s, e) => _dirty = true; }
public CachableLayoutRenderer(ILayout <T> layout, IRenderer <T> renderer, IImageFactory imageFactory, ITerrainMap terrainMap) : this(layout, new[] { renderer }, imageFactory, terrainMap) { }
public CrossTrackFactory(ITerrainMap terrainMap, ILayout <Track> layout) { _terrainMap = terrainMap; _layout = layout; }
public VictoryCalculator(ITerrainMap terrainMap, IUnitList units) { _terrainMap = terrainMap; _units = units; }
public TunnelRenderer(ITerrainMap terrainMap, ILayout <Track> layout, IGameBoard gameBoard) { _terrainMap = terrainMap; _trackLayout = layout; _gameBoard = gameBoard; }
public SignalFactory(ITerrainMap terrainMap, ILayout <Track> layout) { _terrainMap = terrainMap; _layout = layout; }
public ProvisionalDistrict(World w, ITerrainMap map, Rectangle area) : base(w, map, area) { }
public TerrainRenderer(ITerrainMap terrainMap) { _terrainMap = terrainMap; _terrainMap.CollectionChanged += (s, e) => _dirty = true; }
public BridgeRenderer(ITerrainMap terrainMap, IPathFactory pathFactory) { _terrainMap = terrainMap; _cornerPlankPath = BuildCornerPlankPath(pathFactory); _cornerRailPath = BuildCornerRailPath(pathFactory); }
public MainPage(IGame game, IEnumerable <ITool> tools, IEnumerable <ILayerRenderer> layers, IEnumerable <ICommand> commands, ITrainController trainControls, ILayout trackLayout, IGameStorage gameStorage, ITerrainMap terrainMap, MiniMapDelegate miniMapDelegate, TrainsDelegate trainsDelegate) { this.Title("Trains - " + ThisAssembly.AssemblyInformationalVersion); _game = game; _controlDelegate = trainsDelegate; _miniMapDelegate = miniMapDelegate; this.Body = () => { return(new HStack() { new VStack() { _configurationShown?null: new Button(trainControls.BuildMode ? "Building" : "Playing", () => SwitchGameMode()), new Spacer(), _configurationShown ? CreateConfigurationControls(layers) : CreateToolsControls(tools, _controlDelegate, trainControls.BuildMode.Value), new Spacer(), _configurationShown || !trainControls.BuildMode ? null : CreateCommandControls(commands), new Spacer(), new HStack() { new Button(" - ", () => _game.Zoom(-1)) .Frame(40), new Spacer(), new Button(" + ", () => _game.Zoom(1)) .Frame(40), }, new Spacer(), new Button("Snapshot", () => Snapshot()), new Button("Configuration", () => _configurationShown.Value = !_configurationShown.Value), new DrawableControl(_miniMapDelegate).Frame(height: 100) }.Frame(100, alignment: Alignment.Top), new VStack() { new TrainControllerPanel(trainControls), new DrawableControl(_controlDelegate) } }.FillHorizontal()); }; _trackLayout = trackLayout; _gameStorage = gameStorage; _ = PresentLoop(); void SwitchGameMode() { trainControls.ToggleBuildMode(); if (_controlDelegate == null) { return; } _controlDelegate.CurrentTool.Value = tools.FirstOrDefault(t => ShouldShowTool(trainControls.BuildMode, t)); } void Snapshot() { (int width, int height) = _game.GetSize(); using var bitmap = new SKBitmap(width, height, SKImageInfo.PlatformColorType, SKAlphaType.Premul); using var skCanvas = new SKCanvas(bitmap); using (ICanvas canvas = new SKCanvasWrapper(skCanvas)) { canvas.Save(); _game.Render(canvas); canvas.Restore(); } Clipboard.SetImage(bitmap.ToWriteableBitmap()); } _terrainMap = terrainMap; }
public TerrainMapRenderer(ITerrainMap terrainMap, IImageFactory imageFactory) { _terrainMap = terrainMap; _imageFactory = imageFactory; _terrainMap.CollectionChanged += (s, e) => _dirty = true; }
public TrackTool(ILayout <Track> trackLayout, ITerrainMap terrainMap) { _entityCollection = trackLayout; _terrainMap = terrainMap; }
public TrackFactory(ITerrainMap terrainMap) { _terrainMap = terrainMap; }