コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
ファイル: ImageSocketObject.cs プロジェクト: philazzi44/DnDCS
 public ImageSocketObject(SocketConstants.SocketAction action, SimpleImage image)
     : base(action)
 {
     Image = image;
 }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
ファイル: ImageSocketObject.cs プロジェクト: philazzi44/DnDCS
 public ImageSocketObject(SocketConstants.SocketAction action, SimpleImage image)
     : base(action)
 {
     Image = image;
 }
コード例 #7
0
ファイル: ClientControl.cs プロジェクト: philazzi44/DnDCS
 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);
     }
 }
コード例 #8
0
ファイル: ClientControl.cs プロジェクト: philazzi44/DnDCS
 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);
     }
 }