private void connection_OnMapReceived(SimpleImage mapImage) { try { using (var stream = new MemoryStream(mapImage.Bytes)) { gameState.Map = Texture2D.FromStream(GraphicsDevice, stream); } //lock (newFogLock) //{ // // Since we received a new map, we'll automatically black out everything with fog until the Server tells us otherwise. // this.newFog = new Texture2D(GraphicsDevice, newMap.Width, newMap.Height); // this.newFog.SetData<Color>(Enumerable.Repeat(Color.Black, newMap.Width * newMap.Height).ToArray()); //} } catch (Exception e) { Logger.LogError("Map Received Failure", e); } }
private void connection_OnFogReceived(SimpleImage fogSimpleImage) { try { using (var stream = new MemoryStream(fogSimpleImage.Bytes)) { var fogImage = System.Drawing.Image.FromStream(stream); stream.Position = 0; var fogTexture = Texture2D.FromStream(GraphicsDevice, stream); // TODO: The Bitmap uses White to simulate Transparency. This is stupid but acceptable for now. ReplaceNonBlackWithTransparent(fogTexture); this.gameState.FogImage = fogImage; this.gameState.Fog = fogTexture; } } catch (Exception e) { Logger.LogError("Fog received failure.", e); } }
public ImageSocketObject(SocketConstants.SocketAction action, SimpleImage image) : base(action) { Image = image; }
private void connection_OnMapReceived(SimpleImage mapImage) { try { var map = mapImage.Bytes.ToImage(); // Since we received a new map, we'll automatically black out everything with fog until the Server tells us otherwise. this.fog = new Bitmap(map.Width, map.Height); using (var g = Graphics.FromImage(this.fog)) g.Clear(fogColor); this.receivedMap = map; this.assignedMap = new Bitmap(map, (int)(map.Width * assignedZoomFactor), (int)(map.Height * assignedZoomFactor)); this.receivedMapWidth = this.receivedMap.Width; this.receivedMapHeight = this.receivedMap.Height; this.RefreshMapPictureBox(); } catch (Exception e) { Logger.LogError("Map Received Failure", e); } }
private void connection_OnFogReceived(SimpleImage fogImage) { try { this.fog = fogImage.Bytes.ToImage(); if (isBlackoutOn) return; RefreshMapPictureBox(); } catch (Exception e) { Logger.LogError("Fog received failure.", e); } }
private void connection_OnMapReceived(SimpleImage mapImage) { try { // Since we received a new map, we'll automatically black out everything with fog until the Server tells us otherwise. var newMap = mapImage.Bytes.ToImage(); this.ctlDnDMap.SetMapAsync(newMap); } catch (Exception e) { Logger.LogError("Map Received Failure", e); } }
private void connection_OnFogReceived(SimpleImage fogImage) { try { var newFog = fogImage.Bytes.ToImage(); this.ctlDnDMap.SetFogAsync(newFog); } catch (Exception e) { Logger.LogError("Fog received failure.", e); } }