Beispiel #1
0
        /// <summary>
        /// Handles drawing to the map before any layers are drawn.
        /// </summary>
        /// <param name="map">The map the drawing is taking place on.</param>
        /// <param name="e">The <see cref="DrawableMapDrawEventArgs"/> containing the drawing event arguments.</param>
        void IMapDrawingExtension.DrawBeforeMap(IDrawableMap map, DrawableMapDrawEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            if (map == null)
            {
                Debug.Fail("map is null.");
                return;
            }

            if (e.SpriteBatch == null)
            {
                Debug.Fail("spriteBatch is null.");
                return;
            }

            if (e.Camera == null)
            {
                Debug.Fail("camera is null.");
                return;
            }

            Debug.Assert(!e.SpriteBatch.IsDisposed, "spriteBatch is disposed.");

            HandleDrawBeforeMap(map, e.SpriteBatch, e.Camera);
        }
        /// <summary>
        /// Handles the <see cref="IDrawableMap.BeginDrawMap"/> event from the current map.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="NetGore.Graphics.DrawableMapDrawEventArgs"/> instance containing the event data.</param>
        void BeginDrawMapCallback(IDrawableMap sender, DrawableMapDrawEventArgs e)
        {
            Debug.Assert(Map == sender, "How did we get an event from the wrong map?");
            Debug.Assert(e.SpriteBatch != null && !e.SpriteBatch.IsDisposed);

            foreach (var extension in _extensions)
            {
                extension.DrawBeforeMap(sender, e);
            }
        }
        /// <summary>
        /// Handles drawing to the map before any layers are drawn.
        /// </summary>
        /// <param name="map">The map the drawing is taking place on.</param>
        /// <param name="e">The <see cref="DrawableMapDrawEventArgs"/> containing the drawing event arguments.</param>
        void IMapDrawingExtension.DrawBeforeMap(IDrawableMap map, DrawableMapDrawEventArgs e)
        {
            if (!Enabled)
                return;

            if (map == null)
            {
                Debug.Fail("map is null.");
                return;
            }

            if (e.SpriteBatch == null)
            {
                Debug.Fail("spriteBatch is null.");
                return;
            }

            if (e.Camera == null)
            {
                Debug.Fail("camera is null.");
                return;
            }

            Debug.Assert(!e.SpriteBatch.IsDisposed, "spriteBatch is disposed.");

            HandleDrawBeforeMap(map, e.SpriteBatch, e.Camera);
        }