(3ac5065f5) Fixed: Rendering order for Bugreporter window, OK button position
This commit is contained in:
@@ -332,6 +332,7 @@ namespace Barotrauma
|
||||
CharacterInventory.Layout.Right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!character.IsUnconscious && character.Stun <= 0.0f)
|
||||
{
|
||||
@@ -370,13 +371,7 @@ namespace Barotrauma
|
||||
|
||||
private static void DrawOrderIndicator(SpriteBatch spriteBatch, Camera cam, Character character, Order order, float iconAlpha = 1.0f)
|
||||
{
|
||||
if (order.TargetAllCharacters)
|
||||
{
|
||||
if (order.OrderGiver != character && !order.HasAppropriateJob(character))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (order.TargetAllCharacters && !order.HasAppropriateJob(character)) { return; }
|
||||
|
||||
Entity target = order.ConnectedController != null ? order.ConnectedController.Item : order.TargetEntity;
|
||||
if (target == null) { return; }
|
||||
|
||||
@@ -273,7 +273,7 @@ namespace Barotrauma
|
||||
{
|
||||
IsHorizontal = false
|
||||
};
|
||||
cprButton = new GUIButton(new RectTransform(new Point((int)(80 * GUI.Scale)), GUI.Canvas), text: "", style: "CPRButton")
|
||||
cprButton = new GUIButton(new RectTransform(new Point(80, 80), GUI.Canvas), text: "", style: "CPRButton")
|
||||
{
|
||||
OnClicked = (button, userData) =>
|
||||
{
|
||||
|
||||
@@ -36,16 +36,6 @@ namespace Barotrauma
|
||||
get { return (GameMain.GraphicsWidth / 1920.0f + GameMain.GraphicsHeight / 1080.0f) / 2.0f * GameSettings.HUDScale; }
|
||||
}
|
||||
|
||||
public static float xScale
|
||||
{
|
||||
get { return GameMain.GraphicsWidth / 1920.0f * GameSettings.HUDScale; }
|
||||
}
|
||||
|
||||
public static float yScale
|
||||
{
|
||||
get { return GameMain.GraphicsHeight / 1080.0f * GameSettings.HUDScale; }
|
||||
}
|
||||
|
||||
public static GUIStyle Style;
|
||||
|
||||
private static Texture2D t;
|
||||
@@ -396,11 +386,8 @@ namespace Barotrauma
|
||||
{
|
||||
MouseOn.DrawToolTip(spriteBatch);
|
||||
}
|
||||
|
||||
if (GameMain.WindowActive)
|
||||
{
|
||||
Cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition, 0, Scale / 2f);
|
||||
}
|
||||
|
||||
Cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition);
|
||||
}
|
||||
|
||||
public static void DrawBackgroundSprite(SpriteBatch spriteBatch, Sprite backgroundSprite, float blurAmount = 1.0f, float aberrationStrength = 1.0f)
|
||||
@@ -570,7 +557,7 @@ namespace Barotrauma
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -585,7 +572,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
//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();
|
||||
}
|
||||
@@ -1447,7 +1434,16 @@ namespace Barotrauma
|
||||
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
|
||||
};
|
||||
|
||||
@@ -471,8 +471,6 @@ namespace Barotrauma
|
||||
|
||||
public static void DrawToolTip(SpriteBatch spriteBatch, string toolTip, Rectangle targetElement)
|
||||
{
|
||||
if (Tutorials.Tutorial.ContentRunning) return;
|
||||
|
||||
int width = (int)(400 * GUI.Scale);
|
||||
int height = (int)(18 * GUI.Scale);
|
||||
Point padding = new Point((int)(20 * GUI.Scale), (int)(7 * GUI.Scale));
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
InnerFrame.RectTransform.NonScaledSize =
|
||||
new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + (int)(50 * GUI.yScale)));
|
||||
new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + 50));
|
||||
Content.RectTransform.NonScaledSize =
|
||||
new Point(Content.Rect.Width, height);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ namespace Barotrauma
|
||||
Buttons = new List<GUIButton>(buttons.Length);
|
||||
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), buttons[i], style: "GUIButtonLarge");
|
||||
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");
|
||||
Buttons.Add(button);
|
||||
}
|
||||
|
||||
|
||||
@@ -339,7 +339,7 @@ namespace Barotrauma
|
||||
|
||||
Font.DrawString(spriteBatch,
|
||||
Wrap ? wrappedText : text,
|
||||
pos,
|
||||
rect.Location.ToVector2() + textPos + TextOffset,
|
||||
textColor * (textColor.A / 255.0f),
|
||||
0.0f, origin, TextScale,
|
||||
SpriteEffects.None, textDepth);
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace Barotrauma
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
GUI.Font.DrawString(spriteBatch, lines[i],
|
||||
new Vector2((int)(GameMain.GraphicsWidth / 2.0f - GUI.Font.MeasureString(lines[i]).X / 2.0f), (int)(GameMain.GraphicsHeight * 0.78f + i * lineHeight)), Color.White);
|
||||
new Vector2(GameMain.GraphicsWidth / 2.0f - GUI.Font.MeasureString(lines[i]).X / 2.0f, GameMain.GraphicsHeight * 0.78f + i * lineHeight), Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,10 +242,6 @@ namespace Barotrauma
|
||||
if (hover && PlayerInput.LeftButtonClicked())
|
||||
{
|
||||
GameMain.Config.Language = language;
|
||||
//reload tip in the selected language
|
||||
selectedTip = TextManager.Get("LoadingScreenTip", true);
|
||||
GameMain.Config.SetDefaultBindings(legacy: false);
|
||||
GameMain.Config.CheckBindings(useDefaults: true);
|
||||
WaitForLanguageSelection = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -356,7 +356,7 @@ namespace Barotrauma
|
||||
|
||||
Point? minSize = null, maxSize = null;
|
||||
if (element.Attribute("minsize") != null) minSize = element.GetAttributePoint("minsize", Point.Zero);
|
||||
//if (element.Attribute("maxsize") != null) maxSize = element.GetAttributePoint("maxsize", new Point(1000, 1000));
|
||||
if (element.Attribute("maxsize") != null) maxSize = element.GetAttributePoint("maxsize", new Point(1000, 1000));
|
||||
|
||||
RectTransform rectTransform;
|
||||
if (element.Attribute("relativesize") != null)
|
||||
|
||||
@@ -334,7 +334,7 @@ namespace Barotrauma
|
||||
SoundManager.SetCategoryGainMultiplier("ui", Config.SoundVolume);
|
||||
SoundManager.SetCategoryGainMultiplier("waterambience", Config.SoundVolume);
|
||||
SoundManager.SetCategoryGainMultiplier("music", Config.MusicVolume);
|
||||
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume * 5.0f);
|
||||
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume);
|
||||
if (Config.EnableSplashScreen)
|
||||
{
|
||||
var pendingSplashScreens = TitleScreen.PendingSplashScreens;
|
||||
@@ -666,7 +666,7 @@ namespace Barotrauma
|
||||
(NetworkMember == null || !NetworkMember.GameStarted);
|
||||
|
||||
#if !DEBUG
|
||||
if (NetworkMember == null && !WindowActive && !paused && true && Screen.Selected != MainMenuScreen && Config.PauseOnFocusLost)
|
||||
if (NetworkMember == null && !WindowActive && !paused && true && Screen.Selected != MainMenuScreen)
|
||||
{
|
||||
GUI.TogglePauseMenu();
|
||||
paused = true;
|
||||
@@ -812,17 +812,19 @@ namespace Barotrauma
|
||||
// ToDo: Move texts/links to localization, when possible.
|
||||
public void ShowBugReporter()
|
||||
{
|
||||
var msgBox = new GUIMessageBox("", "");
|
||||
var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.05f };
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("bugreportbutton"), "");
|
||||
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>>()
|
||||
{
|
||||
new Pair<string, string>("Barotrauma Feedback Form","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("bugreportfeedbackform"),"https://barotraumagame.com/feedback"),
|
||||
new Pair<string, string>(TextManager.Get("bugreportgithubform"),"https://github.com/Regalis11/Barotrauma/issues/new?template=bug_report.md")
|
||||
};
|
||||
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,
|
||||
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;
|
||||
|
||||
@@ -747,7 +747,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (orderGiver == null || orderGiver.CurrentHull == null) { return; }
|
||||
var hull = orderGiver.CurrentHull;
|
||||
AddOrder(new Order(order.Prefab, hull, null, orderGiver), order.Prefab.FadeOutTime);
|
||||
AddOrder(new Order(order.Prefab, hull, null), order.Prefab.FadeOutTime);
|
||||
if (IsSinglePlayer)
|
||||
{
|
||||
orderGiver.Speak(
|
||||
@@ -1350,7 +1350,7 @@ namespace Barotrauma
|
||||
bool hasFires = Character.Controlled.CurrentHull.FireSources.Count > 0;
|
||||
ToggleReportButton("reportfire", hasFires);
|
||||
|
||||
bool hasLeaks = Character.Controlled.CurrentHull.Submarine != null && Character.Controlled.CurrentHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f);
|
||||
bool hasLeaks = Character.Controlled.CurrentHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f);
|
||||
ToggleReportButton("reportbreach", hasLeaks);
|
||||
|
||||
bool hasIntruders = Character.CharacterList.Any(c => c.CurrentHull == Character.Controlled.CurrentHull && AIObjectiveFightIntruders.IsValidTarget(Character.Controlled, c));
|
||||
|
||||
@@ -233,9 +233,9 @@ namespace Barotrauma.Tutorials
|
||||
|
||||
//patient 1 requests first aid
|
||||
patient1.CanSpeak = true;
|
||||
var newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), patient1.CurrentHull, null, orderGiver: patient1);
|
||||
var newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), patient1.CurrentHull, null);
|
||||
GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime);
|
||||
patient1.Speak(newOrder.GetChatMessage("", patient1.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order);
|
||||
patient1.Speak(newOrder.GetChatMessage("", patient1.CurrentHull?.RoomName, givingOrderToSelf: false), ChatMessageType.Order);
|
||||
patient1.AIController.Enabled = true;
|
||||
|
||||
while (doctor.CurrentHull != patient1.CurrentHull)
|
||||
@@ -317,9 +317,9 @@ namespace Barotrauma.Tutorials
|
||||
|
||||
//patient calls for help
|
||||
patient2.CanSpeak = true;
|
||||
newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), patient2.CurrentHull, null, orderGiver: patient2);
|
||||
newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), patient2.CurrentHull, null);
|
||||
GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime);
|
||||
patient2.Speak(newOrder.GetChatMessage("", patient1.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order);
|
||||
patient2.Speak(newOrder.GetChatMessage("", patient1.CurrentHull?.RoomName, givingOrderToSelf: false), ChatMessageType.Order);
|
||||
patient2.AIController.Enabled = true;
|
||||
patient2.Oxygen = -50;
|
||||
CoroutineManager.StartCoroutine(KeepPatientAlive(patient2), "KeepPatient2Alive");
|
||||
@@ -369,7 +369,7 @@ namespace Barotrauma.Tutorials
|
||||
|
||||
double subEnterTime = Timing.TotalTime;
|
||||
|
||||
bool[] patientCalledHelp = new bool[] { false, false, false, false, false, false };
|
||||
bool[] patientCalledHelp = new bool[] { false, false, false };
|
||||
while (subPatients.Any(p => p.Vitality < p.MaxVitality * 0.9f && !p.IsDead))
|
||||
{
|
||||
for (int i = 0; i < subPatients.Count; i++)
|
||||
@@ -378,10 +378,10 @@ namespace Barotrauma.Tutorials
|
||||
//(within 1 minute intervals of entering the sub)
|
||||
if (!patientCalledHelp[i] && Timing.TotalTime > subEnterTime + 60 * (i + 1))
|
||||
{
|
||||
newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), subPatients[i].CurrentHull, null, orderGiver: subPatients[i]);
|
||||
newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), subPatients[i].CurrentHull, null);
|
||||
GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime);
|
||||
|
||||
string message = newOrder.GetChatMessage("", subPatients[i].CurrentHull?.DisplayName, givingOrderToSelf: false);
|
||||
string message = newOrder.GetChatMessage("", subPatients[i].CurrentHull?.RoomName, givingOrderToSelf: false);
|
||||
if (subPatients[i].CanSpeak)
|
||||
{
|
||||
subPatients[i].Speak(message, ChatMessageType.Order);
|
||||
|
||||
@@ -293,7 +293,7 @@ namespace Barotrauma.Tutorials
|
||||
|
||||
// Room 3
|
||||
do { yield return null; } while (!mechanic_weldingObjectiveSensor.MotionDetected);
|
||||
TriggerTutorialSegment(2, GameMain.Config.KeyBind(InputType.Aim), GameMain.Config.KeyBind(InputType.Shoot)); // Welding objective
|
||||
TriggerTutorialSegment(2, GameMain.Config.KeyBind(InputType.Shoot), GameMain.Config.KeyBind(InputType.Aim)); // Welding objective
|
||||
do
|
||||
{
|
||||
if (!mechanic.HasEquippedItem("divingmask"))
|
||||
@@ -334,13 +334,14 @@ namespace Barotrauma.Tutorials
|
||||
//TriggerTutorialSegment(11, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Up), GameMain.Config.KeyBind(InputType.Down), GameMain.Config.KeyBind(InputType.Select)); // Ladder objective
|
||||
//do { yield return null; } while (!mechanic_ladderSensor.MotionDetected);
|
||||
//RemoveCompletedObjective(segments[11]);
|
||||
yield return new WaitForSeconds(2f);
|
||||
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.News"), ChatMessageType.Radio, null);
|
||||
yield return new WaitForSeconds(1f);
|
||||
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Fire"), ChatMessageType.Radio, null);
|
||||
|
||||
yield return new WaitForSeconds(6f);
|
||||
|
||||
// Room 4
|
||||
do { yield return null; } while (!mechanic_thirdDoor.IsOpen);
|
||||
yield return new WaitForSeconds(1f);
|
||||
mechanic_fire = new DummyFireSource(new Vector2(20f, 2f), Item.ItemList.Find(i => i.HasTag("mechanic_fire")).WorldPosition);
|
||||
//do { yield return null; } while (!mechanic_craftingObjectiveSensor.MotionDetected);
|
||||
TriggerTutorialSegment(4); // Deconstruct
|
||||
|
||||
@@ -405,7 +405,6 @@ namespace Barotrauma.Tutorials
|
||||
private void ReplaySegmentVideo(TutorialSegment segment)
|
||||
{
|
||||
if (ContentRunning) return;
|
||||
Inventory.draggingItem = null;
|
||||
ContentRunning = true;
|
||||
LoadVideo(segment);
|
||||
//videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, callback: () => ContentRunning = false);
|
||||
@@ -527,7 +526,7 @@ namespace Barotrauma.Tutorials
|
||||
titleBlock.RectTransform.IsFixedSize = true;
|
||||
}
|
||||
|
||||
var textBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoContent.RectTransform), " " + text, wrap: true);
|
||||
var textBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoContent.RectTransform), text, wrap: true);
|
||||
textBlock.RectTransform.IsFixedSize = true;
|
||||
|
||||
infoBoxClosedCallback = callback;
|
||||
|
||||
@@ -85,13 +85,6 @@ namespace Barotrauma
|
||||
TextManager.Get("Settings"), textAlignment: Alignment.TopLeft, font: GUI.LargeFont)
|
||||
{ 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));
|
||||
|
||||
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);
|
||||
|
||||
/// Graphics tab --------------------------------------------------------------
|
||||
@@ -464,10 +463,6 @@ namespace Barotrauma
|
||||
{
|
||||
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"));
|
||||
directionalVoiceChat.Selected = UseDirectionalVoiceChat;
|
||||
@@ -755,7 +750,7 @@ namespace Barotrauma
|
||||
OnClicked = (button, data) =>
|
||||
{
|
||||
// TODO: add a prompt
|
||||
LoadDefaultConfig(setLanguage: false);
|
||||
LoadDefaultConfig();
|
||||
CheckBindings(true);
|
||||
RefreshItemMessages();
|
||||
ApplySettings();
|
||||
|
||||
@@ -543,10 +543,7 @@ namespace Barotrauma
|
||||
//equipped item that can't be put in the inventory, use delayed dropping
|
||||
if (quickUseAction == QuickUseAction.Drop)
|
||||
{
|
||||
slots[i].QuickUseButtonToolTip =
|
||||
TextManager.Get("QuickUseAction.HoldToUnequip", returnNull: true) ??
|
||||
(GameMain.Config.Language == "English" ? "Hold to unequip" : TextManager.Get("QuickUseAction.Unequip"));
|
||||
|
||||
slots[i].QuickUseButtonToolTip = "Hold to unequip";
|
||||
if (PlayerInput.LeftButtonHeld())
|
||||
{
|
||||
slots[i].QuickUseTimer = Math.Max(0.1f, slots[i].QuickUseTimer + deltaTime);
|
||||
|
||||
@@ -105,8 +105,7 @@ namespace Barotrauma.Items.Components
|
||||
textBlock = new GUITextBlock(new RectTransform(item.Rect.Size), "",
|
||||
textColor: textColor, font: GUI.UnscaledSmallFont, textAlignment: Alignment.Center, wrap: true, style: null)
|
||||
{
|
||||
TextDepth = item.SpriteDepth - 0.00001f,
|
||||
RoundToNearestPixel = false,
|
||||
TextDepth = item.SpriteDepth - 0.0001f,
|
||||
TextScale = TextScale
|
||||
};
|
||||
}
|
||||
|
||||
@@ -36,9 +36,7 @@ namespace Barotrauma.Items.Components
|
||||
RelativeSpacing = 0.05f
|
||||
};
|
||||
|
||||
int indicatorSize = (int)(30 * GUI.Scale);
|
||||
|
||||
powerIndicator = new GUITickBox(new RectTransform(new Point(indicatorSize, indicatorSize), content.RectTransform),
|
||||
powerIndicator = new GUITickBox(new RectTransform(new Point(30, 30), content.RectTransform),
|
||||
TextManager.Get("EnginePowered"), style: "IndicatorLightGreen")
|
||||
{
|
||||
CanBeFocused = false
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
foreach (FabricationRecipe fi in fabricationRecipes)
|
||||
{
|
||||
GUIFrame frame = new GUIFrame(new RectTransform(new Point(itemList.Rect.Width, (int)(30 * GUI.yScale)), itemList.Content.RectTransform), style: null)
|
||||
GUIFrame frame = new GUIFrame(new RectTransform(new Point(itemList.Rect.Width, 30), itemList.Content.RectTransform), style: null)
|
||||
{
|
||||
UserData = fi,
|
||||
HoverColor = Color.Gold * 0.2f,
|
||||
@@ -116,7 +116,7 @@ namespace Barotrauma.Items.Components
|
||||
ToolTip = fi.TargetItem.Description
|
||||
};
|
||||
|
||||
GUITextBlock textBlock = new GUITextBlock(new RectTransform(Vector2.Zero, frame.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point((int)(50 * GUI.xScale), 0) },
|
||||
GUITextBlock textBlock = new GUITextBlock(new RectTransform(Vector2.Zero, frame.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point(50, 0) },
|
||||
fi.DisplayName)
|
||||
{
|
||||
ToolTip = fi.TargetItem.Description
|
||||
@@ -125,7 +125,7 @@ namespace Barotrauma.Items.Components
|
||||
var itemIcon = fi.TargetItem.InventoryIcon ?? fi.TargetItem.sprite;
|
||||
if (itemIcon != null)
|
||||
{
|
||||
GUIImage img = new GUIImage(new RectTransform(new Point((int)(30 * GUI.Scale)), frame.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point((int)(3 * GUI.xScale), 0) },
|
||||
GUIImage img = new GUIImage(new RectTransform(new Point(30, 30), frame.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point(3, 0) },
|
||||
itemIcon, scaleToFit: true)
|
||||
{
|
||||
Color = fi.TargetItem.InventoryIconColor,
|
||||
|
||||
@@ -114,9 +114,9 @@ namespace Barotrauma.Items.Components
|
||||
Vector2 textSize = GUI.Font.MeasureString(text);
|
||||
Vector2 textPos = child.Center;
|
||||
if (textPos.X + textSize.X / 2 > submarineContainer.Rect.Right)
|
||||
textPos.X -= ((textPos.X + textSize.X / 2) - submarineContainer.Rect.Right) + 10 * GUI.xScale;
|
||||
textPos.X -= ((textPos.X + textSize.X / 2) - submarineContainer.Rect.Right) + 10;
|
||||
if (textPos.X - textSize.X / 2 < submarineContainer.Rect.X)
|
||||
textPos.X += (submarineContainer.Rect.X - (textPos.X - textSize.X / 2)) + 10 * GUI.xScale;
|
||||
textPos.X += (submarineContainer.Rect.X - (textPos.X - textSize.X / 2)) + 10;
|
||||
GUI.DrawString(spriteBatch, textPos - textSize / 2, text,
|
||||
Color.Orange * (float)Math.Abs(Math.Sin(Timing.TotalTime)), Color.Black * 0.8f);
|
||||
break;
|
||||
@@ -269,7 +269,7 @@ namespace Barotrauma.Items.Components
|
||||
start.Y = -start.Y;
|
||||
Vector2 end = (sub.HullVertices[(i + 1) % sub.HullVertices.Count] + offset) * displayScale;
|
||||
end.Y = -end.Y;
|
||||
GUI.DrawLine(spriteBatch, center + start, center + end, Color.DarkCyan * Rand.Range(0.3f, 0.35f), width: (int)(10 * GUI.Scale));
|
||||
GUI.DrawLine(spriteBatch, center + start, center + end, Color.DarkCyan * Rand.Range(0.3f, 0.35f), width: 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
GUIFrame paddedFrame = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.8f), GuiFrame.RectTransform, Anchor.Center), style: null);
|
||||
|
||||
isActiveSlider = new GUIScrollBar(new RectTransform(new Point((int)(50 * GUI.Scale), (int)(100 * GUI.Scale)), paddedFrame.RectTransform, Anchor.CenterLeft),
|
||||
isActiveSlider = new GUIScrollBar(new RectTransform(new Point(50, 100), paddedFrame.RectTransform, Anchor.CenterLeft),
|
||||
barSize: 0.2f, style: "OnOffLever")
|
||||
{
|
||||
IsBooleanSwitch = true,
|
||||
@@ -52,7 +52,7 @@ namespace Barotrauma.Items.Components
|
||||
MaxValue = 0.75f
|
||||
};
|
||||
var sliderHandle = isActiveSlider.GetChild<GUIButton>();
|
||||
sliderHandle.RectTransform.NonScaledSize = new Point((int)(84 * GUI.Scale), sliderHandle.Rect.Height);
|
||||
sliderHandle.RectTransform.NonScaledSize = new Point(84, sliderHandle.Rect.Height);
|
||||
isActiveSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) =>
|
||||
{
|
||||
bool active = scrollBar.BarScroll < 0.5f;
|
||||
@@ -73,7 +73,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
var rightArea = new GUILayoutGroup(new RectTransform(new Vector2(0.75f, 1.0f), paddedFrame.RectTransform, Anchor.CenterRight)) { RelativeSpacing = 0.1f };
|
||||
|
||||
powerIndicator = new GUITickBox(new RectTransform(new Point((int)(30 * GUI.Scale)), rightArea.RectTransform), TextManager.Get("PumpPowered"), style: "IndicatorLightGreen")
|
||||
powerIndicator = new GUITickBox(new RectTransform(new Point(30, 30), rightArea.RectTransform), TextManager.Get("PumpPowered"), style: "IndicatorLightGreen")
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
@@ -89,7 +89,7 @@ namespace Barotrauma.Items.Components
|
||||
RelativeSpacing = 0.05f
|
||||
};
|
||||
|
||||
var outLabel = 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("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")
|
||||
{
|
||||
@@ -109,10 +109,9 @@ namespace Barotrauma.Items.Components
|
||||
return true;
|
||||
}
|
||||
};
|
||||
var inLabel = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1.0f), sliderArea.RectTransform),
|
||||
TextManager.Get("PumpIn"), textAlignment: Alignment.Center, wrap: true, font: GUI.SmallFont);
|
||||
|
||||
GUITextBlock.AutoScaleAndNormalize(outLabel, inLabel);
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.15f, 1.0f), sliderArea.RectTransform),
|
||||
TextManager.Get("PumpIn"), textAlignment: Alignment.Center, wrap: true, font: GUI.SmallFont);
|
||||
}
|
||||
|
||||
public override void OnItemLoaded()
|
||||
|
||||
@@ -441,8 +441,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
Vector2 sector1 = MathUtils.RotatePointAroundTarget(pingDirection * DisplayRadius, Vector2.Zero, DirectionalPingSector * 0.5f);
|
||||
Vector2 sector2 = MathUtils.RotatePointAroundTarget(pingDirection * DisplayRadius, Vector2.Zero, -DirectionalPingSector * 0.5f);
|
||||
DrawLine(spriteBatch, Vector2.Zero, sector1, Color.LightCyan * 0.2f * directionalPingVisibility, width: 3);
|
||||
DrawLine(spriteBatch, Vector2.Zero, sector2, Color.LightCyan * 0.2f * directionalPingVisibility, width: 3);
|
||||
DrawLine(spriteBatch, center, center + sector1, Color.LightCyan * 0.2f * directionalPingVisibility, width: 3);
|
||||
DrawLine(spriteBatch, center, center + sector2, Color.LightCyan * 0.2f * directionalPingVisibility, width: 3);
|
||||
}
|
||||
|
||||
if (GameMain.DebugDraw)
|
||||
|
||||
@@ -14,21 +14,19 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (GuiFrame == null) return;
|
||||
|
||||
Point indicatorSize = new Point((int)(30 * GUI.Scale));
|
||||
|
||||
var paddedFrame = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.7f), GuiFrame.RectTransform, Anchor.Center), style: null);
|
||||
powerIndicator = new GUITickBox(new RectTransform(indicatorSize, paddedFrame.RectTransform),
|
||||
powerIndicator = new GUITickBox(new RectTransform(new Point(30, 30), paddedFrame.RectTransform),
|
||||
TextManager.Get("PowerTransferPowered"), style: "IndicatorLightGreen")
|
||||
{
|
||||
Enabled = false
|
||||
};
|
||||
highVoltageIndicator = new GUITickBox(new RectTransform(indicatorSize, paddedFrame.RectTransform) { AbsoluteOffset = new Point(0, (int)(40 * GUI.yScale)) },
|
||||
highVoltageIndicator = new GUITickBox(new RectTransform(new Point(30, 30), paddedFrame.RectTransform) { AbsoluteOffset = new Point(0, 40) },
|
||||
TextManager.Get("PowerTransferHighVoltage"), style: "IndicatorLightRed")
|
||||
{
|
||||
ToolTip = TextManager.Get("PowerTransferTipOvervoltage"),
|
||||
Enabled = false
|
||||
};
|
||||
lowVoltageIndicator = new GUITickBox(new RectTransform(indicatorSize, paddedFrame.RectTransform) { AbsoluteOffset = new Point(0, (int)(80 * GUI.yScale)) },
|
||||
lowVoltageIndicator = new GUITickBox(new RectTransform(new Point(30, 30), paddedFrame.RectTransform) { AbsoluteOffset = new Point(0, 80) },
|
||||
TextManager.Get("PowerTransferLowVoltage"), style: "IndicatorLightRed")
|
||||
{
|
||||
ToolTip = TextManager.Get("PowerTransferTipLowvoltage"),
|
||||
|
||||
@@ -57,15 +57,15 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 rightPos = new Vector2(x + width - 130 * GUI.xScale, y + 80 * GUI.yScale);
|
||||
Vector2 leftPos = new Vector2(x + 130 * GUI.xScale, y + 80 * GUI.yScale);
|
||||
Vector2 rightPos = new Vector2(x + width - 130, y + 80);
|
||||
Vector2 leftPos = new Vector2(x + 130, y + 80);
|
||||
|
||||
Vector2 rightWirePos = new Vector2(x + width - 5 * GUI.xScale, y + 30 * GUI.yScale);
|
||||
Vector2 leftWirePos = new Vector2(x + 5 * GUI.xScale, y + 30 * GUI.yScale);
|
||||
Vector2 rightWirePos = new Vector2(x + width - 5, y + 30);
|
||||
Vector2 leftWirePos = new Vector2(x + 5, y + 30);
|
||||
|
||||
int wireInterval = (height - (int)(20 * GUI.yScale)) / Math.Max(totalWireCount, 1);
|
||||
int connectorIntervalLeft = (height - (int)(100 * GUI.yScale)) / Math.Max(panel.Connections.Count(c => c.IsOutput), 1);
|
||||
int connectorIntervalRight = (height - (int)(100 * GUI.yScale)) / Math.Max(panel.Connections.Count(c => !c.IsOutput), 1);
|
||||
int wireInterval = (height - 20) / Math.Max(totalWireCount, 1);
|
||||
int connectorIntervalLeft = (height - 100) / Math.Max(panel.Connections.Count(c => c.IsOutput), 1);
|
||||
int connectorIntervalRight = (height - 100) / Math.Max(panel.Connections.Count(c => !c.IsOutput), 1);
|
||||
|
||||
foreach (Connection c in panel.Connections)
|
||||
{
|
||||
@@ -84,7 +84,7 @@ namespace Barotrauma.Items.Components
|
||||
if (c.IsOutput)
|
||||
{
|
||||
c.Draw(spriteBatch, panel, rightPos,
|
||||
new Vector2(rightPos.X - GUI.SmallFont.MeasureString(c.DisplayName).X - 20 * GUI.xScale, rightPos.Y + 3 * GUI.yScale),
|
||||
new Vector2(rightPos.X - GUI.SmallFont.MeasureString(c.DisplayName).X - 20, rightPos.Y + 3),
|
||||
rightWirePos,
|
||||
mouseInRect, equippedWire,
|
||||
wireInterval);
|
||||
@@ -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)
|
||||
{
|
||||
//spriteBatch.DrawString(GUI.SmallFont, Name, new Vector2(labelPos.X, labelPos.Y-10), Color.White);
|
||||
GUI.DrawString(spriteBatch, labelPos, DisplayName, IsPower ? Color.Red : Color.White, Color.Black, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, labelPos, Name, IsPower ? Color.Red : Color.White, Color.Black, 0, GUI.SmallFont);
|
||||
|
||||
connectionSprite.Draw(spriteBatch, position);
|
||||
|
||||
|
||||
@@ -281,8 +281,7 @@ namespace Barotrauma
|
||||
new Vector2(rect.Width, rect.Height),
|
||||
color: color,
|
||||
textureScale: TextureScale * Scale,
|
||||
startOffset: backGroundOffset,
|
||||
depth: Math.Max(Prefab.BackgroundSprite.Depth, depth + 0.000001f));
|
||||
startOffset: backGroundOffset);
|
||||
|
||||
if (UseDropShadow)
|
||||
{
|
||||
|
||||
@@ -66,13 +66,13 @@ namespace Barotrauma.Networking
|
||||
if (order.TargetAllCharacters)
|
||||
{
|
||||
GameMain.GameSession?.CrewManager?.AddOrder(
|
||||
new Order(order.Prefab, targetEntity, (targetEntity as Item)?.Components.FirstOrDefault(ic => ic.GetType() == order.ItemComponentType), orderGiver: senderCharacter),
|
||||
new Order(order.Prefab, targetEntity, (targetEntity as Item)?.Components.FirstOrDefault(ic => ic.GetType() == order.ItemComponentType)),
|
||||
order.Prefab.FadeOutTime);
|
||||
}
|
||||
else if (targetCharacter != null)
|
||||
{
|
||||
targetCharacter.SetOrder(
|
||||
new Order(order.Prefab, targetEntity, (targetEntity as Item)?.Components.FirstOrDefault(ic => ic.GetType() == order.ItemComponentType), orderGiver: senderCharacter),
|
||||
new Order(order.Prefab, targetEntity, (targetEntity as Item)?.Components.FirstOrDefault(ic => ic.GetType() == order.ItemComponentType)),
|
||||
orderOption, senderCharacter);
|
||||
}
|
||||
|
||||
|
||||
@@ -903,7 +903,7 @@ namespace Barotrauma.Networking
|
||||
connected = false;
|
||||
ConnectToServer(serverIP);
|
||||
}
|
||||
if (clientID == myID)
|
||||
else
|
||||
{
|
||||
string msg = "";
|
||||
if (disconnectReason == DisconnectReason.Unknown)
|
||||
@@ -921,18 +921,8 @@ namespace Barotrauma.Networking
|
||||
msg += TextManager.GetServerMessage(splitMsg[i]);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
var msgBox = new GUIMessageBox(TextManager.Get(allowReconnect ? "ConnectionLost" : "CouldNotConnectToServer"), msg);
|
||||
msgBox.Buttons[0].OnClicked += ReturnToServerList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ namespace Barotrauma
|
||||
case "text":
|
||||
AddTextElement(subElement, listBox.Content.RectTransform);
|
||||
break;
|
||||
case "gridtext":
|
||||
AddGridTextElement(subElement, listBox.Content.RectTransform);
|
||||
break;
|
||||
case "spacing":
|
||||
AddSpacingElement(subElement, listBox.Content.RectTransform);
|
||||
break;
|
||||
@@ -41,9 +38,9 @@ namespace Barotrauma
|
||||
listBox.UpdateScrollBarSize();
|
||||
}
|
||||
|
||||
private GUIComponent AddTextElement(XElement element, RectTransform parent, string overrideText = null, Anchor anchor = Anchor.Center)
|
||||
private void AddTextElement(XElement element, RectTransform parent)
|
||||
{
|
||||
var text = overrideText ?? element.ElementInnerText().Replace(@"\n", "\n");
|
||||
var text = element.ElementInnerText().Replace(@"\n", "\n");
|
||||
Color color = element.GetAttributeColor("color", Color.White);
|
||||
float scale = element.GetAttributeFloat("scale", 1.0f);
|
||||
Alignment alignment = Alignment.Center;
|
||||
@@ -72,7 +69,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
var textHolder = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.0f), parent), style: null);
|
||||
var textBlock = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), textHolder.RectTransform, anchor),
|
||||
var textBlock = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), textHolder.RectTransform, Anchor.Center),
|
||||
text,
|
||||
color,
|
||||
font,
|
||||
@@ -84,32 +81,6 @@ namespace Barotrauma
|
||||
textBlock.RectTransform.IsFixedSize = textHolder.RectTransform.IsFixedSize = true;
|
||||
textBlock.RectTransform.NonScaledSize = new Point(textBlock.Rect.Width, textBlock.Rect.Height);
|
||||
textHolder.RectTransform.NonScaledSize = new Point(textHolder.Rect.Width, textBlock.Rect.Height);
|
||||
return textHolder;
|
||||
}
|
||||
|
||||
private void AddGridTextElement(XElement element, RectTransform parent)
|
||||
{
|
||||
var text = element.ElementInnerText().Replace(@"\n", "\n");
|
||||
string[] elements = text.Split(',');
|
||||
RectTransform lineContainer = null;
|
||||
for (int i = 0; i < elements.Length; i++)
|
||||
{
|
||||
switch (i % 3)
|
||||
{
|
||||
case 0:
|
||||
lineContainer = AddTextElement(element, parent, elements[i], Anchor.CenterLeft).RectTransform;
|
||||
lineContainer.Anchor = Anchor.TopCenter;
|
||||
lineContainer.Pivot = Pivot.TopCenter;
|
||||
lineContainer.NonScaledSize = new Point((int)(parent.NonScaledSize.X * 0.7f), lineContainer.NonScaledSize.Y);
|
||||
break;
|
||||
case 1:
|
||||
AddTextElement(element, lineContainer, elements[i], Anchor.Center).GetChild<GUITextBlock>().TextAlignment = Alignment.Center;
|
||||
break;
|
||||
case 2:
|
||||
AddTextElement(element, lineContainer, elements[i], Anchor.CenterRight).GetChild<GUITextBlock>().TextAlignment = Alignment.CenterRight;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddSpacingElement(XElement element, RectTransform parent)
|
||||
|
||||
@@ -440,21 +440,9 @@ namespace Barotrauma
|
||||
GameMain.Config.SettingsFrame.RectTransform.RelativeSize = Vector2.One;
|
||||
break;
|
||||
case Tab.JoinServer:
|
||||
if (!GameMain.Config.CampaignDisclaimerShown)
|
||||
{
|
||||
selectedTab = 0;
|
||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.JoinServer); });
|
||||
return true;
|
||||
}
|
||||
GameMain.ServerListScreen.Select();
|
||||
break;
|
||||
case Tab.HostServer:
|
||||
if (!GameMain.Config.CampaignDisclaimerShown)
|
||||
{
|
||||
selectedTab = 0;
|
||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.HostServer); });
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Tab.Tutorials:
|
||||
if (!GameMain.Config.CampaignDisclaimerShown)
|
||||
@@ -802,7 +790,6 @@ namespace Barotrauma
|
||||
for (int i = legalCrap.Length - 1; i >= 0; i--)
|
||||
{
|
||||
Vector2 textSize = GUI.SmallFont.MeasureString(legalCrap[i]);
|
||||
textSize = new Vector2((int)textSize.X, (int)textSize.Y);
|
||||
bool mouseOn = i == 0 &&
|
||||
PlayerInput.MousePosition.X > textPos.X - textSize.X && PlayerInput.MousePosition.X < textPos.X &&
|
||||
PlayerInput.MousePosition.Y > textPos.Y - textSize.Y && PlayerInput.MousePosition.Y < textPos.Y;
|
||||
|
||||
@@ -31,8 +31,6 @@ namespace Barotrauma
|
||||
private bool masterServerResponded;
|
||||
private IRestResponse masterServerResponse;
|
||||
|
||||
private GUIButton refreshButton;
|
||||
|
||||
private float[] columnRelativeWidth;
|
||||
|
||||
//filters
|
||||
@@ -142,7 +140,7 @@ namespace Barotrauma
|
||||
OnClicked = GameMain.MainMenuScreen.ReturnToMainMenu
|
||||
};
|
||||
|
||||
refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center),
|
||||
var refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center),
|
||||
"", style: "GUIButtonRefresh") {
|
||||
|
||||
ToolTip = TextManager.Get("ServerListRefresh"),
|
||||
@@ -204,7 +202,7 @@ namespace Barotrauma
|
||||
|
||||
private bool RefreshJoinButtonState(GUIComponent component, object obj)
|
||||
{
|
||||
if (obj == null || waitingForRefresh) { return false; }
|
||||
if (obj == null || waitingForRefresh) return false;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
|
||||
{
|
||||
@@ -268,6 +266,16 @@ namespace Barotrauma
|
||||
joinButton.Enabled = false;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(clientNameBox.Text))
|
||||
{
|
||||
joinButton.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
clientNameBox.Flash();
|
||||
joinButton.Enabled = false;
|
||||
}
|
||||
|
||||
ServerInfo serverInfo;
|
||||
try
|
||||
{
|
||||
@@ -292,11 +300,8 @@ namespace Barotrauma
|
||||
ipBox.Text = null;
|
||||
joinButton.Enabled = false;
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
|
||||
TextManager.Get("RefreshingServerList"), textAlignment: Alignment.Center)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
|
||||
TextManager.Get("RefreshingServerList"));
|
||||
|
||||
CoroutineManager.StartCoroutine(WaitForRefresh());
|
||||
|
||||
@@ -317,19 +322,17 @@ namespace Barotrauma
|
||||
if (!SteamManager.GetServers(AddToServerList, UpdateServerInfo, ServerQueryFinished))
|
||||
{
|
||||
serverList.ClearChildren();
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
|
||||
TextManager.Get("ServerListNoSteamConnection"), textAlignment: Alignment.Center)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
|
||||
TextManager.Get("ServerListNoSteamConnection"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CoroutineManager.StartCoroutine(SendMasterServerRequest());
|
||||
waitingForRefresh = false;
|
||||
}
|
||||
|
||||
waitingForRefresh = false;
|
||||
|
||||
refreshDisableTimer = DateTime.Now + AllowedRefreshInterval;
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
@@ -394,11 +397,8 @@ namespace Barotrauma
|
||||
serverList.Content.ClearChildren();
|
||||
if (serverInfos.Count() == 0)
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
|
||||
TextManager.Get("NoServers"), textAlignment: Alignment.Center)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
|
||||
TextManager.Get("NoServers"));
|
||||
return;
|
||||
}
|
||||
foreach (ServerInfo serverInfo in serverInfos)
|
||||
@@ -538,7 +538,6 @@ namespace Barotrauma
|
||||
UserData = "noresults"
|
||||
};
|
||||
}
|
||||
waitingForRefresh = false;
|
||||
}
|
||||
|
||||
private IEnumerable<object> SendMasterServerRequest()
|
||||
|
||||
@@ -478,7 +478,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
var downloadBtn = new GUIButton(new RectTransform(new Point((int)(32 * GUI.Scale)), rightColumn.RectTransform), "+", style: null)
|
||||
var downloadBtn = new GUIButton(new RectTransform(new Point(32, 32), rightColumn.RectTransform), "+", style: null)
|
||||
{
|
||||
Font = GUI.LargeFont,
|
||||
Color = new Color(38, 65, 86, 255),
|
||||
|
||||
@@ -294,8 +294,7 @@ namespace Barotrauma
|
||||
{
|
||||
value = "";
|
||||
}
|
||||
string propertyName = (entity.GetType().Name + "." + property.PropertyInfo.Name).ToLowerInvariant();
|
||||
string displayName = TextManager.Get(propertyName, returnNull: true) ?? property.GetAttribute<Editable>().DisplayName;
|
||||
string displayName = property.GetAttribute<Editable>().DisplayName;
|
||||
if (displayName == null)
|
||||
{
|
||||
displayName = property.Name.FormatCamelCaseWithSpaces();
|
||||
|
||||
@@ -2408,10 +2408,7 @@ namespace Barotrauma.Networking
|
||||
if (senderCharacter != null &&
|
||||
client.Character != null && !client.Character.IsDead)
|
||||
{
|
||||
if (senderCharacter != client.Character)
|
||||
{
|
||||
modifiedMessage = ChatMessage.ApplyDistanceEffect(message, (ChatMessageType)type, senderCharacter, client.Character);
|
||||
}
|
||||
modifiedMessage = ChatMessage.ApplyDistanceEffect(message, (ChatMessageType)type, senderCharacter, client.Character);
|
||||
|
||||
//too far to hear the msg -> don't send
|
||||
if (string.IsNullOrWhiteSpace(modifiedMessage)) continue;
|
||||
@@ -2460,16 +2457,13 @@ namespace Barotrauma.Networking
|
||||
if (message.Sender != null &&
|
||||
client.Character != null && !client.Character.IsDead)
|
||||
{
|
||||
if (message.Sender != client.Character)
|
||||
{
|
||||
modifiedMessage = ChatMessage.ApplyDistanceEffect(message.Text, messageType, message.Sender, client.Character);
|
||||
}
|
||||
modifiedMessage = ChatMessage.ApplyDistanceEffect(message.Text, messageType, message.Sender, client.Character);
|
||||
|
||||
//too far to hear the msg -> don't send
|
||||
if (string.IsNullOrWhiteSpace(modifiedMessage)) continue;
|
||||
}
|
||||
|
||||
SendDirectChatMessage(new OrderChatMessage(message.Order, message.OrderOption, message.TargetEntity, message.TargetCharacter, message.Sender), client);
|
||||
SendDirectChatMessage(message, client);
|
||||
}
|
||||
|
||||
string myReceivedMessage = message.Text;
|
||||
|
||||
@@ -361,9 +361,6 @@
|
||||
<Content Include="$(MSBuildThisFileDirectory)Content\Effects\waterbump.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)Content\Fonts\Exo2-SemiBold.otf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)Content\Fonts\NotoSans\NotoSansCJKsc-Bold.otf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
@@ -543,14 +543,6 @@ namespace Barotrauma
|
||||
{
|
||||
attackSimPos -= Character.Submarine.SimPosition;
|
||||
}
|
||||
else if (Character.Submarine != SelectedAiTarget.Entity.Submarine)
|
||||
{
|
||||
if (Character.Submarine != null && SelectedAiTarget.Entity.Submarine != null)
|
||||
{
|
||||
Vector2 diff = Character.Submarine.SimPosition - SelectedAiTarget.Entity.Submarine.SimPosition;
|
||||
attackSimPos -= diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Math.Abs(Character.AnimController.movement.X) > 0.1f && !Character.AnimController.InWater &&
|
||||
@@ -805,6 +797,7 @@ namespace Barotrauma
|
||||
{
|
||||
UpdateLimbAttack(deltaTime, AttackingLimb, attackSimPos, distance);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsSteeringThroughGap { get; private set; }
|
||||
|
||||
@@ -85,18 +85,12 @@ namespace Barotrauma
|
||||
|
||||
if (Character.Submarine != null || SelectedAiTarget?.Entity?.Submarine != null)
|
||||
{
|
||||
if (steeringManager != insideSteering)
|
||||
{
|
||||
insideSteering.Reset();
|
||||
}
|
||||
if (steeringManager != insideSteering) insideSteering.Reset();
|
||||
steeringManager = insideSteering;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (steeringManager != outsideSteering)
|
||||
{
|
||||
outsideSteering.Reset();
|
||||
}
|
||||
if (steeringManager != outsideSteering) outsideSteering.Reset();
|
||||
steeringManager = outsideSteering;
|
||||
}
|
||||
|
||||
@@ -301,7 +295,7 @@ namespace Barotrauma
|
||||
if (newOrder == null)
|
||||
{
|
||||
var orderPrefab = Order.PrefabList.Find(o => o.AITag == "reportintruders");
|
||||
newOrder = new Order(orderPrefab, c.CurrentHull, null, orderGiver: Character);
|
||||
newOrder = new Order(orderPrefab, c.CurrentHull, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,7 +305,7 @@ namespace Barotrauma
|
||||
if (newOrder == null)
|
||||
{
|
||||
var orderPrefab = Order.PrefabList.Find(o => o.AITag == "reportfire");
|
||||
newOrder = new Order(orderPrefab, hull, null, orderGiver: Character);
|
||||
newOrder = new Order(orderPrefab, hull, null);
|
||||
}
|
||||
}
|
||||
foreach (Character c in Character.CharacterList)
|
||||
@@ -323,7 +317,7 @@ namespace Barotrauma
|
||||
if (newOrder == null)
|
||||
{
|
||||
var orderPrefab = Order.PrefabList.Find(o => o.AITag == "requestfirstaid");
|
||||
newOrder = new Order(orderPrefab, c.CurrentHull, null, orderGiver: Character);
|
||||
newOrder = new Order(orderPrefab, c.CurrentHull, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -335,7 +329,7 @@ namespace Barotrauma
|
||||
if (newOrder == null)
|
||||
{
|
||||
var orderPrefab = Order.PrefabList.Find(o => o.AITag == "reportbreach");
|
||||
newOrder = new Order(orderPrefab, hull, null, orderGiver: Character);
|
||||
newOrder = new Order(orderPrefab, hull, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,7 +343,7 @@ namespace Barotrauma
|
||||
if (newOrder == null)
|
||||
{
|
||||
var orderPrefab = Order.PrefabList.Find(o => o.AITag == "reportbrokendevices");
|
||||
newOrder = new Order(orderPrefab, item.CurrentHull, item.Repairables?.FirstOrDefault(), orderGiver: Character);
|
||||
newOrder = new Order(orderPrefab, item.CurrentHull, item.Repairables?.FirstOrDefault());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -360,9 +354,6 @@ namespace Barotrauma
|
||||
if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime))
|
||||
{
|
||||
Character.Speak(newOrder.GetChatMessage("", Character.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order);
|
||||
#if SERVER
|
||||
GameMain.Server.SendOrderChatMessage(new OrderChatMessage(newOrder, "", Character.CurrentHull, null, Character));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -666,7 +657,7 @@ namespace Barotrauma
|
||||
{
|
||||
CurrentHullSafety = 0;
|
||||
}
|
||||
return CurrentHullSafety;
|
||||
return 0;
|
||||
}
|
||||
if (character == Character)
|
||||
{
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace Barotrauma
|
||||
{
|
||||
bool needsNewPath = currentPath != null && currentPath.Unreachable || Vector2.DistanceSquared(target, currentTarget) > 1;
|
||||
//find a new path if one hasn't been found yet or the target is different from the current target
|
||||
if (currentPath == null || needsNewPath || findPathTimer < -1.0f)
|
||||
if (currentPath == null || Vector2.DistanceSquared(target, currentTarget) > 1.0f || findPathTimer < -1.0f)
|
||||
{
|
||||
IsPathDirty = true;
|
||||
|
||||
@@ -163,11 +163,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
var newPath = pathFinder.FindPath(pos, target, "(Character: " + character.Name + ")");
|
||||
if (currentPath == null || needsNewPath || !newPath.Unreachable && newPath.Cost < currentPath.Cost)
|
||||
{
|
||||
currentPath = newPath;
|
||||
}
|
||||
currentPath = pathFinder.FindPath(pos, target, "(Character: " + character.Name + ")");
|
||||
|
||||
findPathTimer = Rand.Range(1.0f, 1.2f);
|
||||
|
||||
@@ -424,7 +420,7 @@ namespace Barotrauma
|
||||
// It's possible that we could reach another buttons.
|
||||
// If this becomes an issue, we could go through them here and check if any of them are reachable
|
||||
// (would have to cache a collection of buttons instead of a single reference in the CanAccess filter method above)
|
||||
//currentPath.Unreachable = true;
|
||||
currentPath.Unreachable = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Barotrauma
|
||||
if (character.CurrentHull == null)
|
||||
{
|
||||
currenthullSafety = 0;
|
||||
Priority = objectiveManager.CurrentOrder is AIObjectiveGoTo ? 0 : 100;
|
||||
Priority = 100;
|
||||
return;
|
||||
}
|
||||
if (character.OxygenAvailable < CharacterHealth.LowOxygenThreshold) { Priority = 100; }
|
||||
@@ -68,8 +68,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private Hull currentSafeHull;
|
||||
private Hull previousSafeHull;
|
||||
protected override void Act(float deltaTime)
|
||||
{
|
||||
var currentHull = character.AnimController.CurrentHull;
|
||||
@@ -109,20 +107,15 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
searchHullTimer = SearchHullInterval;
|
||||
previousSafeHull = currentSafeHull;
|
||||
currentSafeHull = FindBestHull();
|
||||
if (currentSafeHull == null)
|
||||
var bestHull = FindBestHull();
|
||||
if (bestHull != null && bestHull != currentHull)
|
||||
{
|
||||
currentSafeHull = previousSafeHull;
|
||||
}
|
||||
if (currentSafeHull != null && currentSafeHull != currentHull)
|
||||
{
|
||||
if (goToObjective?.Target != currentSafeHull)
|
||||
if (goToObjective?.Target != bestHull)
|
||||
{
|
||||
goToObjective = null;
|
||||
}
|
||||
TryAddSubObjective(ref goToObjective,
|
||||
constructor: () => new AIObjectiveGoTo(currentSafeHull, character, objectiveManager, getDivingGearIfNeeded: false)
|
||||
constructor: () => new AIObjectiveGoTo(bestHull, character, objectiveManager, getDivingGearIfNeeded: false)
|
||||
{
|
||||
// If we need diving gear, we should already have it, if possible.
|
||||
AllowGoingOutside = HumanAIController.HasDivingSuit(character)
|
||||
@@ -134,15 +127,7 @@ namespace Barotrauma
|
||||
goToObjective = null;
|
||||
}
|
||||
}
|
||||
if (goToObjective != null)
|
||||
{
|
||||
if (goToObjective.IsCompleted())
|
||||
{
|
||||
objectiveManager.GetObjective<AIObjectiveIdle>()?.Wander(deltaTime);
|
||||
}
|
||||
Priority = 0;
|
||||
return;
|
||||
}
|
||||
if (goToObjective != null) { return; }
|
||||
if (currentHull == null) { return; }
|
||||
//goto objective doesn't exist (a safe hull not found, or a path to a safe hull not found)
|
||||
// -> attempt to manually steer away from hazards
|
||||
@@ -181,8 +166,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
Priority = 0;
|
||||
objectiveManager.GetObjective<AIObjectiveIdle>()?.Wander(deltaTime);
|
||||
character.AIController.SteeringManager.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,11 +179,11 @@ namespace Barotrauma
|
||||
{
|
||||
if (hull.Submarine == null) { continue; }
|
||||
if (ignoredHulls != null && ignoredHulls.Contains(hull)) { continue; }
|
||||
if (unreachable.Contains(hull)) { continue; }
|
||||
float hullSafety = 0;
|
||||
if (character.CurrentHull != null)
|
||||
if (character.Submarine != null && SteeringManager == PathSteering)
|
||||
{
|
||||
// Inside
|
||||
// Inside or outside near the sub
|
||||
if (unreachable.Contains(hull)) { continue; }
|
||||
if (!character.Submarine.IsConnectedTo(hull.Submarine)) { continue; }
|
||||
hullSafety = HumanAIController.GetHullSafety(hull, character);
|
||||
// Vertical distance matters more than horizontal (climbing up/down is harder than moving horizontally)
|
||||
@@ -228,7 +212,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
// Outside
|
||||
if (hull.RoomName != null && hull.RoomName.ToLowerInvariant().Contains("airlock"))
|
||||
if (hull.RoomName?.ToLowerInvariant() == "airlock")
|
||||
{
|
||||
hullSafety = 100;
|
||||
}
|
||||
@@ -237,14 +221,13 @@ namespace Barotrauma
|
||||
// TODO: could also target gaps that get us inside?
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
if (item.CurrentHull != hull && item.HasTag("airlock"))
|
||||
if (item.CurrentHull == hull && item.HasTag("airlock"))
|
||||
{
|
||||
hullSafety = 100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: could we get a closest door to the outside and target the flowing hull if no airlock is found?
|
||||
// Huge preference for closer targets
|
||||
float distance = Vector2.DistanceSquared(character.WorldPosition, hull.WorldPosition);
|
||||
float distanceFactor = MathHelper.Lerp(1, 0.2f, MathUtils.InverseLerp(0, MathUtils.Pow(100000, 2), distance));
|
||||
|
||||
@@ -114,23 +114,11 @@ namespace Barotrauma
|
||||
{
|
||||
Vector2 currTargetSimPos = Vector2.Zero;
|
||||
currTargetSimPos = Target.SimPosition;
|
||||
// Take the sub position into account in the sim pos
|
||||
if (character.Submarine == null && Target.Submarine != null)
|
||||
{
|
||||
//currTargetSimPos += Target.Submarine.SimPosition;
|
||||
}
|
||||
else if (character.Submarine != null && Target.Submarine == null)
|
||||
//if character is inside the sub and target isn't, transform the position
|
||||
if (character.Submarine != null && Target.Submarine == null)
|
||||
{
|
||||
currTargetSimPos -= character.Submarine.SimPosition;
|
||||
}
|
||||
else if (character.Submarine != Target.Submarine)
|
||||
{
|
||||
if (character.Submarine != null && Target.Submarine != null)
|
||||
{
|
||||
Vector2 diff = character.Submarine.SimPosition - Target.Submarine.SimPosition;
|
||||
currTargetSimPos -= diff;
|
||||
}
|
||||
}
|
||||
character.AIController.SteeringManager.SteeringSeek(currTargetSimPos);
|
||||
if (getDivingGearIfNeeded)
|
||||
{
|
||||
@@ -159,6 +147,7 @@ namespace Barotrauma
|
||||
// First check the distance
|
||||
// Then the custom condition
|
||||
// And finally check if can interact (heaviest)
|
||||
if (repeat) { return false; }
|
||||
if (isCompleted) { return true; }
|
||||
if (Target == null)
|
||||
{
|
||||
@@ -166,16 +155,7 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
bool closeEnough = Vector2.DistanceSquared(Target.WorldPosition, character.WorldPosition) < CloseEnough * CloseEnough;
|
||||
if (repeat)
|
||||
{
|
||||
if (closeEnough)
|
||||
{
|
||||
character.AIController.SteeringManager.Reset();
|
||||
character.AnimController.TargetDir = Target.WorldPosition.X > character.WorldPosition.X ? Direction.Right : Direction.Left;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (closeEnough)
|
||||
if (closeEnough)
|
||||
{
|
||||
if (customCondition == null || customCondition())
|
||||
{
|
||||
|
||||
@@ -81,11 +81,7 @@ namespace Barotrauma
|
||||
Item.ItemList.FindAll(it => it.Components.Any(ic => ic.GetType() == orderPrefab.ItemComponentType));
|
||||
matchingItems.RemoveAll(it => it.Submarine != character.Submarine);
|
||||
var item = matchingItems.GetRandom();
|
||||
var order = new Order(
|
||||
orderPrefab,
|
||||
item ?? character.CurrentHull as Entity,
|
||||
item?.Components.FirstOrDefault(ic => ic.GetType() == orderPrefab.ItemComponentType),
|
||||
orderGiver: character);
|
||||
var order = new Order(orderPrefab, item ?? character.CurrentHull as Entity, item?.Components.FirstOrDefault(ic => ic.GetType() == orderPrefab.ItemComponentType));
|
||||
if (order == null) { continue; }
|
||||
var objective = CreateObjective(order, automaticOrder.option, character, automaticOrder.priorityModifier);
|
||||
if (objective != null)
|
||||
@@ -202,10 +198,6 @@ namespace Barotrauma
|
||||
{
|
||||
CurrentObjective?.TryComplete(deltaTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
character.AIController.SteeringManager.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetOrder(AIObjective objective)
|
||||
|
||||
@@ -39,9 +39,7 @@ namespace Barotrauma
|
||||
public Entity TargetEntity;
|
||||
public ItemComponent TargetItemComponent;
|
||||
public readonly bool UseController;
|
||||
public Controller ConnectedController;
|
||||
|
||||
public Character OrderGiver;
|
||||
public Controller ConnectedController;
|
||||
|
||||
public readonly string[] AppropriateJobs;
|
||||
public readonly string[] Options;
|
||||
@@ -122,7 +120,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public Order(Order prefab, Entity targetEntity, ItemComponent targetItem, Character orderGiver = null)
|
||||
public Order(Order prefab, Entity targetEntity, ItemComponent targetItem)
|
||||
{
|
||||
Prefab = prefab;
|
||||
|
||||
@@ -136,7 +134,6 @@ namespace Barotrauma
|
||||
TargetAllCharacters = prefab.TargetAllCharacters;
|
||||
AppropriateJobs = prefab.AppropriateJobs;
|
||||
FadeOutTime = prefab.FadeOutTime;
|
||||
OrderGiver = orderGiver;
|
||||
|
||||
TargetEntity = targetEntity;
|
||||
if (targetItem != null)
|
||||
|
||||
@@ -165,8 +165,8 @@ namespace Barotrauma
|
||||
{
|
||||
Vector2 nodePos = node.Position;
|
||||
|
||||
float xDiff = Math.Abs(start.X - nodePos.X);
|
||||
float yDiff = Math.Abs(start.Y - nodePos.Y);
|
||||
float xDiff = System.Math.Abs(start.X - nodePos.X);
|
||||
float yDiff = System.Math.Abs(start.Y - nodePos.Y);
|
||||
|
||||
if (yDiff > 1.0f && node.Waypoint.Ladders == null && node.Waypoint.Stairs == null)
|
||||
{
|
||||
@@ -190,7 +190,7 @@ namespace Barotrauma
|
||||
|
||||
if (body != null)
|
||||
{
|
||||
//if (body.UserData is Submarine) continue;
|
||||
if (body.UserData is Submarine) continue;
|
||||
if (body.UserData is Structure && !((Structure)body.UserData).IsPlatform) continue;
|
||||
if (body.UserData is Item && body.FixtureList[0].CollisionCategories.HasFlag(Physics.CollisionWall)) continue;
|
||||
}
|
||||
@@ -216,7 +216,7 @@ namespace Barotrauma
|
||||
{
|
||||
Vector2 nodePos = node.Position;
|
||||
|
||||
float dist = Vector2.DistanceSquared(end, nodePos);
|
||||
float dist = Vector2.Distance(end, nodePos);
|
||||
if (insideSubmarine)
|
||||
{
|
||||
//much higher cost to waypoints that are outside
|
||||
@@ -229,12 +229,19 @@ namespace Barotrauma
|
||||
//if searching for a path inside the sub, make sure the waypoint is visible
|
||||
if (insideSubmarine)
|
||||
{
|
||||
// Doesn't seem to work
|
||||
//var body = Submarine.CheckVisibility(end, node.Waypoint.SimPosition);
|
||||
//if (body != null && body.UserData is Structure)
|
||||
//{
|
||||
// continue;
|
||||
//}
|
||||
|
||||
var body = Submarine.PickBody(end, node.Waypoint.SimPosition, null,
|
||||
Physics.CollisionWall | Physics.CollisionLevel | Physics.CollisionStairs );
|
||||
|
||||
if (body != null)
|
||||
{
|
||||
//if (body.UserData is Submarine) continue;
|
||||
if (body.UserData is Submarine) continue;
|
||||
if (body.UserData is Structure && !((Structure)body.UserData).IsPlatform) continue;
|
||||
if (body.UserData is Item && body.FixtureList[0].CollisionCategories.HasFlag(Physics.CollisionWall)) continue;
|
||||
|
||||
|
||||
@@ -192,6 +192,14 @@ namespace Barotrauma
|
||||
|
||||
if (dist > maxDistance) return Vector2.Zero;
|
||||
|
||||
return -diff * (1.0f - dist / maxDistance) * weight;
|
||||
}
|
||||
|
||||
Vector2 diff = avoidObstaclePos.Value - host.SimPosition;
|
||||
float dist = diff.Length();
|
||||
|
||||
if (dist > maxDistance) return Vector2.Zero;
|
||||
|
||||
return -diff * (1.0f - dist / maxDistance) * weight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Barotrauma
|
||||
|
||||
public bool PauseOnFocusLost { get; set; } = true;
|
||||
public bool MuteOnFocusLost { get; set; }
|
||||
public bool UseDirectionalVoiceChat { get; set; } = true;
|
||||
public bool UseDirectionalVoiceChat { get; set; }
|
||||
|
||||
public enum VoiceMode
|
||||
{
|
||||
@@ -206,7 +206,7 @@ namespace Barotrauma
|
||||
{
|
||||
voiceChatVolume = MathHelper.Clamp(value, 0.0f, 1.0f);
|
||||
#if CLIENT
|
||||
GameMain.SoundManager?.SetCategoryGainMultiplier("voip", voiceChatVolume * 5.0f);
|
||||
GameMain.SoundManager?.SetCategoryGainMultiplier("voip", voiceChatVolume);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -302,6 +302,10 @@ namespace Barotrauma
|
||||
public void SetDefaultBindings(XDocument doc = null, bool legacy = false)
|
||||
{
|
||||
keyMapping = new KeyOrMouse[Enum.GetNames(typeof(InputType)).Length];
|
||||
keyMapping[(int)InputType.Up] = new KeyOrMouse(Keys.W);
|
||||
keyMapping[(int)InputType.Down] = new KeyOrMouse(Keys.S);
|
||||
keyMapping[(int)InputType.Left] = new KeyOrMouse(Keys.A);
|
||||
keyMapping[(int)InputType.Right] = new KeyOrMouse(Keys.D);
|
||||
keyMapping[(int)InputType.Run] = new KeyOrMouse(Keys.LeftShift);
|
||||
keyMapping[(int)InputType.Attack] = new KeyOrMouse(2);
|
||||
keyMapping[(int)InputType.Crouch] = new KeyOrMouse(Keys.LeftControl);
|
||||
@@ -315,29 +319,11 @@ namespace Barotrauma
|
||||
keyMapping[(int)InputType.RadioChat] = new KeyOrMouse(Keys.R);
|
||||
keyMapping[(int)InputType.CrewOrders] = new KeyOrMouse(Keys.C);
|
||||
|
||||
keyMapping[(int)InputType.SelectNextCharacter] = new KeyOrMouse(Keys.Z);
|
||||
keyMapping[(int)InputType.SelectPreviousCharacter] = new KeyOrMouse(Keys.X);
|
||||
|
||||
keyMapping[(int)InputType.Voice] = new KeyOrMouse(Keys.V);
|
||||
|
||||
if (Language == "French")
|
||||
{
|
||||
keyMapping[(int)InputType.Up] = new KeyOrMouse(Keys.Z);
|
||||
keyMapping[(int)InputType.Down] = new KeyOrMouse(Keys.S);
|
||||
keyMapping[(int)InputType.Left] = new KeyOrMouse(Keys.Q);
|
||||
keyMapping[(int)InputType.Right] = new KeyOrMouse(Keys.D);
|
||||
|
||||
keyMapping[(int)InputType.SelectNextCharacter] = new KeyOrMouse(Keys.X);
|
||||
keyMapping[(int)InputType.SelectPreviousCharacter] = new KeyOrMouse(Keys.W);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyMapping[(int)InputType.Up] = new KeyOrMouse(Keys.W);
|
||||
keyMapping[(int)InputType.Down] = new KeyOrMouse(Keys.S);
|
||||
keyMapping[(int)InputType.Left] = new KeyOrMouse(Keys.A);
|
||||
keyMapping[(int)InputType.Right] = new KeyOrMouse(Keys.D);
|
||||
|
||||
keyMapping[(int)InputType.SelectNextCharacter] = new KeyOrMouse(Keys.Z);
|
||||
keyMapping[(int)InputType.SelectPreviousCharacter] = new KeyOrMouse(Keys.X);
|
||||
}
|
||||
|
||||
if (legacy)
|
||||
{
|
||||
keyMapping[(int)InputType.Use] = new KeyOrMouse(0);
|
||||
@@ -355,15 +341,33 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in doc.Root.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "keymapping")
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
{
|
||||
LoadKeyBinds(subElement);
|
||||
case "keymapping":
|
||||
foreach (XAttribute attribute in subElement.Attributes())
|
||||
{
|
||||
if (Enum.TryParse(attribute.Name.ToString(), true, out InputType inputType))
|
||||
{
|
||||
if (int.TryParse(attribute.Value.ToString(), out int mouseButton))
|
||||
{
|
||||
keyMapping[(int)inputType] = new KeyOrMouse(mouseButton);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Enum.TryParse(attribute.Value.ToString(), true, out Keys key))
|
||||
{
|
||||
keyMapping[(int)inputType] = new KeyOrMouse(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckBindings(bool useDefaults)
|
||||
private void CheckBindings(bool useDefaults)
|
||||
{
|
||||
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
||||
{
|
||||
@@ -416,77 +420,21 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
#region Load DefaultConfig
|
||||
private void LoadDefaultConfig(bool setLanguage = true)
|
||||
private void LoadDefaultConfig()
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(savePath);
|
||||
|
||||
if (setLanguage || string.IsNullOrEmpty(Language))
|
||||
{
|
||||
Language = doc.Root.GetAttributeString("language", "English");
|
||||
}
|
||||
}
|
||||
Language = doc.Root.GetAttributeString("language", "English");
|
||||
|
||||
public void CheckBindings(bool useDefaults)
|
||||
{
|
||||
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
||||
{
|
||||
var binding = keyMapping[(int)inputType];
|
||||
if (binding == null)
|
||||
{
|
||||
switch (inputType)
|
||||
{
|
||||
case InputType.Deselect:
|
||||
if (useDefaults)
|
||||
{
|
||||
binding = new KeyOrMouse(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Legacy support
|
||||
var selectKey = keyMapping[(int)InputType.Select];
|
||||
if (selectKey != null && selectKey.Key != Keys.None)
|
||||
{
|
||||
binding = new KeyOrMouse(selectKey.Key);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case InputType.Shoot:
|
||||
if (useDefaults)
|
||||
{
|
||||
binding = new KeyOrMouse(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Legacy support
|
||||
var useKey = keyMapping[(int)InputType.Use];
|
||||
if (useKey != null && useKey.MouseButton.HasValue)
|
||||
{
|
||||
binding = new KeyOrMouse(useKey.MouseButton.Value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (binding == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Key binding for the input type \"" + inputType + " not set!");
|
||||
binding = new KeyOrMouse(Keys.D1);
|
||||
}
|
||||
keyMapping[(int)inputType] = binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
|
||||
|
||||
#region Load DefaultConfig
|
||||
private void LoadDefaultConfig(bool setLanguage = true)
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(savePath);
|
||||
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true);
|
||||
WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false);
|
||||
|
||||
if (setLanguage || string.IsNullOrEmpty(Language))
|
||||
{
|
||||
Language = doc.Root.GetAttributeString("language", "English");
|
||||
}
|
||||
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
|
||||
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
|
||||
|
||||
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
|
||||
|
||||
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
|
||||
|
||||
@@ -910,6 +858,71 @@ namespace Barotrauma
|
||||
CampaignDisclaimerShown = doc.Root.GetAttributeBool("campaigndisclaimershown", false);
|
||||
EditorDisclaimerShown = doc.Root.GetAttributeBool("editordisclaimershown", false);
|
||||
|
||||
foreach (XElement subElement in doc.Root.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
{
|
||||
case "keymapping":
|
||||
foreach (XAttribute attribute in subElement.Attributes())
|
||||
{
|
||||
if (Enum.TryParse(attribute.Name.ToString(), true, out InputType inputType))
|
||||
{
|
||||
if (int.TryParse(attribute.Value.ToString(), out int mouseButton))
|
||||
{
|
||||
keyMapping[(int)inputType] = new KeyOrMouse(mouseButton);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Enum.TryParse(attribute.Value.ToString(), true, out Keys key))
|
||||
{
|
||||
keyMapping[(int)inputType] = new KeyOrMouse(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "gameplay":
|
||||
jobPreferences = new List<string>();
|
||||
foreach (XElement ele in subElement.Element("jobpreferences").Elements("job"))
|
||||
{
|
||||
string jobIdentifier = ele.GetAttributeString("identifier", "");
|
||||
if (string.IsNullOrEmpty(jobIdentifier)) continue;
|
||||
jobPreferences.Add(jobIdentifier);
|
||||
}
|
||||
break;
|
||||
case "player":
|
||||
defaultPlayerName = subElement.GetAttributeString("name", defaultPlayerName);
|
||||
CharacterHeadIndex = subElement.GetAttributeInt("headindex", CharacterHeadIndex);
|
||||
if (Enum.TryParse(subElement.GetAttributeString("gender", "none"), true, out Gender g))
|
||||
{
|
||||
CharacterGender = g;
|
||||
}
|
||||
if (Enum.TryParse(subElement.GetAttributeString("race", "white"), true, out Race r))
|
||||
{
|
||||
CharacterRace = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
CharacterRace = Race.White;
|
||||
}
|
||||
CharacterHairIndex = subElement.GetAttributeInt("hairindex", CharacterHairIndex);
|
||||
CharacterBeardIndex = subElement.GetAttributeInt("beardindex", CharacterBeardIndex);
|
||||
CharacterMoustacheIndex = subElement.GetAttributeInt("moustacheindex", CharacterMoustacheIndex);
|
||||
CharacterFaceAttachmentIndex = subElement.GetAttributeInt("faceattachmentindex", CharacterFaceAttachmentIndex);
|
||||
break;
|
||||
case "tutorials":
|
||||
foreach (XElement tutorialElement in subElement.Elements())
|
||||
{
|
||||
CompletedTutorialNames.Add(tutorialElement.GetAttributeString("name", ""));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UnsavedSettings = false;
|
||||
|
||||
selectedContentPackagePaths = new HashSet<string>();
|
||||
|
||||
foreach (XElement subElement in doc.Root.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
@@ -1245,26 +1258,6 @@ namespace Barotrauma
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void LoadKeyBinds(XElement element)
|
||||
{
|
||||
foreach (XAttribute attribute in element.Attributes())
|
||||
{
|
||||
if (!Enum.TryParse(attribute.Name.ToString(), true, out InputType inputType)) { continue; }
|
||||
|
||||
if (int.TryParse(attribute.Value.ToString(), out int mouseButton))
|
||||
{
|
||||
keyMapping[(int)inputType] = new KeyOrMouse(mouseButton);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Enum.TryParse(attribute.Value.ToString(), true, out Keys key))
|
||||
{
|
||||
keyMapping[(int)inputType] = new KeyOrMouse(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetToDefault()
|
||||
{
|
||||
LoadDefaultConfig();
|
||||
|
||||
@@ -168,11 +168,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
else
|
||||
{
|
||||
FixBody(user, deltaTime, degreeOfSuccess,
|
||||
Submarine.PickBody(rayStart, rayEnd,
|
||||
ignoredBodies, collisionCategories, ignoreSensors: false,
|
||||
customPredicate: (Fixture f) => { return f?.Body?.UserData != null; },
|
||||
allowInsideFixture: true));
|
||||
FixBody(user, deltaTime, degreeOfSuccess, Submarine.PickBody(rayStart, rayEnd, ignoredBodies, collisionCategories, ignoreSensors: false, allowInsideFixture: true));
|
||||
}
|
||||
|
||||
if (ExtinguishAmount > 0.0f && item.CurrentHull != null)
|
||||
|
||||
@@ -609,7 +609,8 @@ namespace Barotrauma
|
||||
foreach (InterestingPosition pos in positionsOfInterest)
|
||||
{
|
||||
if (pos.PositionType != PositionType.MainPath || pos.Position.X < 5000 || pos.Position.X > Size.X - 5000) 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.X - StartPosition.X) < 10000) continue;
|
||||
if (Math.Abs(pos.Position.Y - StartPosition.Y) < 10000) continue;
|
||||
if (GetTooCloseCells(pos.Position.ToVector2(), minWidth * 0.7f).Count > 0) continue;
|
||||
iceChunkPositions.Add(pos.Position);
|
||||
}
|
||||
|
||||
@@ -301,10 +301,6 @@ namespace Barotrauma
|
||||
#endif
|
||||
spriteColor = prefab.SpriteColor;
|
||||
if (sp.IsHorizontal.HasValue)
|
||||
{
|
||||
IsHorizontal = sp.IsHorizontal.Value;
|
||||
}
|
||||
else if (ResizeHorizontal && !ResizeVertical)
|
||||
{
|
||||
IsHorizontal = true;
|
||||
}
|
||||
@@ -349,7 +345,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
// Only add ai targets automatically to submarine/outpost walls
|
||||
if (aiTarget == null && HasBody && Tags.Contains("wall") && submarine != null && !Prefab.NoAITarget)
|
||||
if (aiTarget == null && HasBody && Tags.Contains("wall") && submarine != null)
|
||||
{
|
||||
aiTarget = new AITarget(this);
|
||||
}
|
||||
|
||||
@@ -184,11 +184,6 @@ namespace Barotrauma
|
||||
sp.Tags.Add(tag.Trim().ToLowerInvariant());
|
||||
}
|
||||
|
||||
if (element.Attribute("ishorizontal") != null)
|
||||
{
|
||||
sp.IsHorizontal = element.GetAttributeBool("ishorizontal", false);
|
||||
}
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString())
|
||||
|
||||
@@ -602,7 +602,7 @@ namespace Barotrauma
|
||||
if (ladderItem != null) Ladders = ladderItem.GetComponent<Ladder>();
|
||||
}
|
||||
|
||||
Body pickedBody = Submarine.PickBody(SimPosition, SimPosition - Vector2.UnitY * 2.0f, null, Physics.CollisionStairs);
|
||||
Body pickedBody = Submarine.PickBody(SimPosition, SimPosition - Vector2.UnitY * 2.0f, null, Physics.CollisionWall | Physics.CollisionStairs);
|
||||
if (pickedBody != null && pickedBody.UserData is Structure)
|
||||
{
|
||||
Structure structure = (Structure)pickedBody.UserData;
|
||||
|
||||
@@ -98,11 +98,6 @@ namespace Barotrauma
|
||||
public readonly AttributeCollection Attributes;
|
||||
public readonly Type PropertyType;
|
||||
|
||||
public PropertyInfo PropertyInfo
|
||||
{
|
||||
get { return propertyInfo; }
|
||||
}
|
||||
|
||||
public SerializableProperty(PropertyDescriptor property, object obj)
|
||||
{
|
||||
Name = property.Name;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,18 +1,3 @@
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
v0.9.0.2
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
|
||||
- Fixed a bug that caused frequent desync kicks when playing a multiplayer monster mission.
|
||||
- Fixed an index out of range error in DoctorTutorial if proceeding too fast to the submarine.
|
||||
- Fixes to missing translations and UI layout problems when using languages other than English.
|
||||
- More readable font and a fix to some texts appearing slightly "clipped".
|
||||
- Additions to the credits.
|
||||
- Fixed bots loading only half of the target items in the contain item objective.
|
||||
- Minor tweaks to subs and shuttles.
|
||||
- Fixed find safety AI objective not working properly.
|
||||
- Miscellaneous crew AI fixes and improvements.
|
||||
- Fixed incorrect reward amount in the "Chemical shipment" description.
|
||||
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
v0.9.0.1
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user