Started moving hard-coded texts to a separate xml file (Content/Texts.xml) to make modding and translating the game easier (see #80). Also Renamed InfoTextManager as TextManager.

This commit is contained in:
Joonas Rikkonen
2017-12-26 23:51:18 +02:00
parent a5d2dd37f4
commit 2894b74edc
16 changed files with 411 additions and 244 deletions

View File

@@ -178,7 +178,7 @@ namespace Barotrauma
{
if (GameMain.NetworkMember != null && Character.controlled == this)
{
string chatMessage = InfoTextManager.GetInfoText("Self_CauseOfDeath." + causeOfDeath.ToString());
string chatMessage = TextManager.Get("Self_CauseOfDeath." + causeOfDeath.ToString());
if (GameMain.Client != null) chatMessage += " Your chat messages will only be visible to other dead players.";
GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead);

View File

@@ -309,12 +309,10 @@ namespace Barotrauma
if (suicideButton == null)
{
suicideButton = new GUIButton(
new Rectangle(new Point(GameMain.GraphicsWidth / 2 - 60, 20), new Point(120, 20)), "Give in", "");
new Rectangle(new Point(GameMain.GraphicsWidth / 2 - 60, 20), new Point(120, 20)), TextManager.Get("GiveInButton"), "");
suicideButton.ToolTip = GameMain.NetworkMember == null ?
"The character can no longer be revived if you give in." :
"Let go of your character and enter spectator mode (other players will no longer be able to revive you)";
suicideButton.ToolTip = TextManager.Get(GameMain.NetworkMember == null ? "GiveInHelpSingleplayer" : "GiveInHelpMultiplayer");
suicideButton.OnClicked = (button, userData) =>
{
@@ -344,7 +342,7 @@ namespace Barotrauma
{
if (GameMain.DebugDraw)
{
GUI.DrawString(spriteBatch, new Vector2(30, GameMain.GraphicsHeight - 260), "Stun: "+character.Stun, Color.White);
GUI.DrawString(spriteBatch, new Vector2(30, GameMain.GraphicsHeight - 260), TextManager.Get("Stun") + ": " + character.Stun, Color.White);
}
if (oxygenBar == null)
@@ -364,7 +362,7 @@ namespace Barotrauma
oxygenBar.Draw(spriteBatch);
if (!oxyMsgShown)
{
GUI.AddMessage(InfoTextManager.GetInfoText("OxygenBarInfo"), new Vector2(oxygenBar.Rect.Right + 10, oxygenBar.Rect.Y), Alignment.Left, Color.White, 5.0f);
GUI.AddMessage(TextManager.Get("OxygenBarInfo"), new Vector2(oxygenBar.Rect.Right + 10, oxygenBar.Rect.Y), Alignment.Left, Color.White, 5.0f);
oxyMsgShown = true;
}
}
@@ -394,7 +392,7 @@ namespace Barotrauma
if (pressureMsgTimer > 0.5f && !pressureMsgShown)
{
GUI.AddMessage(InfoTextManager.GetInfoText("PressureInfo"), new Vector2(40.0f, healthBar.Rect.Y - 60.0f), Alignment.Left, Color.White, 5.0f);
GUI.AddMessage(TextManager.Get("PressureInfo"), new Vector2(40.0f, healthBar.Rect.Y - 60.0f), Alignment.Left, Color.White, 5.0f);
pressureMsgShown = true;
}

View File

@@ -31,7 +31,7 @@ namespace Barotrauma
var skills = Job.Skills;
skills.Sort((s1, s2) => -s1.Level.CompareTo(s2.Level));
new GUITextBlock(new Rectangle(x, y, 200, 20), "Skills:", "", frame, font);
new GUITextBlock(new Rectangle(x, y, 200, 20), TextManager.Get("Skills") + ":", "", frame, font);
y += 20;
foreach (Skill skill in skills)
{

View File

@@ -10,19 +10,19 @@ namespace Barotrauma
{
if (prevTimer % 0.1f > 0.05f && IncubationTimer % 0.1f < 0.05f)
{
GUI.AddMessage(InfoTextManager.GetInfoText("HuskDormant"), Color.Red, 4.0f);
GUI.AddMessage(TextManager.Get("HuskDormant"), Color.Red, 4.0f);
}
}
else if (IncubationTimer < 1.0f)
{
if (state == InfectionState.Dormant && Character.Controlled == character)
{
new GUIMessageBox("", InfoTextManager.GetInfoText("HuskCantSpeak"));
new GUIMessageBox("", TextManager.Get("HuskCantSpeak"));
}
}
else if (state != InfectionState.Active && Character.Controlled == character)
{
new GUIMessageBox("", InfoTextManager.GetInfoText("HuskActivate"));
new GUIMessageBox("", TextManager.Get("HuskActivate"));
}
}
}

View File

@@ -38,7 +38,7 @@ namespace Barotrauma
if (singleplayer)
{
string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" :
string summaryText = TextManager.Get(gameOver ? "gameover" :
(progress ? "progress" : "return"));
var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, "", innerFrame, true);
@@ -81,7 +81,7 @@ namespace Barotrauma
Character character = characterInfo.Character;
if (character == null || character.IsDead)
{
statusText = InfoTextManager.GetInfoText("CauseOfDeath." + characterInfo.CauseOfDeath.ToString());
statusText = TextManager.Get("CauseOfDeath." + characterInfo.CauseOfDeath.ToString());
statusColor = Color.DarkRed;
}
else

View File

@@ -28,25 +28,25 @@ namespace Barotrauma
this.newGameContainer = newGameContainer;
this.loadGameContainer = loadGameContainer;
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Selected submarine:", null, null, Alignment.Left, "", newGameContainer);
new GUITextBlock(new Rectangle(0, 0, 0, 30), TextManager.Get("SelectedSub") + ":", null, null, Alignment.Left, "", newGameContainer);
subList = new GUIListBox(new Rectangle(0, 30, 230, newGameContainer.Rect.Height - 100), "", newGameContainer);
UpdateSubList();
new GUITextBlock(new Rectangle((int)(subList.Rect.Width + 20), 0, 100, 20),
"Save name: ", "", Alignment.Left, Alignment.Left, newGameContainer);
TextManager.Get("SaveName") + ": ", "", Alignment.Left, Alignment.Left, newGameContainer);
saveNameBox = new GUITextBox(new Rectangle((int)(subList.Rect.Width + 30), 30, 180, 20),
Alignment.TopLeft, "", newGameContainer);
new GUITextBlock(new Rectangle((int)(subList.Rect.Width + 20), 60, 100, 20),
"Map Seed: ", "", Alignment.Left, Alignment.Left, newGameContainer);
TextManager.Get("MapSeed") + ": ", "", Alignment.Left, Alignment.Left, newGameContainer);
seedBox = new GUITextBox(new Rectangle((int)(subList.Rect.Width + 30), 90, 180, 20),
Alignment.TopLeft, "", newGameContainer);
seedBox.Text = ToolBox.RandomSeed(8);
var startButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, "", newGameContainer);
var startButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("StartCampaignButton"), Alignment.BottomRight, "", newGameContainer);
startButton.OnClicked = (GUIButton btn, object userData) =>
{
if (string.IsNullOrWhiteSpace(saveNameBox.Text))
@@ -58,10 +58,9 @@ namespace Barotrauma
Submarine selectedSub = subList.SelectedData as Submarine;
if (selectedSub != null && selectedSub.HasTag(SubmarineTag.Shuttle))
{
var msgBox = new GUIMessageBox("Shuttle selected",
"Most shuttles are not adequately equipped to deal with the dangers of the Europan depths. " +
"Are you sure you want to choose a shuttle as your vessel?",
new string[] { "Yes", "No" });
var msgBox = new GUIMessageBox(TextManager.Get("ShuttleSelected"),
TextManager.Get("ShuttleWarning"),
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
string savePath = SaveUtil.CreateSavePath(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer, saveNameBox.Text);
msgBox.Buttons[0].OnClicked = (button, obj) => { StartNewGame?.Invoke(selectedSub, savePath, seedBox.Text); return true; };
@@ -110,7 +109,7 @@ namespace Barotrauma
{
textBlock.TextColor = textBlock.TextColor * 0.85f;
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), TextManager.Get("Shuttle"), "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
shuttleText.TextColor = textBlock.TextColor * 0.8f;
shuttleText.ToolTip = textBlock.ToolTip;
}
@@ -140,7 +139,7 @@ namespace Barotrauma
textBlock.UserData = saveFile;
}
loadGameButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.Right | Alignment.Bottom, "", loadGameContainer);
loadGameButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("LoadButton"), Alignment.Right | Alignment.Bottom, "", loadGameContainer);
loadGameButton.OnClicked = (btn, obj) =>
{
if (string.IsNullOrWhiteSpace(saveList.SelectedData as string)) return false;
@@ -176,16 +175,16 @@ namespace Barotrauma
new GUITextBlock(new Rectangle(0, 0, 0, 20), Path.GetFileNameWithoutExtension(fileName), "", Alignment.TopLeft, Alignment.TopLeft, saveFileFrame, false, GUI.LargeFont);
new GUITextBlock(new Rectangle(0, 35, 0, 20), "Submarine: ", "", saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(0, 35, 0, 20), TextManager.Get("Submarine") + ":", "", saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(15, 52, 0, 20), subName, "", saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(0, 70, 0, 20), "Last saved: ", "", saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(0, 70, 0, 20), TextManager.Get("LastSaved") + ":", "", saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(15, 85, 0, 20), saveTime, "", saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(0, 105, 0, 20), "Map seed: ", "", saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(0, 105, 0, 20), TextManager.Get("MapSeed") + ":", "", saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(15, 120, 0, 20), mapseed, "", saveFileFrame).Font = GUI.SmallFont;
var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Delete", Alignment.BottomCenter, "", saveFileFrame);
var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("Delete"), Alignment.BottomCenter, "", saveFileFrame);
deleteSaveButton.UserData = fileName;
deleteSaveButton.OnClicked = DeleteSave;

View File

@@ -56,12 +56,12 @@ namespace Barotrauma
int crewColumnWidth = Math.Min(300, (container.Rect.Width - 40) / 2);
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Crew:", "", tabs[(int)Tab.Crew], GUI.LargeFont);
new GUITextBlock(new Rectangle(0, 0, 100, 20), TextManager.Get("Crew") + ":", "", tabs[(int)Tab.Crew], GUI.LargeFont);
characterList = new GUIListBox(new Rectangle(0, 40, crewColumnWidth, 0), "", tabs[(int)Tab.Crew]);
characterList.OnSelected = SelectCharacter;
hireList = new GUIListBox(new Rectangle(0, 40, 300, 0), "", Alignment.Right, tabs[(int)Tab.Crew]);
new GUITextBlock(new Rectangle(0, 0, 300, 20), "Hire:", "", Alignment.Right, Alignment.Left, tabs[(int)Tab.Crew], false, GUI.LargeFont);
new GUITextBlock(new Rectangle(0, 0, 300, 20), TextManager.Get("Hire") + ":", "", Alignment.Right, Alignment.Left, tabs[(int)Tab.Crew], false, GUI.LargeFont);
hireList.OnSelected = SelectCharacter;
//---------------------------------------
@@ -71,7 +71,7 @@ namespace Barotrauma
if (GameMain.Client == null)
{
startButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start",
startButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("StartCampaignButton"),
Alignment.BottomRight, "", tabs[(int)Tab.Map]);
startButton.OnClicked = (GUIButton btn, object obj) => { StartRound?.Invoke(); return true; };
startButton.Enabled = false;
@@ -132,7 +132,7 @@ namespace Barotrauma
hireList.ClearChildren();
hireList.Enabled = false;
new GUITextBlock(new Rectangle(0, 0, 0, 0), "No-one available for hire", Color.Transparent, Color.LightGray, Alignment.Center, Alignment.Center, "", hireList);
new GUITextBlock(new Rectangle(0, 0, 0, 0), TextManager.Get("HireUnavailable"), Color.Transparent, Color.LightGray, Alignment.Center, Alignment.Center, "", hireList);
return;
}
@@ -204,8 +204,8 @@ namespace Barotrauma
{
var mission = GameMain.GameSession.Map.SelectedConnection.Mission;
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 20, 0, 20), "Mission: " + mission.Name, "", locationPanel);
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 40, 0, 20), "Reward: " + mission.Reward + " credits", "", locationPanel);
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 20, 0, 20), TextManager.Get("Mission") + ":" + mission.Name, "", locationPanel);
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 40, 0, 20), TextManager.Get("Reward") + ": " + mission.Reward + " " + TextManager.Get("Credits"), "", locationPanel);
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 70, 0, 0), mission.Description, "", Alignment.TopLeft, Alignment.TopLeft, locationPanel, true, GUI.SmallFont);
}
@@ -337,7 +337,7 @@ namespace Barotrauma
public string GetMoney()
{
return "Money: " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", campaign.Money)) + " credits";
return TextManager.Get("Credits") + ": " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", campaign.Money)) + " credits";
}
private bool SelectCharacter(GUIComponent component, object selection)
@@ -375,7 +375,7 @@ namespace Barotrauma
if (component.Parent == hireList)
{
GUIButton hireButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Hire", Alignment.BottomCenter, "", characterPreviewFrame);
GUIButton hireButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("HireButton"), Alignment.BottomCenter, "", characterPreviewFrame);
hireButton.Enabled = campaign.Money >= characterInfo.Salary;
hireButton.UserData = characterInfo;
hireButton.OnClicked = HireCharacter;

View File

@@ -44,16 +44,16 @@ namespace Barotrauma
Alignment.BottomLeft, Alignment.BottomLeft, topPanel);
moneyText.TextGetter = GetMoney;
GUIButton button = new GUIButton(new Rectangle(-240, 0, 100, 30), "Map", null, Alignment.BottomRight, "", topPanel);
GUIButton button = new GUIButton(new Rectangle(-240, 0, 100, 30), TextManager.Get("Map"), null, Alignment.BottomRight, "", topPanel);
button.UserData = CampaignUI.Tab.Map;
button.OnClicked = SelectTab;
SelectTab(button, button.UserData);
button = new GUIButton(new Rectangle(-120, 0, 100, 30), "Crew", null, Alignment.BottomRight, "", topPanel);
button = new GUIButton(new Rectangle(-120, 0, 100, 30), TextManager.Get("Crew"), null, Alignment.BottomRight, "", topPanel);
button.UserData = CampaignUI.Tab.Crew;
button.OnClicked = SelectTab;
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Store", null, Alignment.BottomRight, "", topPanel);
button = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("Store"), null, Alignment.BottomRight, "", topPanel);
button.UserData = CampaignUI.Tab.Store;
button.OnClicked = SelectTab;
@@ -80,7 +80,7 @@ namespace Barotrauma
return;
}
locationTitle.Text = "Location: " + campaign.Map.CurrentLocation.Name;
locationTitle.Text = TextManager.Get("Location") + ": " + campaign.Map.CurrentLocation.Name;
bottomPanel.ClearChildren();
campaignUI = new CampaignUI(campaign, bottomPanel);

View File

@@ -38,41 +38,41 @@ namespace Barotrauma
290, y,
500, 360);
GUIButton button = new GUIButton(new Rectangle(50, y, 200, 30), "Tutorial", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
GUIButton button = new GUIButton(new Rectangle(50, y, 200, 30), TextManager.Get("TutorialButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.OnClicked = TutorialButtonClicked;
button = new GUIButton(new Rectangle(50, y + 60, 200, 30), "New Game", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button = new GUIButton(new Rectangle(50, y + 60, 200, 30), TextManager.Get("NewGameButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.UserData = Tab.NewGame;
button.OnClicked = SelectTab;
button = new GUIButton(new Rectangle(50, y + 100, 200, 30), "Load Game", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button = new GUIButton(new Rectangle(50, y + 100, 200, 30), TextManager.Get("LoadGameButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.UserData = Tab.LoadGame;
button.OnClicked = SelectTab;
button = new GUIButton(new Rectangle(50, y + 160, 200, 30), "Join Server", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button = new GUIButton(new Rectangle(50, y + 160, 200, 30), TextManager.Get("JoinServerButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
//button.UserData = (int)Tabs.JoinServer;
button.OnClicked = JoinServerClicked;
button = new GUIButton(new Rectangle(50, y + 200, 200, 30), "Host Server", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button = new GUIButton(new Rectangle(50, y + 200, 200, 30), TextManager.Get("HostServerButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.UserData = Tab.HostServer;
button.OnClicked = SelectTab;
button = new GUIButton(new Rectangle(50, y + 260, 200, 30), "Submarine Editor", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button = new GUIButton(new Rectangle(50, y + 260, 200, 30), TextManager.Get("SubEditorButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.OnClicked = (GUIButton btn, object userdata) => { GameMain.SubEditorScreen.Select(); return true; };
button = new GUIButton(new Rectangle(50, y + 320, 200, 30), "Settings", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button = new GUIButton(new Rectangle(50, y + 320, 200, 30), TextManager.Get("SettingsButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.UserData = Tab.Settings;
button.OnClicked = SelectTab;
button = new GUIButton(new Rectangle(0, 0, 150, 30), "Quit", Alignment.BottomRight, "", buttonsTab);
button = new GUIButton(new Rectangle(0, 0, 150, 30), TextManager.Get("QuitButton"), Alignment.BottomRight, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.OnClicked = QuitClicked;
@@ -93,15 +93,15 @@ namespace Barotrauma
menuTabs[(int)Tab.HostServer] = new GUIFrame(panelRect, "");
new GUITextBlock(new Rectangle(0, 0, 100, 30), "Server Name:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
new GUITextBlock(new Rectangle(0, 0, 100, 30), TextManager.Get("ServerName"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
serverNameBox = new GUITextBox(new Rectangle(160, 0, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
new GUITextBlock(new Rectangle(0, 50, 100, 30), "Server port:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
new GUITextBlock(new Rectangle(0, 50, 100, 30), TextManager.Get("ServerPort"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
portBox = new GUITextBox(new Rectangle(160, 50, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
portBox.Text = NetConfig.DefaultPort.ToString();
portBox.ToolTip = "Server port";
new GUITextBlock(new Rectangle(0, 100, 100, 30), "Max players:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
new GUITextBlock(new Rectangle(0, 100, 100, 30), TextManager.Get("MaxPlayers"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
maxPlayersBox = new GUITextBox(new Rectangle(195, 100, 30, 30), null, null, Alignment.TopLeft, Alignment.Center, "", menuTabs[(int)Tab.HostServer]);
maxPlayersBox.Text = "8";
maxPlayersBox.Enabled = false;
@@ -114,19 +114,16 @@ namespace Barotrauma
plusPlayersBox.UserData = 1;
plusPlayersBox.OnClicked = ChangeMaxPlayers;
new GUITextBlock(new Rectangle(0, 150, 100, 30), "Password (optional):", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
new GUITextBlock(new Rectangle(0, 150, 100, 30), TextManager.Get("Password"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
passwordBox = new GUITextBox(new Rectangle(160, 150, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), "Public server", Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
isPublicBox.ToolTip = "Public servers are shown in the list of available servers in the \"Join Server\" -tab";
useUpnpBox = new GUITickBox(new Rectangle(10, 250, 20, 20), "Attempt UPnP port forwarding", Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
useUpnpBox.ToolTip = "UPnP can be used for forwarding ports on your router to allow players join the server."
+ " However, UPnP isn't supported by all routers, so you may need to setup port forwards manually"
+" if players are unable to join the server (see the readme for instructions).";
isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), TextManager.Get("PublicServer"), Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
isPublicBox.ToolTip = TextManager.Get("PublicServerToolTip");
GUIButton hostButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, "", menuTabs[(int)Tab.HostServer]);
useUpnpBox = new GUITickBox(new Rectangle(10, 250, 20, 20), TextManager.Get("AttemptUPnP"), Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
useUpnpBox.ToolTip = TextManager.Get("AttemptUPnPToolTip");
GUIButton hostButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("StartServerButton"), Alignment.BottomRight, "", menuTabs[(int)Tab.HostServer]);
hostButton.OnClicked = HostServerClicked;
this.game = game;
@@ -179,8 +176,10 @@ namespace Barotrauma
{
if (GameMain.Config.UnsavedSettings)
{
var applyBox = new GUIMessageBox("Apply changes?", "Do you want to apply the settings or discard the changes?",
new string[] {"Apply", "Discard"});
var applyBox = new GUIMessageBox(
TextManager.Get("ApplySettingsLabel"),
TextManager.Get("ApplySettingsQuestion"),
new string[] { TextManager.Get("ApplySettingsYes"), TextManager.Get("ApplySettingsNo") });
applyBox.Buttons[0].OnClicked += applyBox.Close;
applyBox.Buttons[0].OnClicked += ApplySettings;
applyBox.Buttons[0].UserData = tab;
@@ -216,7 +215,9 @@ namespace Barotrauma
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
{
new GUIMessageBox("Restart required", "You need to restart the game for the resolution changes to take effect.");
new GUIMessageBox(
TextManager.Get("RestartRequiredLabel"),
TextManager.Get("RestartRequiredText"));
}
return true;
@@ -354,7 +355,7 @@ namespace Barotrauma
if (selectedSub == null)
{
new GUIMessageBox("Submarine not selected", "Please select a submarine");
new GUIMessageBox(TextManager.Get("SubNotSelected"), TextManager.Get("SelectSubRequest"));
return;
}

View File

@@ -186,11 +186,11 @@ namespace Barotrauma
if (GameMain.Server != null)
{
if (!GameMain.Server.AutoRestart || GameMain.Server.ConnectedClients.Count == 0) return "";
return "Restarting in " + ToolBox.SecondsToReadableTime(Math.Max(GameMain.Server.AutoRestartTimer, 0));
return TextManager.Get("RestartingIn") + " " + ToolBox.SecondsToReadableTime(Math.Max(GameMain.Server.AutoRestartTimer, 0));
}
if (autoRestartTimer == 0.0f) return "";
return "Restarting in " + ToolBox.SecondsToReadableTime(Math.Max(autoRestartTimer, 0));
return TextManager.Get("RestartingIn") + " " + ToolBox.SecondsToReadableTime(Math.Max(autoRestartTimer, 0));
}
public NetLobbyScreen()
@@ -251,20 +251,20 @@ namespace Barotrauma
int columnWidth = infoFrame.Rect.Width / 3 - 5;
int columnX = 0;
new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), "Submarine:", "", defaultModeContainer);
new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), TextManager.Get("Submarine"), "", defaultModeContainer);
subList = new GUIListBox(new Rectangle(columnX, 140, columnWidth, defaultModeContainer.Rect.Height - 170), Color.White, "", defaultModeContainer);
subList.OnSelected = VotableClicked;
var voteText = new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), "Votes: ", "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
var voteText = new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), TextManager.Get("Votes"), "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
voteText.UserData = "subvotes";
voteText.Visible = false;
columnX += columnWidth + 20;
//respawn shuttle ------------------------------------------------------------------
shuttleTickBox = new GUITickBox(new Rectangle(columnX, 110, 20, 20), "Respawn shuttle:",Alignment.Left, defaultModeContainer);
shuttleTickBox = new GUITickBox(new Rectangle(columnX, 110, 20, 20), TextManager.Get("RespawnShuttle"), Alignment.Left, defaultModeContainer);
shuttleList = new GUIDropDown(new Rectangle(columnX, 140, 200, 20), "", "", defaultModeContainer);
shuttleTickBox.Selected = true;
shuttleTickBox.OnSelected = (GUITickBox box) =>
@@ -276,11 +276,11 @@ namespace Barotrauma
//gamemode ------------------------------------------------------------------
new GUITextBlock(new Rectangle(columnX, 170, 0, 30), "Game mode: ", "", defaultModeContainer);
new GUITextBlock(new Rectangle(columnX, 170, 0, 30), TextManager.Get("GameMode"), "", defaultModeContainer);
modeList = new GUIListBox(new Rectangle(columnX, 200, columnWidth, defaultModeContainer.Rect.Height - 230), "", defaultModeContainer);
modeList.OnSelected = VotableClicked;
voteText = new GUITextBlock(new Rectangle(columnX, 170, columnWidth, 30), "Votes: ", "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
voteText = new GUITextBlock(new Rectangle(columnX, 170, columnWidth, 30), TextManager.Get("Votes"), "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
voteText.UserData = "modevotes";
voteText.Visible = false;
@@ -300,7 +300,7 @@ namespace Barotrauma
//mission type ------------------------------------------------------------------
missionTypeBlock = new GUITextBlock(new Rectangle(columnX, -10, 300, 20), "Mission type:", "", Alignment.BottomLeft, Alignment.CenterLeft, defaultModeContainer);
missionTypeBlock = new GUITextBlock(new Rectangle(columnX, -10, 300, 20), TextManager.Get("MissionType"), "", Alignment.BottomLeft, Alignment.CenterLeft, defaultModeContainer);
missionTypeBlock.Padding = Vector4.Zero;
missionTypeBlock.UserData = 0;
@@ -309,7 +309,7 @@ namespace Barotrauma
missionTypeButtons[0] = new GUIButton(new Rectangle(100, 0, 20, 20), "<", Alignment.BottomLeft, "", missionTypeBlock);
missionTypeButtons[0].UserData = -1;
new GUITextBlock(new Rectangle(120, 0, 80, 20), "Random", "", Alignment.BottomLeft, Alignment.Center, missionTypeBlock).UserData = 0;
new GUITextBlock(new Rectangle(120, 0, 80, 20), TextManager.Get("Random"), "", Alignment.BottomLeft, Alignment.Center, missionTypeBlock).UserData = 0;
missionTypeButtons[1] = new GUIButton(new Rectangle(200, 0, 20, 20), ">", Alignment.BottomLeft, "", missionTypeBlock);
missionTypeButtons[1].UserData = 1;
@@ -332,7 +332,7 @@ namespace Barotrauma
//seed ------------------------------------------------------------------
new GUITextBlock(new Rectangle(columnX, 110, 180, 20),
"Level Seed: ", "", Alignment.Left, Alignment.TopLeft, defaultModeContainer);
TextManager.Get("LevelSeed"), "", Alignment.Left, Alignment.TopLeft, defaultModeContainer);
seedBox = new GUITextBox(new Rectangle(columnX, 140, columnWidth / 2, 20),
Alignment.TopLeft, "", defaultModeContainer);
@@ -341,14 +341,14 @@ namespace Barotrauma
//traitor probability ------------------------------------------------------------------
new GUITextBlock(new Rectangle(columnX, 170, 20, 20), "Traitors:", "", defaultModeContainer);
new GUITextBlock(new Rectangle(columnX, 170, 20, 20), TextManager.Get("Traitors"), "", defaultModeContainer);
traitorProbabilityButtons = new GUIButton[2];
traitorProbabilityButtons[0] = new GUIButton(new Rectangle(columnX, 195, 20, 20), "<", "", defaultModeContainer);
traitorProbabilityButtons[0].UserData = -1;
traitorProbabilityText = new GUITextBlock(new Rectangle(columnX + 20, 195, 80, 20), "No", null, null, Alignment.Center, "", defaultModeContainer);
traitorProbabilityText = new GUITextBlock(new Rectangle(columnX + 20, 195, 80, 20), TextManager.Get("No"), null, null, Alignment.Center, "", defaultModeContainer);
traitorProbabilityButtons[1] = new GUIButton(new Rectangle(columnX + 100, 195, 20, 20), ">", "", defaultModeContainer);
traitorProbabilityButtons[1].UserData = 1;
@@ -356,7 +356,7 @@ namespace Barotrauma
//automatic restart ------------------------------------------------------------------
autoRestartBox = new GUITickBox(new Rectangle(columnX, 230, 20, 20), "Automatic restart", Alignment.TopLeft, defaultModeContainer);
autoRestartBox = new GUITickBox(new Rectangle(columnX, 230, 20, 20), TextManager.Get("AutoRestart"), Alignment.TopLeft, defaultModeContainer);
autoRestartBox.OnSelected = ToggleAutoRestart;
var restartText = new GUITextBlock(new Rectangle(columnX, 255, 20, 20), "", "", defaultModeContainer);
@@ -374,7 +374,7 @@ namespace Barotrauma
serverMessage.Wrap = true;
serverMessage.OnTextChanged = UpdateServerMessage;
var showLogButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Server Log", Alignment.TopRight, "", infoFrame);
var showLogButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("ServerLog"), Alignment.TopRight, "", infoFrame);
showLogButton.UserData = "showlog";
showLogButton.OnClicked = (GUIButton button, object userData) =>
{
@@ -436,13 +436,13 @@ namespace Barotrauma
InfoFrame.FindChild("showlog").Visible = GameMain.Server != null;
campaignViewButton = new GUIButton(new Rectangle(-80, 0, 120, 30), "Campaign view", Alignment.BottomRight, "", defaultModeContainer);
campaignViewButton = new GUIButton(new Rectangle(-80, 0, 120, 30), TextManager.Get("CampaignView"), Alignment.BottomRight, "", defaultModeContainer);
campaignViewButton.OnClicked = (btn, obj) => { ToggleCampaignView(true); return true; };
campaignViewButton.Visible = false;
if (myPlayerFrame.children.Find(c => c.UserData as string == "playyourself") == null)
{
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), TextManager.Get("PlayYourself"), Alignment.TopLeft, myPlayerFrame);
playYourself.Selected = GameMain.NetworkMember.CharacterInfo != null;
playYourself.OnSelected = TogglePlayYourself;
playYourself.UserData = "playyourself";
@@ -476,10 +476,10 @@ namespace Barotrauma
missionTypeButtons[0].OnClicked = ToggleMissionType;
missionTypeButtons[1].OnClicked = ToggleMissionType;
StartButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Start", Alignment.BottomRight, "", defaultModeContainer);
StartButton = new GUIButton(new Rectangle(0, 0, 80, 30), TextManager.Get("StartGameButton"), Alignment.BottomRight, "", defaultModeContainer);
StartButton.OnClicked = GameMain.Server.StartGameClicked;
GUIButton settingsButton = new GUIButton(new Rectangle(-110, 0, 80, 20), "Settings", Alignment.TopRight, "", infoFrame);
GUIButton settingsButton = new GUIButton(new Rectangle(-110, 0, 80, 20), TextManager.Get("ServerSettingsButton"), Alignment.TopRight, "", infoFrame);
settingsButton.OnClicked = GameMain.Server.ToggleSettingsFrame;
settingsButton.UserData = "settingsButton";
@@ -513,7 +513,7 @@ namespace Barotrauma
{
if (GameMain.Client.GameStarted)
{
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Spectate", Alignment.BottomRight, "", infoFrame);
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), TextManager.Get("SpectateButton"), Alignment.BottomRight, "", infoFrame);
spectateButton.OnClicked = GameMain.Client.SpectateClicked;
spectateButton.UserData = "spectateButton";
}
@@ -532,7 +532,7 @@ namespace Barotrauma
if (GameMain.Client == null) return;
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "spectateButton"));
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Spectate", Alignment.BottomRight, "", infoFrame);
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), TextManager.Get("SpectateButton"), Alignment.BottomRight, "", infoFrame);
spectateButton.OnClicked = GameMain.Client.SpectateClicked;
spectateButton.UserData = "spectateButton";
}
@@ -543,7 +543,7 @@ namespace Barotrauma
{
myPlayerFrame.ClearChildren();
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), TextManager.Get("PlayYourself"), Alignment.TopLeft, myPlayerFrame);
playYourself.Selected = GameMain.NetworkMember.CharacterInfo != null;
playYourself.OnSelected = TogglePlayYourself;
playYourself.UserData = "playyourself";
@@ -555,19 +555,19 @@ namespace Barotrauma
toggleHead.UserData = 1;
toggleHead.OnClicked = ToggleHead;
new GUITextBlock(new Rectangle(100, 30, 200, 30), "Gender: ", "", myPlayerFrame);
new GUITextBlock(new Rectangle(100, 30, 200, 30), TextManager.Get("Gender"), "", myPlayerFrame);
GUIButton maleButton = new GUIButton(new Rectangle(100, 50, 60, 20), "Male",
GUIButton maleButton = new GUIButton(new Rectangle(100, 50, 60, 20), TextManager.Get("Male"),
Alignment.TopLeft, "", myPlayerFrame);
maleButton.UserData = Gender.Male;
maleButton.OnClicked += SwitchGender;
GUIButton femaleButton = new GUIButton(new Rectangle(170, 50, 60, 20), "Female",
GUIButton femaleButton = new GUIButton(new Rectangle(170, 50, 60, 20), TextManager.Get("Female"),
Alignment.TopLeft, "", myPlayerFrame);
femaleButton.UserData = Gender.Female;
femaleButton.OnClicked += SwitchGender;
new GUITextBlock(new Rectangle(0, 120, 20, 30), "Job preferences:", "", myPlayerFrame);
new GUITextBlock(new Rectangle(0, 120, 20, 30), TextManager.Get("JobPreferences"), "", myPlayerFrame);
jobList = new GUIListBox(new Rectangle(0, 150, 0, 0), "", myPlayerFrame);
jobList.Enabled = false;
@@ -626,9 +626,9 @@ namespace Barotrauma
GameMain.NetworkMember.CharacterInfo = null;
GameMain.NetworkMember.Character = null;
new GUITextBlock(Rectangle.Empty, "Playing as a spectator", "", Alignment.Center, Alignment.Center, myPlayerFrame, true);
new GUITextBlock(Rectangle.Empty, TextManager.Get("PlayingAsSpectator"), "", Alignment.Center, Alignment.Center, myPlayerFrame, true);
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), TextManager.Get("PlayYourself"), Alignment.TopLeft, myPlayerFrame);
playYourself.OnSelected = TogglePlayYourself;
playYourself.UserData = "playyourself";
}
@@ -763,12 +763,12 @@ namespace Barotrauma
if (matchingSub == null)
{
subTextBlock.TextColor = new Color(subTextBlock.TextColor, 0.5f);
subTextBlock.ToolTip = "Submarine not found in your submarine folder";
subTextBlock.ToolTip = TextManager.Get("SubNotFound");
}
else if (matchingSub.MD5Hash.Hash != sub.MD5Hash.Hash)
{
subTextBlock.TextColor = new Color(subTextBlock.TextColor, 0.5f);
subTextBlock.ToolTip = "Your version of the submarine doesn't match the servers version";
subTextBlock.ToolTip = TextManager.Get("SubDoesntMatch");
}
else
{
@@ -780,7 +780,7 @@ namespace Barotrauma
if (sub.HasTag(SubmarineTag.Shuttle))
{
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, subTextBlock, false, GUI.SmallFont);
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), TextManager.Get("Shuttle"), "", Alignment.Left, Alignment.CenterY | Alignment.Right, subTextBlock, false, GUI.SmallFont);
shuttleText.TextColor = subTextBlock.TextColor * 0.8f;
shuttleText.ToolTip = subTextBlock.ToolTip;
}
@@ -896,14 +896,14 @@ namespace Barotrauma
new GUITextBlock(new Rectangle(0, 25, 150, 15), selectedClient.Connection.RemoteEndPoint.Address.ToString(), "", playerFrameInner);
new GUITextBlock(new Rectangle(0, 45, 0, 15), "Rank", "", playerFrameInner);
var rankDropDown = new GUIDropDown(new Rectangle(0, 70, 150, 20), "Rank", "", playerFrameInner);
new GUITextBlock(new Rectangle(0, 45, 0, 15), TextManager.Get("Rank"), "", playerFrameInner);
var rankDropDown = new GUIDropDown(new Rectangle(0, 70, 150, 20), TextManager.Get("Rank"), "", playerFrameInner);
rankDropDown.UserData = selectedClient;
foreach (PermissionPreset permissionPreset in PermissionPreset.List)
{
rankDropDown.AddItem(permissionPreset.Name, permissionPreset, permissionPreset.Description);
}
rankDropDown.AddItem("Custom", null);
rankDropDown.AddItem(TextManager.Get("CustomRank"), null);
PermissionPreset currentPreset = PermissionPreset.List.Find(p =>
p.Permissions == selectedClient.Permissions &&
@@ -929,7 +929,7 @@ namespace Barotrauma
permissionsBox.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
permissionsBox.UserData = selectedClient;
new GUITextBlock(new Rectangle(0, 100, permissionsBox.Rect.Width, 15), "Permissions:", "", playerFrameInner);
new GUITextBlock(new Rectangle(0, 100, permissionsBox.Rect.Width, 15), TextManager.Get("Permissions"), "", playerFrameInner);
int x = 0, y = 0;
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
{
@@ -972,7 +972,7 @@ namespace Barotrauma
}
}
new GUITextBlock(new Rectangle(0, 100, (int)(playerFrameInner.Rect.Width * 0.5f), 15), "Permitted console commands:", "", Alignment.TopRight, Alignment.TopLeft, playerFrameInner, true);
new GUITextBlock(new Rectangle(0, 100, (int)(playerFrameInner.Rect.Width * 0.5f), 15), TextManager.Get("PermittedConsoleCommands"), "", Alignment.TopRight, Alignment.TopLeft, playerFrameInner, true);
var commandList = new GUIListBox(new Rectangle(0, 125, (int)(playerFrameInner.Rect.Width * 0.5f), 160), "", Alignment.TopRight, playerFrameInner);
commandList.UserData = selectedClient;
foreach (DebugConsole.Command command in DebugConsole.Commands)
@@ -1007,7 +1007,7 @@ namespace Barotrauma
if (GameMain.Server != null || GameMain.Client.HasPermission(ClientPermissions.Kick))
{
var kickButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Kick", Alignment.BottomLeft, "", playerFrameInner);
var kickButton = new GUIButton(new Rectangle(0, 0, 80, 20), TextManager.Get("Kick"), Alignment.BottomLeft, "", playerFrameInner);
kickButton.UserData = obj;
kickButton.OnClicked += KickPlayer;
kickButton.OnClicked += ClosePlayerFrame;
@@ -1015,18 +1015,18 @@ namespace Barotrauma
if (GameMain.Server != null || GameMain.Client.HasPermission(ClientPermissions.Ban))
{
var banButton = new GUIButton(new Rectangle(90, 0, 80, 20), "Ban", Alignment.BottomLeft, "", playerFrameInner);
var banButton = new GUIButton(new Rectangle(90, 0, 80, 20), TextManager.Get("Ban"), Alignment.BottomLeft, "", playerFrameInner);
banButton.UserData = obj;
banButton.OnClicked += BanPlayer;
banButton.OnClicked += ClosePlayerFrame;
var rangebanButton = new GUIButton(new Rectangle(180, 0, 80, 20), "Ban range", Alignment.BottomLeft, "", playerFrameInner);
var rangebanButton = new GUIButton(new Rectangle(180, 0, 80, 20), TextManager.Get("BanRange"), Alignment.BottomLeft, "", playerFrameInner);
rangebanButton.UserData = obj;
rangebanButton.OnClicked += BanPlayerRange;
rangebanButton.OnClicked += ClosePlayerFrame;
}
var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, "", playerFrameInner);
var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("Close"), Alignment.BottomRight, "", playerFrameInner);
closeButton.OnClicked = ClosePlayerFrame;
return false;
@@ -1163,7 +1163,7 @@ namespace Barotrauma
}
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width - 20, 0),
(message.Type == ChatMessageType.Private ? "[PM] " : "") + message.TextWithSender,
(message.Type == ChatMessageType.Private ? TextManager.Get("PrivateMessageTag") + " " : "") + message.TextWithSender,
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, message.Color,
Alignment.Left, Alignment.TopLeft, "", null, true, GUI.SmallFont);
msg.UserData = message;
@@ -1281,7 +1281,7 @@ namespace Barotrauma
campaignUI = new CampaignUI(GameMain.GameSession.GameMode as CampaignMode, campaignContainer);
campaignUI.StartRound = () => { GameMain.Server.StartGame(); };
var backButton = new GUIButton(new Rectangle(0, -20, 100, 30), "Back", "", campaignContainer);
var backButton = new GUIButton(new Rectangle(0, -20, 100, 30), TextManager.Get("Back"), "", campaignContainer);
backButton.OnClicked += (btn, obj) => { ToggleCampaignView(false); return true; };
int buttonX = backButton.Rect.Width + 50;
@@ -1297,7 +1297,7 @@ namespace Barotrauma
buttonX += 110;
}
var moneyText = new GUITextBlock(new Rectangle(120,0,200,20), "Money", "", Alignment.BottomLeft, Alignment.TopLeft, campaignContainer);
var moneyText = new GUITextBlock(new Rectangle(120,0,200,20), TextManager.Get("Credit"), "", Alignment.BottomLeft, Alignment.TopLeft, campaignContainer);
moneyText.TextGetter = campaignUI.GetMoney;
var restartText = new GUITextBlock(new Rectangle(-backButton.Rect.Width - 30, -10, 130, 30), "", "", Alignment.BottomRight, Alignment.BottomRight, campaignContainer);
@@ -1332,7 +1332,7 @@ namespace Barotrauma
if (jobPrefab == null) return false;
jobInfoFrame = jobPrefab.CreateInfoFrame();
GUIButton closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, "", jobInfoFrame.children[0]);
GUIButton closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("Close"), Alignment.BottomRight, "", jobInfoFrame.children[0]);
closeButton.OnClicked = CloseJobInfo;
return true;
}
@@ -1410,22 +1410,19 @@ namespace Barotrauma
string errorMsg = "";
if (sub == null)
{
errorMsg = "Submarine \"" + subName + "\" was selected by the server. Matching file not found in your submarine folder. ";
errorMsg = TextManager.Get("SubNotFoundError").Replace("[subname]", subName) + " ";
}
else if (sub.MD5Hash.Hash == null)
{
errorMsg = "Couldn't load submarine \"" + subName + "\". The file may be corrupted. ";
errorMsg = TextManager.Get("SubLoadError").Replace("[subname]", subName) + " ";
if (matchingListSub != null) matchingListSub.TextColor = Color.Red;
}
else
{
errorMsg = "Your version of the submarine file \"" + sub.Name + "\" doesn't match the server's version!\n"
+ "Your MD5 hash: " + sub.MD5Hash.ShortHash + "\n"
+ "Server's MD5 hash: " + Md5Hash.GetShortHash(md5Hash) + "\n";
errorMsg = TextManager.Get("SubDoesntMatchError").Replace("[subname]", sub.Name).Replace("[myhash]", sub.MD5Hash.ShortHash).Replace("[serverhash]", Md5Hash.GetShortHash(md5Hash)) + " ";
}
errorMsg += "Do you want to download the file from the server host?";
errorMsg += TextManager.Get("DownloadSubQuestion");
//already showing a message about the same sub
if (GUIMessageBox.MessageBoxes.Any(mb => mb.UserData as string == "request" + subName))
@@ -1433,7 +1430,7 @@ namespace Barotrauma
return false;
}
var requestFileBox = new GUIMessageBox("Submarine not found!", errorMsg, new string[] { "Yes", "No" }, 400, 300);
var requestFileBox = new GUIMessageBox(TextManager.Get("DownloadSubLabel"), errorMsg, new string[] { TextManager.Get("Yes"), TextManager.Get("No") }, 400, 300);
requestFileBox.UserData = "request" + subName;
requestFileBox.Buttons[0].UserData = new string[] { subName, md5Hash };
requestFileBox.Buttons[0].OnClicked += requestFileBox.Close;

View File

@@ -57,12 +57,12 @@ namespace Barotrauma
menu = new GUIFrame(panelRect, null, Alignment.Center, "");
menu.Padding = new Vector4(40.0f, 40.0f, 40.0f, 20.0f);
new GUITextBlock(new Rectangle(0, -25, 0, 30), "Join Server", "", Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont);
new GUITextBlock(new Rectangle(0, -25, 0, 30), TextManager.Get("JoinServer"), "", Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont);
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Your Name:", "", menu);
new GUITextBlock(new Rectangle(0, 30, 0, 30), TextManager.Get("YourName"), "", menu);
clientNameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), "", menu);
new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server IP:", "", menu);
new GUITextBlock(new Rectangle(0, 100, 0, 30), TextManager.Get("ServerIP"), "", menu);
ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), "", menu);
int middleX = (int)(width * 0.35f);
@@ -80,35 +80,35 @@ namespace Barotrauma
ScalableFont font = GUI.SmallFont; // serverList.Rect.Width < 400 ? GUI.SmallFont : GUI.Font;
new GUITextBlock(new Rectangle(middleX, 30, 0, 30), "Password", "", menu).Font = font;
new GUITextBlock(new Rectangle(middleX, 30, 0, 30), TextManager.Get("Password"), "", menu).Font = font;
new GUITextBlock(new Rectangle(middleX + columnX[0], 30, 0, 30), "Name", "", menu).Font = font;
new GUITextBlock(new Rectangle(middleX + columnX[1], 30, 0, 30), "Players", "", menu).Font = font;
new GUITextBlock(new Rectangle(middleX + columnX[2], 30, 0, 30), "Round started", "", menu).Font = font;
new GUITextBlock(new Rectangle(middleX + columnX[0], 30, 0, 30), TextManager.Get("ServerListName"), "", menu).Font = font;
new GUITextBlock(new Rectangle(middleX + columnX[1], 30, 0, 30), TextManager.Get("ServerListPlayers"), "", menu).Font = font;
new GUITextBlock(new Rectangle(middleX + columnX[2], 30, 0, 30), TextManager.Get("ServerListRoundStarted"), "", menu).Font = font;
joinButton = new GUIButton(new Rectangle(-170, 0, 150, 30), "Refresh", Alignment.BottomRight, "", menu);
joinButton = new GUIButton(new Rectangle(-170, 0, 150, 30), TextManager.Get("ServerListRefresh"), Alignment.BottomRight, "", menu);
joinButton.OnClicked = RefreshServers;
joinButton = new GUIButton(new Rectangle(0,0,150,30), "Join", Alignment.BottomRight, "", menu);
joinButton = new GUIButton(new Rectangle(0,0,150,30), TextManager.Get("ServerListJoin"), Alignment.BottomRight, "", menu);
joinButton.OnClicked = JoinServer;
//--------------------------------------------------------
int y = 180;
new GUITextBlock(new Rectangle(0, y, 200, 30), "Filter servers:", "", menu);
new GUITextBlock(new Rectangle(0, y, 200, 30), TextManager.Get("FilterServers"), "", menu);
searchBox = new GUITextBox(new Rectangle(0, y + 30, 200, 30), "", menu);
searchBox.OnTextChanged += (txtBox, txt) => { FilterServers(); return true; };
filterPassword = new GUITickBox(new Rectangle(0, y + 60, 30, 30), "No password required", Alignment.TopLeft, menu);
filterPassword = new GUITickBox(new Rectangle(0, y + 60, 30, 30), TextManager.Get("FilterPassword"), Alignment.TopLeft, menu);
filterPassword.OnSelected += (tickBox) => { FilterServers(); return true; };
filterFull = new GUITickBox(new Rectangle(0, y + 90, 30, 30), "Hide full servers", Alignment.TopLeft, menu);
filterFull = new GUITickBox(new Rectangle(0, y + 90, 30, 30), TextManager.Get("FilterFullServers"), Alignment.TopLeft, menu);
filterFull.OnSelected += (tickBox) => { FilterServers(); return true; };
filterEmpty = new GUITickBox(new Rectangle(0, y + 120, 30, 30), "Hide empty servers", Alignment.TopLeft, menu);
filterEmpty = new GUITickBox(new Rectangle(0, y + 120, 30, 30), TextManager.Get("FilterEmptyServers"), Alignment.TopLeft, menu);
filterEmpty.OnSelected += (tickBox) => { FilterServers(); return true; };
//--------------------------------------------------------
GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, "", menu);
GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), TextManager.Get("Back"), Alignment.TopLeft, "", menu);
button.OnClicked = GameMain.MainMenuScreen.SelectTab;
button.SelectedColor = button.Color;
@@ -139,7 +139,7 @@ namespace Barotrauma
if (serverList.children.All(c => !c.Visible))
{
new GUITextBlock(new Rectangle(0, 0, 0, 20), "No matching servers found.", "", serverList).UserData = "noresults";
new GUITextBlock(new Rectangle(0, 0, 0, 20), TextManager.Get("NoMatchingServers"), "", serverList).UserData = "noresults";
}
}
@@ -165,7 +165,7 @@ namespace Barotrauma
if (waitingForRefresh) return false;
serverList.ClearChildren();
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Refreshing server list...", "", serverList);
new GUITextBlock(new Rectangle(0, 0, 0, 20), TextManager.Get("RefreshingServerList"), "", serverList);
CoroutineManager.StartCoroutine(WaitForRefresh());
@@ -192,16 +192,16 @@ namespace Barotrauma
private void UpdateServerList(string masterServerData)
{
serverList.ClearChildren();
if (string.IsNullOrWhiteSpace(masterServerData))
{
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Couldn't find any servers", "", serverList);
new GUITextBlock(new Rectangle(0, 0, 0, 20), TextManager.Get("NoServers"), "", serverList);
return;
}
if (masterServerData.Substring(0, 5).ToLowerInvariant() == "error")
{
DebugConsole.ThrowError("Error while connecting to master server ("+masterServerData+")!");
DebugConsole.ThrowError("Error while connecting to master server (" + masterServerData + ")!");
return;
}
@@ -284,7 +284,7 @@ namespace Barotrauma
{
serverList.ClearChildren();
restRequestHandle.Abort();
new GUIMessageBox("Connection error", "Couldn't connect to master server (request timed out).");
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), TextManager.Get("MasterServerTimeOutError"));
yield return CoroutineStatus.Success;
}
yield return CoroutineStatus.Running;
@@ -293,7 +293,7 @@ namespace Barotrauma
if (masterServerResponse.ErrorException != null)
{
serverList.ClearChildren();
new GUIMessageBox("Connection error", "Error while connecting to master server {" + masterServerResponse.ErrorException + "}");
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), TextManager.Get("MasterServerErrorException").Replace("[error]", masterServerResponse.ErrorException.ToString()));
}
else if (masterServerResponse.StatusCode != System.Net.HttpStatusCode.OK)
{
@@ -302,17 +302,18 @@ namespace Barotrauma
switch (masterServerResponse.StatusCode)
{
case System.Net.HttpStatusCode.NotFound:
new GUIMessageBox("Connection error",
"Error while connecting to master server (404 - \"" + NetConfig.MasterServerUrl + "\" not found)");
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
TextManager.Get("MasterServerError404").Replace("[masterserverurl]", NetConfig.MasterServerUrl));
break;
case System.Net.HttpStatusCode.ServiceUnavailable:
new GUIMessageBox("Connection error",
"Error while connecting to master server (505 - Service Unavailable) " +
"The master server may be down for maintenance or temporarily overloaded. Please try again after in a few moments.");
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
TextManager.Get("MasterServerErrorUnavailable"));
break;
default:
new GUIMessageBox("Connection error",
"Error while connecting to master server (" + masterServerResponse.StatusCode + ": " + masterServerResponse.StatusDescription + ")");
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
TextManager.Get("MasterServerError404")
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
break;
}
}
@@ -353,10 +354,10 @@ namespace Barotrauma
return true;
}
public void JoinServer(string ip, bool hasPassword, string msg = "Password required")
/*public void JoinServer(string ip, bool hasPassword, string msg = "Password required")
{
CoroutineManager.StartCoroutine(ConnectToServer(ip));
}
}*/
private IEnumerable<object> ConnectToServer(string ip)
{

View File

@@ -59,17 +59,17 @@ namespace Barotrauma
private string GetItemCount()
{
return "Items: " +Item.ItemList.Count;
return TextManager.Get("Items") + ": " + Item.ItemList.Count;
}
private string GetStructureCount()
{
return "Structures: " + (MapEntity.mapEntityList.Count - Item.ItemList.Count);
return TextManager.Get("Structures") + ": " + (MapEntity.mapEntityList.Count - Item.ItemList.Count);
}
private string GetTotalHullVolume()
{
return "Total Hull Volume:\n" + Hull.hullList.Sum(h => h.Volume);
return TextManager.Get("TotalHullVolume") + ":\n" + Hull.hullList.Sum(h => h.Volume);
}
private string GetSelectedHullVolume()
@@ -86,16 +86,16 @@ namespace Barotrauma
}
});
buoyancyVol *= neutralPercentage;
string retVal = "Selected Hull Volume:\n" + selectedVol;
string retVal = TextManager.Get("SelectedHullVolume") + ":\n" + selectedVol;
if (selectedVol > 0.0f && buoyancyVol > 0.0f)
{
if (buoyancyVol / selectedVol < 1.0f)
{
retVal += " (optimal NeutralBallastLevel is " + (buoyancyVol / selectedVol).ToString("0.00") + ")";
retVal += " (" + TextManager.Get("OptimalBallastLevel").Replace("[value]", (buoyancyVol / selectedVol).ToString("0.00")) + ")";
}
else
{
retVal += " (insufficient volume for buoyancy control)";
retVal += " (" + TextManager.Get("InsufficientBallast") + ")";
}
}
return retVal;
@@ -103,7 +103,7 @@ namespace Barotrauma
private string GetPhysicsBodyCount()
{
return "Physics bodies: " + GameMain.World.BodyList.Count;
return TextManager.Get("PhysicsBodies") + ": " + GameMain.World.BodyList.Count;
}
public bool CharacterMode
@@ -137,7 +137,7 @@ namespace Barotrauma
GUITextBlock selectedHullVolume = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", "", hullVolumeFrame, GUI.SmallFont);
selectedHullVolume.TextGetter = GetSelectedHullVolume;
var button = new GUIButton(new Rectangle(0, 0, 70, 20), "Open...", "", topPanel);
var button = new GUIButton(new Rectangle(0, 0, 70, 20), TextManager.Get("OpenSubButton"), "", topPanel);
button.OnClicked = (GUIButton btn, object data) =>
{
saveFrame = null;
@@ -147,7 +147,7 @@ namespace Barotrauma
return true;
};
button = new GUIButton(new Rectangle(80,0,70,20), "Save", "", topPanel);
button = new GUIButton(new Rectangle(80,0,70,20), TextManager.Get("SaveSubButton"), "", topPanel);
button.OnClicked = (GUIButton btn, object data) =>
{
loadFrame = null;
@@ -160,11 +160,8 @@ namespace Barotrauma
var nameLabel = new GUITextBlock(new Rectangle(170, 0, 150, 20), "", "", Alignment.TopLeft, Alignment.CenterLeft, topPanel, false, GUI.LargeFont);
nameLabel.TextGetter = GetSubName;
linkedSubBox = new GUIDropDown(new Rectangle(750, 0, 200, 20), "Add submarine", "", topPanel);
linkedSubBox.ToolTip =
"Places another submarine into the current submarine file. " +
"Can be used for adding things such as smaller vessels, " +
"escape pods or detachable sections into the main submarine.";
linkedSubBox = new GUIDropDown(new Rectangle(750, 0, 200, 20), TextManager.Get("AddSubButton"), "", topPanel);
linkedSubBox.ToolTip = TextManager.Get("AddSubToolTip");
foreach (Submarine sub in Submarine.SavedSubmarines)
{
@@ -196,7 +193,7 @@ namespace Barotrauma
GUItabs[i] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "");
GUItabs[i].Padding = new Vector4(10.0f, 30.0f, 10.0f, 20.0f);
new GUITextBlock(new Rectangle(-200, 0, 100, 15), "Filter", "", Alignment.TopRight, Alignment.CenterRight, GUItabs[i], false, GUI.SmallFont);
new GUITextBlock(new Rectangle(-200, 0, 100, 15), TextManager.Get("FilterMapEntities"), "", Alignment.TopRight, Alignment.CenterRight, GUItabs[i], false, GUI.SmallFont);
GUITextBox searchBox = new GUITextBox(new Rectangle(-20, 0, 180, 15), null,null, Alignment.TopRight, Alignment.CenterLeft, "", GUItabs[i]);
searchBox.Font = GUI.SmallFont;
@@ -244,37 +241,37 @@ namespace Barotrauma
}
y += 10;
button = new GUIButton(new Rectangle(0, y, 0, 20), "Character mode", Alignment.Left, "", leftPanel);
button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.";
button = new GUIButton(new Rectangle(0, y, 0, 20), TextManager.Get("CharacterModeButton"), Alignment.Left, "", leftPanel);
button.ToolTip = TextManager.Get("CharacterModeToolTip");
button.OnClicked = ToggleCharacterMode;
y += 25;
button = new GUIButton(new Rectangle(0, y, 0, 20), "Wiring mode", Alignment.Left, "", leftPanel);
//button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.";
button = new GUIButton(new Rectangle(0, y, 0, 20), TextManager.Get("WiringModeButton"), Alignment.Left, "", leftPanel);
button.ToolTip = TextManager.Get("WiringModeToolTip");
button.OnClicked = ToggleWiringMode;
y += 35;
button = new GUIButton(new Rectangle(0, y, 0, 20), "Generate waypoints", Alignment.Left, "", leftPanel);
button.ToolTip = "AI controlled crew members require waypoints to navigate around the sub.";
button = new GUIButton(new Rectangle(0, y, 0, 20), TextManager.Get("GenerateWaypointsButton"), Alignment.Left, "", leftPanel);
button.ToolTip = TextManager.Get("GenerateWaypointsToolTip");
button.OnClicked = GenerateWaypoints;
y += 30;
new GUITextBlock(new Rectangle(0, y, 0, 20), "Show:", "", leftPanel);
new GUITextBlock(new Rectangle(0, y, 0, 20), TextManager.Get("ShowEntitiesLabel"), "", leftPanel);
var tickBox = new GUITickBox(new Rectangle(0,y+20,20,20), "Waypoints", Alignment.TopLeft, leftPanel);
var tickBox = new GUITickBox(new Rectangle(0,y+20,20,20), TextManager.Get("ShowWaypoints"), Alignment.TopLeft, leftPanel);
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowWayPoints = !WayPoint.ShowWayPoints; return true; };
tickBox.Selected = true;
tickBox = new GUITickBox(new Rectangle(0, y + 45, 20, 20), "Spawnpoints", Alignment.TopLeft, leftPanel);
tickBox = new GUITickBox(new Rectangle(0, y + 45, 20, 20), TextManager.Get("ShowSpawnpoints"), Alignment.TopLeft, leftPanel);
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowSpawnPoints = !WayPoint.ShowSpawnPoints; return true; };
tickBox.Selected = true;
tickBox = new GUITickBox(new Rectangle(0, y + 70, 20, 20), "Links", Alignment.TopLeft, leftPanel);
tickBox = new GUITickBox(new Rectangle(0, y + 70, 20, 20), TextManager.Get("ShowLinks"), Alignment.TopLeft, leftPanel);
tickBox.OnSelected = (GUITickBox obj) => { Item.ShowLinks = !Item.ShowLinks; return true; };
tickBox.Selected = true;
tickBox = new GUITickBox(new Rectangle(0, y + 95, 20, 20), "Hulls", Alignment.TopLeft, leftPanel);
tickBox = new GUITickBox(new Rectangle(0, y + 95, 20, 20), TextManager.Get("ShowHulls"), Alignment.TopLeft, leftPanel);
tickBox.OnSelected = (GUITickBox obj) => { Hull.ShowHulls = !Hull.ShowHulls; return true; };
tickBox.Selected = true;
tickBox = new GUITickBox(new Rectangle(0, y + 120, 20, 20), "Gaps", Alignment.TopLeft, leftPanel);
tickBox = new GUITickBox(new Rectangle(0, y + 120, 20, 20), TextManager.Get("ShowGaps"), Alignment.TopLeft, leftPanel);
tickBox.OnSelected = (GUITickBox obj) => { Gap.ShowGaps = !Gap.ShowGaps; return true; };
tickBox.Selected = true;
@@ -282,7 +279,7 @@ namespace Barotrauma
if (y < GameMain.GraphicsHeight - 100)
{
new GUITextBlock(new Rectangle(0, y, 0, 15), "Previously used:", "", leftPanel);
new GUITextBlock(new Rectangle(0, y, 0, 15), TextManager.Get("PreviouslyUsedLabel"), "", leftPanel);
previouslyUsedList = new GUIListBox(new Rectangle(0, y + 20, 0, Math.Min(GameMain.GraphicsHeight - y - 80, 150)), "", leftPanel);
previouslyUsedList.OnSelected = SelectPrefab;
@@ -376,7 +373,7 @@ namespace Barotrauma
{
if (string.IsNullOrWhiteSpace(nameBox.Text))
{
GUI.AddMessage("Name your submarine before saving it", Color.Red, 3.0f);
GUI.AddMessage(TextManager.Get("SubNameMissingWarning"), Color.Red, 3.0f);
nameBox.Flash();
return false;
@@ -403,7 +400,7 @@ namespace Barotrauma
Submarine.SaveCurrent(savePath);
Submarine.MainSub.CheckForErrors();
GUI.AddMessage("Submarine saved to " + Submarine.MainSub.FilePath, Color.Green, 3.0f);
GUI.AddMessage(TextManager.Get("SubSavedNotification").Replace("[filepath]", Submarine.MainSub.FilePath), Color.Green, 3.0f);
Submarine.RefreshSavedSubs();
linkedSubBox.ClearChildren();
@@ -429,11 +426,11 @@ namespace Barotrauma
saveFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", null);
saveFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
new GUITextBlock(new Rectangle(0,0,200,30), "Save submarine", "", saveFrame, GUI.LargeFont);
new GUITextBlock(new Rectangle(0,0,200,30), TextManager.Get("SaveSubDialogHeader"), "", saveFrame, GUI.LargeFont);
y += 30;
new GUITextBlock(new Rectangle(0,y,150,20), "Name:", "", saveFrame);
new GUITextBlock(new Rectangle(0,y,150,20), TextManager.Get("SaveSubDialogName"), "", saveFrame);
y += 20;
nameBox = new GUITextBox(new Rectangle(5, y, 250, 20), "", saveFrame);
@@ -442,7 +439,7 @@ namespace Barotrauma
y += 30;
new GUITextBlock(new Rectangle(0, y, 150, 20), "Description:", "", saveFrame);
new GUITextBlock(new Rectangle(0, y, 150, 20), TextManager.Get("SaveSubDialogDescription"), "", saveFrame);
y += 20;
var descriptionBox = new GUITextBox(new Rectangle(5, y, 0, 100), null, null, Alignment.TopLeft,
@@ -452,7 +449,7 @@ namespace Barotrauma
descriptionBox.OnTextChanged = ChangeSubDescription;
y += descriptionBox.Rect.Height + 15;
new GUITextBlock(new Rectangle(0, y, 150, 20), "Settings:", "", saveFrame);
new GUITextBlock(new Rectangle(0, y, 150, 20), TextManager.Get("SaveSubDialogSettings"), "", saveFrame);
y += 20;
@@ -492,10 +489,10 @@ namespace Barotrauma
}
}
var saveButton = new GUIButton(new Rectangle(-90, 0, 80, 20), "Save", Alignment.Right | Alignment.Bottom, "", saveFrame);
var saveButton = new GUIButton(new Rectangle(-90, 0, 80, 20), TextManager.Get("SaveSubButton"), Alignment.Right | Alignment.Bottom, "", saveFrame);
saveButton.OnClicked = SaveSub;
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Cancel", Alignment.Right | Alignment.Bottom, "", saveFrame);
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), TextManager.Get("Cancel"), Alignment.Right | Alignment.Bottom, "", saveFrame);
cancelButton.OnClicked = (GUIButton btn, object userdata) =>
{
saveFrame = null;
@@ -537,13 +534,13 @@ namespace Barotrauma
if (sub.HasTag(SubmarineTag.Shuttle))
{
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), TextManager.Get("Shuttle"), "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
shuttleText.TextColor = textBlock.TextColor * 0.8f;
shuttleText.ToolTip = textBlock.ToolTip;
}
}
var deleteButton = new GUIButton(new Rectangle(0, 0, 70, 20), "Delete", Alignment.BottomLeft, "", loadFrame);
var deleteButton = new GUIButton(new Rectangle(0, 0, 70, 20), TextManager.Get("Delete"), Alignment.BottomLeft, "", loadFrame);
deleteButton.Enabled = false;
deleteButton.UserData = "delete";
deleteButton.OnClicked = (btn, userdata) =>
@@ -558,10 +555,10 @@ namespace Barotrauma
return true;
};
var loadButton = new GUIButton(new Rectangle(-90, 0, 80, 20), "Load", Alignment.Right | Alignment.Bottom, "", loadFrame);
var loadButton = new GUIButton(new Rectangle(-90, 0, 80, 20), TextManager.Get("Load"), Alignment.Right | Alignment.Bottom, "", loadFrame);
loadButton.OnClicked = LoadSub;
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Cancel", Alignment.Right | Alignment.Bottom, "", loadFrame);
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), TextManager.Get("Cancel"), Alignment.Right | Alignment.Bottom, "", loadFrame);
cancelButton.OnClicked = (GUIButton btn, object userdata) =>
{
loadFrame = null;
@@ -595,7 +592,10 @@ namespace Barotrauma
{
if (sub == null) return;
var msgBox = new GUIMessageBox("Delete file?", "Are you sure you want to delete \"" + sub.Name + "\"", new string[] { "OK", "Cancel" });
var msgBox = new GUIMessageBox(
TextManager.Get("DeleteDialogLabel"),
TextManager.Get("DeleteDialogQuestion").Replace("[file]", sub.Name),
new string[] { TextManager.Get("Yes"), TextManager.Get("Cancel") });
msgBox.Buttons[0].OnClicked += (btn, userData) =>
{
try
@@ -606,7 +606,7 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError("Couldn't delete file \"" + sub.FilePath + "\"!", e);
DebugConsole.ThrowError(TextManager.Get("DeleteFileError").Replace("[file]", sub.FilePath), e);
}
return true;
};

View File

@@ -226,7 +226,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\damageshader.fx" />
<Content Include="$(MSBuildThisFileDirectory)Content\InfoTexts.xml">
<Content Include="$(MSBuildThisFileDirectory)Content\Texts.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Artifacts\alientools.png">
@@ -1404,8 +1404,8 @@
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\MultiplayerCampaign.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\TraitorManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameSession.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\InfoTextManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSettings.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\TextManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\CharacterInventory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\Components\DockingPort.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\Components\Door.cs" />
@@ -1535,4 +1535,4 @@
<Compile Include="$(MSBuildThisFileDirectory)Source\Utils\ToolBox.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Utils\UpdaterUtil.cs" />
</ItemGroup>
</Project>
</Project>

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<infotexts>
<progress>[sub] has made its way to [location].</progress>
<progress>[sub] has arrived at [location].</progress>
<return>[sub] has returned to [location].</return>
<gameover>The ocean has claimed [sub] and its crew.</gameover>
<OxygenBarInfo>Running out of oxygen!</OxygenBarInfo>
<PressureInfo>Water pressure increasing!</PressureInfo>
<CauseOfDeath.Damage>Succumbed to their injuries</CauseOfDeath.Damage>
<CauseOfDeath.Bloodloss>Bled out</CauseOfDeath.Bloodloss>
<CauseOfDeath.Drowning>Drowned</CauseOfDeath.Drowning>
<CauseOfDeath.Suffocation>Suffocated</CauseOfDeath.Suffocation>
<CauseOfDeath.Pressure>Crushed by water pressure</CauseOfDeath.Pressure>
<CauseOfDeath.Burn>Burned to death</CauseOfDeath.Burn>
<CauseOfDeath.Husk>Taken over by a parasite</CauseOfDeath.Husk>
<CauseOfDeath.Disconnected>Disconnected</CauseOfDeath.Disconnected>
<Self_CauseOfDeath.Damage>You have succumbed to your injuries.</Self_CauseOfDeath.Damage>
<Self_CauseOfDeath.Bloodloss>You have bled out.</Self_CauseOfDeath.Bloodloss>
<Self_CauseOfDeath.Drowning>You have drowned.</Self_CauseOfDeath.Drowning>
<Self_CauseOfDeath.Suffocation>You have suffocated.</Self_CauseOfDeath.Suffocation>
<Self_CauseOfDeath.Pressure>You have been crushed by water pressure.</Self_CauseOfDeath.Pressure>
<Self_CauseOfDeath.Burn>You have burned to death.</Self_CauseOfDeath.Burn>
<Self_CauseOfDeath.Husk>The parasite has taken over your body.</Self_CauseOfDeath.Husk>
<Self_CauseOfDeath.Disconnected>You were disconnected from the server.</Self_CauseOfDeath.Disconnected>
<HuskDormant>Your throat feels sore</HuskDormant>
<HuskDormant>Your feel feverish</HuskDormant>
<HuskDormant>It feels as if something was stuck in your throat</HuskDormant>
<HuskDormant>Your muscles are aching</HuskDormant>
<HuskCantSpeak>You feel something moving in your throat. You try to scream but no sound comes out.</HuskCantSpeak>
<HuskActivate>A strange chitinous appendage bursts out from your mouth. Use it to inject eggs into a living body by pressing [Attack]!</HuskActivate>
</infotexts>

View File

@@ -0,0 +1,214 @@
<?xml version="1.0" encoding="utf-8" ?>
<infotexts>
<!-- Main menu buttons -->
<TutorialButton>Tutorial</TutorialButton>
<NewGameButton>New Game</NewGameButton>
<LoadGameButton>Load Game</LoadGameButton>
<JoinServerButton>Join Server</JoinServerButton>
<HostServerButton>Host Server</HostServerButton>
<SubEditorButton>Submarine Editor</SubEditorButton>
<SettingsButton>Settings</SettingsButton>
<QuitButton>Quit</QuitButton>
<!-- Host server menu -->
<ServerName>Server name</ServerName>
<ServerPort>Server port</ServerPort>
<MaxPlayers>Max players</MaxPlayers>
<Password>Password</Password>
<PublicServer>Public server</PublicServer>
<PublicServerToolTip>Public servers are shown in the list of available servers in the "Join Server" -tab.</PublicServerToolTip>
<AttemptUPnP>Attempt UPnP port forwarding</AttemptUPnP>
<AttemptUPnPToolTip>UPnP can be used for forwarding ports on your router to allow players join the server. However, UPnP isn't supported by all routers, so you may need to setup port forwards manually if players are unable to join the server (see the readme for instructions).</AttemptUPnPToolTip>
<StartServerButton>Start</StartServerButton>
<!-- Settings menu -->
<ApplySettingsLabel>Apply changes?</ApplySettingsLabel>
<ApplySettingsQuestion>Do you want to apply the settings or discard the changes?</ApplySettingsQuestion>
<ApplySettingsYes>Apply</ApplySettingsYes>
<ApplySettingsNo>Discard</ApplySettingsNo>
<RestartRequiredLabel>Restart required</RestartRequiredLabel>
<RestartRequiredText>You need to restart the game for the resolution changes to take effect.</RestartRequiredText>
<!-- Round summary -->
<progress>[sub] has made its way to [location].</progress>
<progress>[sub] has arrived at [location].</progress>
<return>[sub] has returned to [location].</return>
<gameover>The ocean has claimed [sub] and its crew.</gameover>
<!-- Character HUD -->
<OxygenBarInfo>Running out of oxygen!</OxygenBarInfo>
<PressureInfo>Water pressure increasing!</PressureInfo>
<Grabbing>Grabbing</Grabbing>
<Stun>Stun</Stun>
<!-- Misc -->
<Yes>Yes</Yes>
<No>No</No>
<OK>OK</OK>
<Skills>Skills</Skills>
<Male>Male</Male>
<Female>Female</Female>
<Submarine>Submarine</Submarine>
<Shuttle>Shuttle</Shuttle>
<RespawnShuttle>Respawn shuttle</RespawnShuttle>
<Close>Close</Close>
<Cancel>Cancel</Cancel>
<Delete>Delete</Delete>
<Load>Load</Load>
<Back>Back</Back>
<DeleteDialogLabel>Delete file?</DeleteDialogLabel>
<DeleteDialogQuestion>Are you sure you want to delete "[file]"?</DeleteDialogQuestion>
<DeleteFileError>Could not delete file "[file]"!</DeleteFileError>
<!-- Campaign setup menu -->
<LoadButton>Load</LoadButton>
<DeleteButton>Delete</DeleteButton>
<SubNotSelected>Submarine not selected!</SubNotSelected>
<SelectSubRequest>Please select a submarine.</SelectSubRequest>
<SelectedSub>Selected submarine</SelectedSub>
<SaveName>Save name</SaveName>
<LastSaved>Last saved</LastSaved>
<MapSeed>Map seed</MapSeed>
<StartCampaignButton>Start</StartCampaignButton>
<ShuttleSelected>Shuttle selected</ShuttleSelected>
<ShuttleWarning>Most shuttles are not adequately equipped to deal with the dangers of the Europan depths. Are you sure you want to choose a shuttle as your vessel?</ShuttleWarning>
<!-- Campaign menu -->
<Map>Map</Map>
<Crew>Crew</Crew>
<Store>Store</Store>
<Hire>Hire</Hire>
<Location>Location</Location>
<HireUnavailable>No-one available for hire.</HireUnavailable>
<Mission>Mission</Mission>
<Reward>Reward</Reward>
<Credit>Credit</Credit>
<Credits>Credits</Credits>
<!-- Server list -->
<JoinServer>Join server</JoinServer>
<YourName>Your name</YourName>
<ServerIP>Server IP</ServerIP>
<ServerListName>Name</ServerListName>
<ServerListPlayers>Players</ServerListPlayers>
<ServerListRoundStarted>Round started</ServerListRoundStarted>
<ServerListRefresh>Refresh</ServerListRefresh>
<ServerListJoin>Join</ServerListJoin>
<FilterServers>Filter servers</FilterServers>
<FilterPassword>No password required</FilterPassword>
<FilterFullServers>Hide full servers</FilterFullServers>
<FilterEmptyServers>Hide empty servers</FilterEmptyServers>
<NoMatchingServers>No matching servers found.</NoMatchingServers>
<RefreshingServerList>Refreshing server list...</RefreshingServerList>
<NoServers>Could not find any servers.</NoServers>
<MasterServerErrorLabel>Connection error</MasterServerErrorLabel>
<MasterServerTimeOutError>Could not connect to master server (request timed out).</MasterServerTimeOutError>
<MasterServerErrorException>Error while connecting to master server { [error] }</MasterServerErrorException>
<MasterServerError404>Error while connecting to master server (404 - [masterserverurl] not found)</MasterServerError404>
<MasterServerErrorUnavailable>Error while connecting to master server (505 - Service Unavailable). The master server may be down for maintenance or temporarily overloaded. Please try again after in a few moments.</MasterServerErrorUnavailable>
<MasterServerErrorDefault>Error while connecting to master server ([statuscode]: [statusdescription])</MasterServerErrorDefault>
<!-- Server lobby -->
<RestartingIn>Restarting in</RestartingIn>
<Votes>Votes</Votes>
<GameMode>Game mode</GameMode>
<MissionType>Mission type</MissionType>
<Random>Random</Random>
<LevelSeed>Level seed</LevelSeed>
<Traitors>Traitors</Traitors>
<AutoRestart>Automatic restart</AutoRestart>
<ServerLog>Server log</ServerLog>
<CampaignView>Campaign view</CampaignView>
<PlayYourself>Play yourself</PlayYourself>
<StartGameButton>Start</StartGameButton>
<ServerSettingsButton>Settings</ServerSettingsButton>
<SpectateButton>Spectate</SpectateButton>
<Gender>Gender</Gender>
<JobPreferences>JobPreferences</JobPreferences>
<PlayingAsSpectator>Playing as a spectator</PlayingAsSpectator>
<SubNotFound>Submarine not found in your submarine folder</SubNotFound>
<SubDoesntMatch>Your version of the submarine doesn't match the servers version</SubDoesntMatch>
<Rank>Rank</Rank>
<CustomRank>Custom</CustomRank>
<Permissions>Permissions</Permissions>
<PermittedConsoleCommands>Permitted console commands</PermittedConsoleCommands>
<Kick>Kick</Kick>
<Ban>Ban</Ban>
<BanRange>Ban range</BanRange>
<PrivateMessageTag>[PM]</PrivateMessageTag>
<SubNotFoundError>Submarine [subname] was selected by the server. Matching file not found in your submarine folder.</SubNotFoundError>
<SubLoadError>Could not load submarine [subname]. The file may be corrupted.</SubLoadError>
<SubDoesntMatchError>Your version of the submarine file [subname] does not match the server's version!\nYour MD5 hash: [myhash]\nServer's MD5 hash: [serverhash]\n</SubDoesntMatchError>
<DownloadSubLabel>Submarine not found!</DownloadSubLabel>
<DownloadSubQuestion>Do you want to download the file from the server host?</DownloadSubQuestion>
<!-- Sub editor -->
<Items>Items</Items>
<Structures>Structures</Structures>
<TotalHullVolume>Total hull volume</TotalHullVolume>
<SelectedHullVolume>Selected hull volume</SelectedHullVolume>
<OptimalBallastLevel>optimal neutral ballast level is [value]</OptimalBallastLevel>
<InsufficientBallast>insufficient volume for buoyancy control</InsufficientBallast>
<PhysicsBodies>Physics bodies</PhysicsBodies>
<OpenSubButton>Open...</OpenSubButton>
<SaveSubButton>Save</SaveSubButton>
<AddSubButton>Add submarine</AddSubButton>
<AddSubToolTip>Places another submarine into the current submarine file. Can be used for adding things such as smaller vessels, escape pods or detachable sections into the main submarine.</AddSubToolTip>
<FilterMapEntities>Filter</FilterMapEntities>
<CharacterModeButton>Character mode</CharacterModeButton>
<CharacterModeToolTip>Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.</CharacterModeToolTip>
<WiringModeButton>Wiring mode</WiringModeButton>
<WiringModeToolTip>Allows you to connect wires between items.</WiringModeToolTip>
<GenerateWaypointsButton>Generate waypoints</GenerateWaypointsButton>
<GenerateWaypointsToolTip>AI controlled crew members require waypoints to navigate around the sub.</GenerateWaypointsToolTip>
<ShowEntitiesLabel>Show</ShowEntitiesLabel>
<ShowWaypoints>Waypoints</ShowWaypoints>
<ShowSpawnpoints>Spawnpoints</ShowSpawnpoints>
<ShowLinks>Links</ShowLinks>
<ShowHulls>Hulls</ShowHulls>
<ShowGaps>Gaps</ShowGaps>
<PreviouslyUsedLabel>Previously used</PreviouslyUsedLabel>
<SubNameMissingWarning>Name your submarine before saving it.</SubNameMissingWarning>
<SubSavedNotification>Submarine saved to [filepath].</SubSavedNotification>
<SaveSubDialogHeader>Save submarine</SaveSubDialogHeader>
<SaveSubDialogName>Name</SaveSubDialogName>
<SaveSubDialogDescription>Description</SaveSubDialogDescription>
<SaveSubDialogSettings>Settings</SaveSubDialogSettings>
<!-- Causes of death -->
<CauseOfDeath.Damage>Succumbed to their injuries</CauseOfDeath.Damage>
<CauseOfDeath.Bloodloss>Bled out</CauseOfDeath.Bloodloss>
<CauseOfDeath.Drowning>Drowned</CauseOfDeath.Drowning>
<CauseOfDeath.Suffocation>Suffocated</CauseOfDeath.Suffocation>
<CauseOfDeath.Pressure>Crushed by water pressure</CauseOfDeath.Pressure>
<CauseOfDeath.Burn>Burned to death</CauseOfDeath.Burn>
<CauseOfDeath.Husk>Taken over by a parasite</CauseOfDeath.Husk>
<CauseOfDeath.Disconnected>Disconnected</CauseOfDeath.Disconnected>
<Self_CauseOfDeath.Damage>You have succumbed to your injuries.</Self_CauseOfDeath.Damage>
<Self_CauseOfDeath.Bloodloss>You have bled out.</Self_CauseOfDeath.Bloodloss>
<Self_CauseOfDeath.Drowning>You have drowned.</Self_CauseOfDeath.Drowning>
<Self_CauseOfDeath.Suffocation>You have suffocated.</Self_CauseOfDeath.Suffocation>
<Self_CauseOfDeath.Pressure>You have been crushed by water pressure.</Self_CauseOfDeath.Pressure>
<Self_CauseOfDeath.Burn>You have burned to death.</Self_CauseOfDeath.Burn>
<Self_CauseOfDeath.Husk>The parasite has taken over your body.</Self_CauseOfDeath.Husk>
<Self_CauseOfDeath.Disconnected>You were disconnected from the server.</Self_CauseOfDeath.Disconnected>
<GiveInButton>Give in</GiveInButton>
<GiveInHelpMultiplayer>Let go of your character and enter spectator mode (other players will no longer be able to revive you)</GiveInHelpMultiplayer>
<GiveInHelpSingleplayer>"The character can no longer be revived if you give in."</GiveInHelpSingleplayer>
<!-- Huskification -->
<HuskDormant>Your throat feels sore</HuskDormant>
<HuskDormant>Your feel feverish</HuskDormant>
<HuskDormant>It feels as if something was stuck in your throat</HuskDormant>
<HuskDormant>Your muscles are aching</HuskDormant>
<HuskCantSpeak>You feel something moving in your throat. You try to scream but no sound comes out.</HuskCantSpeak>
<HuskActivate>A strange chitinous appendage bursts out from your mouth. Use it to inject eggs into a living body by pressing [Attack]!</HuskActivate>
</infotexts>

View File

@@ -6,18 +6,16 @@ using System.Xml.Linq;
namespace Barotrauma
{
static class InfoTextManager
static class TextManager
{
private static Dictionary<string, List<string>> infoTexts;
static InfoTextManager()
static TextManager()
{
LoadInfoTexts(Path.Combine("Content", "InfoTexts.xml"));
Load(Path.Combine("Content", "Texts.xml"));
}
private static void LoadInfoTexts(string file)
private static void Load(string file)
{
infoTexts = new Dictionary<string, List<string>>();
@@ -38,20 +36,18 @@ namespace Barotrauma
}
}
public static string GetInfoText(string infoName)
public static string Get(string infoName)
{
List<string> infoList = null;
if (!infoTexts.TryGetValue(infoName.ToLowerInvariant(), out infoList) || !infoList.Any())
{
#if DEBUG
return "Info text \"" + infoName + "\" not found";
#else
return "";
#endif
DebugConsole.ThrowError("Info text \"" + infoName + "\" not found");
return infoName;
}
string text = infoList[Rand.Int(infoList.Count)];
//todo: get rid of these and only do where needed?
#if CLIENT
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
{