Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TGUI inputs and alerts #8080

Merged
merged 21 commits into from
Jan 20, 2023
Merged

Conversation

itsmeow
Copy link
Member

@itsmeow itsmeow commented Nov 18, 2022

About The Pull Request

Simply adds them to the codebase. Does not actually replace a single input.

Also improves the "Close window" response on existing alerts/inputs, making it equivalent to No or Cancel in most cases. This means closing the alert will not trigger it, previously it could.

I tried to break this into cherry picks but near the end my dude just went mad with unatomized PRs that make 500 changes, so I just copy-pasted the newest versions from TG, however I can list PRs that this does include mainly:

Why It's Good For The Game

These look much better and add potential for additional functionality and accessibility. They've also quite improved from when we first tried porting TGUI list input.

Testing Photographs and Procedure

Screenshots&Videos

I removed the capitalization from all of the SUBMIT/CANCELS here.

Alert with three or more buttons

image

Alert with two buttons

image

Input list (using cameranet as example, unsorted, ignore that)

image

image

Number input (min/max buttons show the min/max values, the reload button resets to the default)

image

Single line text input

image

Multi line text input

image

Results

image

Changelog

🆑
add: Added TGUI inputs and alerts internally, however they are not enabled.
fix: Improved the response of most alert menus when you X them out rather than hitting No/Cancel.
tweak: Increased the contrast of selected/hovered TGUI buttons to 30% (from 15%)
/:cl:

bobbah and others added 18 commits November 18, 2022 01:52
Adds TGUI-based alerts to replace the old tgalert system. Replaces all uses of tgalert with tgui_alert except for one, the 'Report Issue' button, as people were (understandably) concerned that this button using tgui will prevent a tgui bug from being easily reported.

These windows have a nice little progress bar indicator of how much time they have left, and will automatically close themselves after this time elapses.

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This was requested by someone downstream. Some TGUI alerts offer two options e.g. (Kill Bob, Kill Janice), In byond alerts you'd be able to cancel by pressing the X, but tgui alerts don't support this. I've added an option to enable the normal X in the top right, so you can cancel out of alerts if you enable it.
Ported over from https://gitlab.com/cmdevs/colonial-warfare/-/merge_requests/613 which provides an input box to select an option from a list.
Has a search bar to allow filtering for results and an onKeyDown event to replicate default behaviour from the default list input boxes that BYOND provides (where you are able to type the first letter of an element in the list and it'll jump to the first element that matches and then the next and so on)
Right now, it is only applied to the holopad and "Drop Bomb" verb for administrators.

Credits to bobbahbrown for the Loader element from AlertModal.js which allows for a timed input (was needed on the CM codebase for timed inputs) and for the majority of the DM code.

Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
Ported over from https://gitlab.com/cmdevs/colonial-warfare/-/merge_requests/647
When you open the TGUI list input, it'll auto-focus the first element so that you can easily navigate with the arrow keys without having to click on the page beforehand.

Small QoL when opening the thing, don't have to click on it if you want to navigate via arrows keys, etc.
Swapped OK/Cancel buttons in tgui list input, so that it stays consistent with Windows UI guidelines (was Cancel/OK before).
pressing enter or space now selects the selected button
duplicate keys no longer cause input lists to break
* Fix tgui async modal constructor order

* Fix another bug with the async modals
Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
About The Pull Request

Creates the framework for two new TGUI input boxes that can be toggled via game prefs.
This does not convert any actual inputs to TGUI
This does not convert any tgui_list_inputs into being toggleable
Example pictures

Input on a hand labeler. This has a MAX_LENGTH set, so it can be invalidated. Cancel always returns null. Enter button submits, if valid.
text input
(OUTDATED) Multiline input on newscaster. Newer version fills the window with a section, like the others
multiline
Sheets from a stack
number input
Why It's Good For The Game

1
So I did...

    Much sleeker input boxes
    Result should be a in place swap for most occurrences of input
    Renders casting as text/num/null obsolete but still doable
    Input validation from both sides handled
    Prefs toggle if you don't like the look

Changelog

cl
add: TGUI input boxes are on the way! You can find new preferences in the menu. They will be on by default.
/cl
@github-actions github-actions bot added Administration TGUI-Changes Contains changes to TGUI. Make sure its up to date with TGUI 4.0 labels Nov 18, 2022
@itsmeow itsmeow marked this pull request as ready for review November 18, 2022 10:46
code/__HELPERS/game.dm Outdated Show resolved Hide resolved
@Tsar-Salat
Copy link
Contributor

add: Added TGUI inputs and alerts internally, however they are not enabled.

Are we going to test their feasibility at some point? Maybe start with something simple like ghostroles alerts for a testmerge?

@itsmeow
Copy link
Member Author

itsmeow commented Nov 19, 2022

I intend to make another PR actually implementing these into the codebase to see how they work. I'd rather we just have this in so I can port TGUI-Say though because it depends on these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Administration Feature Fix TGUI-Changes Contains changes to TGUI. Make sure its up to date with TGUI 4.0 Tweak
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet