Exemple #1
0
 public void SelectAllFrames()
 {
     if (CurrentSpriteSheet != null && CurrentSpriteSheet.Frames.Count > 0)
     {
         foreach (SpriteSheetFrame frame in CurrentSpriteSheet.Frames)
         {
             CurrentSpriteSheet.SelectFrame(frame, true);
         }
     }
 }
Exemple #2
0
        //------------------------------------------------------------------------------------------------------------------
        //------------------------------------------------------------------------------------------------------------------


        public override void Update(float frameTime)
        {
            base.Update(frameTime);


            if (CurrentSpriteSheet == null)
            {
                return;
            }

            _thereAreSelectedFramesNow = CurrentSpriteSheet.SelectedFrames.Count > 0;

            if (_thereAreSelectedFramesNow && !_thereWereSelectedFramesLastTime)
            {
                ShowBottomPanel();
            }
            else if (!_thereAreSelectedFramesNow && _thereWereSelectedFramesLastTime)
            {
                HideBottomPanel();
            }


            if (_bottomPanel.Top <= bottomPanelPos.Y - bottomPanelSize.Height)
            {
                _bottomPanel.Top = bottomPanelPos.Y - bottomPanelSize.Height;
            }

            if (_bottomPanel.Top >= bottomPanelPos.Y + bottomPanelSize.Height)
            {
                _bottomPanel.Top = bottomPanelPos.Y + bottomPanelSize.Height;
            }


            if (_topPanel.Top <= topPanelPos.Y - topPanelSize.Height)
            {
                _topPanel.Top = topPanelPos.Y - topPanelSize.Height;
            }

            if (_topPanel.Top >= topPanelPos.Y)
            {
                _topPanel.Top = topPanelPos.Y;
            }

            //-------------------------------------------MOUSE EVENTS---------------------------------------------------------
            //----------------------------------------------------------------------------------------------------------------
            //----------------------------------------------------------------------------------------------------------------


            if (MouseIsInside)
            {
                _stateHandler.Update();
            }


            //----KEYBOARD EVENTS-------------------------------------------------------------------------------------------
            //--------------------------------------------------------------------------------------------------------------
            //--------------------------------------------------------------------------------------------------------------
            if (Focused)
            {
                if (Input.AnyOfTheseKeysDown("MainDisplay", Key.A, Key.Left))
                {
                    Camera.Move(-Configuration.CameraSpeed * frameTime, 0);
                }

                if (Input.AnyOfTheseKeysDown("MainDisplay", Key.D, Key.Right))
                {
                    Camera.Move(Configuration.CameraSpeed * frameTime, 0);
                }


                if (Input.AnyOfTheseKeysDown("MainDisplay", Key.W, Key.Up))
                {
                    Camera.Move(0, -Configuration.CameraSpeed * frameTime);
                }

                if (Input.AnyOfTheseKeysDown("MainDisplay", Key.S, Key.Down))
                {
                    Camera.Move(0, Configuration.CameraSpeed * frameTime);
                }


                if (Input.KeyPressed(Key.Delete, "MainDisplay"))
                {
                    if (CurrentSpriteSheet.SelectedFrames.Count == 0)
                    {
                        return;
                    }

                    var removedIds = CurrentSpriteSheet.RemoveSelectedFrames();

                    Application.Instance.OnSpriteSheetFrameRectDeleted(removedIds);

                    Application.Instance.MainWindow.PropertiesGrid.SelectedObject = null;
                }
            }

            _thereWereSelectedFramesLastTime = _thereAreSelectedFramesNow;
        }