public async void ZoomCanvas(double zoomMultiplicator) { double oldCenterX = HexMapCenterX; double oldCenterY = HexMapCenterY; GetHexMapCanvasDimensionsRequestMessage msg = new GetHexMapCanvasDimensionsRequestMessage(); var result = await Messenger.Default.SendAsync(msg); double oldHexMapCanvasWidth = result.Result.Item1; double oldHexMapCanvasHeight = result.Result.Item2; double oldHexMapCanvasX = oldHexMapCanvasWidth / 2; double oldHexMapCanvasY = oldHexMapCanvasHeight / 2; double xMove = oldCenterX - oldHexMapCanvasX; double yMove = oldCenterY - oldHexMapCanvasY; CellRadius = CellRadius * zoomMultiplicator; foreach (var hexViewModel in ListHexViewModel) { hexViewModel.UpdateCellRadius(CellRadius); } HexMapCenterX = HexMapDrawingHelper.GetRedrawnHexMapXCenter(CellRadius, Columns); HexMapCenterY = HexMapDrawingHelper.GetRedrawnHexMapYCenter(CellRadius, Columns, Rows); CenterHexMap(); MoveCanvas(xMove * zoomMultiplicator, yMove * zoomMultiplicator); }
public void UpdateShapes() { HexMapDrawingHelper.InsidePolygon_Update(HexDrawingData, InsidePolygon); HexMapDrawingHelper.BorderPolygon_Draw(HexDrawingData, BorderPolygon); HexMapDrawingHelper.HexLabel_Draw(HexDrawingData, GridLabel, Label); HexMapDrawingHelper.HexLineExploration_Update(HexDrawingData, ListLineExploration); }
public void GenerateShapes() { HexMapDrawingHelper.InsidePolygon_Draw(HexDrawingData, InsidePolygon /*, Color, Bitmap*/); HexMapDrawingHelper.BorderPolygon_Draw(HexDrawingData, BorderPolygon); HexMapDrawingHelper.HexLabel_Draw(HexDrawingData, GridLabel, Label); HexMapDrawingHelper.HexLineExploration_Draw(HexDrawingData, ListLineExploration, DegreExploration); }
public async void UpdateTileData(Color color, string imageName) { GetBitmapByNameMessage msg = new GetBitmapByNameMessage(imageName); var result = await Messenger.Default.SendAsync(msg); HexMapDrawingHelper.InsidePolygon_UpdateFill(InsidePolygon, color, result.Result); }
public BitmapImage GetBitmapImage(string name) { if (!DictionaryBitmapImage.ContainsKey(name)) { DictionaryBitmapImage.Add(name, HexMapDrawingHelper.GetBitmapImageFromName(name)); } return(DictionaryBitmapImage[name]); }
public Bitmap GetBitmap(string name) { if (!DictionaryBitmap.ContainsKey(name)) { DictionaryBitmap.Add(name, HexMapDrawingHelper.GetBitmapFromName(name)); } return(DictionaryBitmap[name]); }
public void UpdateDegreExploration(int degreExploration) { DegreExploration = degreExploration; for (int i = 0; i < ListLineExploration.Count; i++) { HexMapDrawingHelper.LineExploration_UpdateVisibility(ListLineExploration[i], i, DegreExploration); } }
public override async void ApplyModel(TileImageModel model) { _id = model.Id; Name = model.Name; NameLower = model.ImageName; GetBitmapByNameMessage msg = new GetBitmapByNameMessage(model.ImageName); var result = await Messenger.Default.SendAsync(msg); ImageSource = HexMapDrawingHelper.GenerateTileImageSource(Color.LightGreen, result.Result); }
public void UnselectHex() { if (Selected) { Selected = false; HexMapDrawingHelper.BorderPolygon_UpdateSelected(HexDrawingData, BorderPolygon, Selected); Messenger.Default.Send( new HexViewModelUnselectedMessage { HexViewModel = this }); } }
public override async void ApplyModel(HexMapModel hexMapModel) { GetHexMapCanvasDimensionsRequestMessage msg = new GetHexMapCanvasDimensionsRequestMessage(); var result = await Messenger.Default.SendAsync(msg); double hexMapCanvasWidth = result.Result.Item1; double hexMapCanvasHeight = result.Result.Item2; double cellRadius = HexMapDrawingHelper.GetCellRadius(hexMapCanvasHeight, hexMapCanvasWidth, hexMapModel.Columns, hexMapModel.Rows); CellRadius = cellRadius; Columns = hexMapModel.Columns; Rows = hexMapModel.Rows; foreach (var hexViewModel in ListHexViewModel) { hexViewModel.UnsubscribePolygonEvents(); } ListHexViewModel.Clear(); ListUIElement.Clear(); foreach (var hexModel in hexMapModel.ListHexModel) { var hexViewModel = new HexViewModel(); hexViewModel.ApplyModel(hexModel); hexViewModel.InitializeCellRadius(CellRadius); ListHexViewModel.Add(hexViewModel); foreach (UIElement uiElement in hexViewModel.GetAllUIElements()) { ListUIElement.Add(uiElement); } } HexMapCenterX = HexMapDrawingHelper.GetRedrawnHexMapXCenter(CellRadius, Columns); HexMapCenterY = HexMapDrawingHelper.GetRedrawnHexMapYCenter(CellRadius, Columns, Rows); CenterHexMap(); }