snozbot / fungus

An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
MIT License
1.63k stars 290 forks source link

QoL: Ability to cycle through commands in the Inspector #879

Closed TheEmbracedOne closed 4 years ago

TheEmbracedOne commented 4 years ago

Is your feature request related to a problem? Please describe. It would be super useful if there was a quicker way to cycle through commands on a block. For example if I want to double check all Say commands have the correct character name, it'd be handy to have a faster way to cycle through each command in the current block.

Describe the solution you'd like When pressing up/down keys, I'd like the next/previous command selected, displaying its content below like on a regular click; like this, but on up/down key presses on the keyboard instead of clicking: zBgnjKE9OQ

This works in the hierarchy window of Unity by default: AkDATq2lje

Vaqq commented 4 years ago

I'm using "page up" and "page down" on keyboard, to cycle through commands quickly.

TheEmbracedOne commented 4 years ago

Wow @Vaqq that actually works! This piece of code actually resides in Fungus\Scripts\BlockEditor.cs, marked with comments // Next Command and //Previous Command. Modifying that bit of the code from this:

            // Previous Command
            if ((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.PageUp))
            {
                SelectPrevious();
                GUI.FocusControl("dummycontrol");
                Event.current.Use();
            }
            // Next Command
            if ((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.PageDown))
            {
                SelectNext();
                GUI.FocusControl("dummycontrol");
                Event.current.Use();
            }

to this:


            // Previous Command
            if ((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.PageUp) ||
                (Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.UpArrow)) {
                SelectPrevious();
                GUI.FocusControl("dummycontrol");
                Event.current.Use();
            }
            // Next Command
            if ((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.PageDown) ||
                (Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.DownArrow)) {
                SelectNext();
                GUI.FocusControl("dummycontrol");
                Event.current.Use();
            }```
makes it work with arrow keys!