Merge branch 'dev' into hud

This commit is contained in:
_nebula 2023-03-03 14:21:06 +00:00
commit 4a51b91fb0
4 changed files with 45 additions and 20 deletions

View File

@ -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;
}

View File

@ -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<PlayerResources>()._invincible = true;
Locator.GetDeathManager()._invincible = true;
var shipTransform = Locator.GetShipTransform();
if (shipTransform)
{
shipTransform.GetComponentInChildren<ShipDamageController>()._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<PlayerResources>()._invincible = false;
Locator.GetDeathManager()._invincible = false;
var shipTransform = Locator.GetShipTransform();
if (shipTransform)
{
shipTransform.GetComponentInChildren<ShipDamageController>()._invincible = false;
}
}
private void OnWillRenderCanvases()
@ -133,4 +151,4 @@ internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart
_text.text = text;
}
}
}

View File

@ -41,7 +41,7 @@
"GalaxyMapEveryoneNotPresent": "现在还不是时候。需要所有人见证这个时刻。",
"YouAreDead": "你死了。",
"WaitingForRespawn": "等待某人将你复活……",
"WaitingForAllToDie": "等待{0}死亡……",
"WaitingForAllToDie": "等待剩余{0}死亡……",
"AttachToShip": "固定在飞船上",
"DetachFromShip": "取消固定",
"DeathMessages": {
@ -123,4 +123,4 @@
"{0}被电梯挤扁了"
]
}
}
}

View File

@ -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;
}