(a83cec9d6) Made room names translatable, added "RoomName." to all room names in EnglishVanilla.xml

This commit is contained in:
Joonas Rikkonen
2019-04-15 12:06:58 +03:00
parent 0f2e09b65e
commit 66de47f041
10 changed files with 38 additions and 19 deletions
@@ -731,7 +731,7 @@ namespace Barotrauma
if (IsSinglePlayer) if (IsSinglePlayer)
{ {
orderGiver.Speak( orderGiver.Speak(
order.GetChatMessage("", orderGiver.CurrentHull?.RoomName, givingOrderToSelf: character == orderGiver), ChatMessageType.Order); order.GetChatMessage("", orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver), ChatMessageType.Order);
} }
else else
{ {
@@ -748,7 +748,7 @@ namespace Barotrauma
if (IsSinglePlayer) if (IsSinglePlayer)
{ {
orderGiver?.Speak( orderGiver?.Speak(
order.GetChatMessage(character.Name, orderGiver.CurrentHull?.RoomName, givingOrderToSelf: character == orderGiver, orderOption: option), null); order.GetChatMessage(character.Name, orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver, orderOption: option), null);
} }
else if (orderGiver != null) else if (orderGiver != null)
{ {
@@ -221,7 +221,7 @@ namespace Barotrauma.Items.Components
{ {
hullInfoFrame.RectTransform.ScreenSpaceOffset = hullFrame.Rect.Center; hullInfoFrame.RectTransform.ScreenSpaceOffset = hullFrame.Rect.Center;
hullInfoFrame.Visible = true; hullInfoFrame.Visible = true;
hullNameText.Text = hull.RoomName; hullNameText.Text = hull.DisplayName;
foreach (Hull linkedHull in hullData.LinkedHulls) foreach (Hull linkedHull in hullData.LinkedHulls)
{ {
@@ -61,7 +61,7 @@ namespace Barotrauma.Networking
{ {
orderOption = order.Options[optionIndex]; orderOption = order.Options[optionIndex];
} }
txt = order.GetChatMessage(targetCharacter?.Name, senderCharacter?.CurrentHull?.RoomName, givingOrderToSelf: targetCharacter == senderCharacter, orderOption: orderOption); txt = order.GetChatMessage(targetCharacter?.Name, senderCharacter?.CurrentHull?.DisplayName, givingOrderToSelf: targetCharacter == senderCharacter, orderOption: orderOption);
if (order.TargetAllCharacters) if (order.TargetAllCharacters)
{ {
@@ -267,7 +267,7 @@ namespace Barotrauma
if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime)) if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime))
{ {
Character.Speak( Character.Speak(
newOrder.GetChatMessage("", Character.CurrentHull?.RoomName, givingOrderToSelf: false), ChatMessageType.Order); newOrder.GetChatMessage("", Character.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order);
} }
} }
} }
@@ -286,7 +286,7 @@ namespace Barotrauma
if (Character.PressureTimer > 50.0f && Character.CurrentHull != null) if (Character.PressureTimer > 50.0f && Character.CurrentHull != null)
{ {
Character.Speak(TextManager.Get("DialogPressure").Replace("[roomname]", Character.CurrentHull.RoomName), null, 0, "pressure", 30.0f); Character.Speak(TextManager.Get("DialogPressure").Replace("[roomname]", Character.CurrentHull.DisplayName), null, 0, "pressure", 30.0f);
} }
} }
@@ -131,8 +131,8 @@ namespace Barotrauma
character.AIController.SelectTarget(currentTarget.AiTarget); character.AIController.SelectTarget(currentTarget.AiTarget);
string errorMsg = null; string errorMsg = null;
#if DEBUG #if DEBUG
bool isRoomNameFound = currentTarget.RoomName != null; bool isRoomNameFound = currentTarget.DisplayName != null;
errorMsg = "(Character " + character.Name + " idling, target " + (isRoomNameFound ? currentTarget.RoomName : currentTarget.ToString()) + ")"; errorMsg = "(Character " + character.Name + " idling, target " + (isRoomNameFound ? currentTarget.DisplayName : currentTarget.ToString()) + ")";
#endif #endif
var path = PathSteering.PathFinder.FindPath(character.SimPosition, currentTarget.SimPosition, errorMsg); var path = PathSteering.PathFinder.FindPath(character.SimPosition, currentTarget.SimPosition, errorMsg);
PathSteering.SetPath(path); PathSteering.SetPath(path);
@@ -83,7 +83,7 @@ namespace Barotrauma
if (character.SelectedCharacter == null) if (character.SelectedCharacter == null)
{ {
character?.Speak(TextManager.Get("DialogFoundUnconsciousTarget") character?.Speak(TextManager.Get("DialogFoundUnconsciousTarget")
.Replace("[targetname]", targetCharacter.Name).Replace("[roomname]", character.CurrentHull.RoomName), .Replace("[targetname]", targetCharacter.Name).Replace("[roomname]", character.CurrentHull.DisplayName),
null, 1.0f, null, 1.0f,
"foundunconscioustarget" + targetCharacter.Name, 60.0f); "foundunconscioustarget" + targetCharacter.Name, 60.0f);
} }
@@ -108,7 +108,7 @@ namespace Barotrauma
} }
#if CLIENT #if CLIENT
new GUIMessageBox("", TextManager.Get("CargoSpawnNotification").Replace("[roomname]", cargoRoom.RoomName)); new GUIMessageBox("", TextManager.Get("CargoSpawnNotification").Replace("[roomname]", cargoRoom.DisplayName));
#endif #endif
Dictionary<ItemContainer, int> availableContainers = new Dictionary<ItemContainer, int>(); Dictionary<ItemContainer, int> availableContainers = new Dictionary<ItemContainer, int>();
@@ -338,11 +338,11 @@ namespace Barotrauma.Items.Components
sinTime = 0; sinTime = 0;
if (!leak.FlowTargetHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f)) if (!leak.FlowTargetHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f))
{ {
character.Speak(TextManager.Get("DialogLeaksFixed").Replace("[roomname]", leak.FlowTargetHull.RoomName), null, 0.0f, "leaksfixed", 10.0f); character.Speak(TextManager.Get("DialogLeaksFixed").Replace("[roomname]", leak.FlowTargetHull.DisplayName), null, 0.0f, "leaksfixed", 10.0f);
} }
else else
{ {
character.Speak(TextManager.Get("DialogLeakFixed").Replace("[roomname]", leak.FlowTargetHull.RoomName), null, 0.0f, "leakfixed", 10.0f); character.Speak(TextManager.Get("DialogLeakFixed").Replace("[roomname]", leak.FlowTargetHull.DisplayName), null, 0.0f, "leakfixed", 10.0f);
} }
} }
+25 -6
View File
@@ -71,6 +71,25 @@ namespace Barotrauma
set; set;
} }
public string DisplayName
{
get;
private set;
}
private string roomName;
[Editable, Serialize("", true)]
public string RoomName
{
get { return roomName; }
set
{
if (roomName == value) { return; }
roomName = value;
DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName;
}
}
public override Rectangle Rect public override Rectangle Rect
{ {
get get
@@ -798,17 +817,17 @@ namespace Barotrauma
} }
if (roomItems.Contains("reactor")) if (roomItems.Contains("reactor"))
return TextManager.Get("ReactorRoom"); return "RoomName.ReactorRoom";
else if (roomItems.Contains("engine")) else if (roomItems.Contains("engine"))
return TextManager.Get("EngineRoom"); return "RoomName.EngineRoom";
else if (roomItems.Contains("steering") && roomItems.Contains("sonar")) else if (roomItems.Contains("steering") && roomItems.Contains("sonar"))
return TextManager.Get("CommandRoom"); return "RoomName.CommandRoom";
else if (roomItems.Contains("ballast")) else if (roomItems.Contains("ballast"))
return TextManager.Get("Ballast"); return "RoomName.Ballast";
if (ConnectedGaps.Any(g => !g.IsRoomToRoom && g.ConnectedDoor != null)) if (ConnectedGaps.Any(g => !g.IsRoomToRoom && g.ConnectedDoor != null))
{ {
return TextManager.Get("Airlock"); return "RoomName.Airlock";
} }
Rectangle subRect = Submarine.CalculateDimensions(); Rectangle subRect = Submarine.CalculateDimensions();
@@ -828,7 +847,7 @@ namespace Barotrauma
else else
roomPos |= Alignment.Right; roomPos |= Alignment.Right;
return TextManager.Get("Sub" + roomPos.ToString()); return "RoomName.Sub" + roomPos.ToString();
} }
public static Hull Load(XElement element, Submarine submarine) public static Hull Load(XElement element, Submarine submarine)
@@ -20,7 +20,7 @@ namespace Barotrauma.Networking
public OrderChatMessage(Order order, string orderOption, Entity targetEntity, Character targetCharacter, Character sender) public OrderChatMessage(Order order, string orderOption, Entity targetEntity, Character targetCharacter, Character sender)
: this(order, orderOption, : this(order, orderOption,
order.GetChatMessage(targetCharacter?.Name, sender?.CurrentHull?.RoomName, givingOrderToSelf: targetCharacter == sender, orderOption: orderOption), order.GetChatMessage(targetCharacter?.Name, sender?.CurrentHull?.DisplayName, givingOrderToSelf: targetCharacter == sender, orderOption: orderOption),
targetEntity, targetCharacter, sender) targetEntity, targetCharacter, sender)
{ {
} }