(7163b300e) Added: Way for capitalizing / lowercasing replaced variables depending on the position in the sentence & some implementations

This commit is contained in:
Joonas Rikkonen
2019-06-04 15:32:59 +03:00
parent 9e345fb7c6
commit a3e67dd40a
21 changed files with 166 additions and 67 deletions
@@ -16,10 +16,9 @@ namespace Barotrauma
public void Greet(GameServer server, string codeWords, string codeResponse)
{
string greetingMessage = TextManager.Get("TraitorStartMessage").Replace("[targetname]", TargetCharacter.Name);
string moreAgentsMessage = TextManager.Get("TraitorMoreAgentsMessage")
.Replace("[codewords]", codeWords)
.Replace("[coderesponse]", codeResponse);
string greetingMessage = TextManager.GetWithVariable("TraitorStartMessage", "[targetname]", TargetCharacter.Name);
string moreAgentsMessage = TextManager.GetWithVariables("TraitorMoreAgentsMessage",
new string[2] { "[codewords]", "[coderesponse]" }, new string[2] { codeWords, codeResponse });
var greetingChatMsg = ChatMessage.Create(null, greetingMessage, ChatMessageType.Server, null);
var moreAgentsChatMsg = ChatMessage.Create(null, moreAgentsMessage, ChatMessageType.Server, null);
@@ -38,7 +37,7 @@ namespace Barotrauma
{
var ownerMsg = ChatMessage.Create(
null,//TextManager.Get("NewTraitor"),
TextManager.Get("TraitorStartMessageServer").Replace("[targetname]", TargetCharacter.Name).Replace("[traitorname]", Character.Name),
TextManager.GetWithVariables("TraitorStartMessageServer", new string[2] { "[targetname]", "[traitorname]" }, new string[2] { TargetCharacter.Name, Character.Name }),
ChatMessageType.MessageBox,
null
);
@@ -168,9 +167,8 @@ namespace Barotrauma
}
}
endMessage += (TextManager.ReplaceGenderPronouns(TextManager.Get(messageTag), traitorCharacter.Info.Gender) + "\n")
.Replace("[traitorname]", traitorCharacter.Name)
.Replace("[targetname]", targetCharacter.Name);
endMessage += (TextManager.ReplaceGenderPronouns(TextManager.GetWithVariables(messageTag, new string[2] { "[traitorname]", "[targetname]" },
new string[2] { traitorCharacter.Name, targetCharacter.Name }), traitorCharacter.Info.Gender) + "\n");
}
return endMessage;
@@ -415,7 +415,7 @@ namespace Barotrauma.Networking
{
if (endRoundTimer <= 0.0f)
{
SendChatMessage(TextManager.Get("CrewDeadNoRespawns").Replace("[time]", "60"), ChatMessageType.Server);
SendChatMessage(TextManager.GetWithVariable("CrewDeadNoRespawns", "[time]", "60"), ChatMessageType.Server);
}
endRoundTimer += deltaTime;
}
@@ -728,7 +728,7 @@ namespace Barotrauma.Networking
if (matchingSub == null)
{
SendDirectChatMessage(
TextManager.Get("CampaignStartFailedSubNotFound").Replace("[subname]", subName),
TextManager.GetWithVariable("CampaignStartFailedSubNotFound", "[subname]", subName),
connectedClient, ChatMessageType.MessageBox);
}
else