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
Make ClientTimesDisplay static #1147
Conversation
mp/src/game/client/momentum/ui/leaderboards/ClientTimesDisplay.cpp
Outdated
Show resolved
Hide resolved
mp/src/game/client/momentum/ui/leaderboards/ClientTimesDisplay.cpp
Outdated
Show resolved
Hide resolved
mp/src/game/client/momentum/ui/leaderboards/ClientTimesDisplay.cpp
Outdated
Show resolved
Hide resolved
mp/src/game/client/momentum/ui/leaderboards/LeaderboardsTimes.cpp
Outdated
Show resolved
Hide resolved
I'm almost ready for second review however during testing, I came across a weird bug that happens when resizing while having had a non-local leaderboard panel open: m_pCurrentLeaderboards is still correctly set to the global panel and that causes the place colors of the local panel not to show up. But I don't understand why it shows the local panel after res change with the buttons also somehow changing state accordingly. Do you, by chance, have any idea what VGUI mechanism might cause this? From what I found, the only time the buttons' state changes is in OnCommand of ClientTimesDisplay and that doesn't get called on res change. As a last resort, I could add a method to LeaderboardTimes to just set all its panels invisible and then set the current panel visible for this edge case or - like it is on Steam atm - just default to local times in this case. I've pushed my WIP code in the meantime, after this bug is fixed, I'll clean it up. |
I think if people are changing resolution the leaderboards panel should just close itself. |
Ah I think I was a bit vague, what I meant by open is that the last panel that was opened was one of the global times panel. Of course you can't really change resolution while it's open. |
Ah okay I understand now. Changing resolution reloads the res files and there might be something making an assumption. Previously the entire panel was destroyed. I think something to try is re-evaluating the buttons after changing resolution perhaps. |
Of course it's the controls file, I completely forgot that visibility etc. is set there, thanks! W.r.t. reevaluating this, should the focus be to respect the res file and set visibility to whatever's specified there or keep what was last displayed? |
Yeah I think visibility can be forced off ("0") in there and instead be evaluated in code. |
OK so apart from the code review changes, to fix two bugs that I noticed, I
|
This also includes some changes to its update logic: As soon as it gets toggled open, it gets a full update that checks if it's time to get new online times etc. and as long as it's open, it will only get updated by game events. The panel also doesn't get reset and recreated constantly anymore (e.g. on window size change), which was caused by it being a ViewportPanel.
Closes #1135 and also the discussion on #1061
Turns ClientTimesDisplay into a static panel and makes its update logic much less wasteful. The details are in the commit comment. The only thing I'm really unhappy with is that I couldn't name the init function Init() like with the other static panels because CBaseGameSystem, which is a superclass of the panel, already provides Init().
I also looked into whether it was possible to stop the request focus spam in the console without directly editing panel.cpp but found no good way to do it and declaring it a console-style panel doesn't make sense either.
Checklist
momentum_english_ref.res
file with the changes, rantokenizer.py
to generate an up-to-date localization file, and have committed both the.res
file changes and the new localization.txt
fileserver_momentum.vpc
/client_momentum.vpc
/ etc)