(ad567dea) v0.9.7.1
This commit is contained in:
@@ -335,8 +335,7 @@ namespace Barotrauma
|
||||
//an ad-hoc way of allowing the players to have roughly the same maximum view distance regardless of the resolution,
|
||||
//while still keeping the zoom around 1.0 when not looking further away (because otherwise we'd always be downsampling
|
||||
//on lower resolutions, which doesn't look that good)
|
||||
float newZoom = MathHelper.Lerp(unscaledZoom, scaledZoom,
|
||||
(GameMain.Config == null || GameMain.Config.EnableMouseLook) ? (float)Math.Sqrt(zoomOutAmount) : 0.3f);
|
||||
float newZoom = MathHelper.Lerp(unscaledZoom, scaledZoom, (float)Math.Sqrt(zoomOutAmount));
|
||||
|
||||
Zoom += (newZoom - zoom) / ZoomSmoothness;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Barotrauma
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (!ShowAITargets) { return; }
|
||||
if (!ShowAITargets) return;
|
||||
var pos = new Vector2(WorldPosition.X, -WorldPosition.Y);
|
||||
if (soundRange > 0.0f)
|
||||
{
|
||||
@@ -43,7 +43,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
//color = Color.WhiteSmoke;
|
||||
color = Color.WhiteSmoke;
|
||||
// disable the indicators for structures, because they clutter the debug view
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Barotrauma
|
||||
if (State == AIState.Idle && PreviousState == AIState.Attack)
|
||||
{
|
||||
var target = _selectedAiTarget ?? _lastAiTarget;
|
||||
if (target != null && target.Entity != null)
|
||||
if (target != null)
|
||||
{
|
||||
var memory = GetTargetMemory(target);
|
||||
Vector2 targetPos = memory.Location;
|
||||
|
||||
@@ -16,6 +16,11 @@ namespace Barotrauma
|
||||
}*/
|
||||
}
|
||||
|
||||
partial void SetOrderProjSpecific(Order order, string option)
|
||||
{
|
||||
GameMain.GameSession.CrewManager.DisplayCharacterOrder(Character, order, option);
|
||||
}
|
||||
|
||||
public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
|
||||
{
|
||||
Vector2 pos = Character.WorldPosition;
|
||||
@@ -35,7 +40,7 @@ namespace Barotrauma
|
||||
var currentOrder = ObjectiveManager.CurrentOrder;
|
||||
if (currentOrder != null)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"ORDER: {currentOrder.DebugTag} ({currentOrder.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"ORDER: {currentOrder.DebugTag} ({currentOrder.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
}
|
||||
else if (ObjectiveManager.WaitTimer > 0)
|
||||
{
|
||||
@@ -46,17 +51,17 @@ namespace Barotrauma
|
||||
{
|
||||
if (currentOrder == null)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"MAIN OBJECTIVE: {currentObjective.DebugTag} ({currentObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"MAIN OBJECTIVE: {currentObjective.DebugTag} ({currentObjective.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
}
|
||||
var subObjective = currentObjective.CurrentSubObjective;
|
||||
var subObjective = currentObjective.SubObjectives.FirstOrDefault();
|
||||
if (subObjective != null)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 40), $"SUBOBJECTIVE: {subObjective.DebugTag} ({subObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 40), $"SUBOBJECTIVE: {subObjective.DebugTag} ({subObjective.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
}
|
||||
var activeObjective = ObjectiveManager.GetActiveObjective();
|
||||
if (activeObjective != null)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 60), $"ACTIVE OBJECTIVE: {activeObjective.DebugTag} ({activeObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 60), $"ACTIVE OBJECTIVE: {activeObjective.DebugTag} ({activeObjective.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -603,11 +603,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
partial void SetOrderProjSpecific(Order order, string orderOption)
|
||||
{
|
||||
GameMain.GameSession?.CrewManager?.DisplayCharacterOrder(this, order, orderOption);
|
||||
}
|
||||
|
||||
public static void AddAllToGUIUpdateList()
|
||||
{
|
||||
for (int i = 0; i < CharacterList.Count; i++)
|
||||
@@ -643,7 +638,8 @@ namespace Barotrauma
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
if (!Enabled) { return; }
|
||||
if (!Enabled) return;
|
||||
|
||||
AnimController.Draw(spriteBatch, cam);
|
||||
}
|
||||
|
||||
@@ -660,6 +656,8 @@ namespace Barotrauma
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
AnimController.DebugDraw(spriteBatch);
|
||||
|
||||
if (aiTarget != null) aiTarget.Draw(spriteBatch);
|
||||
}
|
||||
|
||||
if (GUI.DisableHUD) return;
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Barotrauma
|
||||
|
||||
if (!character.IsUnconscious && character.Stun <= 0.0f)
|
||||
{
|
||||
if (character.Info != null && !character.ShouldLockHud() && character.SelectedCharacter == null)
|
||||
if (character.Info != null && !character.ShouldLockHud())
|
||||
{
|
||||
bool mouseOnPortrait = HUDLayoutSettings.BottomRightInfoArea.Contains(PlayerInput.MousePosition) && GUI.MouseOn == null;
|
||||
if (mouseOnPortrait && PlayerInput.PrimaryMouseButtonClicked())
|
||||
@@ -309,7 +309,7 @@ namespace Barotrauma
|
||||
(int)(HUDLayoutSettings.BottomRightInfoArea.Y + HUDLayoutSettings.BottomRightInfoArea.Height * 0.1f),
|
||||
(int)(HUDLayoutSettings.BottomRightInfoArea.Width / 2),
|
||||
(int)(HUDLayoutSettings.BottomRightInfoArea.Height * 0.7f)));
|
||||
character.Info.DrawPortrait(spriteBatch, HUDLayoutSettings.PortraitArea.Location.ToVector2(), new Vector2(-12 * GUI.Scale, 4 * GUI.Scale), targetWidth: HUDLayoutSettings.PortraitArea.Width, true);
|
||||
character.Info.DrawPortrait(spriteBatch, HUDLayoutSettings.PortraitArea.Location.ToVector2(), new Vector2((int)(-4 * GUI.Scale), (int)(2 * GUI.Scale)), targetWidth: HUDLayoutSettings.PortraitArea.Width, true);
|
||||
}
|
||||
mouseOnPortrait = HUDLayoutSettings.BottomRightInfoArea.Contains(PlayerInput.MousePosition) && !character.ShouldLockHud();
|
||||
if (mouseOnPortrait)
|
||||
|
||||
@@ -10,12 +10,12 @@ namespace Barotrauma
|
||||
{
|
||||
partial class CharacterInfo
|
||||
{
|
||||
public const float BgScale = 1.2f;
|
||||
private static Sprite infoAreaPortraitBG;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
infoAreaPortraitBG = GUI.Style.GetComponentStyle("InfoAreaPortraitBG")?.Sprites[GUIComponent.ComponentState.None][0].Sprite;
|
||||
new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(833, 298, 142, 98), null, 0);
|
||||
infoAreaPortraitBG = new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(833, 298, 142, 98), null, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,6 @@ namespace Barotrauma
|
||||
|
||||
public void DrawBackground(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (infoAreaPortraitBG == null) { return; }
|
||||
infoAreaPortraitBG.Draw(spriteBatch, HUDLayoutSettings.BottomRightInfoArea.Location.ToVector2(), Color.White, Vector2.Zero, 0.0f,
|
||||
scale: new Vector2(
|
||||
HUDLayoutSettings.BottomRightInfoArea.Width / (float)infoAreaPortraitBG.SourceRect.Width,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.Networking;
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
@@ -385,37 +384,6 @@ namespace Barotrauma
|
||||
character = Create(speciesName, position, seed, info, GameMain.Client.ID != ownerId, hasAi);
|
||||
character.ID = id;
|
||||
character.TeamID = (TeamType)teamID;
|
||||
|
||||
// Check if the character has a current order
|
||||
if (inc.ReadBoolean())
|
||||
{
|
||||
int orderPrefabIndex = inc.ReadByte();
|
||||
Entity targetEntity = FindEntityByID(inc.ReadUInt16());
|
||||
Character orderGiver = inc.ReadBoolean() ? FindEntityByID(inc.ReadUInt16()) as Character : null;
|
||||
int orderOptionIndex = inc.ReadByte();
|
||||
|
||||
if (orderPrefabIndex >= 0 && orderPrefabIndex < Order.PrefabList.Count)
|
||||
{
|
||||
var orderPrefab = Order.PrefabList[orderPrefabIndex];
|
||||
if ((orderPrefab.ItemComponentType == null && orderPrefab.ItemIdentifiers.None()) ||
|
||||
(targetEntity != null && (targetEntity as Item).Components.Any(c => c?.GetType() == orderPrefab.ItemComponentType)))
|
||||
{
|
||||
character.SetOrder(
|
||||
new Order(orderPrefab, targetEntity, (targetEntity as Item)?.Components.FirstOrDefault(c => c?.GetType() == orderPrefab.ItemComponentType), orderGiver: orderGiver),
|
||||
orderOptionIndex >= 0 && orderOptionIndex < orderPrefab.Options.Length ? orderPrefab.Options[orderOptionIndex] : null,
|
||||
orderGiver, speak: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugConsole.ThrowError("Could not set order \"" + orderPrefab.Identifier + "\" for character \"" + character.Name + "\" because required target entity was not found.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugConsole.ThrowError("Invalid order prefab index - index (" + orderPrefabIndex + ") out of bounds.");
|
||||
}
|
||||
}
|
||||
|
||||
bool containsStatusData = inc.ReadBoolean();
|
||||
if (containsStatusData)
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace Barotrauma
|
||||
|
||||
public SoundType Type => Params.State;
|
||||
public Gender Gender => Params.Gender;
|
||||
public float Volume => roundSound == null ? 0.0f : roundSound.Volume;
|
||||
public float Range => roundSound == null ? 0.0f : roundSound.Range;
|
||||
public float Volume => roundSound.Volume;
|
||||
public float Range => roundSound.Range;
|
||||
public Sound Sound => roundSound?.Sound;
|
||||
|
||||
public CharacterSound(CharacterParams.SoundParams soundParams)
|
||||
|
||||
@@ -246,13 +246,11 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
private GUIFrame healthBarHolder;
|
||||
|
||||
private Point healthBarOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
// 0.38775510204f = percentage of offset before reaching the healthbar portion of the graphic going from bottom upwards
|
||||
return new Point(2, (int)(HUDLayoutSettings.HealthBarArea.Size.Y * 0.38775510204f));
|
||||
return new Point(5 - (int)Math.Ceiling(1 - 1 * GUI.Scale), (int)Math.Min(Math.Ceiling(17 * GUI.Scale), 20));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +258,7 @@ namespace Barotrauma
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Point((int)Math.Ceiling(HUDLayoutSettings.HealthBarArea.Size.X - 45 * GUI.Scale), (int)(healthBarHolder.Rect.Height - Math.Min(23 * GUI.Scale, 25)) / 2);
|
||||
return new Point(healthBarHolder.Rect.Width - (int)Math.Ceiling(Math.Min(46 * GUI.Scale, 53)), (int)(healthBarHolder.Rect.Height - Math.Min(23 * GUI.Scale, 25)) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +303,7 @@ namespace Barotrauma
|
||||
healthShadowSize = 1.0f;
|
||||
|
||||
healthBar = new GUIProgressBar(new RectTransform(healthBarSize, healthBarHolder.RectTransform, Anchor.BottomRight),
|
||||
barSize: 1.0f, color: GUI.Style.HealthBarColorHigh, style: horizontal ? "CharacterHealthBarSlider" : "GUIProgressBarVertical", showFrame: false)
|
||||
barSize: 1.0f, color: GUIColorSettings.HealthBarColorHigh, style: horizontal ? "CharacterHealthBarSlider" : "GUIProgressBarVertical", showFrame: false)
|
||||
{
|
||||
HoverCursor = CursorState.Hand,
|
||||
Enabled = true,
|
||||
@@ -522,10 +520,8 @@ namespace Barotrauma
|
||||
|
||||
UpdateAlignment();
|
||||
|
||||
suicideButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.02f), GUI.Canvas, Anchor.TopCenter)
|
||||
{
|
||||
MinSize = new Point(150, 20), RelativeOffset = new Vector2(0.0f, 0.01f)
|
||||
},
|
||||
suicideButton = new GUIButton(new RectTransform(new Vector2(0.06f, 0.02f), GUI.Canvas, Anchor.TopCenter)
|
||||
{ MinSize = new Point(150, 20), RelativeOffset = new Vector2(0.0f, 0.01f) },
|
||||
TextManager.Get("GiveInButton"), style: "GUIButtonLarge")
|
||||
{
|
||||
ToolTip = TextManager.Get(GameMain.NetworkMember == null ? "GiveInHelpSingleplayer" : "GiveInHelpMultiplayer"),
|
||||
@@ -820,7 +816,9 @@ namespace Barotrauma
|
||||
if (highlightedLimbIndex < 0 && selectedLimbIndex < 0)
|
||||
{
|
||||
// If no limb is selected or highlighted, select the one with the most critical afflictions.
|
||||
var affliction = SortAfflictionsBySeverity(GetAllAfflictions(a => a.Prefab.IndicatorLimb != LimbType.None)).FirstOrDefault();
|
||||
var affliction = GetAllAfflictions(a => a.Prefab.IndicatorLimb != LimbType.None)
|
||||
.OrderByDescending(a => a.DamagePerSecond)
|
||||
.ThenByDescending(a => a.Strength).FirstOrDefault();
|
||||
if (affliction.DamagePerSecond > 0 || affliction.Strength > 0)
|
||||
{
|
||||
var limbHealth = GetMatchingLimbHealth(affliction);
|
||||
@@ -851,7 +849,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
healthBar.Color = healthWindowHealthBar.Color = ToolBox.GradientLerp(DisplayedVitality / MaxVitality, GUI.Style.HealthBarColorLow, GUI.Style.HealthBarColorMedium, GUI.Style.HealthBarColorHigh);
|
||||
healthBar.Color = healthWindowHealthBar.Color = ToolBox.GradientLerp(DisplayedVitality / MaxVitality, GUIColorSettings.HealthBarColorLow, GUIColorSettings.HealthBarColorMedium, GUIColorSettings.HealthBarColorHigh);
|
||||
healthBar.HoverColor = healthWindowHealthBar.HoverColor = healthBar.Color * 2.0f;
|
||||
healthBar.BarSize = healthWindowHealthBar.BarSize =
|
||||
(DisplayedVitality > 0.0f) ?
|
||||
@@ -1136,11 +1134,11 @@ namespace Barotrauma
|
||||
{
|
||||
if (prefab.IsBuff)
|
||||
{
|
||||
return ToolBox.GradientLerp(affliction.Strength / prefab.MaxStrength, GUI.Style.BuffColorLow, GUI.Style.BuffColorMedium, GUI.Style.BuffColorHigh);
|
||||
return ToolBox.GradientLerp(affliction.Strength / prefab.MaxStrength, GUIColorSettings.BuffColorLow, GUIColorSettings.BuffColorMedium, GUIColorSettings.BuffColorHigh);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ToolBox.GradientLerp(affliction.Strength / prefab.MaxStrength, GUI.Style.DebuffColorLow, GUI.Style.DebuffColorMedium, GUI.Style.DebuffColorHigh);
|
||||
return ToolBox.GradientLerp(affliction.Strength / prefab.MaxStrength, GUIColorSettings.DebuffColorLow, GUIColorSettings.DebuffColorMedium, GUIColorSettings.DebuffColorHigh);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1187,8 +1185,7 @@ namespace Barotrauma
|
||||
Dictionary<string, float> treatmentSuitability = new Dictionary<string, float>();
|
||||
GetSuitableTreatments(treatmentSuitability, normalize: true, randomization: randomVariance);
|
||||
|
||||
//Affliction mostSevereAffliction = afflictions.FirstOrDefault(a => !a.Prefab.IsBuff && !afflictions.Any(a2 => !a2.Prefab.IsBuff && a2.Strength > a.Strength)) ?? afflictions.FirstOrDefault();
|
||||
Affliction mostSevereAffliction = SortAfflictionsBySeverity(afflictions).FirstOrDefault();
|
||||
Affliction mostSevereAffliction = afflictions.FirstOrDefault(a => !a.Prefab.IsBuff && !afflictions.Any(a2 => !a2.Prefab.IsBuff && a2.Strength > a.Strength)) ?? afflictions.FirstOrDefault();
|
||||
GUIButton buttonToSelect = null;
|
||||
|
||||
foreach (Affliction affliction in afflictions)
|
||||
@@ -1814,8 +1811,8 @@ namespace Barotrauma
|
||||
float iconScale = 0.25f * scale;
|
||||
Vector2 iconPos = highlightArea.Center.ToVector2();
|
||||
|
||||
//Affliction mostSevereAffliction = thisAfflictions.FirstOrDefault(a => !a.Prefab.IsBuff && !thisAfflictions.Any(a2 => !a2.Prefab.IsBuff && a2.Strength > a.Strength)) ?? thisAfflictions.FirstOrDefault();
|
||||
Affliction mostSevereAffliction = SortAfflictionsBySeverity(thisAfflictions).FirstOrDefault();
|
||||
Affliction mostSevereAffliction = thisAfflictions.FirstOrDefault(a => !a.Prefab.IsBuff && !thisAfflictions.Any(a2 => !a2.Prefab.IsBuff && a2.Strength > a.Strength)) ?? thisAfflictions.FirstOrDefault();
|
||||
|
||||
if (mostSevereAffliction != null) { DrawLimbAfflictionIcon(spriteBatch, mostSevereAffliction, iconScale, ref iconPos); }
|
||||
|
||||
if (thisAfflictions.Count() > 1)
|
||||
|
||||
@@ -440,7 +440,6 @@ namespace Barotrauma
|
||||
AssignRelayToServer("ban", false);
|
||||
AssignRelayToServer("banid", false);
|
||||
AssignRelayToServer("dumpids", false);
|
||||
AssignRelayToServer("dumptofile", false);
|
||||
AssignRelayToServer("findentityids", false);
|
||||
AssignRelayToServer("campaigninfo", false);
|
||||
AssignRelayToServer("help", false);
|
||||
@@ -1058,69 +1057,23 @@ namespace Barotrauma
|
||||
if (args.Length != 2 || Screen.Selected != GameMain.SubEditorScreen) { return; }
|
||||
foreach (MapEntity me in MapEntity.SelectedList)
|
||||
{
|
||||
bool propertyFound = false;
|
||||
if (!(me is ISerializableEntity serializableEntity)) { continue; }
|
||||
if (serializableEntity.SerializableProperties == null) { continue; }
|
||||
|
||||
if (serializableEntity.SerializableProperties.TryGetValue(args[0].ToLowerInvariant(), out SerializableProperty property))
|
||||
if (me is ISerializableEntity serializableEntity)
|
||||
{
|
||||
propertyFound = true;
|
||||
object prevValue = property.GetValue(me);
|
||||
if (property.TrySetValue(me, args[1]))
|
||||
if (serializableEntity.SerializableProperties == null)
|
||||
{
|
||||
NewMessage($"Changed the value \"{args[0]}\" from {(prevValue?.ToString() ?? null)} to {args[1]} on entity \"{me.ToString()}\".", Color.LightGreen);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (!serializableEntity.SerializableProperties.TryGetValue(args[0].ToLowerInvariant(), out SerializableProperty property))
|
||||
{
|
||||
NewMessage($"Failed to set the value of \"{args[0]}\" to \"{args[1]}\" on the entity \"{me.ToString()}\".", Color.Orange);
|
||||
NewMessage("Property \"" + args[0] + "\" not found in the entity \"" + me.ToString() + "\".", Color.Orange);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (me is Item item)
|
||||
{
|
||||
foreach (ItemComponent ic in item.Components)
|
||||
if (!property.TrySetValue(me, args[1]))
|
||||
{
|
||||
ic.SerializableProperties.TryGetValue(args[0].ToLowerInvariant(), out SerializableProperty componentProperty);
|
||||
if (componentProperty == null) { continue; }
|
||||
propertyFound = true;
|
||||
object prevValue = componentProperty.GetValue(ic);
|
||||
if (componentProperty.TrySetValue(ic, args[1]))
|
||||
{
|
||||
NewMessage($"Changed the value \"{args[0]}\" from {prevValue} to {args[1]} on item \"{me.ToString()}\", component \"{ic.GetType().Name}\".", Color.LightGreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
NewMessage($"Failed to set the value of \"{args[0]}\" to \"{args[1]}\" on the item \"{me.ToString()}\", component \"{ic.GetType().Name}\".", Color.Orange);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!propertyFound)
|
||||
{
|
||||
NewMessage($"Property \"{args[0]}\" not found in the entity \"{me.ToString()}\".", Color.Orange);
|
||||
}
|
||||
}
|
||||
},
|
||||
() =>
|
||||
{
|
||||
List<string> propertyList = new List<string>();
|
||||
foreach (MapEntity me in MapEntity.SelectedList)
|
||||
{
|
||||
if (!(me is ISerializableEntity serializableEntity)) { continue; }
|
||||
if (serializableEntity.SerializableProperties == null) { continue; }
|
||||
propertyList.AddRange(serializableEntity.SerializableProperties.Select(p => p.Key));
|
||||
if (me is Item item)
|
||||
{
|
||||
foreach (ItemComponent ic in item.Components)
|
||||
{
|
||||
propertyList.AddRange(ic.SerializableProperties.Select(p => p.Key));
|
||||
NewMessage("Failed to set the value of \"" + args[0] + "\" to \"" + args[1] + "\" on the entity \"" + me.ToString() + "\".", Color.Orange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new string[][]
|
||||
{
|
||||
propertyList.Distinct().ToArray(),
|
||||
new string[0]
|
||||
};
|
||||
}));
|
||||
|
||||
commands.Add(new Command("checkmissingloca", "", (string[] args) =>
|
||||
@@ -2360,7 +2313,7 @@ namespace Barotrauma
|
||||
switch (firstArg)
|
||||
{
|
||||
case "name":
|
||||
var sprites = Sprite.LoadedSprites.Where(s => s.Name != null && s.Name.Equals(secondArg, StringComparison.OrdinalIgnoreCase));
|
||||
var sprites = Sprite.LoadedSprites.Where(s => s.Name?.ToLowerInvariant() == secondArg.ToLowerInvariant());
|
||||
if (sprites.Any())
|
||||
{
|
||||
foreach (var s in sprites)
|
||||
@@ -2376,7 +2329,7 @@ namespace Barotrauma
|
||||
}
|
||||
case "identifier":
|
||||
case "id":
|
||||
sprites = Sprite.LoadedSprites.Where(s => s.EntityID != null && s.EntityID.Equals(secondArg, StringComparison.OrdinalIgnoreCase));
|
||||
sprites = Sprite.LoadedSprites.Where(s => s.EntityID?.ToLowerInvariant() == secondArg.ToLowerInvariant());
|
||||
if (sprites.Any())
|
||||
{
|
||||
foreach (var s in sprites)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("icon", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "icon") { continue; }
|
||||
Icon = new Sprite(subElement);
|
||||
IconColor = subElement.GetAttributeColor("color", Color.White);
|
||||
}
|
||||
|
||||
@@ -252,29 +252,21 @@ namespace Barotrauma
|
||||
Visible = false,
|
||||
CanBeFocused = false
|
||||
};
|
||||
var content = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), popupMsg.RectTransform, Anchor.Center));
|
||||
Vector2 senderTextSize = Vector2.Zero;
|
||||
if (!string.IsNullOrEmpty(senderName))
|
||||
{
|
||||
var senderText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform),
|
||||
senderName, textColor: senderColor, style: null, font: GUI.SmallFont)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
senderTextSize = senderText.Font.MeasureString(senderText.WrappedText);
|
||||
senderText.RectTransform.MinSize = new Point(0, senderText.Rect.Height);
|
||||
}
|
||||
var msgPopupText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform),
|
||||
displayedText, textColor: message.Color, font: GUI.SmallFont, textAlignment: Alignment.BottomLeft, style: null, wrap: true)
|
||||
var senderText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), popupMsg.RectTransform, Anchor.TopRight),
|
||||
senderName, textColor: senderColor, font: GUI.SmallFont, textAlignment: Alignment.TopRight)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
msgPopupText.RectTransform.MinSize = new Point(0, msgPopupText.Rect.Height);
|
||||
Vector2 msgSize = msgPopupText.Font.MeasureString(msgPopupText.WrappedText);
|
||||
int textWidth = (int)Math.Max(msgSize.X + msgPopupText.Padding.X + msgPopupText.Padding.Z, senderTextSize.X) + 10;
|
||||
popupMsg.RectTransform.Resize(new Point((int)(textWidth / content.RectTransform.RelativeSize.X) , (int)((senderTextSize.Y + msgSize.Y) / content.RectTransform.RelativeSize.Y)), resizeChildren: true);
|
||||
popupMsg.RectTransform.IsFixedSize = true;
|
||||
content.Recalculate();
|
||||
var msgPopupText = new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.0f), popupMsg.RectTransform, Anchor.TopRight)
|
||||
{ AbsoluteOffset = new Point(0, senderText.Rect.Height) },
|
||||
displayedText, textColor: message.Color, font: GUI.SmallFont, textAlignment: Alignment.TopRight, style: null, wrap: true)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
int textWidth = (int)Math.Max(
|
||||
msgPopupText.Font.MeasureString(msgPopupText.WrappedText).X,
|
||||
senderText.Font.MeasureString(senderText.WrappedText).X);
|
||||
popupMsg.RectTransform.Resize(new Point(textWidth + 20, msgPopupText.Rect.Bottom - senderText.Rect.Y), resizeChildren: false);
|
||||
popupMessages.Enqueue(popupMsg);
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Barotrauma
|
||||
Point size = new Point(0, 0);
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("size", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "size") { continue; }
|
||||
Point maxResolution = subElement.GetAttributePoint("maxresolution", new Point(int.MaxValue, int.MaxValue));
|
||||
if (GameMain.GraphicsWidth <= maxResolution.X && GameMain.GraphicsHeight <= maxResolution.Y)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
public class GUIColorSettings
|
||||
{
|
||||
// Inventory
|
||||
public static Color EquipmentSlotIconColor = new Color(99, 70, 64);
|
||||
|
||||
// Health HUD
|
||||
public static Color BuffColorLow = Color.LightGreen;
|
||||
public static Color BuffColorMedium = Color.Green;
|
||||
public static Color BuffColorHigh = Color.DarkGreen;
|
||||
|
||||
public static Color DebuffColorLow = Color.DarkSalmon;
|
||||
public static Color DebuffColorMedium = Color.Red;
|
||||
public static Color DebuffColorHigh = Color.DarkRed;
|
||||
|
||||
public static Color HealthBarColorLow = Color.Red;
|
||||
public static Color HealthBarColorMedium = Color.Orange;
|
||||
public static Color HealthBarColorHigh = new Color(78, 114, 88);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -801,7 +801,8 @@ namespace Barotrauma
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("conditional", StringComparison.OrdinalIgnoreCase) && !CheckConditional(subElement))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "conditional" &&
|
||||
!CheckConditional(subElement))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -850,7 +851,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("conditional", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "conditional") { continue; }
|
||||
FromXML(subElement, component is GUIListBox listBox ? listBox.Content.RectTransform : component.RectTransform);
|
||||
}
|
||||
|
||||
@@ -1018,7 +1019,7 @@ namespace Barotrauma
|
||||
|
||||
private static GUIFrame LoadGUIFrame(XElement element, RectTransform parent)
|
||||
{
|
||||
string style = element.GetAttributeString("style", element.Name.ToString().Equals("spacing", StringComparison.OrdinalIgnoreCase) ? null : "");
|
||||
string style = element.GetAttributeString("style", element.Name.ToString().ToLowerInvariant() == "spacing" ? null : "");
|
||||
if (style == "null") { style = null; }
|
||||
return new GUIFrame(RectTransform.Load(element, parent), style: style);
|
||||
}
|
||||
|
||||
@@ -59,36 +59,11 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
public Color Blue { get; private set; } = Color.Blue;
|
||||
|
||||
public Color ColorInventoryEmpty { get; private set; } = Color.Red;
|
||||
public Color ColorInventoryHalf { get; private set; } = Color.Orange;
|
||||
public Color ColorInventoryFull { get; private set; } = Color.LightGreen;
|
||||
public Color ColorInventoryBackground { get; private set; } = Color.Gray;
|
||||
|
||||
public Color TextColor { get; private set; } = Color.White * 0.8f;
|
||||
public Color TextColorBright { get; private set; } = Color.White * 0.9f;
|
||||
public Color TextColorDark { get; private set; } = Color.Black * 0.9f;
|
||||
public Color TextColorDim { get; private set; } = Color.White * 0.6f;
|
||||
|
||||
// Inventory
|
||||
public Color EquipmentSlotIconColor { get; private set; } = new Color(99, 70, 64);
|
||||
|
||||
// Health HUD
|
||||
public Color BuffColorLow { get; private set; } = Color.LightGreen;
|
||||
public Color BuffColorMedium { get; private set; } = Color.Green;
|
||||
public Color BuffColorHigh { get; private set; } = Color.DarkGreen;
|
||||
|
||||
public Color DebuffColorLow { get; private set; } = Color.DarkSalmon;
|
||||
public Color DebuffColorMedium { get; private set; } = Color.Red;
|
||||
public Color DebuffColorHigh { get; private set; } = Color.DarkRed;
|
||||
|
||||
public Color HealthBarColorLow { get; private set; } = Color.Red;
|
||||
public Color HealthBarColorMedium { get; private set; } = Color.Orange;
|
||||
public Color HealthBarColorHigh { get; private set; } = new Color(78, 114, 88);
|
||||
|
||||
public Color EquipmentIndicatorNotEquipped { get; private set; } = Color.Gray;
|
||||
public Color EquipmentIndicatorEquipped { get; private set; } = new Color(105, 202, 125);
|
||||
public Color EquipmentIndicatorRunningOut { get; private set; } = new Color(202, 105, 105);
|
||||
|
||||
public static Point ItemFrameMargin => new Point(50, 56).Multiply(GUI.SlicedSpriteScale);
|
||||
public static Point ItemFrameOffset => new Point(0, 3).Multiply(GUI.SlicedSpriteScale);
|
||||
|
||||
@@ -128,22 +103,10 @@ namespace Barotrauma
|
||||
case "blue":
|
||||
Blue = subElement.GetAttributeColor("color", Blue);
|
||||
break;
|
||||
case "colorinventoryempty":
|
||||
ColorInventoryEmpty = subElement.GetAttributeColor("color", ColorInventoryEmpty);
|
||||
break;
|
||||
case "colorinventoryhalf":
|
||||
ColorInventoryHalf = subElement.GetAttributeColor("color", ColorInventoryHalf);
|
||||
break;
|
||||
case "colorinventoryfull":
|
||||
ColorInventoryFull = subElement.GetAttributeColor("color", ColorInventoryFull);
|
||||
break;
|
||||
case "colorinventorybackground":
|
||||
ColorInventoryBackground = subElement.GetAttributeColor("color", ColorInventoryBackground);
|
||||
break;
|
||||
case "textcolordark":
|
||||
TextColorDark = subElement.GetAttributeColor("color", TextColorDark);
|
||||
break;
|
||||
case "textcolorbright":
|
||||
case "TextColorBright":
|
||||
TextColorBright = subElement.GetAttributeColor("color", TextColorBright);
|
||||
break;
|
||||
case "textcolordim":
|
||||
@@ -153,45 +116,6 @@ namespace Barotrauma
|
||||
case "textcolor":
|
||||
TextColor = subElement.GetAttributeColor("color", TextColor);
|
||||
break;
|
||||
case "equipmentsloticoncolor":
|
||||
EquipmentSlotIconColor = subElement.GetAttributeColor("color", EquipmentSlotIconColor);
|
||||
break;
|
||||
case "buffcolorlow":
|
||||
BuffColorLow = subElement.GetAttributeColor("color", BuffColorLow);
|
||||
break;
|
||||
case "buffcolormedium":
|
||||
BuffColorMedium = subElement.GetAttributeColor("color", BuffColorMedium);
|
||||
break;
|
||||
case "buffcolorhigh":
|
||||
BuffColorHigh = subElement.GetAttributeColor("color", BuffColorHigh);
|
||||
break;
|
||||
case "debuffcolorlow":
|
||||
DebuffColorLow = subElement.GetAttributeColor("color", DebuffColorLow);
|
||||
break;
|
||||
case "debuffcolormedium":
|
||||
DebuffColorMedium = subElement.GetAttributeColor("color", DebuffColorMedium);
|
||||
break;
|
||||
case "debuffcolorhigh":
|
||||
DebuffColorHigh = subElement.GetAttributeColor("color", DebuffColorHigh);
|
||||
break;
|
||||
case "healthbarcolorlow":
|
||||
HealthBarColorLow = subElement.GetAttributeColor("color", HealthBarColorLow);
|
||||
break;
|
||||
case "healthbarcolormedium":
|
||||
HealthBarColorMedium = subElement.GetAttributeColor("color", HealthBarColorMedium);
|
||||
break;
|
||||
case "healthbarcolorhigh":
|
||||
HealthBarColorHigh = subElement.GetAttributeColor("color", HealthBarColorHigh);
|
||||
break;
|
||||
case "equipmentindicatornotequipped":
|
||||
EquipmentIndicatorNotEquipped = subElement.GetAttributeColor("color", EquipmentIndicatorNotEquipped);
|
||||
break;
|
||||
case "equipmentindicatorequipped":
|
||||
EquipmentIndicatorEquipped = subElement.GetAttributeColor("color", EquipmentIndicatorEquipped);
|
||||
break;
|
||||
case "equipmentindicatorrunningout":
|
||||
EquipmentIndicatorRunningOut = subElement.GetAttributeColor("color", EquipmentIndicatorRunningOut);
|
||||
break;
|
||||
case "uiglow":
|
||||
UIGlow = new UISprite(subElement);
|
||||
break;
|
||||
@@ -326,8 +250,9 @@ namespace Barotrauma
|
||||
//check if any of the language override fonts want to override the font size as well
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("override", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (GameMain.Config.Language.Equals(subElement.GetAttributeString("language", ""), StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "override") { continue; }
|
||||
string language = subElement.GetAttributeString("language", "").ToLowerInvariant();
|
||||
if (GameMain.Config.Language.ToLowerInvariant() == language)
|
||||
{
|
||||
uint overrideFontSize = GetFontSize(subElement, 0);
|
||||
if (overrideFontSize > 0) { return overrideFontSize; }
|
||||
@@ -336,7 +261,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("size", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "size") { continue; }
|
||||
Point maxResolution = subElement.GetAttributePoint("maxresolution", new Point(int.MaxValue, int.MaxValue));
|
||||
if (GameMain.GraphicsWidth <= maxResolution.X && GameMain.GraphicsHeight <= maxResolution.Y)
|
||||
{
|
||||
@@ -350,8 +275,9 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("override", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (GameMain.Config.Language.Equals(subElement.GetAttributeString("language", ""), StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "override") { continue; }
|
||||
string language = subElement.GetAttributeString("language", "").ToLowerInvariant();
|
||||
if (GameMain.Config.Language.ToLowerInvariant() == language)
|
||||
{
|
||||
return subElement.GetAttributeString("file", "");
|
||||
}
|
||||
@@ -363,8 +289,9 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("override", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (GameMain.Config.Language.Equals(subElement.GetAttributeString("language", ""), StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "override") { continue; }
|
||||
string language = subElement.GetAttributeString("language", "").ToLowerInvariant();
|
||||
if (GameMain.Config.Language.ToLowerInvariant() == language)
|
||||
{
|
||||
return subElement.GetAttributeBool("dynamicloading", false);
|
||||
}
|
||||
@@ -376,8 +303,9 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("override", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (GameMain.Config.Language.Equals(subElement.GetAttributeString("language", ""), StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "override") { continue; }
|
||||
string language = subElement.GetAttributeString("language", "").ToLowerInvariant();
|
||||
if (GameMain.Config.Language.ToLowerInvariant() == language)
|
||||
{
|
||||
return subElement.GetAttributeBool("iscjk", false);
|
||||
}
|
||||
|
||||
@@ -328,7 +328,11 @@ namespace Barotrauma
|
||||
{
|
||||
if (text == null) { return; }
|
||||
|
||||
censoredText = string.IsNullOrEmpty(text) ? "" : new string('\u2022', text.Length);
|
||||
censoredText = "";
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
censoredText += "\u2022";
|
||||
}
|
||||
|
||||
var rect = Rect;
|
||||
|
||||
|
||||
@@ -112,16 +112,16 @@ namespace Barotrauma
|
||||
//slice from the top of the screen for misc buttons (info, end round, server controls)
|
||||
ButtonAreaTop = new Rectangle(Padding, Padding, GameMain.GraphicsWidth - Padding * 2, (int)(50 * GUI.Scale));
|
||||
|
||||
int infoAreaWidth = (int)(142 * GUI.Scale);
|
||||
int infoAreaHeight = (int)(98 * GUI.Scale);
|
||||
int portraitSize = (int)(infoAreaHeight * 0.95f);
|
||||
int infoAreaWidth = (int)(142 * GUI.Scale * CharacterInfo.BgScale);
|
||||
int infoAreaHeight = (int)(98 * GUI.Scale * CharacterInfo.BgScale);
|
||||
int portraitSize = (int)(125 * GUI.Scale);
|
||||
BottomRightInfoArea = new Rectangle(GameMain.GraphicsWidth - Padding * 2 - infoAreaWidth, GameMain.GraphicsHeight - Padding * 2 - infoAreaHeight, infoAreaWidth, infoAreaHeight);
|
||||
PortraitArea = new Rectangle(GameMain.GraphicsWidth - portraitSize, BottomRightInfoArea.Bottom - portraitSize + Padding / 2, portraitSize, portraitSize);
|
||||
PortraitArea = new Rectangle(GameMain.GraphicsWidth - Padding - portraitSize, GameMain.GraphicsHeight - Padding - portraitSize, portraitSize, portraitSize);
|
||||
|
||||
//horizontal slices at the corners of the screen for health bar and affliction icons
|
||||
int afflictionAreaHeight = (int)(50 * GUI.Scale);
|
||||
int healthBarWidth = BottomRightInfoArea.Width + CharacterInventory.SlotSize.X + CharacterInventory.Spacing * 2 + CharacterInventory.HideButtonWidth;
|
||||
int healthBarHeight = (int)(50f * GUI.Scale);
|
||||
int healthBarWidth = (int)((BottomRightInfoArea.Width + CharacterInventory.SlotSize.X + CharacterInventory.Spacing) * 1.1f);
|
||||
int healthBarHeight = (int)Math.Max(50f * GUI.Scale, 25f);
|
||||
HealthBarArea = new Rectangle(BottomRightInfoArea.X - (healthBarWidth - BottomRightInfoArea.Width) + (int)(2 * GUI.Scale), BottomRightInfoArea.Y - healthBarHeight + (int)(10 * GUI.Scale), healthBarWidth, healthBarHeight);
|
||||
AfflictionAreaLeft = new Rectangle(HealthBarArea.X, HealthBarArea.Y - Padding - afflictionAreaHeight, HealthBarArea.Width, afflictionAreaHeight);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Barotrauma
|
||||
if (vanillaContent == null)
|
||||
{
|
||||
// TODO: Dynamic method for defining and finding the vanilla content package.
|
||||
vanillaContent = ContentPackage.List.SingleOrDefault(cp => Path.GetFileName(cp.Path).Equals("vanilla 0.9.xml", StringComparison.OrdinalIgnoreCase));
|
||||
vanillaContent = ContentPackage.List.SingleOrDefault(cp => Path.GetFileName(cp.Path).ToLowerInvariant() == "vanilla 0.9.xml");
|
||||
}
|
||||
return vanillaContent;
|
||||
}
|
||||
@@ -397,7 +397,7 @@ namespace Barotrauma
|
||||
SoundManager.SetCategoryGainMultiplier("ui", Config.SoundVolume, 0);
|
||||
SoundManager.SetCategoryGainMultiplier("waterambience", Config.SoundVolume, 0);
|
||||
SoundManager.SetCategoryGainMultiplier("music", Config.MusicVolume, 0);
|
||||
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume, 0);
|
||||
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume * 20.0f, 0);
|
||||
|
||||
if (Config.EnableSplashScreen && !ConsoleArguments.Contains("-skipintro"))
|
||||
{
|
||||
@@ -421,27 +421,17 @@ namespace Barotrauma
|
||||
GUI.Init(Window, Config.SelectedContentPackages, GraphicsDevice);
|
||||
DebugConsole.Init();
|
||||
|
||||
if (Config.AutoUpdateWorkshopItems)
|
||||
CrossThread.RequestExecutionOnMainThread(() =>
|
||||
{
|
||||
bool waitingForWorkshopUpdates = true;
|
||||
bool result = false;
|
||||
TaskPool.Add(SteamManager.AutoUpdateWorkshopItems(), (task) =>
|
||||
if (Config.AutoUpdateWorkshopItems)
|
||||
{
|
||||
result = task.Result;
|
||||
waitingForWorkshopUpdates = false;
|
||||
});
|
||||
|
||||
while (waitingForWorkshopUpdates) { yield return CoroutineStatus.Running; }
|
||||
|
||||
if (result)
|
||||
{
|
||||
CrossThread.RequestExecutionOnMainThread(() =>
|
||||
if (SteamManager.AutoUpdateWorkshopItems())
|
||||
{
|
||||
ContentPackage.LoadAll();
|
||||
Config.ReloadContentPackages();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (SelectedPackages.None())
|
||||
@@ -1096,10 +1086,7 @@ namespace Barotrauma
|
||||
UserData = "https://steamcommunity.com/app/602960/discussions/1/",
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (!SteamManager.OverlayCustomURL(userdata as string))
|
||||
{
|
||||
ShowOpenUrlInWebBrowserPrompt(userdata as string);
|
||||
}
|
||||
SteamManager.OverlayCustomURL(userdata as string);
|
||||
msgBox.Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (toggleCrewListOpen == value) { return; }
|
||||
toggleCrewListOpen = GameMain.Config.CrewMenuOpen = value;
|
||||
toggleCrewButton.Children.ForEach(c => c.SpriteEffects = toggleCrewListOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,13 +70,13 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("character", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "character") continue;
|
||||
|
||||
var characterInfo = new CharacterInfo(subElement);
|
||||
characterInfos.Add(characterInfo);
|
||||
foreach (XElement invElement in subElement.Elements())
|
||||
{
|
||||
if (!invElement.Name.ToString().Equals("inventory", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (invElement.Name.ToString().ToLowerInvariant() != "inventory") continue;
|
||||
characterInfo.InventoryData = invElement;
|
||||
break;
|
||||
}
|
||||
@@ -97,13 +98,11 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
var commandButtonHeight = (int)(GUI.Scale * 40);
|
||||
var buttonSize = new Point((int)(182f / 99f * commandButtonHeight), commandButtonHeight);
|
||||
var crewListToggleButtonHeight = (int)(64f * buttonSize.X / 175f);
|
||||
var buttonHeight = (int)(GUI.Scale * 40);
|
||||
|
||||
crewArea = new GUIFrame(
|
||||
new RectTransform(
|
||||
new Point(crewAreaWithButtons.Rect.Width, crewAreaWithButtons.Rect.Height - commandButtonHeight - crewListToggleButtonHeight - 2 * HUDLayoutSettings.Padding),
|
||||
new Point(crewAreaWithButtons.Rect.Width, crewAreaWithButtons.Rect.Height - (int)(1.5f * buttonHeight) - 2 * HUDLayoutSettings.Padding),
|
||||
crewAreaWithButtons.RectTransform,
|
||||
Anchor.BottomLeft),
|
||||
style: null,
|
||||
@@ -112,6 +111,7 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
var buttonSize = new Point((int)(182.0f / 99.0f * buttonHeight), buttonHeight);
|
||||
commandButton = new GUIButton(
|
||||
new RectTransform(buttonSize, parent: crewAreaWithButtons.RectTransform),
|
||||
style: "CommandButton")
|
||||
@@ -139,13 +139,14 @@ namespace Barotrauma
|
||||
Spacing = (int)(GUI.Scale * 10)
|
||||
};
|
||||
|
||||
buttonSize.Y = crewListToggleButtonHeight;
|
||||
toggleCrewButton = new GUIButton(
|
||||
new RectTransform(buttonSize, parent: crewAreaWithButtons.RectTransform)
|
||||
new RectTransform(
|
||||
new Point(buttonSize.X, (int)(0.5f * buttonHeight)),
|
||||
parent: crewAreaWithButtons.RectTransform)
|
||||
{
|
||||
AbsoluteOffset = new Point(0, commandButtonHeight + HUDLayoutSettings.Padding)
|
||||
AbsoluteOffset = new Point(0, buttonHeight + HUDLayoutSettings.Padding)
|
||||
},
|
||||
style: "CrewListToggleButton")
|
||||
style: "UIToggleButton")
|
||||
{
|
||||
OnClicked = (GUIButton btn, object userdata) =>
|
||||
{
|
||||
@@ -211,7 +212,7 @@ namespace Barotrauma
|
||||
var chatBox = ChatBox ?? GameMain.Client?.ChatBox;
|
||||
if (chatBox != null)
|
||||
{
|
||||
chatBox.ToggleButton = new GUIButton(new RectTransform(new Point((int)(182f * GUI.Scale * 0.4f), (int)(99f * GUI.Scale * 0.4f)), chatBox.GUIFrame.Parent.RectTransform), style: "ChatToggleButton");
|
||||
chatBox.ToggleButton = new GUIButton(new RectTransform(new Point((int)(182f * GUI.Scale * 0.4f), (int)(99f * GUI.Scale * 0.4f)), guiFrame.RectTransform), style: "ChatToggleButton");
|
||||
chatBox.ToggleButton.RectTransform.AbsoluteOffset = new Point(0, HUDLayoutSettings.ChatBoxArea.Height - chatBox.ToggleButton.Rect.Height);
|
||||
chatBox.ToggleButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||
{
|
||||
@@ -329,7 +330,17 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
AddCharacterToCrewList(character);
|
||||
DisplayCharacterOrder(character, character.CurrentOrder, character.CurrentOrderOption);
|
||||
|
||||
if (character is AICharacter)
|
||||
{
|
||||
var ai = character.AIController as HumanAIController;
|
||||
if (ai == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in crewmanager - attempted to give orders to a character with no HumanAIController");
|
||||
return;
|
||||
}
|
||||
character.SetOrder(ai.CurrentOrder, "", null, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddCharacterInfo(CharacterInfo characterInfo)
|
||||
@@ -777,11 +788,11 @@ namespace Barotrauma
|
||||
characterFrame.SetAsFirstChild();
|
||||
}
|
||||
|
||||
private void DisplayPreviousCharacterOrder(Character character, GUILayoutGroup characterComponent, OrderInfo orderInfo)
|
||||
private void DisplayPreviousCharacterOrder(Character character, GUILayoutGroup characterComponent, OrderInfo currentOrderInfo)
|
||||
{
|
||||
if (orderInfo.Order == null || orderInfo.Order.Identifier == dismissedOrderPrefab.Identifier) { return; }
|
||||
if (currentOrderInfo.Order == null || currentOrderInfo.Order.Identifier == dismissedOrderPrefab.Identifier) { return; }
|
||||
|
||||
var previousOrderInfo = new OrderInfo(orderInfo);
|
||||
var previousOrderInfo = new OrderInfo(currentOrderInfo);
|
||||
var prevOrderFrame = new GUIButton(
|
||||
new RectTransform(
|
||||
characterComponent.GetChildByUserData("job").RectTransform.RelativeSize,
|
||||
@@ -824,12 +835,12 @@ namespace Barotrauma
|
||||
|
||||
private GUIComponent GetCurrentOrderComponent(GUILayoutGroup characterComponent)
|
||||
{
|
||||
return characterComponent?.FindChild(c => c?.UserData is OrderInfo orderInfo && orderInfo.ComponentIdentifier == "currentorder");
|
||||
return characterComponent.FindChild(c => c.UserData is OrderInfo orderInfo && orderInfo.ComponentIdentifier == "currentorder");
|
||||
}
|
||||
|
||||
private GUIComponent GetPreviousOrderComponent(GUILayoutGroup characterComponent)
|
||||
{
|
||||
return characterComponent?.FindChild(c => c?.UserData is OrderInfo orderInfo && orderInfo.ComponentIdentifier == "previousorder");
|
||||
return characterComponent.FindChild(c => c.UserData is OrderInfo orderInfo && orderInfo.ComponentIdentifier == "previousorder");
|
||||
}
|
||||
|
||||
private struct OrderInfo
|
||||
@@ -899,11 +910,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (!(c.UserData is Character character) || character.IsDead || character.Removed) { continue; }
|
||||
AddCharacter(character);
|
||||
if (GetPreviousOrderComponent(c.GetChild<GUILayoutGroup>())?.UserData is OrderInfo prevInfo &&
|
||||
crewList.Content.Children.FirstOrDefault(c => c?.UserData == character)?.GetChild<GUILayoutGroup>() is GUILayoutGroup newLayoutGroup)
|
||||
{
|
||||
DisplayPreviousCharacterOrder(character, newLayoutGroup, prevInfo);
|
||||
}
|
||||
DisplayCharacterOrder(character, character.CurrentOrder, (character.AIController as HumanAIController)?.CurrentOrderOption);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1286,21 +1293,13 @@ namespace Barotrauma
|
||||
{
|
||||
get
|
||||
{
|
||||
#if DEBUG
|
||||
return Character.Controlled == null || Character.Controlled.Info != null && Character.Controlled.SpeechImpediment < 100.0f;
|
||||
#else
|
||||
return Character.Controlled != null && Character.Controlled.SpeechImpediment < 100.0f;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanSomeoneHearCharacter()
|
||||
{
|
||||
#if DEBUG
|
||||
return true;
|
||||
#else
|
||||
return Character.Controlled != null && characters.Any(c => c != Character.Controlled && c.CanHearCharacter(Character.Controlled));
|
||||
#endif
|
||||
}
|
||||
|
||||
private void CreateCommandUI(Character characterContext = null)
|
||||
@@ -1506,7 +1505,17 @@ namespace Barotrauma
|
||||
shortcutCenterNode = null;
|
||||
}
|
||||
CreateNodes(userData);
|
||||
CreateReturnNodeHotkey();
|
||||
if (returnNode != null && returnNode.Visible)
|
||||
{
|
||||
var hotkey = optionNodes.Count + 1;
|
||||
if (expandNode != null && expandNode.Visible) { hotkey += 1; }
|
||||
CreateHotkeyIcon(returnNode.RectTransform, hotkey % 10, true);
|
||||
returnNodeHotkey = Keys.D0 + hotkey % 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnNodeHotkey = Keys.None;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1530,20 +1539,10 @@ namespace Barotrauma
|
||||
returnNode = null;
|
||||
}
|
||||
CreateNodes(userData);
|
||||
CreateReturnNodeHotkey();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CreateReturnNodeHotkey()
|
||||
{
|
||||
if (returnNode != null && returnNode.Visible)
|
||||
{
|
||||
var hotkey = 1;
|
||||
if (targetFrame == null || !targetFrame.Visible)
|
||||
{
|
||||
hotkey = optionNodes.Count + 1;
|
||||
if (expandNode != null && expandNode.Visible) { hotkey += 1; }
|
||||
}
|
||||
var hotkey = optionNodes.Count + 1;
|
||||
if (expandNode != null && expandNode.Visible) { hotkey += 1; }
|
||||
CreateHotkeyIcon(returnNode.RectTransform, hotkey % 10, true);
|
||||
returnNodeHotkey = Keys.D0 + hotkey % 10;
|
||||
}
|
||||
@@ -1551,6 +1550,7 @@ namespace Barotrauma
|
||||
{
|
||||
returnNodeHotkey = Keys.None;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SetCenterNode(GUIButton node)
|
||||
@@ -2148,11 +2148,7 @@ namespace Barotrauma
|
||||
ToolTip = character.Info.DisplayName + " (" + character.Info.Job.Name + ")"
|
||||
};
|
||||
|
||||
#if DEBUG
|
||||
bool canHear = true;
|
||||
#else
|
||||
bool canHear = character.CanHearCharacter(Character.Controlled);
|
||||
#endif
|
||||
if (!canHear)
|
||||
{
|
||||
node.CanBeFocused = icon.CanBeFocused = false;
|
||||
@@ -2275,10 +2271,8 @@ namespace Barotrauma
|
||||
|
||||
private Character GetBestCharacterForOrder(Order order)
|
||||
{
|
||||
#if !DEBUG
|
||||
if (Character.Controlled == null) { return null; }
|
||||
#endif
|
||||
return characters.FindAll(c => Character.Controlled == null || (c != Character.Controlled && c.TeamID == Character.Controlled.TeamID))
|
||||
return characters.FindAll(c => c != Character.Controlled && c.TeamID == Character.Controlled.TeamID)
|
||||
.OrderByDescending(c => c.CurrentOrder == null || c.CurrentOrder.Identifier == dismissedOrderPrefab.Identifier)
|
||||
.ThenByDescending(c => order.HasAppropriateJob(c))
|
||||
.ThenBy(c => c.CurrentOrder?.Weight)
|
||||
@@ -2287,18 +2281,16 @@ namespace Barotrauma
|
||||
|
||||
private List<Character> GetCharactersSortedForOrder(Order order)
|
||||
{
|
||||
#if !DEBUG
|
||||
if (Character.Controlled == null) { return new List<Character>(); }
|
||||
#endif
|
||||
if (order.Identifier == "follow")
|
||||
{
|
||||
return characters.FindAll(c => Character.Controlled == null || (c != Character.Controlled && c.TeamID == Character.Controlled.TeamID))
|
||||
return characters.FindAll(c => c != Character.Controlled && c.TeamID == Character.Controlled.TeamID)
|
||||
.OrderByDescending(c => c.CurrentOrder == null || c.CurrentOrder.Identifier == dismissedOrderPrefab.Identifier)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return characters.FindAll(c => Character.Controlled == null || c.TeamID == Character.Controlled.TeamID)
|
||||
return characters.FindAll(c => c.TeamID == Character.Controlled.TeamID)
|
||||
.OrderByDescending(c => c.CurrentOrder == null || c.CurrentOrder.Identifier == dismissedOrderPrefab.Identifier)
|
||||
.ThenByDescending(c => order.HasAppropriateJob(c))
|
||||
.ThenBy(c => c.CurrentOrder?.Weight)
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ namespace Barotrauma
|
||||
if (Character.Controlled.Submarine != outpost) { return null; }
|
||||
|
||||
//if there's a sub docked to the outpost, we can leave the level
|
||||
if (outpost.DockedTo.Any())
|
||||
if (outpost.DockedTo.Count > 0)
|
||||
{
|
||||
var dockedSub = outpost.DockedTo.FirstOrDefault();
|
||||
return dockedSub.DockedTo.Contains(Submarine.MainSub) ? Submarine.MainSub : dockedSub;
|
||||
|
||||
+2
-3
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.Items.Components;
|
||||
using Barotrauma.Networking;
|
||||
@@ -222,7 +221,7 @@ namespace Barotrauma.Tutorials
|
||||
{
|
||||
//captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f);
|
||||
yield return new WaitForSeconds(1.0f, false);
|
||||
} while (Submarine.MainSub.DockedTo.Any());
|
||||
} while (Submarine.MainSub.DockedTo.Count > 0);
|
||||
RemoveCompletedObjective(segments[4]);
|
||||
yield return new WaitForSeconds(2f, false);
|
||||
TriggerTutorialSegment(5); // Navigate to destination
|
||||
@@ -246,7 +245,7 @@ namespace Barotrauma.Tutorials
|
||||
{
|
||||
//captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f);
|
||||
yield return new WaitForSeconds(1.0f, false);
|
||||
} while (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Any());
|
||||
} while (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Count == 0);
|
||||
RemoveCompletedObjective(segments[6]);
|
||||
yield return new WaitForSeconds(3f, false);
|
||||
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.GetWithVariable("Captain.Radio.Complete", "[OUTPOSTNAME]", GameMain.GameSession.EndLocation.Name), ChatMessageType.Radio, null);
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Barotrauma
|
||||
|
||||
private GUIFrame infoFrameContent;
|
||||
public RoundSummary RoundSummary { get; private set; }
|
||||
public static bool IsInfoFrameOpen => GameMain.GameSession?.infoFrame != null;
|
||||
|
||||
private bool ToggleInfoFrame()
|
||||
{
|
||||
|
||||
@@ -1182,7 +1182,7 @@ namespace Barotrauma
|
||||
{ RelativeOffset = new Vector2(0.02f, 0.02f) })
|
||||
{ RelativeSpacing = 0.01f };
|
||||
|
||||
var automaticQuickStartTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Automatic quickstart enabled", style: "GUITickBox");
|
||||
var automaticQuickStartTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Enable automatic quickstart", style: "GUITickBox");
|
||||
automaticQuickStartTickBox.Selected = AutomaticQuickStartEnabled;
|
||||
automaticQuickStartTickBox.ToolTip = "Will the game automatically move on to Quickstart when the game is launched";
|
||||
automaticQuickStartTickBox.OnSelected = (tickBox) =>
|
||||
@@ -1192,7 +1192,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
var showSplashScreenTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Splash screen enabled", style: "GUITickBox");
|
||||
var showSplashScreenTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Show splash screen", style: "GUITickBox");
|
||||
showSplashScreenTickBox.Selected = EnableSplashScreen;
|
||||
showSplashScreenTickBox.ToolTip = "Are the splash screens shown when the game is launched";
|
||||
showSplashScreenTickBox.OnSelected = (tickBox) =>
|
||||
@@ -1202,7 +1202,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
var verboseLoggingTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Verbose logging enabled", style: "GUITickBox");
|
||||
var verboseLoggingTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Enable verbose logging", style: "GUITickBox");
|
||||
verboseLoggingTickBox.Selected = VerboseLogging;
|
||||
verboseLoggingTickBox.ToolTip = "Should verbose logging be used";
|
||||
verboseLoggingTickBox.OnSelected = (tickBox) =>
|
||||
@@ -1211,16 +1211,6 @@ namespace Barotrauma
|
||||
UnsavedSettings = true;
|
||||
return true;
|
||||
};
|
||||
|
||||
var textManagerDebugModeTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "TextManager debug mode enabled", style: "GUITickBox");
|
||||
textManagerDebugModeTickBox.Selected = TextManagerDebugModeEnabled;
|
||||
textManagerDebugModeTickBox.ToolTip = "Does the TextManager return the text tags for debug purposes?";
|
||||
textManagerDebugModeTickBox.OnSelected = (tickBox) =>
|
||||
{
|
||||
TextManagerDebugModeEnabled = tickBox.Selected;
|
||||
UnsavedSettings = true;
|
||||
return true;
|
||||
};
|
||||
#endif
|
||||
|
||||
UnsavedSettings = false; // Reset unsaved settings to false once the UI has been created
|
||||
@@ -1289,7 +1279,7 @@ namespace Barotrauma
|
||||
string[] prefixes = { "OpenAL Soft on " };
|
||||
foreach (string prefix in prefixes)
|
||||
{
|
||||
if (name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
|
||||
if (name.StartsWith(prefix, StringComparison.InvariantCulture))
|
||||
{
|
||||
return name.Remove(0, prefix.Length);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace Barotrauma
|
||||
public Vector2[] SlotPositions;
|
||||
public static Point SlotSize;
|
||||
public static int Spacing;
|
||||
public static int HideButtonWidth;
|
||||
|
||||
private Layout layout;
|
||||
public Layout CurrentLayout
|
||||
@@ -72,44 +71,22 @@ namespace Barotrauma
|
||||
{
|
||||
get { return personalSlotArea; }
|
||||
}
|
||||
|
||||
private GUIImage[] indicators = new GUIImage[5];
|
||||
private int[] indicatorIndexes = new int[5];
|
||||
private Vector2 indicatorSpriteSize;
|
||||
private GUILayoutGroup indicatorGroup;
|
||||
|
||||
|
||||
partial void InitProjSpecific(XElement element)
|
||||
{
|
||||
Hidden = true;
|
||||
|
||||
hideButton = new GUIButton(new RectTransform(new Point((int)(31f * (HUDLayoutSettings.BottomRightInfoArea.Height / 100f)), HUDLayoutSettings.BottomRightInfoArea.Height), GUI.Canvas)
|
||||
hideButton = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), (int)(60 * GUI.Scale)), GUI.Canvas)
|
||||
{ AbsoluteOffset = HUDLayoutSettings.CrewArea.Location },
|
||||
"", style: "EquipmentToggleButton");
|
||||
|
||||
indicatorGroup = new GUILayoutGroup(new RectTransform(Point.Zero, hideButton.RectTransform)) { IsHorizontal = false };
|
||||
indicatorGroup.ChildAnchor = Anchor.TopCenter;
|
||||
indicatorSpriteSize = GUI.Style.GetComponentStyle("EquipmentIndicatorDivingSuit").Sprites[GUIComponent.ComponentState.None][0].Sprite.size;
|
||||
|
||||
indicators[0] = new GUIImage(new RectTransform(Point.Zero, indicatorGroup.RectTransform), "EquipmentIndicatorDivingSuit");
|
||||
indicators[1] = new GUIImage(new RectTransform(Point.Zero, indicatorGroup.RectTransform), "EquipmentIndicatorID");
|
||||
indicators[2] = new GUIImage(new RectTransform(Point.Zero, indicatorGroup.RectTransform), "EquipmentIndicatorOutfit");
|
||||
indicators[3] = new GUIImage(new RectTransform(Point.Zero, indicatorGroup.RectTransform), "EquipmentIndicatorHeadwear");
|
||||
indicators[4] = new GUIImage(new RectTransform(Point.Zero, indicatorGroup.RectTransform), "EquipmentIndicatorHeadphones");
|
||||
|
||||
indicatorIndexes[0] = FindLimbSlot(InvSlotType.OuterClothes);
|
||||
indicatorIndexes[1] = FindLimbSlot(InvSlotType.Card);
|
||||
indicatorIndexes[2] = FindLimbSlot(InvSlotType.InnerClothes);
|
||||
indicatorIndexes[3] = FindLimbSlot(InvSlotType.Head);
|
||||
indicatorIndexes[4] = FindLimbSlot(InvSlotType.Headset);
|
||||
|
||||
for (int i = 0; i < indicators.Length; i++)
|
||||
{
|
||||
indicators[i].CanBeFocused = false;
|
||||
}
|
||||
|
||||
"", style: "UIToggleButton");
|
||||
hideButton.Children.ForEach(c => c.SpriteEffects = SpriteEffects.FlipHorizontally);
|
||||
hideButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||
{
|
||||
hidePersonalSlots = !hidePersonalSlots;
|
||||
foreach (GUIComponent child in btn.Children)
|
||||
{
|
||||
child.SpriteEffects = hidePersonalSlots ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -268,26 +245,6 @@ namespace Barotrauma
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void SetIndicatorSizes()
|
||||
{
|
||||
indicatorGroup.RectTransform.AbsoluteOffset = new Point((int)Math.Round(4 * GUI.Scale), (int)Math.Round(7 * GUI.Scale));
|
||||
indicatorGroup.RectTransform.NonScaledSize = new Point(hideButton.Rect.Width - indicatorGroup.RectTransform.AbsoluteOffset.X * 2, hideButton.Rect.Height - indicatorGroup.RectTransform.AbsoluteOffset.Y * 2);
|
||||
indicatorGroup.AbsoluteSpacing = (int)Math.Ceiling(2 * GUI.Scale);
|
||||
|
||||
int indicatorHeight = (indicatorGroup.RectTransform.NonScaledSize.Y - indicatorGroup.AbsoluteSpacing * (indicators.Length - 1)) / indicators.Length;
|
||||
int indicatorWidth = (int)(indicatorSpriteSize.X / (indicatorSpriteSize.Y / indicatorHeight));
|
||||
|
||||
if (HideButtonWidth % 2 != indicatorWidth % 2) indicatorWidth++;
|
||||
|
||||
Point indicatorSize = new Point(indicatorWidth, indicatorHeight);
|
||||
|
||||
for (int i = 0; i < indicators.Length; i++)
|
||||
{
|
||||
indicators[i].RectTransform.NonScaledSize = indicatorSize;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSlotPositions(Layout layout)
|
||||
{
|
||||
bool isFourByThree = GUI.IsFourByThree();
|
||||
@@ -300,8 +257,6 @@ namespace Barotrauma
|
||||
Spacing = (int)(8 * UIScale);
|
||||
}
|
||||
|
||||
HideButtonWidth = (int)(31f * (HUDLayoutSettings.BottomRightInfoArea.Height / 100f));
|
||||
|
||||
SlotSize = !isFourByThree ? (SlotSpriteSmall.size * UIScale).ToPoint() : (SlotSpriteSmall.size * UIScale * .925f).ToPoint();
|
||||
int bottomOffset = SlotSize.Y + Spacing * 2 + ContainedIndicatorHeight;
|
||||
|
||||
@@ -317,7 +272,8 @@ namespace Barotrauma
|
||||
int normalSlotCount = SlotTypes.Count(s => !PersonalSlots.HasFlag(s));
|
||||
|
||||
int x = GameMain.GraphicsWidth / 2 - normalSlotCount * (SlotSize.X + Spacing) / 2;
|
||||
int upperX = HUDLayoutSettings.BottomRightInfoArea.X - SlotSize.X - Spacing * 4 - HideButtonWidth;
|
||||
int upperX = HUDLayoutSettings.BottomRightInfoArea.X - Spacing * 2 - SlotSize.X - SlotSize.X / 2;
|
||||
//int upperX = GameMain.GraphicsWidth - personalSlotCount * (slotSize.X + spacing) + (int)(11 * GUI.Scale) + spacing;
|
||||
|
||||
//make sure the rightmost normal slot doesn't overlap with the personal slots
|
||||
x -= Math.Max((x + normalSlotCount * (SlotSize.X + Spacing)) - (upperX - personalSlotCount * (SlotSize.X + Spacing)), 0);
|
||||
@@ -344,13 +300,11 @@ namespace Barotrauma
|
||||
if (hideButtonSlotIndex > -1)
|
||||
{
|
||||
hideButton.RectTransform.SetPosition(Anchor.TopLeft, Pivot.TopLeft);
|
||||
hideButton.RectTransform.NonScaledSize = new Point(HideButtonWidth, HUDLayoutSettings.BottomRightInfoArea.Height);
|
||||
hideButton.RectTransform.NonScaledSize = new Point(SlotSize.X / 2, HUDLayoutSettings.BottomRightInfoArea.Height);
|
||||
hideButton.RectTransform.AbsoluteOffset = new Point(
|
||||
personalSlotArea.Right + Spacing * 2,
|
||||
personalSlotArea.Right + Spacing,
|
||||
HUDLayoutSettings.BottomRightInfoArea.Y);
|
||||
hideButton.Visible = true;
|
||||
|
||||
SetIndicatorSizes();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -503,8 +457,7 @@ namespace Barotrauma
|
||||
hidePersonalSlotsState = hidePersonalSlots ?
|
||||
Math.Min(hidePersonalSlotsState + deltaTime * 5.0f, 1.0f) :
|
||||
Math.Max(hidePersonalSlotsState - deltaTime * 5.0f, 0.0f);
|
||||
|
||||
bool personalSlotsMoving = hidePersonalSlotsState > 0 && hidePersonalSlotsState < 1f;
|
||||
|
||||
for (int i = 0; i < slots.Length; i++)
|
||||
{
|
||||
if (!PersonalSlots.HasFlag(SlotTypes[i])) { continue; }
|
||||
@@ -513,7 +466,6 @@ namespace Barotrauma
|
||||
if (selectedSlot?.Slot == slots[i]) { selectedSlot = null; }
|
||||
highlightedSubInventorySlots.RemoveWhere(s => s.Slot == slots[i]);
|
||||
}
|
||||
slots[i].IsMoving = personalSlotsMoving;
|
||||
slots[i].DrawOffset = Vector2.Lerp(Vector2.Zero, new Vector2(personalSlotArea.Width, 0.0f), hidePersonalSlotsState);
|
||||
}
|
||||
}
|
||||
@@ -599,8 +551,6 @@ namespace Barotrauma
|
||||
|
||||
if (character == Character.Controlled && character.SelectedCharacter == null) // Permanently open subinventories only available when the default UI layout is in use -> not when grabbing characters
|
||||
{
|
||||
UpdateEquipmentIndicators();
|
||||
|
||||
//remove the highlighted slots of other characters' inventories when not grabbing anyone
|
||||
highlightedSubInventorySlots.RemoveWhere(s => s.ParentInventory != this && s.ParentInventory?.Owner is Character);
|
||||
|
||||
@@ -701,39 +651,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateEquipmentIndicators()
|
||||
{
|
||||
for (int i = 0; i < indicators.Length; i++)
|
||||
{
|
||||
Item item = Items[indicatorIndexes[i]];
|
||||
if (item != null)
|
||||
{
|
||||
Wearable wearable = item.GetComponent<Wearable>();
|
||||
if (wearable != null && wearable.DisplayContainedStatus)
|
||||
{
|
||||
float conditionPercentage = item.GetContainedItemConditionPercentage();
|
||||
|
||||
if (conditionPercentage != -1)
|
||||
{
|
||||
indicators[i].Color = ToolBox.GradientLerp(conditionPercentage, GUI.Style.EquipmentIndicatorRunningOut, GUI.Style.EquipmentIndicatorEquipped);
|
||||
}
|
||||
else
|
||||
{
|
||||
indicators[i].Color = GUI.Style.EquipmentIndicatorRunningOut;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
indicators[i].Color = GUI.Style.EquipmentIndicatorEquipped;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
indicators[i].Color = GUI.Style.EquipmentIndicatorNotEquipped;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowSubInventory(SlotReference slotRef, float deltaTime, Camera cam, List<SlotReference> hideSubInventories, bool isEquippedSubInventory)
|
||||
{
|
||||
@@ -1047,7 +964,7 @@ namespace Barotrauma
|
||||
if (limbSlotIcons.ContainsKey(SlotTypes[i]))
|
||||
{
|
||||
var icon = limbSlotIcons[SlotTypes[i]];
|
||||
icon.Draw(spriteBatch, slots[i].Rect.Center.ToVector2() + slots[i].DrawOffset, GUI.Style.EquipmentSlotIconColor, origin: icon.size / 2, scale: slots[i].Rect.Width / icon.size.X);
|
||||
icon.Draw(spriteBatch, slots[i].Rect.Center.ToVector2() + slots[i].DrawOffset, GUIColorSettings.EquipmentSlotIconColor, origin: icon.size / 2, scale: slots[i].Rect.Width / icon.size.X);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@ namespace Barotrauma.Items.Components
|
||||
var inputArea = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 1f), bottomFrame.RectTransform, Anchor.BottomCenter), isHorizontal: true, childAnchor: Anchor.BottomLeft);
|
||||
|
||||
// === INPUT SLOTS === //
|
||||
inputInventoryHolder = new GUIFrame(new RectTransform(new Vector2(0.7f, 1f), inputArea.RectTransform), style: null);
|
||||
inputInventoryHolder = new GUIFrame(new RectTransform(new Vector2(0.8f, 1f), inputArea.RectTransform), style: null);
|
||||
new GUICustomComponent(new RectTransform(Vector2.One, inputInventoryHolder.RectTransform), DrawInputOverLay) { CanBeFocused = false };
|
||||
|
||||
// === ACTIVATE BUTTON === //
|
||||
var buttonFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.3f, 0.8f), inputArea.RectTransform), childAnchor: Anchor.CenterRight);
|
||||
var buttonFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.2f, 0.8f), inputArea.RectTransform), childAnchor: Anchor.CenterRight);
|
||||
activateButton = new GUIButton(new RectTransform(new Vector2(1f, 0.6f), buttonFrame.RectTransform),
|
||||
TextManager.Get("FabricatorCreate"), style: "DeviceButton")
|
||||
{
|
||||
@@ -154,7 +154,7 @@ namespace Barotrauma.Items.Components
|
||||
};
|
||||
// === POWER WARNING === //
|
||||
inSufficientPowerWarning = new GUITextBlock(new RectTransform(Vector2.One, activateButton.RectTransform),
|
||||
TextManager.Get("FabricatorNoPower"), textColor: GUI.Style.Orange, textAlignment: Alignment.Center, color: Color.Black, style: "OuterGlow", wrap: true)
|
||||
TextManager.Get("FabricatorNoPower"), textColor: GUI.Style.Orange, textAlignment: Alignment.Center, color: Color.Black, style: "OuterGlow")
|
||||
{
|
||||
HoverColor = Color.Black,
|
||||
IgnoreLayoutGroups = true,
|
||||
@@ -356,8 +356,6 @@ namespace Barotrauma.Items.Components
|
||||
private void DrawOutputOverLay(SpriteBatch spriteBatch, GUICustomComponent overlayComponent)
|
||||
{
|
||||
overlayComponent.RectTransform.SetAsLastChild();
|
||||
|
||||
if (outputContainer.Inventory.Items.First() != null) { return; }
|
||||
|
||||
FabricationRecipe targetItem = fabricatedItem ?? selectedItem;
|
||||
if (targetItem != null)
|
||||
|
||||
@@ -490,7 +490,7 @@ namespace Barotrauma.Items.Components
|
||||
disruptedDirections.Clear();
|
||||
foreach (AITarget t in AITarget.List)
|
||||
{
|
||||
if (t.SoundRange <= 0.0f || float.IsNaN(t.SoundRange) || float.IsInfinity(t.SoundRange)) { continue; }
|
||||
if (t.SoundRange <= 0.0f || !t.Enabled || float.IsNaN(t.SoundRange) || float.IsInfinity(t.SoundRange)) { continue; }
|
||||
|
||||
float distSqr = Vector2.DistanceSquared(t.WorldPosition, transducerCenter);
|
||||
if (distSqr > t.SoundRange * t.SoundRange * 2) { continue; }
|
||||
|
||||
@@ -665,7 +665,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (Vector2.DistanceSquared(PlayerInput.MousePosition, steerArea.Rect.Center.ToVector2()) < steerRadius * steerRadius)
|
||||
{
|
||||
if (PlayerInput.PrimaryMouseButtonHeld() && !CrewManager.IsCommandInterfaceOpen && !GameSession.IsInfoFrameOpen)
|
||||
if (PlayerInput.PrimaryMouseButtonHeld() && !CrewManager.IsCommandInterfaceOpen)
|
||||
{
|
||||
Vector2 displaySubPos = (-sonar.DisplayOffset * sonar.Zoom) / sonar.Range * sonar.DisplayRadius * sonar.Zoom;
|
||||
displaySubPos.Y = -displaySubPos.Y;
|
||||
|
||||
@@ -236,7 +236,15 @@ namespace Barotrauma.Items.Components
|
||||
DeteriorateAlways = msg.ReadBoolean();
|
||||
ushort currentFixerID = msg.ReadUInt16();
|
||||
currentFixerAction = (FixActions)msg.ReadRangedInteger(0, 2);
|
||||
CurrentFixer = currentFixerID != 0 ? Entity.FindEntityByID(currentFixerID) as Character : null;
|
||||
|
||||
if (currentFixerID == 0)
|
||||
{
|
||||
CurrentFixer = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentFixer = Entity.FindEntityByID(currentFixerID) as Character;
|
||||
}
|
||||
}
|
||||
|
||||
public void ClientWrite(IWriteMessage msg, object[] extraData = null)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("wiresprite", StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "wiresprite")
|
||||
{
|
||||
overrideSprite = new Sprite(subElement);
|
||||
break;
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private void DrawCharacterInfo(SpriteBatch spriteBatch, Character target, float alpha = 1.0f)
|
||||
{
|
||||
Vector2 hudPos = GameMain.GameScreen.Cam.WorldToScreen(target.DrawPosition);
|
||||
Vector2 hudPos = GameMain.GameScreen.Cam.WorldToScreen(target.WorldPosition);
|
||||
hudPos += Vector2.UnitX * 50.0f;
|
||||
|
||||
List<string> texts = new List<string>();
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace Barotrauma.Items.Components
|
||||
string errorMsg = "Error while reading a docking port network event (Dock method did not create a joint between the ports)." +
|
||||
" Submarine: " + (item.Submarine?.Name ?? "null") +
|
||||
", target submarine: " + (DockingTarget.item.Submarine?.Name ?? "null");
|
||||
if (item.Submarine?.ConnectedDockingPorts.ContainsKey(DockingTarget.item.Submarine) ?? false)
|
||||
if (item.Submarine?.DockedTo.Contains(DockingTarget.item.Submarine) ?? false)
|
||||
{
|
||||
errorMsg += "\nAlready docked.";
|
||||
}
|
||||
|
||||
@@ -45,17 +45,12 @@ namespace Barotrauma
|
||||
|
||||
public float QuickUseTimer;
|
||||
public string QuickUseButtonToolTip;
|
||||
public bool IsMoving = false;
|
||||
|
||||
private static Rectangle offScreenRect = new Rectangle(new Point(-1000, 0), Point.Zero);
|
||||
public GUIComponent.ComponentState EquipButtonState;
|
||||
public Rectangle EquipButtonRect
|
||||
{
|
||||
get
|
||||
{
|
||||
// Returns a point off-screen, Rectangle.Empty places buttons in the top left of the screen
|
||||
if (IsMoving) return offScreenRect;
|
||||
|
||||
int buttonDir = Math.Sign(SubInventoryDir);
|
||||
|
||||
float sizeY = Inventory.UnequippedIndicator.size.Y * Inventory.UIScale * Inventory.IndicatorScaleAdjustment;
|
||||
@@ -289,7 +284,6 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
protected static HashSet<SlotReference> highlightedSubInventorySlots = new HashSet<SlotReference>();
|
||||
private static List<SlotReference> subInventorySlotsToDraw = new List<SlotReference>();
|
||||
|
||||
protected static SlotReference selectedSlot;
|
||||
|
||||
@@ -1054,14 +1048,11 @@ namespace Barotrauma
|
||||
return hoverArea;
|
||||
}
|
||||
|
||||
|
||||
public static void DrawFront(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (GUI.PauseMenuOpen || GUI.SettingsMenuOpen) { return; }
|
||||
if (GUI.PauseMenuOpen || GUI.SettingsMenuOpen) return;
|
||||
|
||||
subInventorySlotsToDraw.Clear();
|
||||
subInventorySlotsToDraw.AddRange(highlightedSubInventorySlots);
|
||||
foreach (var slot in subInventorySlotsToDraw)
|
||||
foreach (var slot in highlightedSubInventorySlots)
|
||||
{
|
||||
int slotIndex = Array.IndexOf(slot.ParentInventory.slots, slot.Slot);
|
||||
if (slotIndex > -1 && slotIndex < slot.ParentInventory.slots.Length)
|
||||
@@ -1145,11 +1136,11 @@ namespace Barotrauma
|
||||
/*if (inventory != null && (CharacterInventory.PersonalSlots.HasFlag(type) || (inventory.isSubInventory && (inventory.Owner as Item) != null
|
||||
&& (inventory.Owner as Item).AllowedSlots.Any(a => CharacterInventory.PersonalSlots.HasFlag(a)))))
|
||||
{
|
||||
slotColor = slot.IsHighlighted ? GUI.Style.EquipmentSlotColor : GUI.Style.EquipmentSlotColor * 0.8f;
|
||||
slotColor = slot.IsHighlighted ? GUIColorSettings.EquipmentSlotColor : GUIColorSettings.EquipmentSlotColor * 0.8f;
|
||||
}
|
||||
else
|
||||
{
|
||||
slotColor = slot.IsHighlighted ? GUI.Style.InventorySlotColor : GUI.Style.InventorySlotColor * 0.8f;
|
||||
slotColor = slot.IsHighlighted ? GUIColorSettings.InventorySlotColor : GUIColorSettings.InventorySlotColor * 0.8f;
|
||||
}*/
|
||||
|
||||
if (inventory != null && inventory.Locked) { slotColor = Color.Gray * 0.5f; }
|
||||
@@ -1208,15 +1199,13 @@ namespace Barotrauma
|
||||
dir < 0 ? rect.Bottom + HUDLayoutSettings.Padding / 2 : rect.Y - HUDLayoutSettings.Padding / 2 - ContainedIndicatorHeight, rect.Width, ContainedIndicatorHeight);
|
||||
containedIndicatorArea.Inflate(-4, 0);
|
||||
|
||||
Color backgroundColor = GUI.Style.ColorInventoryBackground;
|
||||
|
||||
if (itemContainer.ContainedStateIndicator?.Texture == null)
|
||||
{
|
||||
containedIndicatorArea.Inflate(0, -2);
|
||||
GUI.DrawRectangle(spriteBatch, containedIndicatorArea, backgroundColor, true);
|
||||
GUI.DrawRectangle(spriteBatch, containedIndicatorArea, Color.Gray * 0.9f, true);
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
new Rectangle(containedIndicatorArea.X, containedIndicatorArea.Y, (int)(containedIndicatorArea.Width * containedState), containedIndicatorArea.Height),
|
||||
ToolBox.GradientLerp(containedState, GUI.Style.ColorInventoryEmpty, GUI.Style.ColorInventoryHalf, GUI.Style.ColorInventoryFull) * 0.8f, true);
|
||||
ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.LightGreen) * 0.8f, true);
|
||||
GUI.DrawLine(spriteBatch,
|
||||
new Vector2(containedIndicatorArea.X + (int)(containedIndicatorArea.Width * containedState), containedIndicatorArea.Y),
|
||||
new Vector2(containedIndicatorArea.X + (int)(containedIndicatorArea.Width * containedState), containedIndicatorArea.Bottom),
|
||||
@@ -1235,12 +1224,12 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
indicatorSprite.Draw(spriteBatch, containedIndicatorArea.Center.ToVector2(),
|
||||
(inventory != null && inventory.Locked) ? backgroundColor * 0.5f : backgroundColor,
|
||||
(inventory != null && inventory.Locked) ? Color.Gray * 0.5f : Color.Gray * 0.9f,
|
||||
origin: indicatorSprite.size / 2,
|
||||
rotate: 0.0f,
|
||||
scale: indicatorScale);
|
||||
|
||||
Color indicatorColor = ToolBox.GradientLerp(containedState, GUI.Style.ColorInventoryEmpty, GUI.Style.ColorInventoryHalf, GUI.Style.ColorInventoryFull);
|
||||
Color indicatorColor = ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.LightGreen);
|
||||
if (inventory != null && inventory.Locked) { indicatorColor *= 0.5f; }
|
||||
|
||||
spriteBatch.Draw(indicatorSprite.Texture, containedIndicatorArea.Center.ToVector2(),
|
||||
|
||||
@@ -333,6 +333,15 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
aiTarget?.Draw(spriteBatch);
|
||||
var containedItems = ContainedItems;
|
||||
if (containedItems != null)
|
||||
{
|
||||
foreach (Item item in containedItems)
|
||||
{
|
||||
item.AiTarget?.Draw(spriteBatch);
|
||||
}
|
||||
}
|
||||
if (body != null)
|
||||
{
|
||||
body.DebugDraw(spriteBatch, Color.White);
|
||||
|
||||
@@ -248,6 +248,8 @@ namespace Barotrauma
|
||||
|
||||
if (!editing && !GameMain.DebugDraw) return;
|
||||
|
||||
if (aiTarget != null) aiTarget.Draw(spriteBatch);
|
||||
|
||||
Rectangle drawRect =
|
||||
Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
|
||||
|
||||
@@ -269,8 +271,7 @@ namespace Barotrauma
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.Center.X, -drawRect.Y + drawRect.Height / 2, 10, (int)(100 * Math.Min(waterVolume / Volume, 1.0f))), Color.Cyan, true);
|
||||
if (WaterVolume > Volume)
|
||||
{
|
||||
float maxExcessWater = Volume * MaxCompress;
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.Center.X, -drawRect.Y + drawRect.Height / 2, 10, (int)(100 * (waterVolume - Volume) / maxExcessWater)), GUI.Style.Red, true);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.Center.X, -drawRect.Y + drawRect.Height / 2, 10, (int)(100 * (waterVolume - Volume) / MaxCompress)), GUI.Style.Red, true);
|
||||
}
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.Center.X, -drawRect.Y + drawRect.Height / 2, 10, 100), Color.Black);
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("sprite", System.StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "sprite") continue;
|
||||
|
||||
Sprite = new Sprite(subElement, lazyLoad: true);
|
||||
break;
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Barotrauma
|
||||
int j = 0;
|
||||
foreach (XElement subElement in Prefab.Config.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("deformablesprite", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "deformablesprite") continue;
|
||||
foreach (XElement animationElement in subElement.Elements())
|
||||
{
|
||||
var newDeformation = SpriteDeformation.Load(animationElement, Prefab.Name);
|
||||
|
||||
+3
-4
@@ -4,7 +4,6 @@ using Barotrauma.SpriteDeformations;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -121,7 +120,7 @@ namespace Barotrauma
|
||||
|
||||
SerializableProperty.SerializeProperties(this, element);
|
||||
|
||||
foreach (XElement subElement in element.Elements().ToList())
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
{
|
||||
@@ -140,7 +139,7 @@ namespace Barotrauma
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (LightSourceParams lightSourceParams in LightSourceParams)
|
||||
{
|
||||
var lightElement = new XElement("LightSource");
|
||||
@@ -161,7 +160,7 @@ namespace Barotrauma
|
||||
bool elementFound = false;
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("overridecommonness", System.StringComparison.OrdinalIgnoreCase)
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "overridecommonness"
|
||||
&& subElement.GetAttributeString("leveltype", "") == overrideCommonness.Key)
|
||||
{
|
||||
subElement.Attribute("commonness").Value = overrideCommonness.Value.ToString("G", CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -589,14 +589,6 @@ namespace Barotrauma
|
||||
if (structure.FlippedX && structure.Prefab.CanSpriteFlipX) spriteEffects ^= SpriteEffects.FlipHorizontally;
|
||||
if (structure.flippedY && structure.Prefab.CanSpriteFlipY) spriteEffects ^= SpriteEffects.FlipVertically;
|
||||
}
|
||||
else if (e is WayPoint wayPoint)
|
||||
{
|
||||
Vector2 drawPos = e.WorldPosition;
|
||||
drawPos.Y = -drawPos.Y;
|
||||
drawPos += moveAmount;
|
||||
wayPoint.Draw(spriteBatch, drawPos);
|
||||
continue;
|
||||
}
|
||||
e.prefab?.DrawPlacing(spriteBatch,
|
||||
new Rectangle(e.WorldRect.Location + new Point((int)moveAmount.X, (int)-moveAmount.Y), e.WorldRect.Size), e.Scale, spriteEffects);
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace Barotrauma
|
||||
spriteBatch,
|
||||
new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)),
|
||||
new Vector2(rect.Width, rect.Height),
|
||||
color: Prefab.BackgroundSpriteColor,
|
||||
color: color,
|
||||
textureScale: TextureScale * Scale,
|
||||
startOffset: backGroundOffset,
|
||||
depth: Math.Max(Prefab.BackgroundSprite.Depth + (ID % 255) * 0.000001f, depth + 0.000001f));
|
||||
@@ -350,6 +350,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AiTarget?.Draw(spriteBatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,6 @@ namespace Barotrauma
|
||||
{
|
||||
partial class StructurePrefab : MapEntityPrefab
|
||||
{
|
||||
public Color BackgroundSpriteColor
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override void UpdatePlacing(Camera cam)
|
||||
{
|
||||
Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub);
|
||||
|
||||
@@ -56,8 +56,6 @@ namespace Barotrauma
|
||||
private static List<RoundSound> roundSounds = null;
|
||||
public static RoundSound LoadRoundSound(XElement element, bool stream = false)
|
||||
{
|
||||
if (GameMain.SoundManager?.Disabled ?? true) { return null; }
|
||||
|
||||
string filename = element.GetAttributeString("file", "");
|
||||
if (string.IsNullOrEmpty(filename)) filename = element.GetAttributeString("sound", "");
|
||||
|
||||
|
||||
@@ -9,8 +9,9 @@ namespace Barotrauma
|
||||
{
|
||||
partial class WayPoint : MapEntity
|
||||
{
|
||||
private static Dictionary<SpawnType, Sprite> iconSprites;
|
||||
private const int WaypointSize = 12, SpawnPointSize = 32;
|
||||
private static Texture2D iconTexture;
|
||||
private const int IconSize = 32;
|
||||
private static int[] iconIndices = { 3, 0, 1, 2 };
|
||||
|
||||
public override bool IsVisible(Rectangle worldView)
|
||||
{
|
||||
@@ -22,58 +23,58 @@ namespace Barotrauma
|
||||
get { return !IsHidden(); }
|
||||
}
|
||||
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
|
||||
{
|
||||
if (!editing && !GameMain.DebugDraw) { return; }
|
||||
|
||||
if (IsHidden()) { return; }
|
||||
|
||||
//Rectangle drawRect =
|
||||
// Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
|
||||
|
||||
Vector2 drawPos = Position;
|
||||
if (Submarine != null) { drawPos += Submarine.DrawPosition; }
|
||||
if (Submarine != null) drawPos += Submarine.DrawPosition;
|
||||
drawPos.Y = -drawPos.Y;
|
||||
|
||||
Draw(spriteBatch, drawPos);
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Vector2 drawPos)
|
||||
{
|
||||
Color clr = currentHull == null ? Color.CadetBlue : GUI.Style.Green;
|
||||
if (spawnType != SpawnType.Path) { clr = Color.Gray; }
|
||||
Color clr = currentHull == null ? Color.Blue : Color.White;
|
||||
if (isObstructed)
|
||||
{
|
||||
clr = Color.Black;
|
||||
}
|
||||
if (IsHighlighted || IsHighlighted) { clr = Color.Lerp(clr, Color.White, 0.8f); }
|
||||
if (IsSelected) clr = GUI.Style.Red;
|
||||
if (IsHighlighted) clr = Color.DarkRed;
|
||||
|
||||
int iconSize = spawnType == SpawnType.Path ? WaypointSize : SpawnPointSize;
|
||||
if (ConnectedGap != null || Ladders != null || Stairs != null || SpawnType != SpawnType.Path) { iconSize = (int)(iconSize * 1.5f); }
|
||||
int iconX = iconIndices[(int)spawnType] * IconSize % iconTexture.Width;
|
||||
int iconY = (int)(Math.Floor(iconIndices[(int)spawnType] * IconSize / (float)iconTexture.Width)) * IconSize;
|
||||
|
||||
if (IsSelected || IsHighlighted)
|
||||
int iconSize = IconSize;
|
||||
if (ConnectedGap != null)
|
||||
{
|
||||
int glowSize = (int)(iconSize * 1.5f);
|
||||
GUI.Style.UIGlowCircular.Draw(spriteBatch,
|
||||
new Rectangle((int)(drawPos.X - glowSize / 2), (int)(drawPos.Y - glowSize / 2), glowSize, glowSize),
|
||||
Color.White);
|
||||
iconSize = (int)(iconSize * 1.5f);
|
||||
}
|
||||
if (Ladders != null)
|
||||
{
|
||||
iconSize = (int)(iconSize * 1.5f);
|
||||
}
|
||||
if (Stairs != null)
|
||||
{
|
||||
iconSize = (int)(iconSize * 1.5f);
|
||||
}
|
||||
|
||||
Sprite sprite = iconSprites[SpawnType];
|
||||
if (spawnType == SpawnType.Human && AssignedJob?.Icon != null)
|
||||
{
|
||||
sprite = iconSprites[SpawnType.Path];
|
||||
}
|
||||
sprite.Draw(spriteBatch, drawPos, clr, scale: iconSize / (float)sprite.SourceRect.Width, depth: 0.001f);
|
||||
sprite.RelativeOrigin = Vector2.One * 0.5f;
|
||||
if (spawnType == SpawnType.Human && AssignedJob?.Icon != null)
|
||||
{
|
||||
AssignedJob.Icon.Draw(spriteBatch, drawPos, AssignedJob.UIColor, scale: iconSize / (float)AssignedJob.Icon.SourceRect.Width * 0.8f, depth: 0.0f);
|
||||
}
|
||||
spriteBatch.Draw(iconTexture,
|
||||
new Rectangle((int)(drawPos.X - iconSize / 2), (int)(drawPos.Y - iconSize / 2), iconSize, iconSize),
|
||||
new Rectangle(iconX, iconY, IconSize, IconSize), clr);
|
||||
|
||||
//GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), clr, true);
|
||||
|
||||
//GUI.SmallFont.DrawString(spriteBatch, Position.ToString(), new Vector2(Position.X, -Position.Y), Color.White);
|
||||
|
||||
foreach (MapEntity e in linkedTo)
|
||||
{
|
||||
GUI.DrawLine(spriteBatch,
|
||||
drawPos,
|
||||
new Vector2(e.DrawPosition.X, -e.DrawPosition.Y),
|
||||
(isObstructed ? Color.Gray : GUI.Style.Green) * 0.7f, width: 5, depth: 0.002f);
|
||||
isObstructed ? Color.Gray : GUI.Style.Green, width: 5);
|
||||
}
|
||||
|
||||
GUI.SmallFont.DrawString(spriteBatch,
|
||||
@@ -82,14 +83,6 @@ namespace Barotrauma
|
||||
Color.WhiteSmoke);
|
||||
}
|
||||
|
||||
public override bool IsMouseOn(Vector2 position)
|
||||
{
|
||||
if (IsHidden()) { return false; }
|
||||
float dist = Vector2.DistanceSquared(position, WorldPosition);
|
||||
float radius = (SpawnType == SpawnType.Path ? WaypointSize : SpawnPointSize) * 0.6f;
|
||||
return dist < radius * radius;
|
||||
}
|
||||
|
||||
private bool IsHidden()
|
||||
{
|
||||
if (spawnType == SpawnType.Path)
|
||||
|
||||
@@ -71,8 +71,7 @@ namespace Barotrauma.Networking
|
||||
else
|
||||
{
|
||||
VoipSound.SetPosition(null);
|
||||
VoipSound.Gain = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
partial void InitProjSpecific()
|
||||
|
||||
@@ -8,7 +8,6 @@ using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
@@ -61,18 +60,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
private bool connected;
|
||||
|
||||
private enum RoundInitStatus
|
||||
{
|
||||
NotStarted,
|
||||
Starting,
|
||||
Started,
|
||||
TimedOut,
|
||||
Error,
|
||||
Interrupted
|
||||
}
|
||||
|
||||
private RoundInitStatus roundInitStatus = RoundInitStatus.NotStarted;
|
||||
|
||||
private byte myID;
|
||||
|
||||
private List<Client> otherClients;
|
||||
@@ -161,8 +148,6 @@ namespace Barotrauma.Networking
|
||||
this.ownerKey = ownerKey;
|
||||
this.steamP2POwner = steamP2POwner;
|
||||
|
||||
roundInitStatus = RoundInitStatus.NotStarted;
|
||||
|
||||
allowReconnect = true;
|
||||
|
||||
netStats = new NetStats();
|
||||
@@ -487,17 +472,13 @@ namespace Barotrauma.Networking
|
||||
|
||||
var msgBox = new GUIMessageBox(pwMsg, "", new string[] { TextManager.Get("OK"), TextManager.Get("Cancel") },
|
||||
relativeSize: new Vector2(0.25f, 0.1f), minSize: new Point(400, 170));
|
||||
var passwordHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), msgBox.Content.RectTransform), childAnchor: Anchor.TopCenter);
|
||||
var passwordBox = new GUITextBox(new RectTransform(new Vector2(0.8f, 1f), passwordHolder.RectTransform) { MinSize = new Point(0, 20) })
|
||||
var passwordHolder = new GUILayoutGroup(new RectTransform(Vector2.One, msgBox.Content.RectTransform), childAnchor: Anchor.TopCenter);
|
||||
var passwordBox = new GUITextBox(new RectTransform(new Vector2(0.8f, 1f) , passwordHolder.RectTransform) { MinSize = new Point(0, 20) })
|
||||
{
|
||||
UserData = "password",
|
||||
Censor = true
|
||||
};
|
||||
|
||||
msgBox.Content.Recalculate();
|
||||
msgBox.Content.RectTransform.MinSize = new Point(0, msgBox.Content.RectTransform.Children.Sum(c => c.Rect.Height));
|
||||
msgBox.Content.Parent.RectTransform.MinSize = new Point(0, (int)(msgBox.Content.RectTransform.MinSize.Y / msgBox.Content.RectTransform.RelativeSize.Y));
|
||||
|
||||
var okButton = msgBox.Buttons[0];
|
||||
var cancelButton = msgBox.Buttons[1];
|
||||
|
||||
@@ -543,7 +524,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
foreach (Client c in ConnectedClients)
|
||||
{
|
||||
if (c.Character != null && c.Character.Removed) { c.Character = null; }
|
||||
c.UpdateSoundPosition();
|
||||
}
|
||||
|
||||
@@ -578,13 +558,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
try
|
||||
{
|
||||
incomingMessagesToProcess.Clear();
|
||||
incomingMessagesToProcess.AddRange(pendingIncomingMessages);
|
||||
foreach (var inc in incomingMessagesToProcess)
|
||||
{
|
||||
ReadDataMessage(inc);
|
||||
}
|
||||
pendingIncomingMessages.Clear();
|
||||
clientPeer?.Update(deltaTime);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -659,23 +632,11 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
private bool waitingForStartRoundFinalize = false;
|
||||
|
||||
private readonly List<IReadMessage> pendingIncomingMessages = new List<IReadMessage>();
|
||||
private readonly List<IReadMessage> incomingMessagesToProcess = new List<IReadMessage>();
|
||||
private CoroutineHandle startGameCoroutine;
|
||||
|
||||
private void ReadDataMessage(IReadMessage inc)
|
||||
{
|
||||
ServerPacketHeader header = (ServerPacketHeader)inc.ReadByte();
|
||||
|
||||
if (header != ServerPacketHeader.STARTGAMEFINALIZE &&
|
||||
header != ServerPacketHeader.ENDGAME &&
|
||||
waitingForStartRoundFinalize)
|
||||
{
|
||||
pendingIncomingMessages.Add(inc);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (header)
|
||||
{
|
||||
case ServerPacketHeader.UPDATE_LOBBY:
|
||||
@@ -753,10 +714,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
break;
|
||||
case ServerPacketHeader.STARTGAME:
|
||||
GameMain.Instance.ShowLoading(StartGame(inc), false);
|
||||
break;
|
||||
case ServerPacketHeader.STARTGAMEFINALIZE:
|
||||
ReadStartGameFinalize(inc);
|
||||
startGameCoroutine = GameMain.Instance.ShowLoading(StartGame(inc), false);
|
||||
break;
|
||||
case ServerPacketHeader.ENDGAME:
|
||||
string endMessage = inc.ReadString();
|
||||
@@ -767,8 +725,6 @@ namespace Barotrauma.Networking
|
||||
GameMain.GameSession.WinningTeam = winningTeam;
|
||||
GameMain.GameSession.Mission.Completed = true;
|
||||
}
|
||||
|
||||
roundInitStatus = RoundInitStatus.Interrupted;
|
||||
CoroutineManager.StartCoroutine(EndGame(endMessage), "EndGame");
|
||||
break;
|
||||
case ServerPacketHeader.CAMPAIGN_SETUP_INFO:
|
||||
@@ -819,37 +775,7 @@ namespace Barotrauma.Networking
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadStartGameFinalize(IReadMessage inc)
|
||||
{
|
||||
ushort contentToPreloadCount = inc.ReadUInt16();
|
||||
List<ContentFile> contentToPreload = new List<ContentFile>();
|
||||
for (int i = 0; i < contentToPreloadCount; i++)
|
||||
{
|
||||
ContentType contentType = (ContentType)inc.ReadByte();
|
||||
string filePath = inc.ReadString();
|
||||
contentToPreload.Add(new ContentFile(filePath, contentType));
|
||||
}
|
||||
|
||||
GameMain.GameSession.EventManager.PreloadContent(contentToPreload);
|
||||
|
||||
int levelEqualityCheckVal = inc.ReadInt32();
|
||||
|
||||
if (Level.Loaded.EqualityCheckVal != levelEqualityCheckVal)
|
||||
{
|
||||
string errorMsg = "Level equality check failed. The level generated at your end doesn't match the level generated by the server (seed: " + Level.Loaded.Seed +
|
||||
", sub: " + Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash.ShortHash + ")" +
|
||||
", mirrored: " + Level.Loaded.Mirrored + ").";
|
||||
GameAnalyticsManager.AddErrorEventOnce("GameClient.StartGame:LevelsDontMatch" + Level.Loaded.Seed, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
GameMain.GameSession.Mission?.ClientReadInitial(inc);
|
||||
|
||||
roundInitStatus = RoundInitStatus.Started;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OnDisconnect()
|
||||
{
|
||||
if (SteamManager.IsInitialized)
|
||||
@@ -958,7 +884,6 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
else
|
||||
{
|
||||
connected = false;
|
||||
connectCancelled = true;
|
||||
|
||||
string msg = "";
|
||||
@@ -1183,8 +1108,6 @@ namespace Barotrauma.Networking
|
||||
if (Character != null) Character.Remove();
|
||||
HasSpawned = false;
|
||||
eventErrorWritten = false;
|
||||
waitingForStartRoundFinalize = false;
|
||||
GameMain.NetLobbyScreen.StopWaitingForStartRound();
|
||||
|
||||
while (CoroutineManager.IsCoroutineRunning("EndGame"))
|
||||
{
|
||||
@@ -1203,11 +1126,9 @@ namespace Barotrauma.Networking
|
||||
|
||||
EndVoteTickBox.Selected = false;
|
||||
|
||||
roundInitStatus = RoundInitStatus.Starting;
|
||||
|
||||
int seed = inc.ReadInt32();
|
||||
string levelSeed = inc.ReadString();
|
||||
//int levelEqualityCheckVal = inc.ReadInt32();
|
||||
int levelEqualityCheckVal = inc.ReadInt32();
|
||||
float levelDifficulty = inc.ReadSingle();
|
||||
|
||||
byte losMode = inc.ReadByte();
|
||||
@@ -1225,15 +1146,23 @@ namespace Barotrauma.Networking
|
||||
int missionIndex = inc.ReadInt16();
|
||||
|
||||
bool respawnAllowed = inc.ReadBoolean();
|
||||
bool loadSecondSub = inc.ReadBoolean();
|
||||
|
||||
bool disguisesAllowed = inc.ReadBoolean();
|
||||
bool rewiringAllowed = inc.ReadBoolean();
|
||||
|
||||
bool allowRagdollButton = inc.ReadBoolean();
|
||||
|
||||
serverSettings.ReadMonsterEnabled(inc);
|
||||
ushort contentToPreloadCount = inc.ReadUInt16();
|
||||
List<ContentFile> contentToPreload = new List<ContentFile>();
|
||||
for (int i = 0; i < contentToPreloadCount; i++)
|
||||
{
|
||||
ContentType contentType = (ContentType)inc.ReadByte();
|
||||
string filePath = inc.ReadString();
|
||||
contentToPreload.Add(new ContentFile(filePath, contentType));
|
||||
}
|
||||
|
||||
bool includesFinalize = inc.ReadBoolean(); inc.ReadPadBits();
|
||||
serverSettings.ReadMonsterEnabled(inc);
|
||||
|
||||
GameModePreset gameMode = GameModePreset.List.Find(gm => gm.Identifier == modeIdentifier);
|
||||
MultiPlayerCampaign campaign =
|
||||
@@ -1269,8 +1198,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
Rand.SetSyncedSeed(seed);
|
||||
|
||||
Task startRoundTask;
|
||||
|
||||
if (campaign == null)
|
||||
{
|
||||
//this shouldn't happen, TrySelectSub should stop the coroutine if the correct sub/shuttle cannot be found
|
||||
@@ -1310,132 +1237,21 @@ namespace Barotrauma.Networking
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
|
||||
MissionPrefab missionPrefab = missionIndex < 0 ? null : MissionPrefab.List[missionIndex];
|
||||
|
||||
GameMain.GameSession = missionIndex < 0 ?
|
||||
new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, MissionType.None) :
|
||||
new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, missionPrefab);
|
||||
|
||||
//startRoundTask = Task.Run(async () => { await Task.Yield(); GameMain.GameSession.StartRound(levelSeed, levelDifficulty); });
|
||||
GameMain.GameSession.StartRound(levelSeed, levelDifficulty);
|
||||
new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, MissionPrefab.List[missionIndex]);
|
||||
GameMain.GameSession.StartRound(levelSeed, levelDifficulty, loadSecondSub);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GameMain.GameSession?.CrewManager != null) GameMain.GameSession.CrewManager.Reset();
|
||||
/*startRoundTask = Task.Run(async () =>
|
||||
{
|
||||
await Task.Yield();
|
||||
GameMain.GameSession.StartRound(campaign.Map.SelectedConnection.Level,
|
||||
reloadSub: true,
|
||||
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
||||
});*/
|
||||
GameMain.GameSession.StartRound(campaign.Map.SelectedConnection.Level,
|
||||
reloadSub: true,
|
||||
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
||||
reloadSub: true,
|
||||
loadSecondSub: false,
|
||||
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
||||
}
|
||||
|
||||
waitingForStartRoundFinalize = true;
|
||||
|
||||
DateTime? timeOut = null;
|
||||
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (timeOut.HasValue)
|
||||
{
|
||||
if (DateTime.Now > timeOut)
|
||||
{
|
||||
DebugConsole.ThrowError("Error while starting the round (did not receive STARTROUNDFINALIZE message from the server). Stopping the round...");
|
||||
roundInitStatus = RoundInitStatus.TimedOut;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (includesFinalize)
|
||||
{
|
||||
ReadStartGameFinalize(inc);
|
||||
}
|
||||
else
|
||||
{
|
||||
IWriteMessage msg = new WriteOnlyMessage();
|
||||
msg.Write((byte)ClientPacketHeader.REQUEST_STARTGAMEFINALIZE);
|
||||
clientPeer.Send(msg, DeliveryMethod.Reliable);
|
||||
}
|
||||
|
||||
//wait for up to 30 seconds for the server to send the STARTGAMEFINALIZE message
|
||||
timeOut = DateTime.Now + new TimeSpan(0, 0, seconds: 30);
|
||||
/*if (startRoundTask.Status == TaskStatus.RanToCompletion)
|
||||
{
|
||||
if (includesFinalize)
|
||||
{
|
||||
ReadStartGameFinalize(inc);
|
||||
}
|
||||
else
|
||||
{
|
||||
IWriteMessage msg = new WriteOnlyMessage();
|
||||
msg.Write((byte)ClientPacketHeader.REQUEST_STARTGAMEFINALIZE);
|
||||
clientPeer.Send(msg, DeliveryMethod.Reliable);
|
||||
}
|
||||
|
||||
//wait for up to 30 seconds for the server to send the STARTGAMEFINALIZE message
|
||||
timeOut = DateTime.Now + new TimeSpan(0, 0, seconds: 30);
|
||||
}
|
||||
else if (startRoundTask.Status == TaskStatus.Faulted)
|
||||
{
|
||||
DebugConsole.ThrowError("There was an error initializing the round: startRoundTask failed.", startRoundTask.Exception.InnerExceptions[0]);
|
||||
roundInitStatus = RoundInitStatus.Error;
|
||||
break;
|
||||
}
|
||||
else if (startRoundTask.Status == TaskStatus.Canceled)
|
||||
{
|
||||
DebugConsole.ThrowError("There was an error initializing the round: startRoundTask was canceled.");
|
||||
roundInitStatus = RoundInitStatus.Error;
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!connected)
|
||||
{
|
||||
roundInitStatus = RoundInitStatus.Interrupted;
|
||||
break;
|
||||
}
|
||||
|
||||
if (roundInitStatus != RoundInitStatus.Starting)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
clientPeer.Update((float)Timing.Step);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("There was an error initializing the round.", e, true);
|
||||
roundInitStatus = RoundInitStatus.Error;
|
||||
//startRoundTask?.Wait();
|
||||
break;
|
||||
}
|
||||
|
||||
//waiting for a STARTGAMEFINALIZE message
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
waitingForStartRoundFinalize = false;
|
||||
|
||||
if (roundInitStatus != RoundInitStatus.Started)
|
||||
{
|
||||
if (roundInitStatus != RoundInitStatus.Interrupted)
|
||||
{
|
||||
DebugConsole.ThrowError(roundInitStatus.ToString());
|
||||
CoroutineManager.StartCoroutine(EndGame(""));
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
}
|
||||
GameMain.GameSession.Mission?.ClientReadInitial(inc);
|
||||
|
||||
if (GameMain.GameSession.Submarine.IsFileCorrupted)
|
||||
{
|
||||
@@ -1445,7 +1261,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
for (int i = 0; i < Submarine.MainSubs.Length; i++)
|
||||
{
|
||||
if (Submarine.MainSubs[i] == null) { break; }
|
||||
if (!loadSecondSub && i > 0) { break; }
|
||||
|
||||
var teamID = i == 0 ? Character.TeamType.Team1 : Character.TeamType.Team2;
|
||||
Submarine.MainSubs[i].TeamID = teamID;
|
||||
@@ -1455,10 +1271,23 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
if (Level.Loaded.EqualityCheckVal != levelEqualityCheckVal)
|
||||
{
|
||||
string errorMsg = "Level equality check failed. The level generated at your end doesn't match the level generated by the server (seed: " + Level.Loaded.Seed +
|
||||
", sub: " + Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash.ShortHash + ")" +
|
||||
", mirrored: " + Level.Loaded.Mirrored + ").";
|
||||
DebugConsole.ThrowError(errorMsg, createMessageBox: true);
|
||||
GameAnalyticsManager.AddErrorEventOnce("GameClient.StartGame:LevelsDontMatch" + levelSeed, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
CoroutineManager.StartCoroutine(EndGame(""));
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
|
||||
if (respawnAllowed) { respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.UsingShuttle ? GameMain.NetLobbyScreen.SelectedShuttle : null); }
|
||||
|
||||
gameStarted = true;
|
||||
GameMain.GameSession.EventManager.PreloadContent(contentToPreload);
|
||||
|
||||
ServerSettings.ServerDetailsChanged = true;
|
||||
gameStarted = true;
|
||||
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
@@ -1606,7 +1435,7 @@ namespace Barotrauma.Networking
|
||||
existingClient.Muted = tc.Muted;
|
||||
existingClient.AllowKicking = tc.AllowKicking;
|
||||
GameMain.NetLobbyScreen.SetPlayerNameAndJobPreference(existingClient);
|
||||
if (Screen.Selected != GameMain.NetLobbyScreen && tc.CharacterID > 0)
|
||||
if (tc.CharacterID > 0)
|
||||
{
|
||||
existingClient.Character = Entity.FindEntityByID(tc.CharacterID) as Character;
|
||||
if (existingClient.Character == null)
|
||||
@@ -2150,7 +1979,8 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (!permissions.HasFlag(ClientPermissions.ConsoleCommands)) { return false; }
|
||||
|
||||
if (permittedConsoleCommands.Any(c => c.Equals(commandName, StringComparison.OrdinalIgnoreCase))) { return true; }
|
||||
commandName = commandName.ToLowerInvariant();
|
||||
if (permittedConsoleCommands.Any(c => c.ToLowerInvariant() == commandName)) { return true; }
|
||||
|
||||
//check aliases
|
||||
foreach (DebugConsole.Command command in DebugConsole.Commands)
|
||||
@@ -2668,7 +2498,6 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
var transfer = fileReceiver.ActiveTransfers.First();
|
||||
GameMain.NetLobbyScreen.FileTransferFrame.Visible = true;
|
||||
GameMain.NetLobbyScreen.FileTransferFrame.UserData = transfer;
|
||||
GameMain.NetLobbyScreen.FileTransferTitle.Text =
|
||||
ToolBox.LimitString(
|
||||
TextManager.GetWithVariable("DownloadingFile", "[filename]", transfer.FileName),
|
||||
@@ -2982,8 +2811,8 @@ namespace Barotrauma.Networking
|
||||
errorLines.Add(" " + DebugConsole.Messages[i].Time + " - " + DebugConsole.Messages[i].Text);
|
||||
}
|
||||
|
||||
string filePath = "event_error_log_client_" + Name + "_" + DateTime.UtcNow.ToShortTimeString() + ".log";
|
||||
filePath = Path.Combine(ServerLog.SavePath, ToolBox.RemoveInvalidFileNameChars(filePath));
|
||||
string filePath = "event_error_log_client_" + Name + "_" + ToolBox.RemoveInvalidFileNameChars(DateTime.UtcNow.ToShortTimeString() + ".log");
|
||||
filePath = Path.Combine(ServerLog.SavePath, filePath);
|
||||
|
||||
if (!Directory.Exists(ServerLog.SavePath))
|
||||
{
|
||||
|
||||
+2
-1
@@ -91,7 +91,6 @@ namespace Barotrauma.Networking
|
||||
return;
|
||||
}
|
||||
|
||||
incomingLidgrenMessages.Clear();
|
||||
netClient.ReadMessages(incomingLidgrenMessages);
|
||||
|
||||
foreach (NetIncomingMessage inc in incomingLidgrenMessages)
|
||||
@@ -108,6 +107,8 @@ namespace Barotrauma.Networking
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
incomingLidgrenMessages.Clear();
|
||||
}
|
||||
|
||||
private void HandleDataMessage(NetIncomingMessage inc)
|
||||
|
||||
@@ -1314,69 +1314,79 @@ namespace Barotrauma.Steam
|
||||
return upToDate;
|
||||
}
|
||||
|
||||
public static async Task<bool> AutoUpdateWorkshopItems()
|
||||
public static bool AutoUpdateWorkshopItems()
|
||||
{
|
||||
if (!isInitialized) { return false; }
|
||||
|
||||
var query = new Steamworks.Ugc.Query(Steamworks.UgcType.All)
|
||||
.WhereUserSubscribed()
|
||||
.WithLongDescription();
|
||||
|
||||
DateTime startTime = DateTime.Now;
|
||||
DateTime endTime = startTime + new TimeSpan(0, 0, 30);
|
||||
|
||||
int processedResults = 0; int pageIndex = 1;
|
||||
Steamworks.Ugc.ResultPage? resultPage = await query.GetPageAsync(pageIndex);
|
||||
|
||||
while (resultPage.HasValue && resultPage?.ResultCount > 0)
|
||||
//ugcResultPageTasks ??= new List<Task>();
|
||||
//ugcResultPageTasks.Add();
|
||||
CancellationTokenSource cancelTokenSource = new CancellationTokenSource();
|
||||
CancellationToken cancelToken = cancelTokenSource.Token;
|
||||
Task task = Task.Factory.StartNew(async () =>
|
||||
{
|
||||
if (DateTime.Now > endTime)
|
||||
int processedResults = 0; int pageIndex = 1;
|
||||
Steamworks.Ugc.ResultPage? resultPage = await query.GetPageAsync(pageIndex);
|
||||
|
||||
while (resultPage.HasValue && resultPage?.ResultCount > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
foreach (var item in resultPage.Value.Entries)
|
||||
{
|
||||
try
|
||||
foreach (var item in resultPage.Value.Entries)
|
||||
{
|
||||
if (!item.IsInstalled || !CheckWorkshopItemEnabled(item) || CheckWorkshopItemUpToDate(item)) { continue; }
|
||||
if (!UpdateWorkshopItem(item, out string errorMsg))
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
{
|
||||
cancelToken.ThrowIfCancellationRequested();
|
||||
}
|
||||
try
|
||||
{
|
||||
if (!item.IsInstalled || !CheckWorkshopItemEnabled(item) || CheckWorkshopItemUpToDate(item)) { continue; }
|
||||
if (!UpdateWorkshopItem(item, out string errorMsg))
|
||||
{
|
||||
DebugConsole.ThrowError(errorMsg);
|
||||
new GUIMessageBox(
|
||||
TextManager.Get("Error"),
|
||||
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, errorMsg }));
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: potential race condition
|
||||
new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", item.Title));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError(errorMsg);
|
||||
new GUIMessageBox(
|
||||
TextManager.Get("Error"),
|
||||
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, errorMsg }));
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: potential race condition
|
||||
new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", item.Title));
|
||||
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, e.Message + ", " + e.TargetSite }));
|
||||
GameAnalyticsManager.AddErrorEventOnce(
|
||||
"SteamManager.AutoUpdateWorkshopItems:" + e.Message,
|
||||
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
|
||||
"Failed to autoupdate workshop item \"" + item.Title + "\". " + e.Message + "\n" + e.StackTrace);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
new GUIMessageBox(
|
||||
TextManager.Get("Error"),
|
||||
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, e.Message + ", " + e.TargetSite }));
|
||||
GameAnalyticsManager.AddErrorEventOnce(
|
||||
"SteamManager.AutoUpdateWorkshopItems:" + e.Message,
|
||||
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
|
||||
"Failed to autoupdate workshop item \"" + item.Title + "\". " + e.Message + "\n" + e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
processedResults += resultPage.Value.ResultCount;
|
||||
pageIndex++;
|
||||
if (processedResults < resultPage?.TotalCount)
|
||||
{
|
||||
resultPage = await query.GetPageAsync(pageIndex);
|
||||
processedResults += resultPage.Value.ResultCount;
|
||||
pageIndex++;
|
||||
if (processedResults < resultPage?.TotalCount)
|
||||
{
|
||||
resultPage = await query.GetPageAsync(pageIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultPage = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resultPage = null;
|
||||
}
|
||||
}
|
||||
}, cancelToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
|
||||
|
||||
return true;
|
||||
task.Wait(10000);
|
||||
if (!task.IsCompleted)
|
||||
{
|
||||
cancelTokenSource.Cancel();
|
||||
task.Wait();
|
||||
}
|
||||
|
||||
return task.Status == TaskStatus.RanToCompletion;
|
||||
}
|
||||
|
||||
public static bool UpdateWorkshopItem(Steamworks.Ugc.Item? item, out string errorMsg)
|
||||
@@ -1421,7 +1431,7 @@ namespace Barotrauma.Steam
|
||||
|
||||
private static void CorrectContentFileCopy(ContentPackage package, string src, string dest, bool overwrite)
|
||||
{
|
||||
if (Path.GetExtension(src).Equals(".xml", StringComparison.OrdinalIgnoreCase))
|
||||
if (Path.GetExtension(src).ToLowerInvariant() == ".xml")
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(src);
|
||||
if (doc != null)
|
||||
@@ -1471,7 +1481,7 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
if (checkIfFileExists)
|
||||
{
|
||||
ContentPackage otherContentPackage = ContentPackage.List.Find(cp => cp.Name.Equals(splitPath[1], StringComparison.OrdinalIgnoreCase));
|
||||
ContentPackage otherContentPackage = ContentPackage.List.Find(cp => cp.Name.ToLowerInvariant() == splitPath[1].ToLowerInvariant());
|
||||
if (otherContentPackage != null)
|
||||
{
|
||||
string otherPackageName = Path.GetDirectoryName(otherContentPackage.Path);
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Barotrauma.Networking
|
||||
if (client.VoipSound == null)
|
||||
{
|
||||
DebugConsole.Log("Recreating voipsound " + queueId);
|
||||
client.VoipSound = new VoipSound(client.Name, GameMain.SoundManager, client.VoipQueue);
|
||||
client.VoipSound = new VoipSound(GameMain.SoundManager, client.VoipQueue);
|
||||
}
|
||||
|
||||
if (client.Character != null && !client.Character.IsDead && !client.Character.Removed && client.Character.SpeechImpediment <= 100.0f)
|
||||
@@ -119,7 +119,7 @@ namespace Barotrauma.Networking
|
||||
GameMain.NetLobbyScreen?.SetPlayerSpeaking(client);
|
||||
GameMain.GameSession?.CrewManager?.SetClientSpeaking(client);
|
||||
|
||||
if ((client.VoipSound.CurrentAmplitude * client.VoipSound.Gain * GameMain.SoundManager.GetCategoryGainMultiplier("voip")) > 0.1f) //TODO: might need to tweak
|
||||
if (client.VoipSound.CurrentAmplitude > 0.1f) //TODO: might need to tweak
|
||||
{
|
||||
if (client.Character != null && !client.Character.Removed)
|
||||
{
|
||||
|
||||
@@ -11,18 +11,7 @@ namespace Barotrauma.Particles
|
||||
|
||||
public string OriginalName { get { return Name; } }
|
||||
|
||||
private string _identifier;
|
||||
public string Identifier
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_identifier == null)
|
||||
{
|
||||
_identifier = Name.ToLowerInvariant();
|
||||
}
|
||||
return _identifier;
|
||||
}
|
||||
}
|
||||
public string Identifier { get { return Name.ToLowerInvariant(); } }
|
||||
|
||||
public string FilePath { get; private set; }
|
||||
|
||||
@@ -57,7 +46,7 @@ namespace Barotrauma.Particles
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("sprite", StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "sprite")
|
||||
{
|
||||
Sprites.Add(new Sprite(subElement));
|
||||
}
|
||||
|
||||
@@ -150,12 +150,6 @@ namespace Barotrauma.Particles
|
||||
{
|
||||
DistanceMin = DistanceMax = element.GetAttributeFloat("distance", 0.0f);
|
||||
}
|
||||
if (DistanceMax < DistanceMin)
|
||||
{
|
||||
var temp = DistanceMin;
|
||||
DistanceMin = DistanceMax;
|
||||
DistanceMax = temp;
|
||||
}
|
||||
|
||||
if (element.Attribute("velocity") == null)
|
||||
{
|
||||
@@ -166,12 +160,6 @@ namespace Barotrauma.Particles
|
||||
{
|
||||
VelocityMin = VelocityMax = element.GetAttributeFloat("velocity", 0.0f);
|
||||
}
|
||||
if (VelocityMax < VelocityMin)
|
||||
{
|
||||
var temp = VelocityMin;
|
||||
VelocityMin = VelocityMax;
|
||||
VelocityMax = temp;
|
||||
}
|
||||
|
||||
EmitInterval = element.GetAttributeFloat("emitinterval", 0.0f);
|
||||
ParticlesPerSecond = element.GetAttributeInt("particlespersecond", 0);
|
||||
|
||||
-3
@@ -3347,7 +3347,6 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
void CreateCloseButton(SerializableEntityEditor editor, Action onButtonClicked, float size = 1)
|
||||
{
|
||||
if (editor == null) { return; }
|
||||
int height = 30;
|
||||
var parent = new GUIFrame(new RectTransform(new Point(editor.Rect.Width, (int)(height * size * GUI.yScale)), editor.RectTransform, isFixedSize: true), style: null)
|
||||
{
|
||||
@@ -3367,7 +3366,6 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
void CreateAddButtonAtLast(ParamsEditor editor, Action onButtonClicked, string text)
|
||||
{
|
||||
if (editor == null) { return; }
|
||||
var parentFrame = new GUIFrame(new RectTransform(new Point(editor.EditorBox.Rect.Width, (int)(50 * GUI.yScale)), editor.EditorBox.Content.RectTransform), style: null, color: ParamsEditor.Color)
|
||||
{
|
||||
CanBeFocused = false
|
||||
@@ -3385,7 +3383,6 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
void CreateAddButton(SerializableEntityEditor editor, Action onButtonClicked, string text)
|
||||
{
|
||||
if (editor == null) { return; }
|
||||
var parent = new GUIFrame(new RectTransform(new Point(editor.Rect.Width, (int)(60 * GUI.yScale)), editor.RectTransform), style: null)
|
||||
{
|
||||
CanBeFocused = false
|
||||
|
||||
@@ -394,7 +394,7 @@ namespace Barotrauma.CharacterEditor
|
||||
return false;
|
||||
}
|
||||
var path = Path.GetFileName(TexturePath);
|
||||
if (!path.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
|
||||
if (!path.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("WrongFileType"), GUI.Style.Red);
|
||||
texturePathElement.Flash(GUI.Style.Red);
|
||||
@@ -724,8 +724,8 @@ namespace Barotrauma.CharacterEditor
|
||||
{
|
||||
ParseLimbsFromGUIElements();
|
||||
ParseJointsFromGUIElements();
|
||||
var main = LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.Equals("torso", StringComparison.OrdinalIgnoreCase)).FirstOrDefault() ??
|
||||
LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.Equals("head", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
|
||||
var main = LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.ToLowerInvariant() == "torso").FirstOrDefault() ??
|
||||
LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.ToLowerInvariant() == "head").FirstOrDefault();
|
||||
if (main == null)
|
||||
{
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("MissingTorsoOrHead"), GUI.Style.Red);
|
||||
|
||||
@@ -91,13 +91,7 @@ namespace Barotrauma
|
||||
c.DoVisibilityCheck(cam);
|
||||
if (c.IsVisible != wasVisible)
|
||||
{
|
||||
c.AnimController.Limbs.ForEach(l =>
|
||||
{
|
||||
if (l.LightSource != null)
|
||||
{
|
||||
l.LightSource.Enabled = c.IsVisible;
|
||||
}
|
||||
});
|
||||
c.AnimController.Limbs.ForEach(l => { if (l.LightSource != null) l.LightSource.Enabled = c.IsVisible; });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,23 +282,14 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.LinearWrap, DepthStencilState.None, null, null, cam.Transform);
|
||||
foreach (Character c in Character.CharacterList)
|
||||
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch, cam);
|
||||
|
||||
if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch, cam);
|
||||
if (GameMain.DebugDraw && GameMain.GameSession?.EventManager != null)
|
||||
{
|
||||
c.DrawFront(spriteBatch, cam);
|
||||
}
|
||||
if (Level.Loaded != null)
|
||||
{
|
||||
Level.Loaded.DrawFront(spriteBatch, cam);
|
||||
}
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
MapEntity.mapEntityList.ForEach(me => me.AiTarget?.Draw(spriteBatch));
|
||||
Character.CharacterList.ForEach(c => c.AiTarget?.Draw(spriteBatch));
|
||||
if (GameMain.GameSession?.EventManager != null)
|
||||
{
|
||||
GameMain.GameSession.EventManager.DebugDraw(spriteBatch);
|
||||
}
|
||||
GameMain.GameSession.EventManager.DebugDraw(spriteBatch);
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
if (GameMain.LightManager.LosEnabled && GameMain.LightManager.LosMode != LosMode.None && Character.Controlled != null)
|
||||
|
||||
@@ -517,21 +517,8 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
XElement levelParamElement = element;
|
||||
if (element.IsOverride())
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals(genParams.Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SerializableProperty.SerializeProperties(genParams, subElement, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (element.Name.ToString().Equals(genParams.Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SerializableProperty.SerializeProperties(genParams, element, true);
|
||||
}
|
||||
if (element.Name.ToString().ToLowerInvariant() != genParams.Name.ToLowerInvariant()) continue;
|
||||
SerializableProperty.SerializeProperties(genParams, element, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -552,7 +539,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
if (!element.Name.ToString().Equals(levelObjPrefab.Name, StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (element.Name.ToString().ToLowerInvariant() != levelObjPrefab.Name.ToLowerInvariant()) continue;
|
||||
levelObjPrefab.Save(element);
|
||||
break;
|
||||
}
|
||||
@@ -577,7 +564,7 @@ namespace Barotrauma
|
||||
bool elementFound = false;
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
if (!element.Name.ToString().Equals(genParams.Name, StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (element.Name.ToString().ToLowerInvariant() != genParams.Name.ToLowerInvariant()) continue;
|
||||
SerializableProperty.SerializeProperties(genParams, element, true);
|
||||
elementFound = true;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,8 @@ namespace Barotrauma
|
||||
private IEnumerable<object> LoadRound()
|
||||
{
|
||||
GameMain.GameSession.StartRound(campaignUI.SelectedLevel,
|
||||
reloadSub: true,
|
||||
reloadSub: true,
|
||||
loadSecondSub: false,
|
||||
mirrorLevel: GameMain.GameSession.Map.CurrentLocation != GameMain.GameSession.Map.SelectedConnection.Locations[0]);
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
|
||||
@@ -443,7 +443,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (!(FileTransferFrame.UserData is FileReceiver.FileTransferIn transfer)) { return false; }
|
||||
if (!(userdata is FileReceiver.FileTransferIn transfer)) { return false; }
|
||||
GameMain.Client?.CancelFileTransfer(transfer);
|
||||
GameMain.Client.FileReceiver.StopTransfer(transfer);
|
||||
return true;
|
||||
@@ -658,7 +658,7 @@ namespace Barotrauma
|
||||
OnClicked = (btn, obj) =>
|
||||
{
|
||||
GameMain.Client.RequestStartRound();
|
||||
CoroutineManager.StartCoroutine(WaitForStartRound(StartButton, allowCancel: false), "WaitForStartRound");
|
||||
CoroutineManager.StartCoroutine(WaitForStartRound(StartButton, allowCancel: true), "WaitForStartRound");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1147,22 +1147,6 @@ namespace Barotrauma
|
||||
clientDisabledElements.AddRange(botSpawnModeButtons);
|
||||
}
|
||||
|
||||
public void StopWaitingForStartRound()
|
||||
{
|
||||
CoroutineManager.StopCoroutines("WaitForStartRound");
|
||||
|
||||
GUIMessageBox.CloseAll();
|
||||
if (StartButton != null)
|
||||
{
|
||||
StartButton.Enabled = true;
|
||||
}
|
||||
if (campaignUI?.StartButton != null)
|
||||
{
|
||||
campaignUI.StartButton.Enabled = true;
|
||||
}
|
||||
GUI.ClearCursorWait();
|
||||
}
|
||||
|
||||
public IEnumerable<object> WaitForStartRound(GUIButton startButton, bool allowCancel)
|
||||
{
|
||||
GUI.SetCursorWaiting();
|
||||
@@ -1189,8 +1173,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
DateTime timeOut = DateTime.Now + new TimeSpan(0, 0, 10);
|
||||
while (Selected == GameMain.NetLobbyScreen &&
|
||||
DateTime.Now < timeOut)
|
||||
while (Selected == GameMain.NetLobbyScreen && DateTime.Now < timeOut)
|
||||
{
|
||||
msgBox.Header.Text = headerText + new string('.', ((int)Timing.TotalTime % 3 + 1));
|
||||
yield return CoroutineStatus.Running;
|
||||
@@ -1339,8 +1322,6 @@ namespace Barotrauma
|
||||
if (GameMain.Client == null) return;
|
||||
spectateButton.Visible = true;
|
||||
spectateButton.Enabled = true;
|
||||
|
||||
StartButton.Visible = false;
|
||||
}
|
||||
|
||||
public void SetCampaignCharacterInfo(CharacterInfo newCampaignCharacterInfo)
|
||||
@@ -1780,7 +1761,7 @@ namespace Barotrauma
|
||||
}
|
||||
GameMain.Client.RequestSelectMode(component.Parent.GetChildIndex(component));
|
||||
HighlightMode(SelectedModeIndex);
|
||||
return !presetName.Equals("multiplayercampaign", StringComparison.OrdinalIgnoreCase);
|
||||
return (presetName.ToLowerInvariant() != "multiplayercampaign");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -2260,7 +2241,7 @@ namespace Barotrauma
|
||||
targetMicStyle = "GUIMicrophoneDisabled";
|
||||
}
|
||||
|
||||
if (!targetMicStyle.Equals(currMicStyle, StringComparison.OrdinalIgnoreCase))
|
||||
if (targetMicStyle.ToLowerInvariant() != currMicStyle.ToLowerInvariant())
|
||||
{
|
||||
GUI.Style.Apply(micIcon, targetMicStyle);
|
||||
}
|
||||
@@ -2616,7 +2597,7 @@ namespace Barotrauma
|
||||
GUILayoutGroup row = null;
|
||||
int itemsInRow = 0;
|
||||
|
||||
XElement headElement = info.Ragdoll.MainElement.Elements().FirstOrDefault(e => e.GetAttributeString("type", "").Equals("head", StringComparison.OrdinalIgnoreCase));
|
||||
XElement headElement = info.Ragdoll.MainElement.Elements().FirstOrDefault(e => e.GetAttributeString("type", "").ToLowerInvariant() == "head");
|
||||
XElement headSpriteElement = headElement.Element("sprite");
|
||||
string spritePathWithTags = headSpriteElement.Attribute("texture").Value;
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
if (!element.Name.ToString().Equals(prefab.Name, StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (element.Name.ToString().ToLowerInvariant() != prefab.Name.ToLowerInvariant()) continue;
|
||||
SerializableProperty.SerializeProperties(prefab, element, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -965,7 +965,7 @@ namespace Barotrauma
|
||||
|
||||
child.Visible =
|
||||
serverInfo.OwnerVerified &&
|
||||
serverInfo.ServerName.Contains(searchBox.Text, StringComparison.OrdinalIgnoreCase) &&
|
||||
serverInfo.ServerName.ToLowerInvariant().Contains(searchBox.Text.ToLowerInvariant()) &&
|
||||
(!filterSameVersion.Selected || (remoteVersion != null && NetworkMember.IsCompatible(remoteVersion, GameMain.Version))) &&
|
||||
(!filterPassword.Selected || !serverInfo.HasPassword) &&
|
||||
(!filterIncompatible.Selected || !incompatible) &&
|
||||
@@ -996,7 +996,7 @@ namespace Barotrauma
|
||||
foreach (GUITickBox tickBox in gameModeTickBoxes)
|
||||
{
|
||||
var gameMode = (string)tickBox.UserData;
|
||||
if (!tickBox.Selected && serverInfo.GameMode.Equals(gameMode, StringComparison.OrdinalIgnoreCase))
|
||||
if (!tickBox.Selected && (serverInfo.GameMode == gameMode.ToLowerInvariant() || serverInfo.GameMode == gameMode))
|
||||
{
|
||||
child.Visible = false;
|
||||
break;
|
||||
@@ -1512,7 +1512,7 @@ namespace Barotrauma
|
||||
{
|
||||
serverList.ClearChildren();
|
||||
|
||||
if (masterServerData.Substring(0, 5).Equals("error", StringComparison.OrdinalIgnoreCase))
|
||||
if (masterServerData.Substring(0, 5).ToLowerInvariant() == "error")
|
||||
{
|
||||
DebugConsole.ThrowError("Error while connecting to master server (" + masterServerData + ")!");
|
||||
return;
|
||||
|
||||
@@ -1097,7 +1097,7 @@ namespace Barotrauma
|
||||
var tagBtn = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tagHolder.Content.RectTransform, anchor: Anchor.CenterLeft),
|
||||
tag.CapitaliseFirstInvariant(), style: "GUIButtonRound");
|
||||
tagBtn.TextBlock.AutoScaleHorizontal = true;
|
||||
tagBtn.Selected = itemEditor?.Tags?.Any(t => t.Equals(tag, StringComparison.OrdinalIgnoreCase)) ?? false;
|
||||
tagBtn.Selected = itemEditor?.Tags?.Any(t => t.ToLowerInvariant() == tag) ?? false;
|
||||
|
||||
tagBtn.OnClicked = (btn, userdata) =>
|
||||
{
|
||||
@@ -1108,7 +1108,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
itemEditor?.Tags?.RemoveAll(t => t.Equals(tagBtn.Text, StringComparison.OrdinalIgnoreCase));
|
||||
itemEditor?.Tags?.RemoveAll(t => t.ToLowerInvariant() == tagBtn.Text.ToLowerInvariant());
|
||||
tagBtn.Selected = false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -7,8 +7,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using EventInput;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -90,9 +88,6 @@ namespace Barotrauma
|
||||
private GUITextBlock submarineDescriptionCharacterCount;
|
||||
|
||||
private Mode mode;
|
||||
|
||||
// Prevent the mode from changing
|
||||
private bool lockMode;
|
||||
|
||||
public override Camera Cam
|
||||
{
|
||||
@@ -238,21 +233,15 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
var spacing = new GUIFrame(new RectTransform(new Vector2(0.02f, 1.0f), paddedTopPanel.RectTransform), style: null);
|
||||
new GUIFrame(new RectTransform(new Vector2(0.1f, 0.9f), spacing.RectTransform, Anchor.Center), style: "VerticalLine");
|
||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.9f), paddedTopPanel.RectTransform), style: "VerticalLine");
|
||||
|
||||
defaultModeTickBox = new GUITickBox(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "EditSubButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("SubEditorEditingMode"),
|
||||
OnSelected = (GUITickBox tBox) =>
|
||||
{
|
||||
if (!lockMode)
|
||||
{
|
||||
if (tBox.Selected) { SetMode(Mode.Default); }
|
||||
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
if (tBox.Selected) { SetMode(Mode.Default); }
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -261,12 +250,8 @@ namespace Barotrauma
|
||||
ToolTip = TextManager.Get("CharacterModeButton") + '\n' + TextManager.Get("CharacterModeToolTip"),
|
||||
OnSelected = (GUITickBox tBox) =>
|
||||
{
|
||||
if (!lockMode)
|
||||
{
|
||||
SetMode(tBox.Selected ? Mode.Character : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
SetMode(tBox.Selected ? Mode.Character : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -275,17 +260,20 @@ namespace Barotrauma
|
||||
ToolTip = TextManager.Get("WiringModeButton") + '\n' + TextManager.Get("WiringModeToolTip"),
|
||||
OnSelected = (GUITickBox tBox) =>
|
||||
{
|
||||
if (!lockMode)
|
||||
{
|
||||
SetMode(tBox.Selected ? Mode.Wiring : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
SetMode(tBox.Selected ? Mode.Wiring : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
spacing = new GUIFrame(new RectTransform(new Vector2(0.02f, 1.0f), paddedTopPanel.RectTransform), style: null);
|
||||
new GUIFrame(new RectTransform(new Vector2(0.1f, 0.9f), spacing.RectTransform, Anchor.Center), style: "VerticalLine");
|
||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.9f), paddedTopPanel.RectTransform), style: "VerticalLine");
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "GenerateWaypointsButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("GenerateWaypointsButton") + '\n' + TextManager.Get("GenerateWaypointsToolTip"),
|
||||
OnClicked = GenerateWaypoints
|
||||
};
|
||||
|
||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.9f), paddedTopPanel.RectTransform), style: "VerticalLine");
|
||||
|
||||
var visibilityButton = new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "SetupVisibilityButton")
|
||||
{
|
||||
@@ -311,42 +299,6 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
spacing = new GUIFrame(new RectTransform(new Vector2(0.02f, 1.0f), paddedTopPanel.RectTransform), style: null);
|
||||
new GUIFrame(new RectTransform(new Vector2(0.1f, 0.9f), spacing.RectTransform, Anchor.Center), style: "VerticalLine");
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "GenerateWaypointsButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("GenerateWaypointsButton") + '\n' + TextManager.Get("GenerateWaypointsToolTip"),
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (WayPoint.WayPointList.Any())
|
||||
{
|
||||
var generateWaypointsVerification = new GUIMessageBox("", TextManager.Get("generatewaypointsverification"), new string[] { TextManager.Get("ok"), TextManager.Get("cancel") });
|
||||
generateWaypointsVerification.Buttons[0].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (GenerateWaypoints())
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("waypointsgeneratedsuccesfully"), GUI.Style.Green);
|
||||
}
|
||||
WayPoint.ShowWayPoints = true;
|
||||
generateWaypointsVerification.Close();
|
||||
return true;
|
||||
};
|
||||
generateWaypointsVerification.Buttons[1].OnClicked = generateWaypointsVerification.Close;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GenerateWaypoints())
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("waypointsgeneratedsuccesfully"), GUI.Style.Green);
|
||||
}
|
||||
WayPoint.ShowWayPoints = true;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(0.1f, 1.0f), paddedTopPanel.RectTransform, Anchor.CenterRight), style: "GUINotificationButton")
|
||||
{
|
||||
IgnoreLayoutGroups = true,
|
||||
@@ -1035,27 +987,18 @@ namespace Barotrauma
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
var result = SaveSubToFile(nameBox.Text);
|
||||
saveFrame = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
private bool SaveSubToFile(string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
|
||||
foreach (char illegalChar in Path.GetInvalidFileNameChars())
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("SubNameMissingWarning"), GUI.Style.Red);
|
||||
return false;
|
||||
if (nameBox.Text.Contains(illegalChar))
|
||||
{
|
||||
GUI.AddMessage(TextManager.GetWithVariable("SubNameIllegalCharsWarning", "[illegalchar]", illegalChar.ToString()), GUI.Style.Red);
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var illegalChar in Path.GetInvalidFileNameChars())
|
||||
{
|
||||
if (!name.Contains(illegalChar)) continue;
|
||||
GUI.AddMessage(TextManager.GetWithVariable("SubNameIllegalCharsWarning", "[illegalchar]", illegalChar.ToString()), GUI.Style.Red);
|
||||
return false;
|
||||
}
|
||||
|
||||
string savePath = name + ".sub";
|
||||
string savePath = nameBox.Text + ".sub";
|
||||
string prevSavePath = null;
|
||||
if (Submarine.MainSub != null)
|
||||
{
|
||||
@@ -1072,8 +1015,8 @@ namespace Barotrauma
|
||||
if (vanilla != null)
|
||||
{
|
||||
var vanillaSubs = vanilla.GetFilesOfType(ContentType.Submarine);
|
||||
string pathToCompare = savePath.Replace(@"\", @"/");
|
||||
if (vanillaSubs.Any(sub => sub.Replace(@"\", @"/").Equals(pathToCompare, StringComparison.OrdinalIgnoreCase)))
|
||||
string pathToCompare = savePath.Replace(@"\", @"/").ToLowerInvariant();
|
||||
if (vanillaSubs.Any(sub => sub.Replace(@"\", @"/").ToLowerInvariant() == pathToCompare))
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("CannotEditVanillaSubs"), GUI.Style.Red, font: GUI.LargeFont);
|
||||
return false;
|
||||
@@ -1081,7 +1024,7 @@ namespace Barotrauma
|
||||
}
|
||||
#endif
|
||||
|
||||
if (previewImage?.Sprite?.Texture != null)
|
||||
if (previewImage.Sprite?.Texture != null)
|
||||
{
|
||||
using (MemoryStream imgStream = new MemoryStream())
|
||||
{
|
||||
@@ -1093,7 +1036,7 @@ namespace Barotrauma
|
||||
{
|
||||
Submarine.SaveCurrent(savePath);
|
||||
}
|
||||
Submarine.MainSub?.CheckForErrors();
|
||||
Submarine.MainSub.CheckForErrors();
|
||||
|
||||
GUI.AddMessage(TextManager.GetWithVariable("SubSavedNotification", "[filepath]", Submarine.MainSub.FilePath), GUI.Style.Green);
|
||||
|
||||
@@ -1111,6 +1054,8 @@ namespace Barotrauma
|
||||
|
||||
subNameLabel.Text = ToolBox.LimitString(Submarine.MainSub.Name, subNameLabel.Font, subNameLabel.Rect.Width);
|
||||
|
||||
saveFrame = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1679,10 +1624,7 @@ namespace Barotrauma
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
var lightComponent = item.GetComponent<LightComponent>();
|
||||
if (lightComponent != null)
|
||||
{
|
||||
lightComponent.Light.Enabled = item.ParentInventory == null;
|
||||
}
|
||||
if (lightComponent != null) lightComponent.Light.Enabled = item.ParentInventory == null;
|
||||
}
|
||||
|
||||
if (selectedSub.GameVersion < new Version("0.8.9.0"))
|
||||
@@ -1812,20 +1754,18 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetMode(Mode newMode)
|
||||
public void SetMode(Mode mode)
|
||||
{
|
||||
if (newMode == mode) { return; }
|
||||
mode = newMode;
|
||||
if (mode == this.mode) { return; }
|
||||
this.mode = mode;
|
||||
|
||||
lockMode = true;
|
||||
defaultModeTickBox.Selected = newMode == Mode.Default;
|
||||
defaultModeTickBox.Selected = mode == Mode.Default;
|
||||
defaultModeTickBox.CanBeFocused = !defaultModeTickBox.Selected;
|
||||
|
||||
characterModeTickBox.Selected = newMode == Mode.Character;
|
||||
wiringModeTickBox.Selected = newMode == Mode.Wiring;
|
||||
lockMode = false;
|
||||
|
||||
switch (newMode)
|
||||
characterModeTickBox.Selected = mode == Mode.Character;
|
||||
wiringModeTickBox.Selected = mode == Mode.Wiring;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case Mode.Character:
|
||||
CreateDummyCharacter();
|
||||
@@ -1850,7 +1790,6 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
MapEntity.DeselectAll();
|
||||
MapEntity.FilteredSelectedList.Clear();
|
||||
}
|
||||
|
||||
private void RemoveDummyCharacter()
|
||||
@@ -2065,10 +2004,12 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool GenerateWaypoints()
|
||||
private bool GenerateWaypoints(GUIButton button, object obj)
|
||||
{
|
||||
if (Submarine.MainSub == null) { return false; }
|
||||
return WayPoint.GenerateSubWaypoints(Submarine.MainSub);
|
||||
if (Submarine.MainSub == null) return false;
|
||||
|
||||
WayPoint.GenerateSubWaypoints(Submarine.MainSub);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AddPreviouslyUsed(MapEntityPrefab mapEntityPrefab)
|
||||
@@ -2465,53 +2406,12 @@ namespace Barotrauma
|
||||
hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull);
|
||||
saveAssemblyFrame.Visible = MapEntity.SelectedList.Count > 0;
|
||||
|
||||
if (GUI.KeyboardDispatcher.Subscriber == null)
|
||||
if (PlayerInput.KeyHit(Microsoft.Xna.Framework.Input.Keys.Tab))
|
||||
{
|
||||
// TODO adjust when the new inventory stuff rolls in
|
||||
if (PlayerInput.KeyHit(Keys.Q) && mode == Mode.Default)
|
||||
{
|
||||
toggleEntityMenuButton.OnClicked?.Invoke(toggleEntityMenuButton, toggleEntityMenuButton.UserData);
|
||||
}
|
||||
|
||||
if (PlayerInput.KeyHit(Keys.Tab))
|
||||
{
|
||||
entityFilterBox.Select();
|
||||
}
|
||||
|
||||
if (PlayerInput.KeyDown(Keys.LeftControl))
|
||||
{
|
||||
// Save menu
|
||||
if (PlayerInput.KeyHit(Keys.S))
|
||||
{
|
||||
if (PlayerInput.KeyDown(Keys.LeftShift))
|
||||
{
|
||||
// Save the sub without a menu
|
||||
if (subNameLabel != null)
|
||||
{
|
||||
SaveSubToFile(subNameLabel.Text);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save menu
|
||||
if (saveFrame == null)
|
||||
{
|
||||
CreateSaveScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 1-3 keys on the keyboard for switching modes
|
||||
if (PlayerInput.KeyHit(Keys.D1)) { SetMode(Mode.Default); }
|
||||
if (PlayerInput.KeyHit(Keys.D2)) { SetMode(Mode.Character); }
|
||||
if (PlayerInput.KeyHit(Keys.D3)) { SetMode(Mode.Wiring); }
|
||||
}
|
||||
else
|
||||
{
|
||||
cam.MoveCamera((float) deltaTime, true);
|
||||
}
|
||||
entityFilterBox.Select();
|
||||
}
|
||||
|
||||
|
||||
cam.MoveCamera((float)deltaTime, true);
|
||||
if (PlayerInput.MidButtonHeld())
|
||||
{
|
||||
Vector2 moveSpeed = PlayerInput.MouseSpeed * (float)deltaTime * 100.0f / cam.Zoom;
|
||||
|
||||
@@ -97,32 +97,6 @@ namespace Barotrauma.Sounds
|
||||
|
||||
if (position != null)
|
||||
{
|
||||
if (float.IsNaN(position.Value.X))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.X is NaN");
|
||||
}
|
||||
if (float.IsNaN(position.Value.Y))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.Y is NaN");
|
||||
}
|
||||
if (float.IsNaN(position.Value.Z))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.Z is NaN");
|
||||
}
|
||||
|
||||
if (float.IsInfinity(position.Value.X))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.X is Infinity");
|
||||
}
|
||||
if (float.IsInfinity(position.Value.Y))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.Y is Infinity");
|
||||
}
|
||||
if (float.IsInfinity(position.Value.Z))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.Z is Infinity");
|
||||
}
|
||||
|
||||
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
|
||||
Al.Sourcei(alSource, Al.SourceRelative, Al.False);
|
||||
int alError = Al.GetError();
|
||||
@@ -404,12 +378,12 @@ namespace Barotrauma.Sounds
|
||||
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
|
||||
if (!Al.IsSource(alSource)) return false;
|
||||
Al.GetSourcei(alSource, Al.SourceState, out state);
|
||||
bool playing = state == Al.Playing;
|
||||
int alError = Al.GetError();
|
||||
if (alError != Al.NoError)
|
||||
{
|
||||
throw new Exception("Failed to determine playing state from source: " + debugName + ", " + Al.GetErrorString(alError));
|
||||
}
|
||||
bool playing = state == Al.Playing;
|
||||
return playing;
|
||||
}
|
||||
}
|
||||
@@ -641,7 +615,7 @@ namespace Barotrauma.Sounds
|
||||
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
|
||||
|
||||
int state;
|
||||
Al.GetSourcei(alSource, Al.SourceState, out state);
|
||||
Al.GetSourcei(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.SourceState, out state);
|
||||
bool playing = state == Al.Playing;
|
||||
int alError = Al.GetError();
|
||||
if (alError != Al.NoError)
|
||||
@@ -656,7 +630,7 @@ namespace Barotrauma.Sounds
|
||||
{
|
||||
throw new Exception("Failed to determine processed buffers from streamed source: " + debugName + ", " + Al.GetErrorString(alError));
|
||||
}
|
||||
|
||||
|
||||
Al.SourceUnqueueBuffers(alSource, unqueuedBufferCount, unqueuedBuffers);
|
||||
alError = Al.GetError();
|
||||
if (alError != Al.NoError)
|
||||
@@ -753,20 +727,9 @@ namespace Barotrauma.Sounds
|
||||
streamAmplitude = streamBufferAmplitudes[queueStartIndex];
|
||||
|
||||
Al.GetSourcei(alSource, Al.SourceState, out state);
|
||||
alError = Al.GetError();
|
||||
if (alError != Al.NoError)
|
||||
{
|
||||
throw new Exception("Failed to retrieve stream source state: " + debugName + ", " + Al.GetErrorString(alError));
|
||||
}
|
||||
|
||||
if (state != Al.Playing)
|
||||
{
|
||||
Al.SourcePlay(alSource);
|
||||
alError = Al.GetError();
|
||||
if (alError != Al.NoError)
|
||||
{
|
||||
throw new Exception("Failed to start stream playback: " + debugName + ", " + Al.GetErrorString(alError));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,10 +738,6 @@ namespace Barotrauma.Sounds
|
||||
streamAmplitude = 0.0f;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError($"An exception was thrown when updating a sound stream ({debugName})", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Monitor.Exit(mutex);
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Barotrauma
|
||||
string filePathB = b.GetAttributeString("file", "").CleanUpPath();
|
||||
float baseGainB = b.GetAttributeFloat("volume", 1.0f);
|
||||
float rangeB = b.GetAttributeFloat("range", 1000.0f);
|
||||
return a.Name.ToString().Equals(b.Name.ToString(), StringComparison.OrdinalIgnoreCase) &&
|
||||
return a.Name.ToString().ToLowerInvariant() == b.Name.ToString().ToLowerInvariant() &&
|
||||
filePathA == filePathB && MathUtils.NearlyEqual(baseGainA, baseGainB) &&
|
||||
MathUtils.NearlyEqual(rangeA, rangeB);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ namespace Barotrauma
|
||||
|
||||
SoundCount = 1 + soundElements.Count();
|
||||
|
||||
var startUpSoundElement = soundElements.Find(e => e.Name.ToString().Equals("startupsound", StringComparison.OrdinalIgnoreCase));
|
||||
var startUpSoundElement = soundElements.Find(e => e.Name.ToString().ToLowerInvariant() == "startupsound");
|
||||
if (startUpSoundElement != null)
|
||||
{
|
||||
startUpSound = GameMain.SoundManager.LoadSound(startUpSoundElement, false);
|
||||
@@ -182,7 +182,7 @@ namespace Barotrauma
|
||||
musicClips.AddIfNotNull(newMusicClip);
|
||||
if (loadedSoundElements != null)
|
||||
{
|
||||
if (newMusicClip.Type.Equals("menu", StringComparison.OrdinalIgnoreCase))
|
||||
if (newMusicClip.Type.ToLowerInvariant() == "menu")
|
||||
{
|
||||
targetMusic[0] = newMusicClip;
|
||||
}
|
||||
|
||||
@@ -59,10 +59,8 @@ namespace Barotrauma.Sounds
|
||||
get { return soundChannel?.CurrentAmplitude ?? 0.0f; }
|
||||
}
|
||||
|
||||
public VoipSound(string name, SoundManager owner, VoipQueue q) : base(owner, "voip", true, true)
|
||||
public VoipSound(SoundManager owner, VoipQueue q) : base(owner, "voip", true, true)
|
||||
{
|
||||
Filename = $"VoIP ({name})";
|
||||
|
||||
VoipConfig.SetupEncoding();
|
||||
|
||||
ALFormat = Al.FormatMono16;
|
||||
@@ -95,28 +93,9 @@ namespace Barotrauma.Sounds
|
||||
|
||||
public void ApplyFilters(short[] buffer, int readSamples)
|
||||
{
|
||||
for (int i = 0; i < readSamples; i++)
|
||||
{
|
||||
float fVal = ShortToFloat(buffer[i]);
|
||||
if (UseMuffleFilter)
|
||||
{
|
||||
foreach (var filter in muffleFilters)
|
||||
{
|
||||
fVal = filter.Process(fVal);
|
||||
}
|
||||
}
|
||||
if (UseRadioFilter)
|
||||
{
|
||||
foreach (var filter in radioFilters)
|
||||
{
|
||||
fVal = filter.Process(fVal);
|
||||
}
|
||||
}
|
||||
buffer[i] = FloatToShort(fVal);
|
||||
}
|
||||
if (UseMuffleFilter)
|
||||
{
|
||||
ApplyFilters(muffleFilters, buffer, readSamples);
|
||||
ApplyFilters(radioFilters, buffer, readSamples);
|
||||
}
|
||||
|
||||
if (UseRadioFilter)
|
||||
@@ -127,6 +106,15 @@ namespace Barotrauma.Sounds
|
||||
|
||||
private void ApplyFilters(IEnumerable<BiQuad> filters, short[] buffer, int readSamples)
|
||||
{
|
||||
for (int i = 0; i < readSamples; i++)
|
||||
{
|
||||
float fVal = ShortToFloat(buffer[i]);
|
||||
foreach (var filter in filters)
|
||||
{
|
||||
fVal = filter.Process(fVal);
|
||||
}
|
||||
buffer[i] = FloatToShort(fVal);
|
||||
}
|
||||
}
|
||||
|
||||
public override SoundChannel Play(float gain, float range, Vector2 position, bool muffle = false)
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
partial void ApplyProjSpecific(float deltaTime, Entity entity, IEnumerable<ISerializableEntity> targets, Hull hull, Vector2 worldPosition)
|
||||
partial void ApplyProjSpecific(float deltaTime, Entity entity, List<ISerializableEntity> targets, Hull hull, Vector2 worldPosition)
|
||||
{
|
||||
if (entity == null) { return; }
|
||||
|
||||
@@ -116,13 +116,13 @@ namespace Barotrauma
|
||||
{
|
||||
if (entity is Item item && item.body != null)
|
||||
{
|
||||
angle = -item.body.Rotation;
|
||||
if (item.body.Dir < 0.0f) { angle += MathHelper.Pi; }
|
||||
angle = item.body.Rotation + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi);
|
||||
}
|
||||
}
|
||||
|
||||
emitter.Emit(deltaTime, worldPosition, hull, angle: angle, particleRotation: angle);
|
||||
}
|
||||
emitter.Emit(deltaTime, worldPosition, hull, angle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static partial void UpdateAllProjSpecific(float deltaTime)
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Barotrauma
|
||||
Identifier = element.GetAttributeString("identifier", "");
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("icon", StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "icon")
|
||||
{
|
||||
Icon = new Sprite(subElement);
|
||||
IconColor = subElement.GetAttributeColor("color", Color.White);
|
||||
|
||||
@@ -240,13 +240,13 @@ namespace Barotrauma
|
||||
name = null; endpoint = null; lobbyId = 0;
|
||||
if (args == null || args.Length < 2) { return; }
|
||||
|
||||
if (args[0].Equals("-connect", StringComparison.OrdinalIgnoreCase))
|
||||
if (args[0].Equals("-connect", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
if (args.Length < 3) { return; }
|
||||
name = args[1];
|
||||
endpoint = args[2];
|
||||
}
|
||||
else if (args[0].Equals("+connect_lobby", StringComparison.OrdinalIgnoreCase))
|
||||
else if (args[0].Equals("+connect_lobby", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
UInt64.TryParse(args[1], out lobbyId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user