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

Read elevation keybind from vanilla settings #1454

Merged

Conversation

krzychu124
Copy link
Member

Closes #1326

  • list the currently set keybinds for elevation change action
  • update values after rebinding via vanilla UI at Keybinds tab
  • dynamically colorize and replace [[xyz]] tag with replacement values (each match gets own replacement value) - skip {x} matches could be added in the future if necessary for complex translations text,
  • bunch of tests for tag colorize+replacement function

Changes in action:

2022-03-04.01-18-03.mp4

@krzychu124 krzychu124 added Usability Make mod easier to use Keybinds Keyboard (and mouse) shortcuts labels Mar 4, 2022
@krzychu124 krzychu124 self-assigned this Mar 4, 2022
@krzychu124 krzychu124 added this to the 11.6.5.1 milestone Mar 4, 2022
@originalfoo
Copy link
Member

I've done some brief testing in-game and it seems to work as advertised. Will do some more testing tomorrow.

@kianzarrin
Copy link
Collaborator

can't we just use the CS's keybind for this?

@krzychu124
Copy link
Member Author

can't we just use the CS's keybind for this?

It does exactly that... Previously it was hardcoded to PageUp/PageDown

@kianzarrin
Copy link
Collaborator

No I mean instead of adding an entry to TMPE options we can just use NetTool.m_buildElevationUp/Down insteaed

@krzychu124
Copy link
Member Author

Have you read the code? It's just read-only thing, not saved anywhere.

@originalfoo
Copy link
Member

No I mean instead of adding an entry to TMPE options

The keybinds tab in TMPE options doubles-up as a quick reference guide for users, hence listing the elevation keybinds.

/// <param name="e"></param>
/// <returns>true once when user releases the key.</returns>
public bool KeyUp() {
return Key.IsKeyUp();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have done the same thing for the KeyDown() method above

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, KeyDown() method above is weird, I tried to use it and after rebinding PageUp to something else like [ or comma (theoretically not used anywhere) it stopped working, I couldn't figure out why KeyDown() always return false - I even attached debugger 😂

TLM/TLM/U/UIUtil.cs Outdated Show resolved Hide resolved
Copy link
Collaborator

@kianzarrin kianzarrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Just a single comment about replacement pattern (I hope github does not hide comments as usual!)

Copy link
Member

@originalfoo originalfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@krzychu124 krzychu124 merged commit 60e39dc into master Mar 4, 2022
@krzychu124 krzychu124 deleted the feature/1326-read-elevation-keybind-from-vanilla-settings branch March 4, 2022 23:43
@originalfoo
Copy link
Member

originalfoo commented Mar 4, 2022

Oops - just noticed an issue with this PR:

image

Only one of those shortcuts will go to underground view, but both are listed as switching to undergound?

Maybe it should be context sensitive (using TrafficManagerTool.IsUndergroundMode to determine current mode) showing relevant shortcut key?

Edit: Alternatively the hint text could be Switch to undeground/overground view ?

@krzychu124
Copy link
Member Author

It's a translation on the Crowdin, needs the update 😉

@originalfoo
Copy link
Member

I'll add to the locale updates list :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Keybinds Keyboard (and mouse) shortcuts Usability Make mod easier to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to under/overground should be read from the game keybinds
3 participants