Ejemplo n.º 1
0
        private void FogOrRevealAll(bool revealAll)
        {
            var message = (revealAll) ? "This will reveal the entire map. Are you sure? This cannot be undone." : "This will fog the entire map. Are you sure? This cannot be undone.";
            var title   = (revealAll) ? "Reveal Entire Map?" : "Fog Entire Map?";

            if (MessageBox.Show(this, message, title, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                var fogAllFogUpdate = new FogUpdate(revealAll);
                fogAllFogUpdate.Add(new SimplePoint(0, 0));
                fogAllFogUpdate.Add(new SimplePoint(fog.Width, 0));
                fogAllFogUpdate.Add(new SimplePoint(fog.Width, fog.Height));
                fogAllFogUpdate.Add(new SimplePoint(0, fog.Height));

                UpdateFogImage(fogAllFogUpdate);
                undoFogUpdates.Clear();
                redoFogUpdates.Clear();
                undoLastFogAction.Enabled = redoLastFogAction.Enabled = false;
                pbxMap.Refresh();

                if (realTimeFogUpdates)
                {
                    connection.WriteFog(fog);
                }
            }
        }
Ejemplo n.º 2
0
        public override void FogOrRevealAll(bool fogAll)
        {
            var fogAllFogUpdate = new FogUpdate(!fogAll);

            fogAllFogUpdate.Add(new SimplePoint(0, 0));
            fogAllFogUpdate.Add(new SimplePoint(base.LoadedMapSize.Width, 0));
            fogAllFogUpdate.Add(new SimplePoint(base.LoadedMapSize.Width, base.LoadedMapSize.Height));
            fogAllFogUpdate.Add(new SimplePoint(0, base.LoadedMapSize.Height));

            this.SetFogUpdateAsync(fogAllFogUpdate, true);
        }
Ejemplo n.º 3
0
        public override void FogOrRevealAll(bool fogAll)
        {
            var fogAllFogUpdate = new FogUpdate(!fogAll);

            fogAllFogUpdate.Add(new SimplePoint(0, 0));
            fogAllFogUpdate.Add(new SimplePoint(this.Fog.Width, 0));
            fogAllFogUpdate.Add(new SimplePoint(this.Fog.Width, this.Fog.Height));
            fogAllFogUpdate.Add(new SimplePoint(0, this.Fog.Height));

            UpdateFogImage(fogAllFogUpdate, true, true);
            undoFogUpdates.Clear();
            redoFogUpdates.Clear();
            this.RefreshAll();
        }
Ejemplo n.º 4
0
        private void pbxMap_MouseMove(object sender, MouseEventArgs e)
        {
            // We ignore events firing too fast so that we don't end up with several points that are simply too close to each other to matter.
            if (DateTime.Now - lastMouseMoveTime < MouseMoveInterval)
            {
                return;
            }
            lastMouseMoveTime = DateTime.Now;

            // Update the New Fog image with the newly added point, so it can be drawn on the screen in real time.
            currentFogUpdate.Add(ConvertPointToStretchedImage(e.Location));

            UpdateNewFogImage(currentFogUpdate);

            // Invalidate only the region that we can see.
            pbxMap.Invalidate(new Rectangle(this.pnlMap.HorizontalScroll.Value, this.pnlMap.VerticalScroll.Value, pnlMap.Width, pnlMap.Height));
        }
Ejemplo n.º 5
0
        private void pbxMap_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != System.Windows.Forms.MouseButtons.Left && e.Button != System.Windows.Forms.MouseButtons.Right)
            {
                return;
            }

            pbxMap.MouseMove += new MouseEventHandler(pbxMap_MouseMove);
            pbxMap.MouseUp   += new MouseEventHandler(pbxMap_MouseUp);

            newFog = new Bitmap(fog.Width, fog.Height);

            currentFogUpdate = new FogUpdate((e.Button == System.Windows.Forms.MouseButtons.Left));
            currentFogUpdate.Add(ConvertPointToStretchedImage(e.Location));
        }