/// <inheritdoc />
        /// <summary>
        /// </summary>
        public void Perform()
        {
            var skin = SkinManager.Skin.Keys[WorkingMap.Mode];

            foreach (var h in HitObjects)
            {
                h.Info.Lane = WorkingMap.GetKeyCount() - h.Info.Lane + 1;
                h.X         = Container.ScreenRectangle.X + Container.LaneSize * (h.Info.Lane - 1) + Container.DividerLineWidth;

                var index = skin.ColorObjectsBySnapDistance ? HitObjectManager.GetBeatSnap(h.Info, h.Info.GetTimingPoint(WorkingMap.TimingPoints)) : 0;

                if (h.Info.IsLongNote)
                {
                    var ln = (DrawableEditorHitObjectLong)h;

                    if (ConfigManager.EditorViewLayers.Value)
                    {
                        h.Image       = skin.EditorLayerNoteHitObjects[h.Info.Lane - 1];
                        ln.Body.Image = skin.EditorLayerNoteHoldBodies[h.Info.Lane - 1];
                        ln.Tail.Image = skin.EditorLayerNoteHoldEnds[h.Info.Lane - 1];
                    }
                    else
                    {
                        h.Image       = skin.NoteHoldHitObjects[h.Info.Lane - 1][index];
                        ln.Body.Image = skin.NoteHoldBodies[h.Info.Lane - 1].First();
                        ln.Tail.Image = skin.NoteHoldEnds[h.Info.Lane - 1];
                    }

                    ln.ResizeLongNote();
                }
                else
                {
                    if (ConfigManager.EditorViewLayers.Value)
                    {
                        h.Image = skin.EditorLayerNoteHitObjects[h.Info.Lane - 1];
                    }
                    else
                    {
                        h.Image = skin.NoteHitObjects[h.Info.Lane - 1][index];
                    }
                }
            }
        }
Beispiel #2
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="gameTime"></param>
        protected override void HandleInput(GameTime gameTime)
        {
            if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.PageUp))
            {
                ConfigManager.EditorScrollSpeedKeys.Value++;
            }

            if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.PageDown))
            {
                ConfigManager.EditorScrollSpeedKeys.Value--;
            }

            if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.Delete))
            {
                DeleteSelectedHitObjects();
            }

            // Clever way of handing key input with num keys since the enum values are 1 after each other.
            for (var i = 0; i < WorkingMap.GetKeyCount(); i++)
            {
                if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.D1 + i))
                {
                    PlaceObject(CompositionInputDevice.Keyboard, i + 1, AudioEngine.Track.Time);
                }
            }

            // Change between composition tools (only when shift isn't held down).
            // if shift is held down, then it'll change the beat snap.
            if (KeyboardManager.CurrentState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.LeftShift) &&
                KeyboardManager.CurrentState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.RightShift))
            {
                var index = (int)CompositionTool.Value;

                if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.Up))
                {
                    if (index - 1 >= 0)
                    {
                        CompositionTool.Value = (EditorCompositionTool)index - 1;
                    }
                }

                if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.Down))
                {
                    if (index + 1 < Enum.GetNames(typeof(EditorCompositionTool)).Length)
                    {
                        CompositionTool.Value = (EditorCompositionTool)index + 1;
                    }
                }

                SwitchGraphs();
            }

            // Select all
            if (KeyboardManager.CurrentState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) ||
                KeyboardManager.CurrentState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightControl))
            {
                if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.A))
                {
                    SelectAllHitObjects();
                }

                if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.C))
                {
                    CopySelectedHitObjects();
                }

                if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.V))
                {
                    PasteHitObjects();
                }

                if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.X))
                {
                    CutHitObjects();
                }

                if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.H))
                {
                    FlipHitObjectsHorizontally();
                }
            }

            HandleHitObjectSelection();

            switch (CompositionTool.Value)
            {
            case EditorCompositionTool.Select:
                break;

            case EditorCompositionTool.Note:
            case EditorCompositionTool.LongNote:
            case EditorCompositionTool.Mine:
                HandleHitObjectMouseInput();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            // Right click/delete object.
            if (MouseManager.IsUniqueClick(MouseButton.Right) && !View.MenuBar.IsActive)
            {
                DeleteHoveredHitObject();
            }
        }