-
Notifications
You must be signed in to change notification settings - Fork 85
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
Texture atlas breaks when changing option involving menu rebuild #1514
Comments
The menu rebuild is triggered by checkbox event handlers which call internal static void RebuildMenu() {
if (TMPELifecycle.Instance.Deserializing || ModUI.Instance == null) {
Log._Debug("OptionsManager.RebuildMenu() - Ignoring; Deserialising or ModUI.Instance is null");
return;
}
Log.Info("OptionsManager.RebuildMenu()");
ModUI.Instance.RebuildMenu();
// TM:PE main button also needs to be updated
if (ModUI.Instance.MainMenuButton != null) {
ModUI.Instance.MainMenuButton.UpdateButtonSkinAndTooltip();
}
RoadUI.Instance.ReloadTexturesWithTranslation();
TrafficLightTextures.Instance.ReloadTexturesWithTranslation();
TMPELifecycle.Instance.TranslationDatabase.ReloadTutorialTranslations();
TMPELifecycle.Instance.TranslationDatabase.ReloadGuideTranslations();
} Note - the following should probably only ever be done when language changes? RoadUI.Instance.ReloadTexturesWithTranslation();
TrafficLightTextures.Instance.ReloadTexturesWithTranslation();
TMPELifecycle.Instance.TranslationDatabase.ReloadTutorialTranslations();
TMPELifecycle.Instance.TranslationDatabase.ReloadGuideTranslations(); @kvakvs does that make sense? |
Yeah that second part should be called when language changes - I don't see why it's now/was every time 🤷♂️ |
IIRC it was doing that originally so I just kind of left it. Here's the original code before I stared changing stuff (it used to live in Lines 127 to 144 in 768fe7f
|
Yeah, I've checked original code. All good, but I'll test if it's really necessary. No need to waste time if not needed. Anyways.... it's a race condition when it comes to issue with UI texture. I need to figure out a better solution |
I think the original The only 2 times I'm aware of that locales and textures should get updated:
So we could put the texture reload in to a method and only call it when required - vague mockup (needs improvement): internal static void ReloadLocalisations(bool languageChanged = false) {
if (TMPELifecycle.Instance.Deserializing || ModUI.Instance == null) {
Log._Debug("OptionsManager.ReloadTextures() - Ignoring; Deserialising or ModUI.Instance is null");
return;
}
// relaod whenever language code or road theme changes
RoadUI.Instance.ReloadTexturesWithTranslation();
TrafficLightTextures.Instance.ReloadTexturesWithTranslation();
// only reload if language code changed
if (languageChanged) {
TMPELifecycle.Instance.TranslationDatabase.ReloadTutorialTranslations();
TMPELifecycle.Instance.TranslationDatabase.ReloadGuideTranslations();
}
} |
Ok, above code works good enough but there is a regression with regards to priority signs textures. |
I do not understand, there is no special handling of chinese signs in my theme code. But there is special handling of chinese TTL icons, where special versions of TTL icons for Chinese are loaded. Please make an issue with a screenshot. |
Note also that there's two variants of Chinese - |
Locale is a combination of ISO language code (ZH for chinese) and country code where it is used (CN is for mainland China and TW for Taiwan, there's also SG for Singapore and HK for Hong Kong which we do not see in the game). Don't ask me how ZH means Chinese, probably some hieroglyph meaning China or Chinese transliterates to that and it became accepted by the ISO. Also this means most common Mandarin Chinese but there are a few more variations https://iso639-3.sil.org/code/zho |
Files are loaded correctly, we just don't use them anymore because of introduced themes. There is even [Obsolete] label above both fields holding refs to loaded textures. Everything was "working" before introducing Speed limit themes but now we just need either do an exception for the rule we have or better build a basic theme for Chinese. |
I do not think we should localize the signs when a user playing Chinese C:S would switch to another theme. Can we merge these signs or reuse from the existing theme engine? What's exactly not working? |
I already explained. Yield and Stop signs as localized Chinese version -> #1081 |
I don't mind adding Chinese signs or several themes for different lands speaking Chinese. What you think? |
If we find textures why not. The more complete set of textures the better. |
Describe the problem
See steps below. Investigating... (TM:PE workshop TEST also affected so probably a bug introduced in texture rebuild fix)
Steps to reproduce
Now the fun part
Now the weird part
Log files
Screenshots?
Notes or questions?
It looks like every second rebuild of menu, texture source or whatever is happening there fixes the problem 🤷♂️
Everything works, just textures are missing.
The text was updated successfully, but these errors were encountered: