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
Search bar for save/load window and crashes fix #5634
Search bar for save/load window and crashes fix #5634
Conversation
Fixes crash with this tab opened when in main menu.
Fixes crash when choosing new game variant after loading the save and exiting back to main menu.
Search bar looks nice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest that the search bar would work much better as a separate element before the list of save files (with the case-sensitive checkbox on the same line as the search box). With the search bar on the bottom, the difference in placement for the filename input vs. search bar in the save/load menu is very awkward and can be confusing for a new user. It's also a UX issue to have the search bar below the Save/Load buttons, as those should semantically be the last items in the window.
Other than that change, there are a few code style changes I'd like to see made before I approve this PR, but on the whole I'm pretty happy with it.
This is how it looks like right now: Load modeSave modeThe only issues right now is buttons are shifting more to separator in load mode at the bottom the lower the resolution is. And there's an additional scroll bar at low resolution too. Besides that I think it works fine. Also in
maybe we can change this to table:
And change this statements to this: I think this will make code look more clean. And make it easier to add additional checks if you planning to add more flight states in the future. What do you think about it before I make a force-push? |
You can start the line with the "Save" text and place the filename bar on the same line as the Save text. Same with the "Search" text at the top if you feel so inclined. At low resolutions, the save file dialog should be modified to fill most of the screen.
As long as the enum strings are the same as the lang strings but in a different case, you could simply do |
Search bar for save/load window to search saves by name with a checkbox to make search case-sensitive. Some rewrite to make this window more prone to resolution scaling.
Case-sensitive text entry for checkbox in save/load window
3ce656f
to
ac9f7ea
Compare
By the by, looking at the code - you only need to add the |
I added this to every lang in |
Also, about buttons and additional scroll bar. I just wanted to know if you wanted it to be fixed. I don't care myself, because I don't play with this resolution and I don't know anybody who plays on it nowdays. This window should look fine on resolutions from 1280x1024 to 2560x1440, but feel free to tell me if I missed something. Thanks for letting me know about |
Pioneer unofficially targets a minimum resolution of 1280x720, so as long as it works on this resolution or larger it should be fine. I've not gotten a chance to test it yet, but even if there are scalability issues they can be fixed in a separate PR. We should probably make this an official minimum resolution, but we haven't made the decision to drop the potential for running the game at 800x600 (albeit with UI issues) yet. |
I'm not sure that (RU) translation will persist, might be over-written by transifex. Maybe not, perhaps. Btw, if you want to play more with these screens, perhaps we want the ability to delete saves as well? (definitely not for this PR) |
- Use ImGui tooltip delay function to avoid parsing the savefile unless the user really wants to see the hover tooltip - Expose SetItemTooltip / ImGuiHoveredFlags functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed one change to reduce the lag when scrolling/hovering the list of saved games, but otherwise I'm happy with this PR. Good work!
Search bar for save/load window with some rewrite
This PR adds search bar for save/load window to search for specific save by name for quickly choosing it from the list, if player has a lot of saves, for example. Some rewrite to better support resolution scaling and addition of new elements to bottom part.
In action:
Pioneer.search.bar.for.save.load.menu.mp4
Known issue: although not showed in the video, doesn't support case-insensitive search for non-english characters due to #4110
And some fixes to two crashes that don't have their own issue.
Crash 1
This was happening in main menu with opened tab
Commodity Price
inDebug Info
, because it lacked check inregisterTab
inDebugCommodityPrices
:if Game.player == nil then return end
Crash 2
This was happening when player tried to choose new game variant in new game window after loading any save and then exiting to main menu.
This was happening, because in
Equipment.lua
tables that define items are reinitialized after loading the save.This tables is used during registering of start variants in
new-game-window\class.lua
(ex. forStart At Mars
start):and then this tables are compared in this function in
new-game-window\ship.lua
:But since tables in
Equipment.lua
are reinitialized on save load the game will crash with message showed earlier.So comparison changed to compare against equipment's
l10n_key
since it's unique for every equipment.