Return to part gui when pressing escape in part sub-guis - #1713
Merged
Conversation
Pressing escape in an aspect's property gui closed all guis. Instead, it now saves the setting and reopens the part's aspect overview gui, just like the existing "<<" exit button does.
Just like in the aspect settings gui, escape now reuses the existing "Save" button action, which saves the values and reopens the part gui, instead of closing all guis.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pressing escape in the aspect settings, part settings, or part offsets gui closed all guis, forcing the player to re-open the part and navigate back to where they were.
Escape now does the same as the button that already exists in each of these guis for leaving it: it saves the current values and reopens the part gui the player came from.
Changes
Each of these three screens overrides
keyPressedand delegated the escape key tosuper.keyPressed, which ends up callingcloseContainer. Instead, they now trigger the press callback of their existing exit/save button:ContainerScreenAspectSettings<<button (top-left)ContainerAspectSettings.BUTTON_EXITContainerScreenPartSettingsSavebuttonContainerPartSettings.BUTTON_SAVEContainerScreenPartOffsetSavebuttonContainerPartOffset.BUTTON_SAVEAll three of those button actions already call
PartHelpers.openContainerPart(...)server-side, so the part gui reopens instead of everything closing. The client-side half of each callback (saveSetting()/onSave()) still runs, so escape keeps saving exactly as it did before.Reusing the buttons' callbacks rather than duplicating their logic keeps the two ways of leaving each gui from drifting apart.
These guis are only ever opened from a part gui (
ContainerMultipart/ContainerMultipartAspects, viaPartHelpers.openContainerPartSettings/openContainerPartOffsets/openContainerAspectSettings), so the part gui is always the correct place to return to.Testing
./gradlew compileJavapasses. The change is client-side gui input handling only, so it isn't covered by unit or game tests; verified by reading the existing exit/save button flows it now reuses.