(81d7f4c1c) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev

This commit is contained in:
Joonas Rikkonen
2019-05-18 17:44:13 +03:00
parent ada4e17dfe
commit 6332cfd55f
17 changed files with 126 additions and 123 deletions
@@ -273,7 +273,7 @@ namespace Barotrauma
{ {
IsHorizontal = false IsHorizontal = false
}; };
cprButton = new GUIButton(new RectTransform(new Point(80, 80), GUI.Canvas), text: "", style: "CPRButton") cprButton = new GUIButton(new RectTransform(new Point((int)(80 * GUI.Scale)), GUI.Canvas), text: "", style: "CPRButton")
{ {
OnClicked = (button, userData) => OnClicked = (button, userData) =>
{ {
+16 -4
View File
@@ -397,7 +397,10 @@ namespace Barotrauma
MouseOn.DrawToolTip(spriteBatch); MouseOn.DrawToolTip(spriteBatch);
} }
Cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition); if (GameMain.WindowActive)
{
Cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition, 0, Scale / 2f);
}
} }
public static void DrawBackgroundSprite(SpriteBatch spriteBatch, Sprite backgroundSprite, float blurAmount = 1.0f, float aberrationStrength = 1.0f) public static void DrawBackgroundSprite(SpriteBatch spriteBatch, Sprite backgroundSprite, float blurAmount = 1.0f, float aberrationStrength = 1.0f)
@@ -567,7 +570,7 @@ namespace Barotrauma
private static void HandlePersistingElements(float deltaTime) private static void HandlePersistingElements(float deltaTime)
{ {
if (GUIMessageBox.VisibleBox != null && GUIMessageBox.VisibleBox.UserData as string != "verificationprompt") if (GUIMessageBox.VisibleBox != null && GUIMessageBox.VisibleBox.UserData as string != "verificationprompt" && GUIMessageBox.VisibleBox.UserData as string != "bugreporter")
{ {
GUIMessageBox.VisibleBox.AddToGUIUpdateList(); GUIMessageBox.VisibleBox.AddToGUIUpdateList();
} }
@@ -582,7 +585,7 @@ namespace Barotrauma
} }
//the "are you sure you want to quit" prompts are drawn on top of everything else //the "are you sure you want to quit" prompts are drawn on top of everything else
if (GUIMessageBox.VisibleBox?.UserData as string == "verificationprompt") if (GUIMessageBox.VisibleBox?.UserData as string == "verificationprompt" || GUIMessageBox.VisibleBox?.UserData as string == "bugreporter")
{ {
GUIMessageBox.VisibleBox.AddToGUIUpdateList(); GUIMessageBox.VisibleBox.AddToGUIUpdateList();
} }
@@ -1444,7 +1447,16 @@ namespace Barotrauma
RelativeSpacing = 0.05f RelativeSpacing = 0.05f
}; };
var button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("PauseMenuResume"), style: "GUIButtonLarge") var button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("bugreportbutton"), style: "GUIButtonLarge")
{
Color = Color.Red,
HoverColor = Color.DarkRed,
PressedColor = Color.White,
OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; }
};
button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("PauseMenuResume"), style: "GUIButtonLarge")
{ {
OnClicked = TogglePauseMenu OnClicked = TogglePauseMenu
}; };
@@ -91,7 +91,7 @@ namespace Barotrauma
} }
InnerFrame.RectTransform.NonScaledSize = InnerFrame.RectTransform.NonScaledSize =
new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + 50)); new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + (int)(50 * GUI.yScale)));
Content.RectTransform.NonScaledSize = Content.RectTransform.NonScaledSize =
new Point(Content.Rect.Width, height); new Point(Content.Rect.Width, height);
} }
@@ -99,7 +99,7 @@ namespace Barotrauma
Buttons = new List<GUIButton>(buttons.Length); Buttons = new List<GUIButton>(buttons.Length);
for (int i = 0; i < buttons.Length; i++) for (int i = 0; i < buttons.Length; i++)
{ {
var button = new GUIButton(new RectTransform(new Vector2(Math.Min(0.9f / buttons.Length, 0.5f), 1.0f), buttonContainer.RectTransform, maxSize: new Point(300, 35)), buttons[i], style: "GUIButtonLarge"); var button = new GUIButton(new RectTransform(new Vector2(Math.Min(0.9f / buttons.Length, 0.5f), 1.0f), buttonContainer.RectTransform), buttons[i], style: "GUIButtonLarge");
Buttons.Add(button); Buttons.Add(button);
} }
+12 -7
View File
@@ -334,7 +334,7 @@ namespace Barotrauma
SoundManager.SetCategoryGainMultiplier("ui", Config.SoundVolume); SoundManager.SetCategoryGainMultiplier("ui", Config.SoundVolume);
SoundManager.SetCategoryGainMultiplier("waterambience", Config.SoundVolume); SoundManager.SetCategoryGainMultiplier("waterambience", Config.SoundVolume);
SoundManager.SetCategoryGainMultiplier("music", Config.MusicVolume); SoundManager.SetCategoryGainMultiplier("music", Config.MusicVolume);
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume); SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume * 5.0f);
if (Config.EnableSplashScreen) if (Config.EnableSplashScreen)
{ {
var pendingSplashScreens = TitleScreen.PendingSplashScreens; var pendingSplashScreens = TitleScreen.PendingSplashScreens;
@@ -666,7 +666,7 @@ namespace Barotrauma
(NetworkMember == null || !NetworkMember.GameStarted); (NetworkMember == null || !NetworkMember.GameStarted);
#if !DEBUG #if !DEBUG
if (NetworkMember == null && !WindowActive && !paused && true && Screen.Selected != MainMenuScreen) if (NetworkMember == null && !WindowActive && !paused && true && Screen.Selected != MainMenuScreen && Config.PauseOnFocusLost)
{ {
GUI.TogglePauseMenu(); GUI.TogglePauseMenu();
paused = true; paused = true;
@@ -812,17 +812,19 @@ namespace Barotrauma
// ToDo: Move texts/links to localization, when possible. // ToDo: Move texts/links to localization, when possible.
public void ShowBugReporter() public void ShowBugReporter()
{ {
var msgBox = new GUIMessageBox("", ""); var msgBox = new GUIMessageBox(TextManager.Get("bugreportbutton"), "");
var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.05f }; msgBox.UserData = "bugreporter";
var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.025f };
linkHolder.RectTransform.MaxSize = new Point(int.MaxValue, linkHolder.Rect.Height);
List<Pair<string, string>> links = new List<Pair<string, string>>() List<Pair<string, string>> links = new List<Pair<string, string>>()
{ {
new Pair<string, string>("Barotrauma Feedback Form","https://barotraumagame.com/feedback"), new Pair<string, string>(TextManager.Get("bugreportfeedbackform"),"https://barotraumagame.com/feedback"),
new Pair<string, string>("Github Issue Form (Needs account)","https://github.com/Regalis11/Barotrauma/issues/new?template=bug_report.md") new Pair<string, string>(TextManager.Get("bugreportgithubform"),"https://github.com/Regalis11/Barotrauma/issues/new?template=bug_report.md")
}; };
foreach (var link in links) foreach (var link in links)
{ {
new GUIButton(new RectTransform(new Vector2(1.0f, 0.2f), linkHolder.RectTransform), link.First, style: "MainMenuGUIButton", textAlignment: Alignment.Left) new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), linkHolder.RectTransform), link.First, style: "MainMenuGUIButton", textAlignment: Alignment.Left)
{ {
UserData = link.Second, UserData = link.Second,
OnClicked = (btn, userdata) => OnClicked = (btn, userdata) =>
@@ -833,6 +835,9 @@ namespace Barotrauma
} }
}; };
} }
msgBox.InnerFrame.RectTransform.MinSize = new Point(0,
msgBox.InnerFrame.Rect.Height + linkHolder.Rect.Height + msgBox.Content.AbsoluteSpacing * 2 + (int)(50 * GUI.Scale));
} }
static bool waitForKeyHit = true; static bool waitForKeyHit = true;
@@ -85,13 +85,6 @@ namespace Barotrauma
TextManager.Get("Settings"), textAlignment: Alignment.TopLeft, font: GUI.LargeFont) TextManager.Get("Settings"), textAlignment: Alignment.TopLeft, font: GUI.LargeFont)
{ ForceUpperCase = true }; { ForceUpperCase = true };
//TODO: enable when new texts can be added
/*new GUIButton(new RectTransform(new Vector2(1.0f, 0.75f), settingsTitle.RectTransform, Anchor.CenterRight), style: "GUIBugButton")
{
ToolTip = "Bug Reporter",
OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; }
};*/
var generalLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), leftPanel.RectTransform, Anchor.TopLeft)); var generalLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), leftPanel.RectTransform, Anchor.TopLeft));
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), generalLayoutGroup.RectTransform), TextManager.Get("ContentPackages")); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), generalLayoutGroup.RectTransform), TextManager.Get("ContentPackages"));
@@ -178,6 +171,12 @@ namespace Barotrauma
}; };
} }
new GUIButton(new RectTransform(new Vector2(0.05f, 0.75f), tabButtonHolder.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.0f, 0.2f) }, style: "GUIBugButton")
{
ToolTip = TextManager.Get("bugreportbutton"),
OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; }
};
var buttonArea = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.08f), paddedFrame.RectTransform, Anchor.BottomCenter), style: null); var buttonArea = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.08f), paddedFrame.RectTransform, Anchor.BottomCenter), style: null);
/// Graphics tab -------------------------------------------------------------- /// Graphics tab --------------------------------------------------------------
@@ -464,10 +463,6 @@ namespace Barotrauma
{ {
DebugConsole.NewMessage(name + " " + name.Length.ToString(), Color.Lime); DebugConsole.NewMessage(name + " " + name.Length.ToString(), Color.Lime);
} }
deviceList.OnSelected = (GUIComponent selected, object obj) =>
{
string name = obj as string;
if (VoiceCaptureDevice == name) { return true; }
GUITickBox directionalVoiceChat = new GUITickBox(new RectTransform(new Point(32, 32), audioSliders.RectTransform), TextManager.Get("DirectionalVoiceChat")); GUITickBox directionalVoiceChat = new GUITickBox(new RectTransform(new Point(32, 32), audioSliders.RectTransform), TextManager.Get("DirectionalVoiceChat"));
directionalVoiceChat.Selected = UseDirectionalVoiceChat; directionalVoiceChat.Selected = UseDirectionalVoiceChat;
@@ -543,7 +543,10 @@ namespace Barotrauma
//equipped item that can't be put in the inventory, use delayed dropping //equipped item that can't be put in the inventory, use delayed dropping
if (quickUseAction == QuickUseAction.Drop) if (quickUseAction == QuickUseAction.Drop)
{ {
slots[i].QuickUseButtonToolTip = "Hold to unequip"; slots[i].QuickUseButtonToolTip =
TextManager.Get("QuickUseAction.HoldToUnequip", returnNull: true) ??
(GameMain.Config.Language == "English" ? "Hold to unequip" : TextManager.Get("QuickUseAction.Unequip"));
if (PlayerInput.LeftButtonHeld()) if (PlayerInput.LeftButtonHeld())
{ {
slots[i].QuickUseTimer = Math.Max(0.1f, slots[i].QuickUseTimer + deltaTime); slots[i].QuickUseTimer = Math.Max(0.1f, slots[i].QuickUseTimer + deltaTime);
@@ -89,7 +89,7 @@ namespace Barotrauma.Items.Components
RelativeSpacing = 0.05f RelativeSpacing = 0.05f
}; };
new GUITextBlock(new RectTransform(new Vector2(0.15f, 1.0f), sliderArea.RectTransform), var outLabel = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1.0f), sliderArea.RectTransform),
TextManager.Get("PumpOut"), textAlignment: Alignment.Center, wrap: true, font: GUI.SmallFont); TextManager.Get("PumpOut"), textAlignment: Alignment.Center, wrap: true, font: GUI.SmallFont);
pumpSpeedSlider = new GUIScrollBar(new RectTransform(new Vector2(0.8f, 1.0f), sliderArea.RectTransform), barSize: 0.25f, style: "GUISlider") pumpSpeedSlider = new GUIScrollBar(new RectTransform(new Vector2(0.8f, 1.0f), sliderArea.RectTransform), barSize: 0.25f, style: "GUISlider")
{ {
@@ -109,9 +109,10 @@ namespace Barotrauma.Items.Components
return true; return true;
} }
}; };
var inLabel = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1.0f), sliderArea.RectTransform),
new GUITextBlock(new RectTransform(new Vector2(0.15f, 1.0f), sliderArea.RectTransform),
TextManager.Get("PumpIn"), textAlignment: Alignment.Center, wrap: true, font: GUI.SmallFont); TextManager.Get("PumpIn"), textAlignment: Alignment.Center, wrap: true, font: GUI.SmallFont);
GUITextBlock.AutoScaleAndNormalize(outLabel, inLabel);
} }
public override void OnItemLoaded() public override void OnItemLoaded()
@@ -143,7 +143,7 @@ namespace Barotrauma.Items.Components
private void Draw(SpriteBatch spriteBatch, ConnectionPanel panel, Vector2 position, Vector2 labelPos, Vector2 wirePosition, bool mouseIn, Wire equippedWire, float wireInterval) private void Draw(SpriteBatch spriteBatch, ConnectionPanel panel, Vector2 position, Vector2 labelPos, Vector2 wirePosition, bool mouseIn, Wire equippedWire, float wireInterval)
{ {
//spriteBatch.DrawString(GUI.SmallFont, Name, new Vector2(labelPos.X, labelPos.Y-10), Color.White); //spriteBatch.DrawString(GUI.SmallFont, Name, new Vector2(labelPos.X, labelPos.Y-10), Color.White);
GUI.DrawString(spriteBatch, labelPos, Name, IsPower ? Color.Red : Color.White, Color.Black, 0, GUI.SmallFont); GUI.DrawString(spriteBatch, labelPos, DisplayName, IsPower ? Color.Red : Color.White, Color.Black, 0, GUI.SmallFont);
connectionSprite.Draw(spriteBatch, position); connectionSprite.Draw(spriteBatch, position);
@@ -281,7 +281,8 @@ namespace Barotrauma
new Vector2(rect.Width, rect.Height), new Vector2(rect.Width, rect.Height),
color: color, color: color,
textureScale: TextureScale * Scale, textureScale: TextureScale * Scale,
startOffset: backGroundOffset); startOffset: backGroundOffset,
depth: Math.Max(Prefab.BackgroundSprite.Depth, depth + 0.000001f));
if (UseDropShadow) if (UseDropShadow)
{ {
@@ -903,7 +903,7 @@ namespace Barotrauma.Networking
connected = false; connected = false;
ConnectToServer(serverIP); ConnectToServer(serverIP);
} }
else if (clientID == myID)
{ {
string msg = ""; string msg = "";
if (disconnectReason == DisconnectReason.Unknown) if (disconnectReason == DisconnectReason.Unknown)
@@ -921,8 +921,18 @@ namespace Barotrauma.Networking
msg += TextManager.GetServerMessage(splitMsg[i]); msg += TextManager.GetServerMessage(splitMsg[i]);
} }
} }
var msgBox = new GUIMessageBox(TextManager.Get(allowReconnect ? "ConnectionLost" : "CouldNotConnectToServer"), msg);
msgBox.Buttons[0].OnClicked += ReturnToServerList; if (msg == NetConnection.NoResponseMessage)
{
//display a generic "could not connect" popup if the message is Lidgren's "failed to establish connection"
var msgBox = new GUIMessageBox(TextManager.Get("ConnectionFailed"), TextManager.Get(allowReconnect ? "ConnectionLost" : "CouldNotConnectToServer"));
msgBox.Buttons[0].OnClicked += ReturnToServerList;
}
else
{
var msgBox = new GUIMessageBox(TextManager.Get(allowReconnect ? "ConnectionLost" : "CouldNotConnectToServer"), msg);
msgBox.Buttons[0].OnClicked += ReturnToServerList;
}
} }
} }
@@ -31,6 +31,8 @@ namespace Barotrauma
private bool masterServerResponded; private bool masterServerResponded;
private IRestResponse masterServerResponse; private IRestResponse masterServerResponse;
private GUIButton refreshButton;
private float[] columnRelativeWidth; private float[] columnRelativeWidth;
//filters //filters
@@ -140,7 +142,7 @@ namespace Barotrauma
OnClicked = GameMain.MainMenuScreen.ReturnToMainMenu OnClicked = GameMain.MainMenuScreen.ReturnToMainMenu
}; };
var refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center), refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center),
"", style: "GUIButtonRefresh") { "", style: "GUIButtonRefresh") {
ToolTip = TextManager.Get("ServerListRefresh"), ToolTip = TextManager.Get("ServerListRefresh"),
@@ -196,10 +198,6 @@ namespace Barotrauma
UserData = "noresults" UserData = "noresults"
}; };
} }
else
{
joinButton.Enabled = false;
}
return true; return true;
} }
@@ -220,9 +218,35 @@ namespace Barotrauma
return true; return true;
} }
private bool RefreshJoinButtonState(GUIComponent component, object obj)
{
if (obj == null || waitingForRefresh) { return false; }
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
{
joinButton.Enabled = true;
}
else
{
joinButton.Enabled = false;
}
return true;
}
private bool SelectServer(GUIComponent component, object obj) private bool SelectServer(GUIComponent component, object obj)
{ {
if (obj == null || waitingForRefresh) return false; if (obj == null || waitingForRefresh) { return false; }
if (!string.IsNullOrWhiteSpace(clientNameBox.Text))
{
joinButton.Enabled = true;
}
else
{
clientNameBox.Flash();
joinButton.Enabled = false;
}
if (!string.IsNullOrWhiteSpace(clientNameBox.Text)) if (!string.IsNullOrWhiteSpace(clientNameBox.Text))
{ {
@@ -258,8 +282,11 @@ namespace Barotrauma
ipBox.Text = null; ipBox.Text = null;
joinButton.Enabled = false; joinButton.Enabled = false;
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform), new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
TextManager.Get("RefreshingServerList")); TextManager.Get("RefreshingServerList"), textAlignment: Alignment.Center)
{
CanBeFocused = false
};
CoroutineManager.StartCoroutine(WaitForRefresh()); CoroutineManager.StartCoroutine(WaitForRefresh());
@@ -280,17 +307,19 @@ namespace Barotrauma
if (!SteamManager.GetServers(AddToServerList, UpdateServerInfo, ServerQueryFinished)) if (!SteamManager.GetServers(AddToServerList, UpdateServerInfo, ServerQueryFinished))
{ {
serverList.ClearChildren(); serverList.ClearChildren();
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform), new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
TextManager.Get("ServerListNoSteamConnection")); TextManager.Get("ServerListNoSteamConnection"), textAlignment: Alignment.Center)
{
CanBeFocused = false
};
} }
} }
else else
{ {
CoroutineManager.StartCoroutine(SendMasterServerRequest()); CoroutineManager.StartCoroutine(SendMasterServerRequest());
waitingForRefresh = false;
} }
waitingForRefresh = false;
refreshDisableTimer = DateTime.Now + AllowedRefreshInterval; refreshDisableTimer = DateTime.Now + AllowedRefreshInterval;
yield return CoroutineStatus.Success; yield return CoroutineStatus.Success;
@@ -355,8 +384,11 @@ namespace Barotrauma
serverList.Content.ClearChildren(); serverList.Content.ClearChildren();
if (serverInfos.Count() == 0) if (serverInfos.Count() == 0)
{ {
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform), new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
TextManager.Get("NoServers")); TextManager.Get("NoServers"), textAlignment: Alignment.Center)
{
CanBeFocused = false
};
return; return;
} }
foreach (ServerInfo serverInfo in serverInfos) foreach (ServerInfo serverInfo in serverInfos)
@@ -496,6 +528,7 @@ namespace Barotrauma
UserData = "noresults" UserData = "noresults"
}; };
} }
waitingForRefresh = false;
} }
private IEnumerable<object> SendMasterServerRequest() private IEnumerable<object> SendMasterServerRequest()
@@ -478,7 +478,7 @@ namespace Barotrauma
} }
else else
{ {
var downloadBtn = new GUIButton(new RectTransform(new Point(32, 32), rightColumn.RectTransform), "+", style: null) var downloadBtn = new GUIButton(new RectTransform(new Point((int)(32 * GUI.Scale)), rightColumn.RectTransform), "+", style: null)
{ {
Font = GUI.LargeFont, Font = GUI.LargeFont,
Color = new Color(38, 65, 86, 255), Color = new Color(38, 65, 86, 255),
@@ -379,6 +379,9 @@ 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(newOrder.GetChatMessage("", Character.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order); Character.Speak(newOrder.GetChatMessage("", Character.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order);
#if SERVER
GameMain.Server.SendOrderChatMessage(new OrderChatMessage(newOrder, "", Character.CurrentHull, null, Character));
#endif
} }
} }
} }
@@ -45,7 +45,7 @@ namespace Barotrauma
public bool PauseOnFocusLost { get; set; } = true; public bool PauseOnFocusLost { get; set; } = true;
public bool MuteOnFocusLost { get; set; } public bool MuteOnFocusLost { get; set; }
public bool UseDirectionalVoiceChat { get; set; } public bool UseDirectionalVoiceChat { get; set; } = true;
public enum VoiceMode public enum VoiceMode
{ {
@@ -206,7 +206,7 @@ namespace Barotrauma
{ {
voiceChatVolume = MathHelper.Clamp(value, 0.0f, 1.0f); voiceChatVolume = MathHelper.Clamp(value, 0.0f, 1.0f);
#if CLIENT #if CLIENT
GameMain.SoundManager?.SetCategoryGainMultiplier("voip", voiceChatVolume); GameMain.SoundManager?.SetCategoryGainMultiplier("voip", voiceChatVolume * 5.0f);
#endif #endif
} }
} }
@@ -424,74 +424,6 @@ namespace Barotrauma
{ {
Language = doc.Root.GetAttributeString("language", "English"); Language = doc.Root.GetAttributeString("language", "English");
} }
}
#region Load DefaultConfig
private void LoadDefaultConfig()
{
XDocument doc = XMLExtensions.TryLoadXml(savePath);
Language = doc.Root.GetAttributeString("language", "English");
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true);
WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false);
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true);
WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false);
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true);
WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false);
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true);
WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false);
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true);
WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false);
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true);
WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false);
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", ""); MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
@@ -609,8 +609,7 @@ namespace Barotrauma
foreach (InterestingPosition pos in positionsOfInterest) foreach (InterestingPosition pos in positionsOfInterest)
{ {
if (pos.PositionType != PositionType.MainPath || pos.Position.X < 5000 || pos.Position.X > Size.X - 5000) continue; if (pos.PositionType != PositionType.MainPath || pos.Position.X < 5000 || pos.Position.X > Size.X - 5000) continue;
if (Math.Abs(pos.Position.X - StartPosition.X) < 10000) continue; if (Math.Abs(pos.Position.X - StartPosition.X) < minWidth * 2 || Math.Abs(pos.Position.X - EndPosition.X) < minWidth * 2) continue;
if (Math.Abs(pos.Position.Y - StartPosition.Y) < 10000) continue;
if (GetTooCloseCells(pos.Position.ToVector2(), minWidth * 0.7f).Count > 0) continue; if (GetTooCloseCells(pos.Position.ToVector2(), minWidth * 0.7f).Count > 0) continue;
iceChunkPositions.Add(pos.Position); iceChunkPositions.Add(pos.Position);
} }
@@ -301,6 +301,10 @@ namespace Barotrauma
#endif #endif
spriteColor = prefab.SpriteColor; spriteColor = prefab.SpriteColor;
if (sp.IsHorizontal.HasValue) if (sp.IsHorizontal.HasValue)
{
IsHorizontal = sp.IsHorizontal.Value;
}
else if (ResizeHorizontal && !ResizeVertical)
{ {
IsHorizontal = true; IsHorizontal = true;
} }
@@ -345,7 +349,7 @@ namespace Barotrauma
} }
// Only add ai targets automatically to submarine/outpost walls // Only add ai targets automatically to submarine/outpost walls
if (aiTarget == null && HasBody && Tags.Contains("wall") && submarine != null) if (aiTarget == null && HasBody && Tags.Contains("wall") && submarine != null && !Prefab.NoAITarget)
{ {
aiTarget = new AITarget(this); aiTarget = new AITarget(this);
} }
@@ -184,6 +184,11 @@ namespace Barotrauma
sp.Tags.Add(tag.Trim().ToLowerInvariant()); sp.Tags.Add(tag.Trim().ToLowerInvariant());
} }
if (element.Attribute("ishorizontal") != null)
{
sp.IsHorizontal = element.GetAttributeBool("ishorizontal", false);
}
foreach (XElement subElement in element.Elements()) foreach (XElement subElement in element.Elements())
{ {
switch (subElement.Name.ToString()) switch (subElement.Name.ToString())