Пример #1
0
        public PanelTextureMap()
        {
            // Change default state
            SetStyle(ControlStyles.Selectable, true);
            BorderStyle    = BorderStyle.FixedSingle;
            DoubleBuffered = true;

            // Scroll bars
            _hScrollBar.Size          = new Size(Width - _scrollSize - 2, _scrollSize);
            _hScrollBar.Location      = new Point(1, Height - _scrollSize - 1);
            _hScrollBar.Anchor        = AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left;
            _hScrollBar.ValueChanged += (sender, e) => { ViewPosition = new Vector2((float)_hScrollBar.ValueCentered, ViewPosition.Y); };

            _vScrollBar.Size          = new Size(_scrollSize, Height - _scrollSize - 2);
            _vScrollBar.Location      = new Point(Width - _scrollSize - 1, 1);
            _vScrollBar.Anchor        = AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top;
            _vScrollBar.ValueChanged += (sender, e) => { ViewPosition = new Vector2(ViewPosition.X, (float)_vScrollBar.ValueCentered); };

            Controls.Add(_vScrollBar);
            Controls.Add(_hScrollBar);

            _movementTimer = new MovementTimer(MoveTimerTick);

            if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
            {
                _editor = Editor.Instance;
                _editor.EditorEventRaised += EditorEventRaised;
            }
        }
Пример #2
0
        public Panel2DMap()
        {
            DoubleBuffered = true;
            AllowDrop      = true;
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Selectable, true);
            UpdateStyles();

            if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
            {
                _editor = Editor.Instance;
                _editor.EditorEventRaised += EditorEventRaised;

                _depthBar = new DepthBar(_editor);
                _depthBar.InvalidateParent += Invalidate;
                _depthBar.GetParent        += () => this;
                _depthBar.SelectedRoom     += rooms => _editor.SelectRoomsAndResetCamera(WinFormsUtils.BoolCombine(_editor.SelectedRooms, rooms, ModifierKeys));

                _movementTimer = new MovementTimer(MoveTimerTick);

                UpdateBrushes();
                ResetView();
            }
        }