diff --git a/QSB/Localization/QSBLocalization.cs b/QSB/Localization/QSBLocalization.cs index a81af601..70a6d918 100644 --- a/QSB/Localization/QSBLocalization.cs +++ b/QSB/Localization/QSBLocalization.cs @@ -43,8 +43,21 @@ public static class QSBLocalization return; } + // just use the system language until the profile is loaded and does SetLanguage // hack to stop things from breaking - Current = _translations[0]; + { + var language = TextTranslation.Get().GetSystemLanguage(); + DebugLog.DebugWrite($"Language changed to {language}"); + var newTranslation = _translations.FirstOrDefault(x => x.Language == language); + + if (newTranslation == default) + { + DebugLog.ToConsole($"Error - Could not find translation for language {language}! Defaulting to English."); + newTranslation = _translations.First(x => x.Language == TextTranslation.Language.ENGLISH); + } + + Current = newTranslation; + } TextTranslation.Get().OnLanguageChanged += OnLanguageChanged; } diff --git a/QSB/TimeSync/TimeSyncUI.cs b/QSB/TimeSync/TimeSyncUI.cs index d57833e4..60bce5e8 100644 --- a/QSB/TimeSync/TimeSyncUI.cs +++ b/QSB/TimeSync/TimeSyncUI.cs @@ -70,6 +70,15 @@ internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart enabled = true; _canvas.enabled = true; Canvas.willRenderCanvases += OnWillRenderCanvases; + + // silly hack that shouldnt be in the ui component but oh well + Locator.GetPlayerTransform().GetComponent()._invincible = true; + Locator.GetDeathManager()._invincible = true; + var shipTransform = Locator.GetShipTransform(); + if (shipTransform) + { + shipTransform.GetComponentInChildren()._invincible = true; + } } private void EndTimeSync() @@ -78,6 +87,15 @@ internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart enabled = false; _canvas.enabled = false; Canvas.willRenderCanvases -= OnWillRenderCanvases; + + // silly hack that shouldnt be in the ui component but oh well + Locator.GetPlayerTransform().GetComponent()._invincible = false; + Locator.GetDeathManager()._invincible = false; + var shipTransform = Locator.GetShipTransform(); + if (shipTransform) + { + shipTransform.GetComponentInChildren()._invincible = false; + } } private void OnWillRenderCanvases() @@ -133,4 +151,4 @@ internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart _text.text = text; } -} \ No newline at end of file +} diff --git a/QSB/Translations/zh_CN.json b/QSB/Translations/zh_CN.json index d64142b0..79065b52 100644 --- a/QSB/Translations/zh_CN.json +++ b/QSB/Translations/zh_CN.json @@ -41,7 +41,7 @@ "GalaxyMapEveryoneNotPresent": "现在还不是时候。需要所有人见证这个时刻。", "YouAreDead": "你死了。", "WaitingForRespawn": "等待某人将你复活……", - "WaitingForAllToDie": "等待{0}死亡……", + "WaitingForAllToDie": "等待剩余{0}人死亡……", "AttachToShip": "固定在飞船上", "DetachFromShip": "取消固定", "DeathMessages": { @@ -123,4 +123,4 @@ "{0}被电梯挤扁了" ] } -} \ No newline at end of file +} diff --git a/QSB/Utility/DebugLog.cs b/QSB/Utility/DebugLog.cs index 90badb74..8c17293a 100644 --- a/QSB/Utility/DebugLog.cs +++ b/QSB/Utility/DebugLog.cs @@ -16,19 +16,20 @@ public static class DebugLog public static void ToConsole(string message, MessageType type = MessageType.Message) { - if (QSBCore.Helper == null) - { - // yes i know this is only meant for OWML, but it's useful as a backup - ModConsole.OwmlConsole.WriteLine(message, type, GetCallingType()); - return; - } - if (QSBCore.DebugSettings.InstanceIdInLogs) { message = $"[{ProcessInstanceId}] " + message; } - QSBCore.Helper.Console.WriteLine(message, type, GetCallingType()); + if (QSBCore.Helper == null) + { + // yes i know this is only meant for OWML, but it's useful as a backup + ModConsole.OwmlConsole.WriteLine(message, type, GetCallingType()); + } + else + { + QSBCore.Helper.Console.WriteLine(message, type, GetCallingType()); + } } public static void ToHud(string message) @@ -50,13 +51,6 @@ public static class DebugLog public static void DebugWrite(string message, MessageType type = MessageType.Message) { - if (QSBCore.Helper == null) - { - // yes i know this is only meant for OWML, but it's useful as a backup - ModConsole.OwmlConsole.WriteLine(message, type, GetCallingType()); - return; - } - if (QSBCore.DebugSettings.DebugMode) { ToConsole(message, type); @@ -67,6 +61,6 @@ public static class DebugLog new StackTrace(2) // skip this function and calling function .GetFrames()! .Select(x => x.GetMethod().DeclaringType!) - .First(x => x != typeof(DebugLog) && !x.IsDefined(typeof(CompilerGeneratedAttribute))) + .First(x => x != typeof(DebugLog) && !x.IsDefined(typeof(CompilerGeneratedAttribute), true)) .Name; }