/// <summary>
 /// Initializes a new instance of the <see cref="MoveManyTransBox"/> class.
 /// </summary>
 /// <param name="owner">The <see cref="TransBoxManager"/>.</param>
 /// <param name="spatials">The <see cref="ISpatial"/>s.</param>
 /// <param name="position">The position.</param>
 /// <param name="camera">The camera.</param>
 public MoveManyTransBox(TransBoxManager owner, IEnumerable<ISpatial> spatials, Vector2 position, ICamera2D camera)
 {
     _owner = owner;
     _camera = camera;
     _position = position;
     _spatials = spatials.ToImmutable();
 }
            /// <summary>
            /// Creates a series of transformation boxes around an entity.
            /// </summary>
            /// <param name="transBoxManager">The <see cref="TransBoxManager"/>.</param>
            /// <param name="entity">Entity to create the transformation boxes for.</param>
            /// <returns></returns>
            public static IEnumerable <ITransBox> SurroundEntity(TransBoxManager transBoxManager, ISpatial entity)
            {
                var ret       = new List <ITransBox>(entity.SupportsResize ? 9 : 1);
                var scaleSize = GetTransBoxSize(TransBoxType.BottomLeft);

                // Move box
                ret.Add(new TransBox(transBoxManager, TransBoxType.Move, entity));

                if (entity.SupportsResize)
                {
                    // Four corners
                    ret.Add(new TransBox(transBoxManager, TransBoxType.TopLeft, entity));
                    ret.Add(new TransBox(transBoxManager, TransBoxType.TopRight, entity));
                    ret.Add(new TransBox(transBoxManager, TransBoxType.BottomLeft, entity));
                    ret.Add(new TransBox(transBoxManager, TransBoxType.BottomRight, entity));

                    // Horizontal sides
                    if (entity.Size.X > scaleSize.X + 4)
                    {
                        ret.Add(new TransBox(transBoxManager, TransBoxType.Top, entity));
                        ret.Add(new TransBox(transBoxManager, TransBoxType.Bottom, entity));
                    }

                    // Vertical sides
                    if (entity.Size.Y > scaleSize.Y + 4)
                    {
                        ret.Add(new TransBox(transBoxManager, TransBoxType.Left, entity));
                        ret.Add(new TransBox(transBoxManager, TransBoxType.Right, entity));
                    }
                }

                return(ret);
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="MoveManyTransBox"/> class.
 /// </summary>
 /// <param name="owner">The <see cref="TransBoxManager"/>.</param>
 /// <param name="spatials">The <see cref="ISpatial"/>s.</param>
 /// <param name="position">The position.</param>
 /// <param name="camera">The camera.</param>
 public MoveManyTransBox(TransBoxManager owner, IEnumerable <ISpatial> spatials, Vector2 position, ICamera2D camera)
 {
     _owner    = owner;
     _camera   = camera;
     _position = position;
     _spatials = spatials.ToImmutable();
 }
            /// <summary>
            /// Initializes a new instance of the <see cref="TransBox"/> class.
            /// </summary>
            /// <param name="owner">The <see cref="TransBoxManager"/>.</param>
            /// <param name="type">The <see cref="TransBoxType"/>.</param>
            /// <param name="spatial">The <see cref="ISpatial"/>.</param>
            TransBox(TransBoxManager owner, TransBoxType type, ISpatial spatial)
            {
                _owner = owner;

                _type = type;
                _spatial = spatial;

                _size = GetTransBoxSize(type);
                _position = GetPosition();
            }
            /// <summary>
            /// Initializes a new instance of the <see cref="TransBox"/> class.
            /// </summary>
            /// <param name="owner">The <see cref="TransBoxManager"/>.</param>
            /// <param name="type">The <see cref="TransBoxType"/>.</param>
            /// <param name="spatial">The <see cref="ISpatial"/>.</param>
            TransBox(TransBoxManager owner, TransBoxType type, ISpatial spatial)
            {
                _owner = owner;

                _type    = type;
                _spatial = spatial;

                _size     = GetTransBoxSize(type);
                _position = GetPosition();
            }
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MapScreenControl"/> class.
        /// </summary>
        public GrhAtlasView()
        {
            TilesetConfiguration = null;
            if (!DesignMode && LicenseManager.UsageMode != LicenseUsageMode.Runtime)
                return;
            _transBoxManager = new TransBoxManager();
            _camera = new Camera2D(ClientSize.ToVector2()) { KeepInMap = false };





        }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MapScreenControl"/> class.
        /// </summary>
        public MapScreenControl()
        {
            if (!DesignMode && LicenseManager.UsageMode != LicenseUsageMode.Runtime)
                return;

            _drawingManager = new DrawingManager();
            _transBoxManager = new TransBoxManager();
            _camera = new Camera2D(ClientSize.ToVector2()) { KeepInMap = true };

            if (DrawingManager.LightManager.DefaultSprite == null)
                DrawingManager.LightManager.DefaultSprite = new Grh(GrhInfo.GetData("Effect", "light"));

            GlobalState.Instance.Map.SelectedObjsManager.SelectedChanged += SelectedObjsManager_SelectedChanged;

            lock (_instancesSync)
            {
                _instances.Add(this);
            }
        }
            /// <summary>
            /// Creates a series of transformation boxes around an entity.
            /// </summary>
            /// <param name="transBoxManager">The <see cref="TransBoxManager"/>.</param>
            /// <param name="entity">Entity to create the transformation boxes for.</param>
            /// <returns></returns>
            public static IEnumerable<ITransBox> SurroundEntity(TransBoxManager transBoxManager, ISpatial entity)
            {
                var ret = new List<ITransBox>(entity.SupportsResize ? 9 : 1);
                var scaleSize = GetTransBoxSize(TransBoxType.BottomLeft);

                // Move box
                ret.Add(new TransBox(transBoxManager, TransBoxType.Move, entity));

                if (entity.SupportsResize)
                {
                    // Four corners
                    ret.Add(new TransBox(transBoxManager, TransBoxType.TopLeft, entity));
                    ret.Add(new TransBox(transBoxManager, TransBoxType.TopRight, entity));
                    ret.Add(new TransBox(transBoxManager, TransBoxType.BottomLeft, entity));
                    ret.Add(new TransBox(transBoxManager, TransBoxType.BottomRight, entity));

                    // Horizontal sides
                    if (entity.Size.X > scaleSize.X + 4)
                    {
                        ret.Add(new TransBox(transBoxManager, TransBoxType.Top, entity));
                        ret.Add(new TransBox(transBoxManager, TransBoxType.Bottom, entity));
                    }

                    // Vertical sides
                    if (entity.Size.Y > scaleSize.Y + 4)
                    {
                        ret.Add(new TransBox(transBoxManager, TransBoxType.Left, entity));
                        ret.Add(new TransBox(transBoxManager, TransBoxType.Right, entity));
                    }
                }

                return ret;
            }