mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Non-latin star system fonts (#174) and add translation for warp prompts
This commit is contained in:
parent
62269557d2
commit
6df3b86fbc
@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/xen-42/outer-wilds-new-horizons/master/NewHorizons/translation_schema.json",
|
||||
"$schema": "https://raw.githubusercontent.com/xen-42/outer-wilds-new-horizons/main/NewHorizons/Schemas/translation_schema.json",
|
||||
"DialogueDictionary":
|
||||
{
|
||||
"NEW_HORIZONS_WARP_DRIVE_DIALOGUE_1" : "Your ship is now equiped with a warp drive!",
|
||||
@ -11,6 +11,8 @@
|
||||
"INTERSTELLAR_MODE" : "Interstellar Mode",
|
||||
"FREQ_STATUE" : "Nomai Statue",
|
||||
"FREQ_WARP_CORE" : "Anti-Graviton Flux",
|
||||
"FREQ_UNKNOWN" : "???"
|
||||
"FREQ_UNKNOWN" : "???",
|
||||
"ENGAGE_WARP_PROMPT" : "Engage Warp To {0}",
|
||||
"WARP_LOCKED" : "AUTOPILOT LOCKED TO:\n{0}"
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
namespace NewHorizons.Components
|
||||
{
|
||||
@ -105,12 +106,15 @@ namespace NewHorizons.Components
|
||||
}
|
||||
|
||||
var newCard = GameObject.Instantiate(_cardTemplate, parent);
|
||||
var textComponent = newCard.transform.Find("EntryCardRoot/NameBackground/Name").GetComponent<UnityEngine.UI.Text>();
|
||||
var textComponent = newCard.transform.Find("EntryCardRoot/NameBackground/Name").GetComponent<Text>();
|
||||
|
||||
var name = UniqueIDToName(uniqueID);
|
||||
|
||||
textComponent.text = name;
|
||||
if (name.Length > 17) textComponent.fontSize = 10;
|
||||
// Do it next frame
|
||||
var fontPath = "Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ScaleRoot/PanRoot/TH_VILLAGE/EntryCardRoot/NameBackground/Name";
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => textComponent.font = SearchUtilities.Find(fontPath).GetComponent<Text>().font);
|
||||
|
||||
newCard.SetActive(true);
|
||||
newCard.transform.name = uniqueID;
|
||||
@ -273,16 +277,20 @@ namespace NewHorizons.Components
|
||||
private void SetWarpTarget(ShipLogEntryCard shipLogEntryCard)
|
||||
{
|
||||
RemoveWarpTarget(false);
|
||||
_oneShotSource.PlayOneShot(global::AudioType.ShipLogUnmarkLocation, 1f);
|
||||
_oneShotSource.PlayOneShot(AudioType.ShipLogUnmarkLocation, 1f);
|
||||
_target = shipLogEntryCard;
|
||||
_target.SetMarkedOnHUD(true);
|
||||
Locator._rfTracker.UntargetReferenceFrame();
|
||||
|
||||
GlobalMessenger.FireEvent("UntargetReferenceFrame");
|
||||
_warpNotificationData = new NotificationData($"AUTOPILOT LOCKED TO:\n{UniqueIDToName(shipLogEntryCard.name).ToUpper()}");
|
||||
|
||||
var name = UniqueIDToName(shipLogEntryCard.name);
|
||||
|
||||
var warpNotificationDataText = TranslationHandler.GetTranslation("WARP_LOCKED", TranslationHandler.TextType.UI).Replace("{0}", name.ToUpper());
|
||||
_warpNotificationData = new NotificationData(warpNotificationDataText);
|
||||
NotificationManager.SharedInstance.PostNotification(_warpNotificationData, true);
|
||||
|
||||
_warpPrompt.SetText($"<CMD> Engage Warp To {UniqueIDToName(shipLogEntryCard.name)}");
|
||||
var warpPromptText = "<CMD> " + TranslationHandler.GetTranslation("ENGAGE_WARP_PROMPT", TranslationHandler.TextType.UI).Replace("{0}", name);
|
||||
_warpPrompt.SetText(warpPromptText);
|
||||
}
|
||||
|
||||
private void RemoveWarpTarget(bool playSound = false)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.External.Configs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -18,6 +18,11 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
|
||||
public static string GetTranslation(string text, TextType type)
|
||||
{
|
||||
return GetTranslation(text, type, out var _);
|
||||
}
|
||||
|
||||
public static string GetTranslation(string text, TextType type, out TextTranslation.Language translatedLanguage)
|
||||
{
|
||||
Dictionary<TextTranslation.Language, Dictionary<string, string>> dictionary;
|
||||
var language = TextTranslation.Get().m_language;
|
||||
@ -34,6 +39,7 @@ namespace NewHorizons.Handlers
|
||||
dictionary = _uiTranslationDictionary;
|
||||
break;
|
||||
default:
|
||||
translatedLanguage = TextTranslation.Language.UNKNOWN;
|
||||
return text;
|
||||
}
|
||||
|
||||
@ -41,6 +47,7 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
if (table.TryGetValue(text, out var translatedText))
|
||||
{
|
||||
translatedLanguage = language;
|
||||
return translatedText;
|
||||
}
|
||||
}
|
||||
@ -51,11 +58,13 @@ namespace NewHorizons.Handlers
|
||||
|
||||
if (englishTable.TryGetValue(text, out var englishText))
|
||||
{
|
||||
translatedLanguage = TextTranslation.Language.ENGLISH;
|
||||
return englishText;
|
||||
}
|
||||
}
|
||||
|
||||
// Default to the key
|
||||
translatedLanguage = TextTranslation.Language.UNKNOWN;
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user