public EditScreen(Vector2f WindowSize, Map Map, TileRenderer TileRenderer) : base(WindowSize, Map, TileRenderer) { _FileDropDown.Add(new SelectionOption <object>("select-option") { DisplayedString = "File" }); var newOption = new SelectionOption <object>("select-option") { DisplayedString = "New " }; newOption.OnClick += HandleNewClicked; _FileDropDown.Add(newOption); var openOption = new SelectionOption <object>("select-option") { DisplayedString = "Open" }; openOption.OnClick += HandleOpenClicked; _FileDropDown.Add(openOption); var saveOption = new SelectionOption <object>("select-option") { DisplayedString = "Save" }; saveOption.OnClick += HandleSaveClicked; _FileDropDown.Add(saveOption); _Items.Add(_FileDropDown); }
public MapRegionView(MapRegion MapRegion, TileRenderer Renderer) { this.MapRegion = MapRegion; _Text = new Text(MapRegion.Name, Renderer.FontFace, 32); _Text.Color = Renderer.FontColor; _Text.Scale = new Vector2f(1f / 128, 1f / 128); MapRegion.OnChange += (sender, e) => Update(); Update(); }
public MatchScreen( Vector2f WindowSize, Match Match, IEnumerable <Army> FollowedArmies, TileRenderer TileRenderer, UnitConfigurationRenderer UnitRenderer, FactionRenderer FactionRenderer) : base(WindowSize, Match.Map, TileRenderer) { Match.OnStartPhase += _EventBuffer.Hook <StartTurnComponentEventArgs>(HandleNewTurn).Invoke; Match.OnExecuteOrder += _EventBuffer.Hook <ExecuteOrderEventArgs>(HandleOrderExecuted).Invoke; this.UnitRenderer = UnitRenderer; this.FactionRenderer = FactionRenderer; _FollowedArmies = new HashSet <Army>(FollowedArmies); _FogOfWar = Match.Scenario.Rules.FogOfWar; _FogOfWarHandler = _EventBuffer.Hook <SightUpdatedEventArgs>(HandleSightUpdated); EventHandler <NewUnitEventArgs> addUnitHandler = _EventBuffer.Hook <NewUnitEventArgs>(AddUnit).Invoke; foreach (Army a in Match.Armies) { a.OnUnitAdded += addUnitHandler; foreach (Unit u in a.Units) { AddUnit(u); } } for (int i = 0; i < Match.Scenario.TurnConfiguration.Turns; ++i) { _TurnCounter.Add(new Checkbox("overlay-turn-counter-box") { Enabled = false }); } _FinishButton.Position = Size - _FinishButton.Size - new Vector2f(32, 32); _FinishButton.OnClick += HandleFinishClicked; _InfoDisplay.Position = _FinishButton.Position - new Vector2f(0, _InfoDisplay.Size.Y + 16); _VictoryConditionDisplay.Position = _InfoDisplay.Position - new Vector2f(0, _VictoryConditionDisplay.Size.Y + 16); _ActionDisplay.Position = new Vector2f(WindowSize.X - _ActionDisplay.Size.X - 16, 16); _TransformedItems.Add(_StackLayer); _Items.Add(_FinishButton); _Items.Add(_InfoDisplay); _Items.Add(_VictoryConditionDisplay); _Items.Add(_TurnCounter); _Items.Add(_ActionDisplay); }
public MapView(Map Map, TileRenderer TileRenderer) { _Map = Map; Tiles = new TileView[_Map.Tiles.GetLength(0), _Map.Tiles.GetLength(1)]; MapRegions = Map.Regions.Select(i => new MapRegionView(i, TileRenderer)).ToList(); this.TileRenderer = TileRenderer; for (int i = 0; i < _Map.Tiles.GetLength(0); ++i) { for (int j = 0; j < _Map.Tiles.GetLength(1); ++j) { Tiles[i, j] = new TileView(_Map.Tiles[i, j], TileRenderer); } } }
public TileView(Tile Tile, TileRenderer TileRenderer) { this.Tile = Tile; Tile.Configuration.OnReconfigure += (sender, e) => Render(TileRenderer); foreach (Tile t in Tile.NeighborTiles) { if (t != null) { t.Configuration.OnReconfigure += (sender, e) => Render(TileRenderer); } } _BorderVertices = new Vertex[Tile.Bounds.Length + 1]; for (int i = 0; i < _BorderVertices.Length; ++i) { _BorderVertices[i] = new Vertex(Tile.Bounds[i % Tile.Bounds.Length].Point, Color.Black); } Render(TileRenderer); }
public MapScreenBase(Vector2f WindowSize, Map Map, TileRenderer TileRenderer) { MapView = new MapView(Map, TileRenderer); _TileRenderer = TileRenderer; Size = WindowSize; Camera = new Camera(WindowSize, new Vector2f(MapView.Map.Width, MapView.Map.Height) * .5f, 64); var backdropColor = MakeBackdropColor(MapView.TileRenderer.BaseColor); _Backdrop = new Vertex[] { new Vertex(new Vector2f(0, 0), backdropColor), new Vertex(new Vector2f(WindowSize.X, 0), backdropColor), new Vertex(WindowSize, backdropColor), new Vertex(new Vector2f(0, WindowSize.Y), backdropColor) }; _AlertText.Position = new Vector2f(.5f * WindowSize.X, 0); _TransformedItems.Add(MapView); _TransformedItems.Add(HighlightLayer); _Items.Add(_AlertText); }
void Render(TileRenderer TileRenderer) { _Vertices = TileRenderer.Render(Tile); }