diff --git a/Barotrauma/BarotraumaClient/ClientCode.projitems b/Barotrauma/BarotraumaClient/ClientCode.projitems index 991ce2d39..1b79fd2eb 100644 --- a/Barotrauma/BarotraumaClient/ClientCode.projitems +++ b/Barotrauma/BarotraumaClient/ClientCode.projitems @@ -43,12 +43,8 @@ - - + - - - @@ -188,7 +184,6 @@ - diff --git a/Barotrauma/BarotraumaClient/Icon.bmp b/Barotrauma/BarotraumaClient/Icon.bmp index 0a6d53e80..dedeee273 100644 Binary files a/Barotrauma/BarotraumaClient/Icon.bmp and b/Barotrauma/BarotraumaClient/Icon.bmp differ diff --git a/Barotrauma/BarotraumaClient/Launch_Barotrauma b/Barotrauma/BarotraumaClient/Launch_Barotrauma index 4e95158fd..8792fad24 100644 --- a/Barotrauma/BarotraumaClient/Launch_Barotrauma +++ b/Barotrauma/BarotraumaClient/Launch_Barotrauma @@ -1,3 +1,3 @@ #!/bin/sh -./Barotrauma +exec mono "./Barotrauma.exe" MONO_LOG_LEVEL=debug "$@" diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj index 56b243537..f0fa4331e 100644 --- a/Barotrauma/BarotraumaClient/LinuxClient.csproj +++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj @@ -56,30 +56,13 @@ true 0 - - true - ..\bin\x86\ReleaseLinux\ - TRACE;LINUX;CLIENT - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - true - - - true - ..\bin\x86\DebugLinux\ - TRACE;DEBUG;LINUX;CLIENT - 0 - full - x86 - MinimumRecommendedRules.ruleset - true - + + ..\..\Libraries\NuGet\Concentus.1.1.7\lib\portable-net45+win+wpa81+wp80\Concentus.dll + ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll @@ -149,10 +132,6 @@ - - {0e7fee6a-15e5-4a4e-943c-80276003478c} - Concentus - {3af0347c-5a9b-4421-868c-8ee3dbfaebc6} Facepunch.Steamworks @@ -207,73 +186,13 @@ PreserveNewest - - PreserveNewest - PreserveNewest PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - @@ -298,12 +217,7 @@ Other similar extension points exist, see Microsoft.Common.targets. - --> - - - - - + --> \ No newline at end of file diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj index 797f42a80..29dd488d3 100644 --- a/Barotrauma/BarotraumaClient/MacClient.csproj +++ b/Barotrauma/BarotraumaClient/MacClient.csproj @@ -55,30 +55,13 @@ true 0 - - true - ..\bin\x86\ReleaseMac\ - TRACE;OSX;CLIENT - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - true - - - true - ..\bin\x86\DebugMac\ - TRACE;DEBUG;OSX;CLIENT - 0 - full - x86 - MinimumRecommendedRules.ruleset - true - + + ..\..\Libraries\NuGet\Concentus.1.1.7\lib\portable-net45+win+wpa81+wp80\Concentus.dll + ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll @@ -148,10 +131,6 @@ - - {0e7fee6a-15e5-4a4e-943c-80276003478c} - Concentus - {3af0347c-5a9b-4421-868c-8ee3dbfaebc6} Facepunch.Steamworks @@ -209,62 +188,7 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - @@ -284,12 +208,7 @@ Other similar extension points exist, see Microsoft.Common.targets. - --> - - - - - + --> \ No newline at end of file diff --git a/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs b/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs index 5e2918897..b67af8559 100644 --- a/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs +++ b/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.8.10.0")] -[assembly: AssemblyFileVersion("0.8.10.0")] +[assembly: AssemblyVersion("0.8.9.10")] +[assembly: AssemblyFileVersion("0.8.9.10")] diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs index 2e11c7af2..69530ef26 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs @@ -98,7 +98,7 @@ namespace Barotrauma if (distSqrd > 10.0f || !character.AllowInput) { Collider.TargetRotation = newRotation; - SetPosition(newPosition, lerp: distSqrd < 5.0f, ignorePlatforms: false); + SetPosition(newPosition, lerp: distSqrd < 5.0f); } else { @@ -238,16 +238,20 @@ namespace Barotrauma } float errorMagnitude = positionError.Length(); - if (errorMagnitude > 0.5f) - { - character.MemLocalState.Clear(); - SetPosition(serverPos.Position, lerp: true, ignorePlatforms: false); - } - else if (errorMagnitude > 0.01f) + if (errorMagnitude > 0.01f) { Collider.TargetPosition = Collider.SimPosition + positionError; Collider.TargetRotation = Collider.Rotation + rotationError; Collider.MoveToTargetPosition(lerp: true); + if (errorMagnitude > 0.5f) + { + character.MemLocalState.Clear(); + foreach (Limb limb in Limbs) + { + limb.body.TargetPosition = limb.body.SimPosition + positionError; + limb.body.MoveToTargetPosition(lerp: true); + } + } } } @@ -260,17 +264,57 @@ namespace Barotrauma partial void ImpactProjSpecific(float impact, Body body) { - float volume = MathHelper.Clamp(impact - 3.0f, 0.5f, 1.0f); + float volume = Math.Min(impact - 3.0f, 1.0f); - if (body.UserData is Limb limb && character.Stun <= 0f) + partial void UpdateNetPlayerPositionProjSpecific(float deltaTime, float lowestSubPos) + { + if (character != GameMain.Client.Character || !character.AllowInput) { - if (impact > 3.0f) { PlayImpactSound(limb); } - } - else if (body.UserData is Limb || body == Collider.FarseerBody) - { - if (!character.IsRemotePlayer && impact > ImpactTolerance) + Limb limb = (Limb)body.UserData; + if (impact > 3.0f && limb.LastImpactSoundTime < Timing.TotalTime - Limb.SoundInterval) { - SoundPlayer.PlayDamageSound("LimbBlunt", strongestImpact, Collider); + limb.LastImpactSoundTime = (float)Timing.TotalTime; + if (!string.IsNullOrWhiteSpace(limb.HitSoundTag)) + { + SoundPlayer.PlaySound(limb.HitSoundTag, volume, impact * 100.0f, limb.WorldPosition, character.CurrentHull); + } + + //unconscious/dead characters can't correct their position using AnimController movement + // -> we need to correct it manually + if (!character.AllowInput) + { + float mainLimbDistSqrd = Vector2.DistanceSquared(MainLimb.PullJointWorldAnchorA, Collider.SimPosition); + float mainLimbErrorTolerance = 0.1f; + //if the main limb is roughly at the correct position and the collider isn't moving (much at least), + //don't attempt to correct the position. + if (mainLimbDistSqrd > mainLimbErrorTolerance || Collider.LinearVelocity.LengthSquared() > 0.05f) + { + SoundPlayer.PlaySound(wearable.Sound, volume, impact * 100.0f, limb.WorldPosition, character.CurrentHull); + } + } + } + character.MemLocalState.Clear(); + } + else + { + if (!character.IsRemotePlayer) + { + if (character.Submarine == null) + { + //transform in-sub coordinates to outside coordinates + if (character.MemLocalState[i].Position.Y > lowestSubPos) + { + character.MemLocalState[i].TransformInToOutside(); + } + } + else if (currentHull?.Submarine != null) + { + //transform outside coordinates to in-sub coordinates + if (character.MemLocalState[i].Position.Y < lowestSubPos) + { + character.MemLocalState[i].TransformOutToInside(currentHull.Submarine); + } + } } } if (Character.Controlled == character) @@ -279,29 +323,6 @@ namespace Barotrauma } } - public void PlayImpactSound(Limb limb) - { - limb.LastImpactSoundTime = (float)Timing.TotalTime; - if (!string.IsNullOrWhiteSpace(limb.HitSoundTag)) - { - bool inWater = limb.inWater; - if (character.CurrentHull != null && - character.CurrentHull.Surface > character.CurrentHull.Rect.Y - character.CurrentHull.Rect.Height && - limb.SimPosition.Y < ConvertUnits.ToSimUnits(character.CurrentHull.Rect.Y - character.CurrentHull.Rect.Height) + limb.body.GetMaxExtent()) - { - inWater = true; - } - SoundPlayer.PlaySound(inWater ? "footstep_water" : limb.HitSoundTag, limb.WorldPosition, hullGuess: character.CurrentHull); - } - foreach (WearableSprite wearable in limb.WearingItems) - { - if (limb.type == wearable.Limb && !string.IsNullOrWhiteSpace(wearable.Sound)) - { - SoundPlayer.PlaySound(wearable.Sound, limb.WorldPosition, hullGuess: character.CurrentHull); - } - } - } - partial void Splash(Limb limb, Hull limbHull) { //create a splash particle @@ -364,8 +385,6 @@ namespace Barotrauma partial void UpdateProjSpecific(float deltaTime) { - if (!character.Enabled || SimplePhysicsEnabled) { return; } - LimbJoints.ForEach(j => j.UpdateDeformations(deltaTime)); foreach (var deformation in SpriteDeformations) { @@ -396,7 +415,7 @@ namespace Barotrauma } } - partial void SeverLimbJointProjSpecific(LimbJoint limbJoint, bool playSound = true) + partial void SeverLimbJointProjSpecific(LimbJoint limbJoint) { foreach (Limb limb in new Limb[] { limbJoint.LimbA, limbJoint.LimbB }) { @@ -414,11 +433,6 @@ namespace Barotrauma character.CurrentHull?.AddDecal(character.BloodDecalName, limb.WorldPosition, MathHelper.Clamp(limb.Mass, 0.5f, 2.0f)); } } - - if (playSound) - { - SoundPlayer.PlayDamageSound("Gore", 1.0f, limbJoint.LimbA.body); - } } public virtual void Draw(SpriteBatch spriteBatch, Camera cam) @@ -436,15 +450,14 @@ namespace Barotrauma return; } - Color? color = null; - if (character.ExternalHighlight) - { - color = Color.Lerp(Color.White, Color.OrangeRed, (float)Math.Sin(Timing.TotalTime * 3.5f)); - } + //foreach (Limb limb in Limbs) + //{ + // limb.Draw(spriteBatch, cam); + //} for (int i = 0; i < limbs.Length; i++) { - inversedLimbDrawOrder[i].Draw(spriteBatch, cam, color); + inversedLimbDrawOrder[i].Draw(spriteBatch, cam); } LimbJoints.ForEach(j => j.Draw(spriteBatch)); } diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs b/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs index 3b3626b65..7d293d643 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs @@ -50,7 +50,7 @@ namespace Barotrauma if (sound != null) { - SoundPlayer.PlaySound(sound.Sound, worldPosition, sound.Volume, sound.Range); + SoundPlayer.PlaySound(sound.Sound, sound.Volume, sound.Range, worldPosition); } } } diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs index 4c029c726..e4668eccd 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs @@ -46,7 +46,8 @@ namespace Barotrauma if (controlled == value) return; controlled = value; if (controlled != null) controlled.Enabled = true; - CharacterHealth.OpenHealthWindow = null; + CharacterHealth.OpenHealthWindow = null; + } } @@ -110,33 +111,6 @@ namespace Barotrauma get { return gibEmitters; } } - public class ObjectiveEntity - { - public Entity Entity; - public Sprite Sprite; - public Color Color; - - public ObjectiveEntity(Entity entity, Sprite sprite, Color? color = null) - { - Entity = entity; - Sprite = sprite; - if (color.HasValue) - { - Color = color.Value; - } - else - { - Color = Color.White; - } - } - } - - private List activeObjectiveEntities = new List(); - public IEnumerable ActiveObjectiveEntities - { - get { return activeObjectiveEntities; } - } - partial void InitProjSpecific(XDocument doc) { soundInterval = doc.Root.GetAttributeFloat("soundinterval", 10.0f); @@ -164,6 +138,7 @@ namespace Barotrauma break; } } + } hudProgressBars = new Dictionary(); } @@ -756,24 +731,10 @@ namespace Barotrauma var matchingSoundsList = matchingSounds.ToList(); var selectedSound = matchingSoundsList[Rand.Int(matchingSoundsList.Count)]; - soundChannel = SoundPlayer.PlaySound(selectedSound.Sound, AnimController.WorldPosition, selectedSound.Volume, selectedSound.Range, CurrentHull); + soundChannel = SoundPlayer.PlaySound(selectedSound.Sound, selectedSound.Volume, selectedSound.Range, AnimController.WorldPosition, CurrentHull); soundTimer = soundInterval; } - public void AddActiveObjectiveEntity(Entity entity, Sprite sprite, Color? color = null) - { - if (activeObjectiveEntities.Any(aoe => aoe.Entity == entity)) return; - ObjectiveEntity objectiveEntity = new ObjectiveEntity(entity, sprite, color); - activeObjectiveEntities.Add(objectiveEntity); - } - - public void RemoveActiveObjectiveEntity(Entity entity) - { - ObjectiveEntity found = activeObjectiveEntities.Find(aoe => aoe.Entity == entity); - if (found == null) return; - activeObjectiveEntities.Remove(found); - } - partial void ImplodeFX() { Vector2 centerOfMass = AnimController.GetCenterOfMass(); diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs index 34cc2ebeb..a2137e660 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs @@ -85,8 +85,7 @@ namespace Barotrauma { if (character.Inventory != null) { - if (!character.LockHands && character.Stun < 0.1f && - (character.SelectedConstruction == null || character.SelectedConstruction.GetComponent() == null)) + if (!character.LockHands && character.Stun < 0.1f) { character.Inventory.Update(deltaTime, cam); } @@ -169,12 +168,7 @@ namespace Barotrauma DrawOrderIndicator(spriteBatch, cam, character, character.CurrentOrder, 1.0f); } } - - foreach (Character.ObjectiveEntity objectiveEntity in character.ActiveObjectiveEntities) - { - DrawObjectiveIndicator(spriteBatch, cam, character, objectiveEntity, 1.0f); - } - + foreach (Item brokenItem in brokenItems) { float dist = Vector2.Distance(character.WorldPosition, brokenItem.WorldPosition); @@ -321,7 +315,6 @@ namespace Barotrauma } if (character.Inventory != null && !character.LockHands) { - character.Inventory.Locked = (character.SelectedConstruction != null && character.SelectedConstruction.GetComponent() != null); character.Inventory.DrawOwn(spriteBatch); character.Inventory.CurrentLayout = CharacterHealth.OpenHealthWindow == null && character.SelectedCharacter == null ? CharacterInventory.Layout.Default : @@ -366,33 +359,17 @@ namespace Barotrauma private static void DrawOrderIndicator(SpriteBatch spriteBatch, Camera cam, Character character, Order order, float iconAlpha = 1.0f) { - if (order.TargetAllCharacters && !order.HasAppropriateJob(character)) { return; } + if (order.TargetAllCharacters && !order.HasAppropriateJob(character)) return; Entity target = order.ConnectedController != null ? order.ConnectedController.Item : order.TargetEntity; - if (target == null) { return; } + if (target == null) return; - //don't show the indicator if far away and not inside the same sub - //prevents exploiting the indicators in locating the sub - if (character.Submarine != target.Submarine && - Vector2.DistanceSquared(character.WorldPosition, target.WorldPosition) > 1000.0f * 1000.0f) - { - return; - } - - if (!orderIndicatorCount.ContainsKey(target)) { orderIndicatorCount.Add(target, 0); } + if (!orderIndicatorCount.ContainsKey(target)) orderIndicatorCount.Add(target, 0); Vector2 drawPos = target.WorldPosition + Vector2.UnitX * order.SymbolSprite.size.X * 1.5f * orderIndicatorCount[target]; GUI.DrawIndicator(spriteBatch, drawPos, cam, 100.0f, order.SymbolSprite, order.Color * iconAlpha); orderIndicatorCount[target] = orderIndicatorCount[target] + 1; } - - private static void DrawObjectiveIndicator(SpriteBatch spriteBatch, Camera cam, Character character, Character.ObjectiveEntity objectiveEntity, float iconAlpha = 1.0f) - { - if (objectiveEntity == null) return; - - Vector2 drawPos = objectiveEntity.Entity.WorldPosition;// + Vector2.UnitX * objectiveEntity.Sprite.size.X * 1.5f; - GUI.DrawIndicator(spriteBatch, drawPos, cam, 100.0f, objectiveEntity.Sprite, objectiveEntity.Color * iconAlpha); - } } } diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterInfo.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterInfo.cs index 473dd6774..e01a3dd2b 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/CharacterInfo.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterInfo.cs @@ -50,7 +50,7 @@ namespace Barotrauma Job.Name, textColor: Job.Prefab.UIColor, font: font); } - if (personalityTrait != null && TextManager.Language == "English") + if (personalityTrait != null) { new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), headerTextArea.RectTransform), TextManager.Get("PersonalityTrait") + ": " + personalityTrait.Name, font: font); diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs b/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs index 34ebcb336..777bc7775 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs @@ -96,11 +96,6 @@ namespace Barotrauma private const float UpdateDisplayedAfflictionsInterval = 0.5f; private List currentDisplayedAfflictions = new List(); - public bool MouseOnElement - { - get { return highlightedLimbIndex > -1 || GUI.MouseOn == dropItemArea; } - } - private static CharacterHealth openHealthWindow; public static CharacterHealth OpenHealthWindow { @@ -136,17 +131,6 @@ namespace Barotrauma } } - public GUIButton CPRButton - { - get { return cprButton; } - } - - public float HealthBarPulsateTimer - { - get { return healthBarPulsateTimer; } - set { healthBarPulsateTimer = MathHelper.Clamp(value, 0.0f, 10.0f); } - } - static CharacterHealth() { damageOverlay = new Sprite("Content/UI/damageOverlay.png", Vector2.Zero); @@ -188,16 +172,18 @@ namespace Barotrauma afflictionInfoContainer = new GUIListBox(new RectTransform(new Vector2(0.7f, 0.85f), paddedInfoFrame.RectTransform, Anchor.BottomLeft)); - lowSkillIndicator = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), paddedInfoFrame.RectTransform, Anchor.TopRight), - TextManager.Get("LowMedicalSkillWarning"), Color.Orange, textAlignment: Alignment.TopRight, font: GUI.SmallFont, wrap: true) + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.08f), paddedInfoFrame.RectTransform), TextManager.Get("SuitableTreatments"), textAlignment: Alignment.TopRight); + lowSkillIndicator = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.07f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.08f) }, + TextManager.Get("LowMedicalSkillWarning"), Color.Orange, textAlignment: Alignment.Center, font: GUI.SmallFont, wrap: true) { Visible = false }; - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), paddedInfoFrame.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.05f) }, TextManager.Get("SuitableTreatments"), textAlignment: Alignment.BottomRight); - - recommendedTreatmentContainer = new GUIListBox(new RectTransform(new Vector2(0.28f, 0.5f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.12f) }); + recommendedTreatmentContainer = new GUIListBox(new RectTransform(new Vector2(0.28f, 0.5f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.15f) }) + { + Spacing = 10 + }; dropItemArea = new GUIFrame(new RectTransform(new Vector2(0.28f, 0.3f), paddedInfoFrame.RectTransform, Anchor.BottomRight) - { RelativeOffset = new Vector2(0.02f, 0.0f) }, style: null) + { RelativeOffset = new Vector2(0.0f, 0.0f) }, style: null) { ToolTip = TextManager.Get("HealthItemUseTip") }; @@ -598,18 +584,9 @@ namespace Barotrauma 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 = GetMathingLimbHealth(affliction); + if (limbHealth != null) { - var limbHealth = GetMathingLimbHealth(affliction); - if (limbHealth != null) - { - selectedLimbIndex = limbHealths.IndexOf(limbHealth); - } - } - else - { - // If no affliction is critical, select the limb which has most damage. - var limbHealth = limbHealths.OrderByDescending(l => l.TotalDamage).FirstOrDefault(); selectedLimbIndex = limbHealths.IndexOf(limbHealth); } } @@ -951,7 +928,7 @@ namespace Barotrauma { afflictionInfoContainer.Content.ClearChildren(); recommendedTreatmentContainer.Content.ClearChildren(); - + float characterSkillLevel = Character.Controlled == null ? 0.0f : Character.Controlled.GetSkillLevel("medical"); //random variance is 200% when the skill is 0 @@ -1046,15 +1023,14 @@ namespace Barotrauma { ItemPrefab item = MapEntityPrefab.Find(name: null, identifier: treatment.Key, showErrorMessages: false) as ItemPrefab; if (item == null) continue; - int slotSize = (int)(recommendedTreatmentContainer.Content.Rect.Width * 0.5f); + int slotSize = (int)(recommendedTreatmentContainer.Content.Rect.Width * 0.8f); - var itemSlot = new GUIFrame(new RectTransform(new Point(recommendedTreatmentContainer.Content.Rect.Width, slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter), - style: "InnerGlow") + var itemSlot = new GUIButton(new RectTransform(new Point(slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter), + text: "", style: "InventorySlotSmall") { - UserData = item, - CanBeFocused = false + UserData = item }; - itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.Orange, Color.LightGreen); + itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.White, Color.LightGreen); Sprite itemSprite = item.InventoryIcon ?? item.sprite; Color itemColor = itemSprite == item.sprite ? item.SpriteColor : item.InventoryIconColor; @@ -1438,8 +1414,6 @@ namespace Barotrauma { foreach (Limb limb in Character.AnimController.Limbs) { - if (limb.HealthIndex < 0 || limb.HealthIndex >= limbHealths.Count) { continue; } - limb.BurnOverlayStrength = 0.0f; limb.DamageOverlayStrength = 0.0f; if (limbHealths[limb.HealthIndex].Afflictions.Count == 0) continue; diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Jobs/JobPrefab.cs b/Barotrauma/BarotraumaClient/Source/Characters/Jobs/JobPrefab.cs index 4fc63b3cb..1ef7b8cc5 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Jobs/JobPrefab.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Jobs/JobPrefab.cs @@ -20,7 +20,7 @@ namespace Barotrauma var skillContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.45f, 0.5f), paddedFrame.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.2f + descriptionBlock.RectTransform.RelativeSize.Y) }); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), skillContainer.RectTransform), - TextManager.Get("Skills"), font: GUI.LargeFont); + TextManager.Get("Skills") + ": ", font: GUI.LargeFont); foreach (SkillPrefab skill in Skills) { new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), skillContainer.RectTransform), @@ -30,7 +30,7 @@ namespace Barotrauma var itemContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.45f, 0.5f), paddedFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.2f + descriptionBlock.RectTransform.RelativeSize.Y) }); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), itemContainer.RectTransform), - TextManager.Get("Items", fallBackTag: "mapentitycategory.equipment"), font: GUI.LargeFont); + TextManager.Get("Items") + ": ", font: GUI.LargeFont); foreach (string itemName in ItemNames) { new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), itemContainer.RectTransform), diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs index 63beecb56..0db66467c 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs @@ -292,10 +292,10 @@ namespace Barotrauma if (!string.IsNullOrWhiteSpace(damageModifier.DamageSound)) { damageSoundType = damageModifier.DamageSound; + SoundPlayer.PlayDamageSound(damageSoundType, Math.Max(damage, bleedingDamage), WorldPosition); break; } } - SoundPlayer.PlayDamageSound(damageSoundType, Math.Max(damage, bleedingDamage), WorldPosition); } // Always spawn damage particles diff --git a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs index 908458aaf..e1b97e425 100644 --- a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs +++ b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs @@ -29,7 +29,7 @@ namespace Barotrauma if (!CheatsEnabled && IsCheat) { NewMessage("You need to enable cheats using the command \"enablecheats\" before you can use the command \"" + names[0] + "\".", Color.Red); - if (Steam.SteamManager.USE_STEAM) + if (GameMain.Config.UseSteam) { NewMessage("Enabling cheats will disable Steam achievements during this play session.", Color.Red); } @@ -340,7 +340,7 @@ namespace Barotrauma CheatsEnabled = true; SteamAchievementManager.CheatsEnabled = true; NewMessage("Enabled cheat commands.", Color.Red); - if (Steam.SteamManager.USE_STEAM) + if (GameMain.Config.UseSteam) { NewMessage("Steam achievements have been disabled during this play session.", Color.Red); } @@ -377,27 +377,23 @@ namespace Barotrauma GameMain.SubEditorScreen.Select(); })); - commands.Add(new Command("editparticles|particleeditor", "editparticles/particleeditor: Switch to the Particle Editor to edit particle effects.", (string[] args) => + commands.Add(new Command("editparticles|particleeditor", "", (string[] args) => { GameMain.ParticleEditorScreen.Select(); })); - commands.Add(new Command("editlevels|leveleditor", "editlevels/leveleditor: Switch to the Level Editor to edit levels.", (string[] args) => + commands.Add(new Command("editlevels|editlevel|leveleditor", "", (string[] args) => { GameMain.LevelEditorScreen.Select(); })); - commands.Add(new Command("editsprites|spriteeditor", "editsprites/spriteeditor: Switch to the Sprite Editor to edit the source rects and origins of sprites.", (string[] args) => + commands.Add(new Command("editsprites|editsprite|spriteeditor|spriteedit", "", (string[] args) => { GameMain.SpriteEditorScreen.Select(); })); - commands.Add(new Command("editcharacters|charactereditor", "editcharacters/charactereditor: Switch to the Character Editor to edit/create the ragdolls and animations of characters.", (string[] args) => + commands.Add(new Command("charactereditor|editcharacter|editcharacters|editanimation|editanimations|animedit|animationeditor|animeditor|animationedit", "charactereditor: Edit characters, animations, ragdolls....", (string[] args) => { - if (Screen.Selected == GameMain.GameScreen) - { - NewMessage("WARNING: Switching between the character editor and the game view may cause odd behaviour or bugs. Use with caution.", Color.Orange); - } GameMain.CharacterEditorScreen.Select(); })); @@ -1096,8 +1092,8 @@ namespace Barotrauma List lines = new List(); foreach (MapEntityPrefab me in MapEntityPrefab.List) { - lines.Add("" + me.Name + ""); - lines.Add("" + me.Description + ""); + lines.Add("" + me.Name + ""); + lines.Add("" + me.Description + ""); } File.WriteAllLines(filePath, lines); })); @@ -1527,7 +1523,7 @@ namespace Barotrauma character.AnimController.ResetRagdoll(); }, isCheat: true)); - commands.Add(new Command("reloadwearables", "Reloads the sprites of all limbs and wearable sprites (clothing) of the controlled character. Provide id or name if you want to target another character.", args => + commands.Add(new Command("reloadwearables|reloadlimbs", "Reloads the sprites of all limbs and wearable sprites (clothing) of the controlled character. Provide id or name if you want to target another character.", args => { var character = (args.Length == 0) ? Character.Controlled : FindMatchingCharacter(args, true); if (character == null) @@ -1538,26 +1534,6 @@ namespace Barotrauma ReloadWearables(character); }, isCheat: true)); - commands.Add(new Command("loadwearable", "Force select certain variant for the selected character.", args => - { - var character = Character.Controlled; - if (character == null) - { - ThrowError("Not controlling any character."); - return; - } - if (args.Length == 0) - { - ThrowError("No arguments provided! Give an index number for the variant starting from 1."); - return; - } - if (int.TryParse(args[0], out int variant)) - { - ReloadWearables(character, variant); - } - - }, isCheat: true)); - commands.Add(new Command("reloadsprite|reloadsprites", "Reloads the sprites of the selected item(s)/structure(s) (hovering over or selecting in the subeditor) or the controlled character. Can also reload sprites by entity id or by the name attribute (sprite element). Example 1: reloadsprite id itemid. Example 2: reloadsprite name \"Sprite name\"", args => { if (Screen.Selected is SpriteEditorScreen) @@ -1705,7 +1681,7 @@ namespace Barotrauma }, isCheat: true)); } - private static void ReloadWearables(Character character, int variant = 0) + private static void ReloadWearables(Character character) { foreach (var limb in character.AnimController.Limbs) { @@ -1714,17 +1690,11 @@ namespace Barotrauma limb.DeformSprite?.Sprite.ReloadTexture(); foreach (var wearable in limb.WearingItems) { - if (variant > 0 && wearable.Variant > 0) - { - wearable.Variant = variant; - } - wearable.RefreshPath(); wearable.Sprite.ReloadXML(); wearable.Sprite.ReloadTexture(); } foreach (var wearable in limb.OtherWearables) { - wearable.RefreshPath(); wearable.Sprite.ReloadXML(); wearable.Sprite.ReloadTexture(); } diff --git a/Barotrauma/BarotraumaClient/Source/EventInput/EventInput.cs b/Barotrauma/BarotraumaClient/Source/EventInput/EventInput.cs index ee3619634..557196cd5 100644 --- a/Barotrauma/BarotraumaClient/Source/EventInput/EventInput.cs +++ b/Barotrauma/BarotraumaClient/Source/EventInput/EventInput.cs @@ -155,9 +155,6 @@ namespace EventInput return SetWindowLongPtr(hWnd, nIndex, dwNewLong); } - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - static extern IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong); - [DllImport("user32.dll", CharSet = CharSet.Unicode)] static extern IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong); #endif @@ -176,8 +173,8 @@ namespace EventInput #if WINDOWS hookProcDelegate = HookProc; - prevWndProc = TrySetWindowLong(window.Handle, GWL_WNDPROC, - Marshal.GetFunctionPointerForDelegate(hookProcDelegate)); + prevWndProc = SetWindowLongPtr(window.Handle, GWL_WNDPROC, + Marshal.GetFunctionPointerForDelegate(hookProcDelegate)); hIMC = ImmGetContext(window.Handle); #else diff --git a/Barotrauma/BarotraumaClient/Source/Fonts/ScalableFont.cs b/Barotrauma/BarotraumaClient/Source/Fonts/ScalableFont.cs index f3f368a53..a5ef20967 100644 --- a/Barotrauma/BarotraumaClient/Source/Fonts/ScalableFont.cs +++ b/Barotrauma/BarotraumaClient/Source/Fonts/ScalableFont.cs @@ -56,11 +56,11 @@ namespace Barotrauma } public ScalableFont(XElement element, GraphicsDevice gd = null) - : this (element.GetAttributeString("file", ""), (uint)element.GetAttributeInt("size", 14), gd, element.GetAttributeBool("dynamicloading", false)) + : this (element.GetAttributeString("file", ""), (uint)element.GetAttributeInt("size", 14), gd) { } - public ScalableFont(string filename, uint size, GraphicsDevice gd = null, bool dynamicLoading = false) + public ScalableFont(string filename, uint size, GraphicsDevice gd = null) { if (Lib == null) Lib = new Library(); this.filename = filename; @@ -390,14 +390,10 @@ namespace Barotrauma if (text[i] == '\n') { currentLineX = 0.0f; - retVal.Y += baseHeight * 1.8f; + retVal.Y += baseHeight * 18 / 10; continue; } uint charIndex = text[i]; - if (DynamicLoading && !texCoords.ContainsKey(charIndex)) - { - DynamicRenderAtlas(graphicsDevice, charIndex); - } if (texCoords.TryGetValue(charIndex, out GlyphData gd)) { currentLineX += gd.advance; @@ -411,10 +407,6 @@ namespace Barotrauma { Vector2 retVal = Vector2.Zero; retVal.Y = baseHeight * 1.8f; - if (DynamicLoading && !texCoords.ContainsKey(c)) - { - DynamicRenderAtlas(graphicsDevice, c); - } if (texCoords.TryGetValue(c, out GlyphData gd)) { retVal.X = gd.advance; diff --git a/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs index ff3cd1dae..490c0d21a 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs @@ -18,7 +18,9 @@ namespace Barotrauma private GUITextBox inputBox; private GUIButton toggleButton; - + + private GUIButton radioButton; + private Point screenResolution; private bool isSinglePlayer; @@ -58,7 +60,12 @@ namespace Barotrauma { get { return guiFrame; } } - + + public GUIButton RadioButton + { + get { return radioButton; } + } + public GUITextBox InputBox { get { return inputBox; } @@ -102,7 +109,31 @@ namespace Barotrauma { gui.Text = ""; }; - + + radioButton = new GUIButton(new RectTransform(new Vector2(0.1f, 2.0f), inputBox.RectTransform, + HUDLayoutSettings.ChatBoxAlignment == Alignment.Right ? Anchor.BottomRight : Anchor.BottomLeft, + HUDLayoutSettings.ChatBoxAlignment == Alignment.Right ? Pivot.TopRight : Pivot.TopLeft), + style: null); + new GUIImage(new RectTransform(Vector2.One, radioButton.RectTransform), radioIcon, scaleToFit: true); + radioButton.OnClicked = (GUIButton btn, object userData) => + { + if (inputBox.Selected) + { + inputBox.Text = ""; + inputBox.Deselect(); + } + else + { + inputBox.Select(); + var radioItem = Character.Controlled?.Inventory?.Items.FirstOrDefault(i => i?.GetComponent() != null); + if (radioItem != null && Character.Controlled.HasEquippedItem(radioItem) && radioItem.GetComponent().CanTransmit()) + { + inputBox.Text = "r; "; + } + } + return true; + }; + ToggleOpen = GameMain.Config.ChatOpen; } @@ -337,6 +368,7 @@ namespace Barotrauma } openState = MathHelper.Clamp(openState, 0.0f, 1.0f); int hiddenBoxOffset = guiFrame.Rect.Width + toggleButton.Rect.Width; + if (radioButton != null) hiddenBoxOffset += (int)(radioButton.Rect.Width * 1.5f); guiFrame.RectTransform.AbsoluteOffset = new Point((int)MathHelper.SmoothStep(hiddenBoxOffset * (HUDLayoutSettings.ChatBoxAlignment == Alignment.Left ? -1 : 1), 0, openState), 0); } diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs index bb18cab55..53457108e 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs @@ -129,8 +129,6 @@ namespace Barotrauma get { return pauseMenuOpen; } } - public static bool PreventPauseMenuToggle = false; - public static Color ScreenOverlayColor { get; @@ -1415,7 +1413,6 @@ namespace Barotrauma public static void TogglePauseMenu() { if (Screen.Selected == GameMain.MainMenuScreen) return; - if (PreventPauseMenuToggle) return; settingsMenuOpen = false; @@ -1549,9 +1546,9 @@ namespace Barotrauma if (GameMain.GameSession != null) { - if (Tutorial.Initialized) + if (ContextualTutorial.Initialized && GameMain.GameSession.GameMode is SinglePlayerCampaign) { - ((TutorialMode)GameMain.GameSession.GameMode).Tutorial.Stop(); + ((SinglePlayerCampaign)GameMain.GameSession.GameMode).ContextualTutorial.Stop(); } if (GameSettings.SendUserStatistics) @@ -1571,7 +1568,7 @@ namespace Barotrauma } /// - /// Displays a message at the center of the screen, automatically preventing overlapping with other centered messages. TODO: Allow to show messages at the middle of the screen (instead of the top center). + /// Displays a message at the center of the screen, automatically preventing overlapping with other centered messages /// public static void AddMessage(string message, Color color, float? lifeTime = null, bool playSound = true, ScalableFont font = null) { diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIButton.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIButton.cs index 05e991ab8..e9046010b 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIButton.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIButton.cs @@ -174,11 +174,6 @@ namespace Barotrauma if (frame != null) frame.ApplyStyle(style); } - public override void Flash(Color? color = null, float flashDuration = 1.5f, bool useRectangleFlash = false, Vector2? flashRectInflate = null) - { - Frame.Flash(color, flashDuration, useRectangleFlash, flashRectInflate); - } - protected override void Draw(SpriteBatch spriteBatch) { //do nothing diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs index 5d05c9d64..d7fa5f045 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs @@ -121,22 +121,17 @@ namespace Barotrauma protected Color selectedColor; protected Color pressedColor; - private CoroutineHandle pulsateCoroutine; - protected ComponentState state; protected Color flashColor; protected float flashDuration = 1.5f; - private bool useRectangleFlash; - public virtual float FlashTimer - { - get { return flashTimer; } - } protected float flashTimer; private Vector2 flashRectInflate; public bool IgnoreLayoutGroups; + public bool IgnoreLayoutGroups; + public virtual ScalableFont Font { get; @@ -166,7 +161,9 @@ namespace Barotrauma get { return enabled; } set { enabled = value; } } - + + public bool TileSprites; + private static GUITextBlock toolTipBlock; public Vector2 Center @@ -267,8 +264,6 @@ namespace Barotrauma set { pressedColor = value; } } - public bool ExternalHighlight = false; - private RectTransform rectTransform; public RectTransform RectTransform { @@ -441,21 +436,11 @@ namespace Barotrauma int flashCycleCount = (int)Math.Max(flashDuration, 1); float flashCycleDuration = flashDuration / flashCycleCount; - Rectangle flashRect = Rect; - flashRect.Inflate(flashRectInflate.X, flashRectInflate.Y); - //MathHelper.Pi * 0.8f -> the curve goes from 144 deg to 0, //i.e. quickly bumps up from almost full brightness to full and then fades out - if (!useRectangleFlash) - { - GUI.UIGlow.Draw(spriteBatch, - flashRect, - flashColor * (float)Math.Sin(flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f)); - } - else - { - GUI.DrawRectangle(spriteBatch, flashRect, flashColor * (float)Math.Sin(flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f), true); - } + GUI.UIGlow.Draw(spriteBatch, + rect, + flashColor * (float)Math.Sin(flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f)); } } @@ -503,11 +488,9 @@ namespace Barotrauma color = new Color(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, a); } - public virtual void Flash(Color? color = null, float flashDuration = 1.5f, bool useRectangleFlash = false, Vector2? flashRectInflate = null) + public virtual void Flash(Color? color = null, float flashDuration = 1.5f) { flashTimer = flashDuration; - this.flashRectInflate = flashRectInflate ?? Vector2.Zero; - this.useRectangleFlash = useRectangleFlash; this.flashDuration = flashDuration; flashColor = (color == null) ? Color.Red : (Color)color; } @@ -525,7 +508,9 @@ namespace Barotrauma while (t < duration) { t += CoroutineManager.DeltaTime; + SetAlpha(MathHelper.Lerp(startA, to, t / duration)); + yield return CoroutineStatus.Running; } @@ -538,30 +523,9 @@ namespace Barotrauma yield return CoroutineStatus.Success; } + #endregion - public void Pulsate(Vector2 startScale, Vector2 endScale, float duration) - { - if (CoroutineManager.IsCoroutineRunning(pulsateCoroutine)) - { - return; - } - pulsateCoroutine = CoroutineManager.StartCoroutine(DoPulsate(startScale, endScale, duration), "Pulsate" + ToString()); - } - - private IEnumerable DoPulsate(Vector2 startScale, Vector2 endScale, float duration) - { - float t = 0.0f; - while (t < duration) - { - t += CoroutineManager.DeltaTime; - RectTransform.LocalScale = Vector2.Lerp(startScale, endScale, (float)Math.Sin(t / duration * MathHelper.Pi)); - yield return CoroutineStatus.Running; - } - RectTransform.LocalScale = startScale; - yield return CoroutineStatus.Success; - } - - public virtual void ApplyStyle(GUIComponentStyle style) + protected virtual void SetAlpha(float a) { if (style == null) return; @@ -574,7 +538,13 @@ namespace Barotrauma OutlineColor = style.OutlineColor; - this.style = style; + public virtual void Flash(Color? color = null, float flashDuration = 1.5f, bool useRectangleFlash = false, Vector2? flashRectInflate = null) + { + flashTimer = flashDuration; + this.flashRectInflate = flashRectInflate ?? Vector2.Zero; + this.useRectangleFlash = useRectangleFlash; + this.flashDuration = flashDuration; + flashColor = (color == null) ? Color.Red : (Color)color; } } } diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIImage.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIImage.cs index 27743748b..d4f13ecad 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIImage.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIImage.cs @@ -108,18 +108,18 @@ namespace Barotrauma { float scale = Math.Min(Rect.Width / uiSprite.Sprite.size.X, Rect.Height / uiSprite.Sprite.size.Y); spriteBatch.Draw(uiSprite.Sprite.Texture, Rect.Center.ToVector2(), uiSprite.Sprite.SourceRect, currColor * (currColor.A / 255.0f), Rotation, uiSprite.Sprite.size / 2, - Scale * scale, SpriteEffects, 0.0f); + Scale * scale, SpriteEffects.None, 0.0f); } else { - uiSprite.Draw(spriteBatch, Rect, currColor * (currColor.A / 255.0f), SpriteEffects); + uiSprite.Draw(spriteBatch, Rect, currColor * (currColor.A / 255.0f), SpriteEffects.None); } } } else if (sprite?.Texture != null) { spriteBatch.Draw(sprite.Texture, Rect.Center.ToVector2(), sourceRect, currColor * (currColor.A / 255.0f), Rotation, sprite.size / 2, - Scale, SpriteEffects, 0.0f); + Scale, SpriteEffects.None, 0.0f); } } diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs index 528ce8e2b..049ea780e 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs @@ -511,8 +511,10 @@ namespace Barotrauma pos = 0; totalSize += child.Rect.Width + spacing; } - pos += child.Rect.Height + spacing; - + else + { + pos += child.Rect.Height + spacing; + } if (child == children.Last()) { totalSize += child.Rect.Width + spacing; @@ -525,7 +527,10 @@ namespace Barotrauma pos = 0; totalSize += child.Rect.Height + spacing; } - pos += child.Rect.Width + spacing; + else + { + pos += child.Rect.Width + spacing; + } if (child == children.Last()) { diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIMessageBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIMessageBox.cs index 0c091c992..ec9c026e6 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIMessageBox.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIMessageBox.cs @@ -41,22 +41,33 @@ namespace Barotrauma InnerFrame = new GUIFrame(new RectTransform(new Point(width, height), RectTransform, Anchor.Center) { IsFixedSize = false }, style: null); GUI.Style.Apply(InnerFrame, "", this); + InnerFrame = new GUIFrame(new RectTransform(new Point(width, height), RectTransform, Anchor.Center) { IsFixedSize = false }, style: null); + GUI.Style.Apply(InnerFrame, "", this); + Content = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.85f), InnerFrame.RectTransform, Anchor.Center)) { AbsoluteSpacing = 5 }; Tag = tag; - + + if (height == 0) + { + string wrappedText = ToolBox.WrapText(text, Content.Rect.Width, GUI.Font); + string[] lines = wrappedText.Split('\n'); + foreach (string line in lines) + { + height += (int)GUI.Font.MeasureString(line).Y; + } + height += string.IsNullOrWhiteSpace(headerText) ? 220 : 220 - headerHeight; + } + InnerFrame.RectTransform.NonScaledSize = new Point(InnerFrame.Rect.Width, height); + Header = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), Content.RectTransform), headerText, textAlignment: Alignment.Center, wrap: true); - GUI.Style.Apply(Header, "", this); - Header.RectTransform.MinSize = new Point(0, Header.Rect.Height); + GUI.Style.Apply(Header, "", this); - if (!string.IsNullOrWhiteSpace(text)) + if (height == 0) { Text = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), Content.RectTransform), text, textAlignment: textAlignment, wrap: true); GUI.Style.Apply(Text, "", this); - Text.RectTransform.NonScaledSize = Text.RectTransform.MinSize = Text.RectTransform.MaxSize = - new Point(Text.Rect.Width, Text.Rect.Height); - Text.RectTransform.IsFixedSize = true; } var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.15f), Content.RectTransform, Anchor.BottomCenter, maxSize: new Point(1000, 50)), @@ -65,22 +76,7 @@ namespace Barotrauma AbsoluteSpacing = 5, IgnoreLayoutGroups = true }; - buttonContainer.RectTransform.NonScaledSize = buttonContainer.RectTransform.MinSize = buttonContainer.RectTransform.MaxSize = - new Point(buttonContainer.Rect.Width, (int)(30 * GUI.Scale)); - buttonContainer.RectTransform.IsFixedSize = true; - - if (height == 0) - { - height += Header.Rect.Height + Content.AbsoluteSpacing; - height += (Text == null ? 0 : Text.Rect.Height) + Content.AbsoluteSpacing; - height += buttonContainer.Rect.Height; - - InnerFrame.RectTransform.NonScaledSize = - new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + 50)); - Content.RectTransform.NonScaledSize = - new Point(Content.Rect.Width, height); - } - + Buttons = new List(buttons.Length); for (int i = 0; i < buttons.Length; i++) { diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs index 2eddac84f..f7006dea9 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs @@ -1,5 +1,4 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.Xml.Linq; @@ -10,12 +9,6 @@ namespace Barotrauma { private Dictionary componentStyles; - private XElement configElement; - - private GraphicsDevice graphicsDevice; - - private ScalableFont defaultFont; - public ScalableFont Font { get; private set; } public ScalableFont SmallFont { get; private set; } public ScalableFont LargeFont { get; private set; } @@ -52,6 +45,24 @@ namespace Barotrauma { switch (subElement.Name.ToString().ToLowerInvariant()) { + case "font": + Font = new ScalableFont(subElement, graphicsDevice); + break; + case "smallfont": + SmallFont = new ScalableFont(subElement, graphicsDevice); + break; + case "largefont": + LargeFont = new ScalableFont(subElement, graphicsDevice); + break; + case "objectivetitle": + ObjectiveTitleFont = new ScalableFont(subElement, graphicsDevice); + break; + case "objectivename": + ObjectiveNameFont = new ScalableFont(subElement, graphicsDevice); + break; + case "videotitle": + VideoTitleFont = new ScalableFont(subElement, graphicsDevice); + break; case "cursor": CursorSprite = new Sprite(subElement); break; @@ -61,48 +72,12 @@ namespace Barotrauma case "focusindicator": FocusIndicator = new SpriteSheet(subElement); break; - case "font": - Font = LoadFont(subElement, graphicsDevice); - break; - case "smallfont": - SmallFont = LoadFont(subElement, graphicsDevice); - break; - case "largefont": - LargeFont = LoadFont(subElement, graphicsDevice); - break; - case "objectivetitle": - ObjectiveTitleFont = LoadFont(subElement, graphicsDevice); - break; - case "objectivename": - ObjectiveNameFont = LoadFont(subElement, graphicsDevice); - break; - case "videotitle": - VideoTitleFont = LoadFont(subElement, graphicsDevice); - break; default: GUIComponentStyle componentStyle = new GUIComponentStyle(subElement); componentStyles.Add(subElement.Name.ToString().ToLowerInvariant(), componentStyle); break; } } - } - - /// - /// Returns the default font of the currently selected language - /// - public ScalableFont LoadCurrentDefaultFont() - { - defaultFont?.Dispose(); - defaultFont = null; - foreach (XElement subElement in configElement.Elements()) - { - switch (subElement.Name.ToString().ToLowerInvariant()) - { - case "font": - defaultFont = LoadFont(subElement, graphicsDevice); - break; - } - } return defaultFont; } @@ -191,6 +166,12 @@ namespace Barotrauma return style; } + public GUIComponentStyle GetComponentStyle(string name) + { + componentStyles.TryGetValue(name.ToLowerInvariant(), out GUIComponentStyle style); + return style; + } + public void Apply(GUIComponent targetComponent, string styleName = "", GUIComponent parent = null) { GUIComponentStyle componentStyle = null; diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUITextBlock.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUITextBlock.cs index 04e0d0848..0968704c5 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUITextBlock.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUITextBlock.cs @@ -1,8 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; -using System.Collections.Generic; -using System.Linq; namespace Barotrauma { @@ -249,7 +247,7 @@ namespace Barotrauma return; } - textPos = new Vector2(padding.X + (rect.Width - padding.Z - padding.X) / 2.0f, padding.Y + (rect.Height - padding.Y - padding.W) / 2.0f); + textPos = new Vector2(rect.Width / 2.0f, rect.Height / 2.0f); origin = TextSize * 0.5f; if (textAlignment.HasFlag(Alignment.Left) && !overflowClipActive) @@ -335,7 +333,7 @@ namespace Barotrauma { spriteBatch.End(); spriteBatch.GraphicsDevice.ScissorRectangle = prevScissorRect; - spriteBatch.Begin(SpriteSortMode.Deferred, rasterizerState: GameMain.ScissorTestEnable); + spriteBatch.Begin(SpriteSortMode.Deferred); } if (OutlineColor.A * currColor.A > 0.0f) GUI.DrawRectangle(spriteBatch, rect, OutlineColor * (currColor.A / 255.0f), false); diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUITextBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUITextBox.cs index 886e5aa2c..b21e70a49 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUITextBox.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUITextBox.cs @@ -123,12 +123,6 @@ namespace Barotrauma } } - public bool OverflowClip - { - get { return textBlock.OverflowClip; } - set { textBlock.OverflowClip = value; } - } - public override bool Enabled { get { return enabled; } @@ -324,7 +318,7 @@ namespace Barotrauma for (int i = 0; i <= textBlock.Text.Length; i++) { Vector2 textSize = Font.MeasureString(textBlock.Text.Substring(0, i)); - Vector2 indexPos = new Vector2(textSize.X + textBlock.Padding.X, textSize.Y + textBlock.Padding.Y) + textBlock.TextPos - textBlock.Origin; + Vector2 indexPos = new Vector2(textSize.X + textBlock.Padding.X, textSize.Y + textBlock.Padding.Y); //DebugConsole.NewMessage($"index: {i}, pos: {indexPos}", Color.WhiteSmoke); positions.Add(new Tuple(textBlock.Rect.Location.ToVector2() + indexPos, i)); } @@ -365,9 +359,9 @@ namespace Barotrauma OnDeselected?.Invoke(this, Keys.None); } - public override void Flash(Color? color = null, float flashDuration = 1.5f, bool useRectangleFlash = false, Vector2? flashRectOffset = null) + public override void Flash(Color? color = null, float flashDuration = 1.5f) { - textBlock.Flash(color, flashDuration, useRectangleFlash, flashRectOffset); + textBlock.Flash(color, flashDuration); } protected override void Update(float deltaTime) @@ -411,7 +405,7 @@ namespace Barotrauma { isSelecting = PlayerInput.KeyDown(Keys.LeftShift) || PlayerInput.KeyDown(Keys.RightShift); } - + if (CaretEnabled) { if (textBlock.OverflowClipActive) @@ -434,7 +428,7 @@ namespace Barotrauma CalculateCaretPos(); } } - + if (GUI.KeyboardDispatcher.Subscriber == this) { state = ComponentState.Selected; @@ -553,7 +547,15 @@ namespace Barotrauma public void ReceiveTextInput(char inputChar) { - ReceiveTextInput(inputChar.ToString()); + if (selectedCharacters > 0) + { + RemoveSelectedText(); + } + if (SetText(Text.Insert(CaretIndex, inputChar.ToString()))) + { + CaretIndex = Math.Min(Text.Length, CaretIndex + 1); + OnTextChanged?.Invoke(this, Text); + } } public void ReceiveTextInput(string input) @@ -562,16 +564,10 @@ namespace Barotrauma { RemoveSelectedText(); } - Vector2 textPos = textBlock.TextPos; - bool wasOverflowClipActive = textBlock.OverflowClipActive; if (SetText(Text.Insert(CaretIndex, input))) { CaretIndex = Math.Min(Text.Length, CaretIndex + input.Length); OnTextChanged?.Invoke(this, Text); - if (textBlock.OverflowClipActive && wasOverflowClipActive && !MathUtils.NearlyEqual(textBlock.TextPos, textPos)) - { - textBlock.TextPos = textPos + Vector2.UnitX * Font.MeasureString(input).X; - } } } diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUITickBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUITickBox.cs index 06e197eeb..913914243 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUITickBox.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUITickBox.cs @@ -44,11 +44,10 @@ namespace Barotrauma public Color TextColor { - get { return text.TextColor; } - set { text.TextColor = value; } + get { return box; } } - public override Rectangle MouseRect + public GUITextBlock TextBlock { get { @@ -57,17 +56,14 @@ namespace Barotrauma } } - public override ScalableFont Font + public override string ToolTip { - get - { - return base.Font; - } - + get { return base.ToolTip; } set { - base.Font = value; - if (text != null) text.Font = value; + base.ToolTip = value; + box.ToolTip = value; + text.ToolTip = value; } } @@ -76,11 +72,6 @@ namespace Barotrauma get { return box; } } - public GUITextBlock TextBlock - { - get { return text; } - } - public override string ToolTip { get { return base.ToolTip; } @@ -128,7 +119,6 @@ namespace Barotrauma private void ResizeBox() { box.RectTransform.NonScaledSize = new Point(RectTransform.NonScaledSize.Y); - text.RectTransform.NonScaledSize = new Point(Rect.Width - box.Rect.Width, text.Rect.Height); text.RectTransform.AbsoluteOffset = new Point(box.Rect.Width, 0); } diff --git a/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs b/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs index e8e7f7d0a..260e45a1d 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs @@ -5,13 +5,12 @@ using System; using System.Collections.Generic; using System.Xml.Linq; using Barotrauma.Media; -using System.Linq; namespace Barotrauma { class LoadingScreen { - private Texture2D backgroundTexture; + private Texture2D backgroundTexture, monsterTexture, titleTexture; private RenderTarget2D renderTarget; @@ -44,7 +43,18 @@ namespace Barotrauma private object loadMutex = new object(); private float? loadState; - + + public Vector2 TitleSize + { + get { return new Vector2(titleTexture.Width, titleTexture.Height); } + } + + public float Scale + { + get; + private set; + } + public float? LoadState { get @@ -93,7 +103,7 @@ namespace Barotrauma try { DrawSplashScreen(spriteBatch); - if (SplashScreen != null && SplashScreen.IsPlaying) return; + if (SplashScreen!=null && SplashScreen.IsPlaying) return; } catch (Exception e) { @@ -101,27 +111,20 @@ namespace Barotrauma GameMain.Config.EnableSplashScreen = false; } } - - var titleStyle = GUI.Style?.GetComponentStyle("TitleText"); - Sprite titleSprite = null; - if (titleStyle != null && titleStyle.Sprites.ContainsKey(GUIComponent.ComponentState.None)) - { - titleSprite = titleStyle.Sprites[GUIComponent.ComponentState.None].First()?.Sprite; - } - + drawn = true; graphics.SetRenderTarget(renderTarget); - float backgroundScale = GameMain.GraphicsHeight / 1500.0f; - float titleScale = MathHelper.SmoothStep(0.8f, 1.0f, state / 10.0f) * GameMain.GraphicsHeight / 1000.0f; + Scale = GameMain.GraphicsHeight / 1500.0f; state += deltaTime; if (DrawLoadingText) { - BackgroundPosition = new Vector2(GameMain.GraphicsWidth * 0.3f, GameMain.GraphicsHeight * 0.45f); - TitlePosition = new Vector2(GameMain.GraphicsWidth * 0.5f, GameMain.GraphicsHeight * 0.45f); + CenterPosition = new Vector2(GameMain.GraphicsWidth * 0.3f, GameMain.GraphicsHeight / 2.0f); + TitlePosition = CenterPosition + new Vector2(-0.0f + (float)Math.Sqrt(state) * 220.0f, 0.0f) * Scale; + TitlePosition.X = Math.Min(TitlePosition.X, (float)GameMain.GraphicsWidth / 2.0f); } spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); @@ -129,10 +132,16 @@ namespace Barotrauma spriteBatch.Draw(backgroundTexture, BackgroundPosition, null, Color.White * Math.Min(state / 5.0f, 1.0f), 0.0f, new Vector2(backgroundTexture.Width / 2.0f, backgroundTexture.Height / 2.0f), - backgroundScale * 1.5f, SpriteEffects.None, 0.2f); - - titleSprite?.Draw(spriteBatch, TitlePosition, Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), scale: titleScale); - + Scale * 1.5f, SpriteEffects.None, 0.2f); + + spriteBatch.Draw(monsterTexture, + CenterPosition + new Vector2((state % 40) * 100.0f - 1800.0f, (state % 40) * 30.0f - 200.0f) * Scale, null, + Color.White, 0.0f, Vector2.Zero, Scale, SpriteEffects.None, 0.1f); + + spriteBatch.Draw(titleTexture, + TitlePosition, null, + Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), 0.0f, new Vector2(titleTexture.Width / 2.0f, titleTexture.Height / 2.0f), Scale, SpriteEffects.None, 0.0f); + spriteBatch.End(); graphics.SetRenderTarget(null); @@ -145,7 +154,9 @@ namespace Barotrauma spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); - titleSprite?.Draw(spriteBatch, TitlePosition, Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), scale: titleScale); + spriteBatch.Draw(titleTexture, + TitlePosition, null, + Color.White * Math.Min((state - 3.0f) / 5.0f, 1.0f), 0.0f, new Vector2(titleTexture.Width / 2.0f, titleTexture.Height / 2.0f), Scale, SpriteEffects.None, 0.0f); if (DrawLoadingText) { diff --git a/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs b/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs index be069e5da..bb327ac69 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs @@ -10,10 +10,9 @@ namespace Barotrauma { class VideoPlayer { - public bool IsPlaying; - private Video currentVideo; private string filePath; + private bool isPlaying; private GUIFrame background, videoFrame, textFrame; private GUITextBlock title, textContent, objectiveTitle, objectiveText; @@ -25,14 +24,12 @@ namespace Barotrauma private Point scaledVideoResolution; private readonly int borderSize = 20; - private readonly Point buttonSize = new Point(120, 30); + private readonly Point buttonSize = new Point(160, 50); private readonly int titleHeight = 30; private readonly int objectiveFrameHeight = 60; private readonly int textHeight = 25; - private bool useTextOnRightSide = false; - - public class TextSettings + public struct TextSettings { public string Text; public int Width; @@ -44,7 +41,7 @@ namespace Barotrauma } } - public class VideoSettings + public struct VideoSettings { public string File; @@ -65,14 +62,7 @@ namespace Barotrauma background = new GUIFrame(new RectTransform(Point.Zero, GUI.Canvas, Anchor.Center), "InnerFrame", backgroundColor); videoFrame = new GUIFrame(new RectTransform(Point.Zero, background.RectTransform, Anchor.Center, Pivot.Center), "SonarFrame"); - if (useTextOnRightSide) - { - textFrame = new GUIFrame(new RectTransform(Point.Zero, videoFrame.RectTransform, Anchor.CenterLeft, Pivot.CenterLeft), "TextFrame"); - } - else - { - textFrame = new GUIFrame(new RectTransform(Point.Zero, videoFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), "TextFrame"); - } + textFrame = new GUIFrame(new RectTransform(Point.Zero, videoFrame.RectTransform, Anchor.CenterLeft, Pivot.CenterLeft), "TextFrame"); videoView = new GUICustomComponent(new RectTransform(Point.Zero, videoFrame.RectTransform, Anchor.Center), (spriteBatch, guiCustomComponent) => { DrawVideo(spriteBatch, guiCustomComponent.Rect); }); title = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft), string.Empty, font: GUI.VideoTitleFont, textColor: new Color(253, 174, 0), textAlignment: Alignment.Left); @@ -80,7 +70,7 @@ namespace Barotrauma textContent = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft), string.Empty, font: GUI.Font, textAlignment: Alignment.TopLeft); objectiveTitle = new GUITextBlock(new RectTransform(new Vector2(1f, 0f), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.ObjectiveTitleFont, textAlignment: Alignment.CenterRight, textColor: Color.White); - objectiveTitle.Text = TextManager.Get("Tutorial.NewObjective"); + objectiveTitle.Text = TextManager.Get("NewObjective"); objectiveText = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.ObjectiveNameFont, textColor: new Color(4, 180, 108), textAlignment: Alignment.CenterRight); objectiveTitle.Visible = objectiveText.Visible = false; @@ -88,12 +78,12 @@ namespace Barotrauma public void Play() { - IsPlaying = true; + isPlaying = true; } public void Stop() { - IsPlaying = false; + isPlaying = false; if (currentVideo == null) return; currentVideo.Dispose(); currentVideo = null; @@ -109,6 +99,13 @@ namespace Barotrauma public void Update() { if (currentVideo == null) return; + + if (PlayerInput.KeyHit(Keys.Enter) || PlayerInput.KeyHit(Keys.Escape)) + { + DisposeVideo(null, null); + return; + } + if (currentVideo.IsPlaying) return; currentVideo.Dispose(); @@ -118,7 +115,7 @@ namespace Barotrauma public void AddToGUIUpdateList(bool ignoreChildren = false, int order = 0) { - if (!IsPlaying) return; + if (!isPlaying) return; background.AddToGUIUpdateList(ignoreChildren, order); } @@ -141,8 +138,8 @@ namespace Barotrauma } currentVideo = CreateVideo(scaledVideoResolution); - title.Text = textSettings != null ? TextManager.Get(contentId) : string.Empty; - textContent.Text = textSettings != null ? textSettings.Text : string.Empty; + title.Text = TextManager.Get(contentId); + textContent.Text = textSettings.Text; objectiveText.Text = objective; AdjustFrames(videoSettings, textSettings); @@ -168,8 +165,7 @@ namespace Barotrauma title.TextScale = textContent.TextScale = objectiveText.TextScale = objectiveTitle.TextScale = GUI.Scale; int scaledBorderSize = (int)(borderSize * GUI.Scale); - int scaledTextWidth = 0; - if (textSettings != null) scaledTextWidth = useTextOnRightSide ? (int)(textSettings.Width * GUI.Scale) : scaledVideoResolution.X / 2; + int scaledTextWidth = (int)(textSettings.Width * GUI.Scale); int scaledTitleHeight = (int)(titleHeight * GUI.Scale); int scaledTextHeight = (int)(textHeight * GUI.Scale); int scaledObjectiveFrameHeight = (int)(objectiveFrameHeight * GUI.Scale); @@ -184,21 +180,13 @@ namespace Barotrauma title.RectTransform.NonScaledSize += new Point(scaledTextWidth, scaledTitleHeight); title.RectTransform.AbsoluteOffset = new Point((int)(5 * GUI.Scale), (int)(10 * GUI.Scale)); - if (textSettings != null && !string.IsNullOrEmpty(textSettings.Text)) + if (!string.IsNullOrEmpty(textSettings.Text)) { textSettings.Text = ToolBox.WrapText(textSettings.Text, scaledTextWidth, GUI.Font); int wrappedHeight = textSettings.Text.Split('\n').Length * scaledTextHeight; textFrame.RectTransform.NonScaledSize += new Point(scaledTextWidth + scaledBorderSize, wrappedHeight + scaledBorderSize + scaledButtonSize.Y + scaledTitleHeight); - - if (useTextOnRightSide) - { - textFrame.RectTransform.AbsoluteOffset = new Point(scaledVideoResolution.X + scaledBorderSize * 2, 0); - } - else - { - textFrame.RectTransform.AbsoluteOffset = new Point(0, scaledVideoResolution.Y + scaledBorderSize * 2); - } + textFrame.RectTransform.AbsoluteOffset = new Point(scaledVideoResolution.X + scaledBorderSize * 2, 0); textContent.RectTransform.NonScaledSize += new Point(scaledTextWidth, wrappedHeight); textContent.RectTransform.AbsoluteOffset = new Point(0, scaledBorderSize + scaledTitleHeight); @@ -221,41 +209,22 @@ namespace Barotrauma objectiveTitle.Visible = objectiveText.Visible = false; } + int totalFrameWidth = videoFrame.Rect.Width + textFrame.Rect.Width + scaledBorderSize * 2; + int xOffset = videoFrame.Rect.Width / 2 + scaledBorderSize - (videoFrame.Rect.Width / 2 - textFrame.Rect.Width / 2); + + + videoFrame.RectTransform.AbsoluteOffset = new Point(-xOffset, (int)(50 * GUI.Scale)); + if (okButton != null) { textFrame.RemoveChild(okButton); okButton = null; } - if (textSettings != null) + okButton = new GUIButton(new RectTransform(scaledButtonSize, textFrame.RectTransform, Anchor.BottomRight, Pivot.BottomRight) { AbsoluteOffset = new Point(scaledBorderSize, scaledBorderSize) }, TextManager.Get("OK")) { - if (useTextOnRightSide) - { - int totalFrameWidth = videoFrame.Rect.Width + textFrame.Rect.Width + scaledBorderSize * 2; - int xOffset = videoFrame.Rect.Width / 2 + scaledBorderSize - (videoFrame.Rect.Width / 2 - textFrame.Rect.Width / 2); - videoFrame.RectTransform.AbsoluteOffset = new Point(-xOffset, (int)(50 * GUI.Scale)); - } - else - { - int totalFrameHeight = videoFrame.Rect.Height + textFrame.Rect.Height + scaledBorderSize * 2; - int yOffset = videoFrame.Rect.Height / 2 + scaledBorderSize - (videoFrame.Rect.Height / 2 - textFrame.Rect.Height / 2); - videoFrame.RectTransform.AbsoluteOffset = new Point(0, -yOffset); - } - - okButton = new GUIButton(new RectTransform(scaledButtonSize, textFrame.RectTransform, Anchor.BottomRight, Pivot.BottomRight) { AbsoluteOffset = new Point(scaledBorderSize, scaledBorderSize) }, TextManager.Get("OK")) - { - OnClicked = DisposeVideo - }; - } - else - { - videoFrame.RectTransform.AbsoluteOffset = new Point(0, (int)(100 * GUI.Scale)); - - okButton = new GUIButton(new RectTransform(scaledButtonSize, videoFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft) { AbsoluteOffset = new Point(scaledBorderSize, scaledBorderSize) }, TextManager.Get("Back")) - { - OnClicked = DisposeVideo - }; - } + OnClicked = DisposeVideo + }; } private Video CreateVideo(Point resolution) @@ -276,7 +245,7 @@ namespace Barotrauma private void DrawVideo(SpriteBatch spriteBatch, Rectangle rect) { - if (!IsPlaying) return; + if (!isPlaying) return; spriteBatch.Draw(currentVideo.GetTexture(), rect, Color.White); } diff --git a/Barotrauma/BarotraumaClient/Source/GameMain.cs b/Barotrauma/BarotraumaClient/Source/GameMain.cs index 91e268bc9..96409dd29 100644 --- a/Barotrauma/BarotraumaClient/Source/GameMain.cs +++ b/Barotrauma/BarotraumaClient/Source/GameMain.cs @@ -178,6 +178,10 @@ namespace Barotrauma GUI.KeyboardDispatcher = new EventInput.KeyboardDispatcher(Window); + GUI.KeyboardDispatcher = new EventInput.KeyboardDispatcher(Window); + + + PerformanceCounter = new PerformanceCounter(); PerformanceCounter = new PerformanceCounter(); @@ -340,6 +344,7 @@ namespace Barotrauma GUI.Init(Window, Config.SelectedContentPackages, GraphicsDevice); DebugConsole.Init(); + SteamManager.Initialize(); if (Config.AutoUpdateWorkshopItems) { if (SteamManager.AutoUpdateWorkshopItems()) @@ -525,20 +530,11 @@ namespace Barotrauma } /// - /// Returns the file paths of all files of the given type in the content packages. + /// Returns the file paths of all files of the given type in the currently selected content packages. /// - /// - /// If true, also returns files in content packages that are installed but not currently selected. - public IEnumerable GetFilesOfType(ContentType type, bool searchAllContentPackages = false) + public IEnumerable GetFilesOfType(ContentType type) { - if (searchAllContentPackages) - { - return ContentPackage.GetFilesOfType(ContentPackage.List, type); - } - else - { - return ContentPackage.GetFilesOfType(SelectedPackages, type); - } + return ContentPackage.GetFilesOfType(SelectedPackages, type); } /// @@ -631,14 +627,6 @@ namespace Barotrauma { ((GUIMessageBox)GUIMessageBox.VisibleBox).Close(); } - else if (Tutorial.Initialized && Tutorial.ContentRunning) - { - (GameSession.GameMode as TutorialMode).Tutorial.CloseActiveContentGUI(); - } - else if (GUI.PauseMenuOpen) - { - GUI.TogglePauseMenu(); - } else if ((Character.Controlled?.SelectedConstruction == null || !Character.Controlled.SelectedConstruction.ActiveHUDs.Any(ic => ic.GuiFrame != null)) && Inventory.SelectedSlot == null && CharacterHealth.OpenHealthWindow == null) { @@ -648,17 +636,9 @@ namespace Barotrauma } GUI.ClearUpdateList(); - paused = (DebugConsole.IsOpen || GUI.PauseMenuOpen || GUI.SettingsMenuOpen || Tutorial.ContentRunning) && + paused = (DebugConsole.IsOpen || GUI.PauseMenuOpen || GUI.SettingsMenuOpen || ContextualTutorial.ContentRunning) && (NetworkMember == null || !NetworkMember.GameStarted); -#if !DEBUG - if (NetworkMember == null && !WindowActive && !paused && true && Screen.Selected != MainMenuScreen) - { - GUI.TogglePauseMenu(); - paused = true; - } -#endif - Screen.Selected.AddToGUIUpdateList(); if (Client != null) @@ -675,9 +655,9 @@ namespace Barotrauma { Screen.Selected.Update(Timing.Step); } - else if (Tutorial.Initialized && Tutorial.ContentRunning) + else if (ContextualTutorial.Initialized && ContextualTutorial.ContentRunning && GameSession.GameMode is SinglePlayerCampaign) { - (GameSession.GameMode as TutorialMode).Update((float)Timing.Step); + (GameSession.GameMode as SinglePlayerCampaign).ContextualTutorial.Update((float)Timing.Step); } if (NetworkMember != null) @@ -742,85 +722,6 @@ namespace Barotrauma PerformanceCounter.DrawTimeGraph.Update(sw.ElapsedTicks / (float)TimeSpan.TicksPerMillisecond); } - public void ShowCampaignDisclaimer(Action onContinue = null) - { - var msgBox = new GUIMessageBox(TextManager.Get("CampaignDisclaimerTitle"), TextManager.Get("CampaignDisclaimerText"), - new string[] { TextManager.Get("CampaignRoadMapTitle"), TextManager.Get("OK") }); - - msgBox.Buttons[0].OnClicked = (btn, userdata) => - { - var roadMap = new GUIMessageBox(TextManager.Get("CampaignRoadMapTitle"), TextManager.Get("CampaignRoadMapText"), - new string[] { TextManager.Get("Back"), TextManager.Get("OK") }); - roadMap.Buttons[0].OnClicked += roadMap.Close; - roadMap.Buttons[0].OnClicked += (_, __) => { ShowCampaignDisclaimer(onContinue); return true; }; - roadMap.Buttons[1].OnClicked += roadMap.Close; - roadMap.Buttons[1].OnClicked += (_, __) => { onContinue?.Invoke(); return true; }; - return true; - }; - msgBox.Buttons[0].OnClicked += msgBox.Close; - msgBox.Buttons[1].OnClicked += msgBox.Close; - msgBox.Buttons[1].OnClicked += (_, __) => { onContinue?.Invoke(); return true; }; - - Config.CampaignDisclaimerShown = true; - Config.SaveNewPlayerConfig(); - } - - public void ShowEditorDisclaimer() - { - var msgBox = new GUIMessageBox(TextManager.Get("EditorDisclaimerTitle"), TextManager.Get("EditorDisclaimerText")); - var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.25f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.025f }; - linkHolder.RectTransform.MaxSize = new Point(int.MaxValue, linkHolder.Rect.Height); - List> links = new List>() - { - new Pair(TextManager.Get("EditorDisclaimerWikiLink"),TextManager.Get("EditorDisclaimerWikiUrl")), - new Pair(TextManager.Get("EditorDisclaimerDiscordLink"),TextManager.Get("EditorDisclaimerDiscordUrl")), - new Pair(TextManager.Get("EditorDisclaimerForumLink"),TextManager.Get("EditorDisclaimerForumUrl")), - }; - foreach (var link in links) - { - new GUIButton(new RectTransform(new Vector2(1.0f, 0.2f), linkHolder.RectTransform), link.First, style: "MainMenuGUIButton", textAlignment: Alignment.Left) - { - UserData = link.Second, - OnClicked = (btn, userdata) => - { - Process.Start(userdata as string); - return true; - } - }; - } - - msgBox.InnerFrame.RectTransform.MinSize = new Point(0, - msgBox.InnerFrame.Rect.Height + linkHolder.Rect.Height + msgBox.Content.AbsoluteSpacing * 2 + 10); - Config.EditorDisclaimerShown = true; - Config.SaveNewPlayerConfig(); - } - - // ToDo: Move texts/links to localization, when possible. - public void ShowBugReporter() - { - var msgBox = new GUIMessageBox("", ""); - var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.05f }; - - List> links = new List>() - { - new Pair("Barotrauma Feedback Form","https://barotraumagame.com/feedback"), - new Pair("Github Issue Form (Needs account)","https://github.com/Regalis11/Barotrauma/issues/new?template=bug_report.md") - }; - foreach (var link in links) - { - new GUIButton(new RectTransform(new Vector2(1.0f, 0.2f), linkHolder.RectTransform), link.First, style: "MainMenuGUIButton", textAlignment: Alignment.Left) - { - UserData = link.Second, - OnClicked = (btn, userdata) => - { - Process.Start(userdata as string); - msgBox.Close(); - return true; - } - }; - } - } - static bool waitForKeyHit = true; public CoroutineHandle ShowLoading(IEnumerable loader, bool waitKeyHit = true) { diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index 5d3ed8c05..9f8baaf79 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -49,8 +49,6 @@ namespace Barotrauma private GUIComponent orderTargetFrame, orderTargetFrameShadow; - public bool AllowCharacterSwitch = true; - public bool ToggleCrewAreaOpen { get { return toggleCrewAreaOpen; } @@ -65,8 +63,6 @@ namespace Barotrauma } } - public List OrderOptionButtons = new List(); - #endregion #region Constructors @@ -477,10 +473,7 @@ namespace Barotrauma orderButtonFrame.RectTransform; var btn = new GUIButton(new RectTransform(new Point(iconSize, iconSize), btnParent, Anchor.CenterLeft), - style: null) - { - UserData = order - }; + style: null); new GUIFrame(new RectTransform(new Vector2(1.5f), btn.RectTransform, Anchor.Center), "OuterGlow") { @@ -572,7 +565,6 @@ namespace Barotrauma /// public bool CharacterClicked(GUIComponent component, object selection) { - if (!AllowCharacterSwitch) { return false; } Character character = selection as Character; if (character == null || character.IsDead || character.IsUnconscious) return false; SelectCharacter(character); @@ -614,7 +606,27 @@ namespace Barotrauma characterListBox.BarScroll = roundedPos; } - return false; + #endregion + + + #region Voice chat + + public void SetPlayerVoiceIconState(Client client, bool muted, bool mutedLocally) + { + if (client?.Character == null) { return; } + + var playerFrame = characterListBox.Content.FindChild(client.Character)?.FindChild(client.Character); + if (playerFrame == null) { return; } + var soundIcon = playerFrame.FindChild("soundicon"); + var soundIconDisabled = playerFrame.FindChild("soundicondisabled"); + + if (!soundIcon.Visible) + { + soundIcon.Color = new Color(soundIcon.Color, 0.0f); + } + soundIcon.Visible = !muted && !mutedLocally; + soundIconDisabled.Visible = muted || mutedLocally; + soundIconDisabled.ToolTip = TextManager.Get(mutedLocally ? "MutedLocally" : "MutedGlobally"); } private IEnumerable KillCharacterAnim(GUIComponent component) @@ -662,10 +674,6 @@ namespace Barotrauma } if (string.IsNullOrEmpty(text)) { return; } - if (sender != null) - { - GameMain.GameSession.CrewManager.SetCharacterSpeaking(sender); - } ChatBox.AddMessage(ChatMessage.Create(senderName, text, messageType, sender)); } @@ -717,19 +725,15 @@ namespace Barotrauma soundIconDisabled.ToolTip = TextManager.Get(mutedLocally ? "MutedLocally" : "MutedGlobally"); } - public void SetClientSpeaking(Client client) + public void SetPlayerSpeaking(Client client) { - if (client?.Character != null) { SetCharacterSpeaking(client.Character); } - } + if (client?.Character == null) { return; } - public void SetCharacterSpeaking(Character character) - { - var playerFrame = characterListBox.Content.FindChild(character)?.FindChild(character); + var playerFrame = characterListBox.Content.FindChild(client.Character)?.FindChild(client.Character); if (playerFrame == null) { return; } var soundIcon = playerFrame.FindChild("soundicon"); soundIcon.Color = new Color(soundIcon.Color, 1.0f); } - #endregion /// @@ -746,7 +750,7 @@ namespace Barotrauma if (IsSinglePlayer) { orderGiver.Speak( - order.GetChatMessage("", orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver), ChatMessageType.Order); + order.GetChatMessage("", orderGiver.CurrentHull?.RoomName, givingOrderToSelf: character == orderGiver), ChatMessageType.Order); } else { @@ -763,7 +767,7 @@ namespace Barotrauma if (IsSinglePlayer) { orderGiver?.Speak( - order.GetChatMessage(character.Name, orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver, orderOption: option), null); + order.GetChatMessage(character.Name, orderGiver.CurrentHull?.RoomName, givingOrderToSelf: character == orderGiver, orderOption: option), null); } else if (orderGiver != null) { @@ -837,6 +841,12 @@ namespace Barotrauma matchingItems.RemoveAll(it => it.Submarine != submarine && !submarine.DockedTo.Contains(it.Submarine)); matchingItems.RemoveAll(it => it.Submarine != null && it.Submarine.IsOutpost); } + var characterElement = characterListBox.Content.FindChild(character); + GUIButton orderBtn = characterElement.FindChild(order, recursive: true) as GUIButton; + if (orderBtn.Frame.FlashTimer <= 0) + { + orderBtn.Flash(color, 1.5f, false, flashRectInflate); + } //more than one target item -> create a minimap-like selection with a pic of the sub if (matchingItems.Count > 1) @@ -916,12 +926,9 @@ namespace Barotrauma if (Character.Controlled == null) return false; SetCharacterOrder(character, userData as Order, option, Character.Controlled); orderTargetFrame = null; - OrderOptionButtons.Clear(); return true; } }; - - OrderOptionButtons.Add(optionButton); } } @@ -954,13 +961,9 @@ namespace Barotrauma if (Character.Controlled == null) return false; SetCharacterOrder(character, userData as Order, option, Character.Controlled); orderTargetFrame = null; - OrderOptionButtons.Clear(); return true; } }; - - OrderOptionButtons.Add(optionButton); - //lines between the order buttons if (i < order.Options.Length - 1) { @@ -976,24 +979,6 @@ namespace Barotrauma color: matchingItems.Count > 1 ? Color.Black * 0.9f : Color.Black * 0.7f); } - public void HighlightOrderButton(Character character, string orderAiTag, Color color, Vector2? flashRectInflate = null) - { - var order = Order.PrefabList.Find(o => o.AITag == orderAiTag); - if (order == null) - { - DebugConsole.ThrowError("Could not find an order with the AI tag \"" + orderAiTag + "\".\n" + Environment.StackTrace); - return; - } - var characterElement = characterListBox.Content.FindChild(character); - GUIButton orderBtn = characterElement.FindChild(order, recursive: true) as GUIButton; - if (orderBtn.Frame.FlashTimer <= 0) - { - orderBtn.Flash(color, 1.5f, false, flashRectInflate); - } - - //orderBtn.Pulsate(Vector2.One, Vector2.One * 2.0f, 1.5f); - } - #region Updating and drawing the UI private void DrawMiniMapOverlay(SpriteBatch spriteBatch, GUICustomComponent container) @@ -1051,7 +1036,6 @@ namespace Barotrauma public void SelectNextCharacter() { - if (!AllowCharacterSwitch) { return; } if (GameMain.IsMultiplayer) { return; } if (characters.None()) { return; } SelectCharacter(characters[TryAdjustIndex(1)]); @@ -1059,7 +1043,6 @@ namespace Barotrauma public void SelectPreviousCharacter() { - if (!AllowCharacterSwitch) { return; } if (GameMain.IsMultiplayer) { return; } if (characters.None()) { return; } SelectCharacter(characters[TryAdjustIndex(-1)]); @@ -1067,7 +1050,6 @@ namespace Barotrauma private void SelectCharacter(Character character) { - if (!AllowCharacterSwitch) { return; } //make the previously selected character wait in place for some time //(so they don't immediately start idling and walking away from their station) if (Character.Controlled?.AIController?.ObjectiveManager != null) @@ -1113,7 +1095,7 @@ namespace Barotrauma ChatBox.Update(deltaTime); ChatBox.InputBox.Visible = Character.Controlled != null; - if (!DebugConsole.IsOpen && ChatBox.InputBox.Visible && GUI.KeyboardDispatcher.Subscriber == null) + if (!DebugConsole.IsOpen && ChatBox.InputBox.Visible) { if (PlayerInput.KeyHit(InputType.Chat) && !ChatBox.InputBox.Selected) { diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs index bb18197ea..8ec219fd1 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs @@ -135,8 +135,6 @@ namespace Barotrauma msg.Write(map.SelectedLocationIndex == -1 ? UInt16.MaxValue : (UInt16)map.SelectedLocationIndex); msg.Write(map.SelectedMissionIndex == -1 ? byte.MaxValue : (byte)map.SelectedMissionIndex); - msg.Write(PurchasedHullRepairs); - msg.Write(PurchasedItemRepairs); msg.Write((UInt16)CargoManager.PurchasedItems.Count); foreach (PurchasedItem pi in CargoManager.PurchasedItems) diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs index b0463872e..b4a7414e3 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs @@ -9,6 +9,8 @@ namespace Barotrauma { class SinglePlayerCampaign : CampaignMode { + public ContextualTutorial ContextualTutorial; + private GUIButton endRoundButton; private bool crewDead; @@ -39,6 +41,13 @@ namespace Barotrauma CrewManager.AddCharacterInfo(new CharacterInfo(Character.HumanConfigFile, "", jobPrefab)); } } + + ContextualTutorial = Tutorial.Tutorials.Find(t => t is ContextualTutorial) as ContextualTutorial; + + if (ContextualTutorial.Selected) // Selected when starting a new game -> initialize + { + ContextualTutorial.Initialize(); + } } public override void Start() @@ -56,6 +65,11 @@ namespace Barotrauma endTimer = 5.0f; isRunning = true; CrewManager.InitSinglePlayerRound(); + + if (ContextualTutorial.Initialized) + { + ContextualTutorial.Start(); + } } public bool TryHireCharacter(Location location, CharacterInfo characterInfo) @@ -148,6 +162,11 @@ namespace Barotrauma base.AddToGUIUpdateList(); CrewManager.AddToGUIUpdateList(); endRoundButton.AddToGUIUpdateList(); + + if (ContextualTutorial.Initialized) + { + ContextualTutorial.AddToGUIUpdateList(); + } } public override void Update(float deltaTime) @@ -156,6 +175,11 @@ namespace Barotrauma base.Update(deltaTime); + if (ContextualTutorial.Initialized) + { + ContextualTutorial.Update(deltaTime); + } + if (!GUI.DisableHUD && !GUI.DisableUpperHUD) { endRoundButton.UpdateManually(deltaTime); @@ -292,6 +316,7 @@ namespace Barotrauma TextManager.Get("QuitButton")); quitButton.OnClicked += GameMain.LobbyScreen.QuitToMainMenu; quitButton.OnClicked += (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Remove(GUIMessageBox.VisibleBox); return true; }; + quitButton.OnClicked += (GUIButton button, object obj) => { if (ContextualTutorial.Initialized) ContextualTutorial.Stop(); return true; }; } } @@ -376,6 +401,10 @@ namespace Barotrauma case "map": campaign.map = Map.LoadNew(subElement); break; + case "contextualtutorial": + campaign.ContextualTutorial.Initialize(); // Initialize when saved element found + campaign.ContextualTutorial.LoadPartiallyComplete(subElement); + break; } } @@ -384,7 +413,7 @@ namespace Barotrauma if (campaign.CheatsEnabled) { DebugConsole.CheatsEnabled = true; - if (Steam.SteamManager.USE_STEAM && !SteamAchievementManager.CheatsEnabled) + if (GameMain.Config.UseSteam && !SteamAchievementManager.CheatsEnabled) { SteamAchievementManager.CheatsEnabled = true; new GUIMessageBox("Cheats enabled", "Cheat commands have been enabled on the campaign. You will not receive Steam Achievements until you restart the game."); @@ -411,6 +440,12 @@ namespace Barotrauma new XAttribute("cheatsenabled", CheatsEnabled)); CrewManager.Save(modeElement); Map.Save(modeElement); + + if (ContextualTutorial.Initialized) + { + ContextualTutorial.SavePartiallyComplete(modeElement); + } + element.Add(modeElement); } } diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs index 0a0677484..95f619e22 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/BasicTutorial.cs @@ -303,7 +303,7 @@ namespace Barotrauma.Tutorials yield return new WaitForSeconds(1.0f); - infoBox = CreateInfoFrame("", "Uh-oh... Something enormous just appeared on the sonar."); + infoBox = CreateInfoFrame("Uh-oh... Something enormous just appeared on the sonar."); List windows = new List(); foreach (Structure s in Structure.WallList) diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ContextualTutorial.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ContextualTutorial.cs index a05c6a835..d8ac5bc80 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ContextualTutorial.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ContextualTutorial.cs @@ -1,20 +1,25 @@ -/*using System.Collections.Generic; +using System.Collections.Generic; using System.Xml.Linq; using System; using Microsoft.Xna.Framework; using Barotrauma.Items.Components; using System.Linq; +using Microsoft.Xna.Framework.Input; namespace Barotrauma.Tutorials { class ContextualTutorial : Tutorial { - public ContextualTutorial(XElement element) : base(element) - { - //Name = "ContextualTutorial"; - } - public static bool Selected = false; + public static bool ContentRunning = false; + public static bool Initialized = false; + + private enum ContentTypes { None = 0, Video = 1, TextOnly = 2 }; + + private TutorialSegment activeSegment; + private List segments; + + private VideoPlayer videoPlayer; private Steering navConsole; private Reactor reactor; @@ -28,24 +33,83 @@ namespace Barotrauma.Tutorials private List> characterTimeOnSonar; private float requiredTimeOnSonar = 5f; + private bool started = false; + private string playableContentPath; + private float tutorialTimer; private bool disableTutorialOnDeficiencyFound = true; + private GUIFrame holderFrame, objectiveFrame; + private List activeObjectives = new List(); + private string objectiveTranslated; + private float floodTutorialTimer = 0.0f; private const float floodTutorialDelay = 2.0f; private float medicalTutorialTimer = 0.0f; private const float medicalTutorialDelay = 2.0f; + private Point screenResolution; + private float prevUIScale; + + private class TutorialSegment + { + public string Id; + public string Objective; + public ContentTypes ContentType; + public XElement TextContent; + public XElement VideoContent; + public bool IsTriggered; + public GUIButton ReplayButton; + public GUITextBlock LinkedTitle, LinkedText; + + public TutorialSegment(XElement config) + { + Id = config.GetAttributeString("id", "Missing ID"); + Objective = TextManager.Get(config.GetAttributeString("objective", string.Empty), true); + Enum.TryParse(config.GetAttributeString("contenttype", "None"), true, out ContentType); + IsTriggered = config.GetAttributeBool("istriggered", false); + + switch (ContentType) + { + case ContentTypes.None: + break; + case ContentTypes.Video: + VideoContent = config.Element("Video"); + TextContent = config.Element("Text"); + break; + case ContentTypes.TextOnly: + TextContent = config.Element("Text"); + break; + } + } + } + + public ContextualTutorial(XElement element) : base(element) + { + playableContentPath = element.GetAttributeString("playablecontentpath", ""); + segments = new List(); + + foreach (var segment in element.Elements("Segment")) + { + segments.Add(new TutorialSegment(segment)); + } + + Name = "ContextualTutorial"; + } + public override void Initialize() { - base.Initialize(); - for (int i = 0; i < segments.Count; i++) { segments[i].IsTriggered = false; } + if (Initialized) return; + Initialized = true; + + base.Initialize(); + videoPlayer = new VideoPlayer(); characterTimeOnSonar = new List>(); } @@ -103,7 +167,10 @@ namespace Barotrauma.Tutorials base.Start(); injuredMember = null; - activeContentSegment = null; + activeObjectives.Clear(); + objectiveTranslated = TextManager.Get("Objective"); + CreateObjectiveFrame(); + activeSegment = null; tutorialTimer = floodTutorialTimer = medicalTutorialTimer = 0.0f; subStartingPosition = Vector2.Zero; characterTimeOnSonar.Clear(); @@ -116,10 +183,10 @@ namespace Barotrauma.Tutorials #if DEBUG if (reactor == null || navConsole == null || sonar == null) { - infoBox = CreateInfoFrame("Error", "Submarine not compatible with the tutorial:" + infoBox = CreateInfoFrame("Submarine not compatible with the tutorial:" + "\nReactor - " + (reactor != null ? "OK" : "Tag 'reactor' not found") + "\nNavigation Console - " + (navConsole != null ? "OK" : "Tag 'command' not found") - + "\nSonar - " + (sonar != null ? "OK" : "Not found under Navigation Console"), hasButton: true); + + "\nSonar - " + (sonar != null ? "OK" : "Not found under Navigation Console"), true); CoroutineManager.StartCoroutine(WaitForErrorClosed()); return; } @@ -155,15 +222,62 @@ namespace Barotrauma.Tutorials } #endif - public override void Stop() + public void Stop() { - base.Stop(); + started = ContentRunning = Initialized = false; + videoPlayer.Remove(); + videoPlayer = null; characterTimeOnSonar = null; } + private void CreateObjectiveFrame() + { + holderFrame = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.Canvas, Anchor.Center)); + objectiveFrame = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ObjectiveAnchor, holderFrame.RectTransform), style: null); + + for (int i = 0; i < activeObjectives.Count; i++) + { + CreateObjectiveGUI(activeObjectives[i], i); + } + + screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight); + prevUIScale = GUI.Scale; + } + + public override void AddToGUIUpdateList() + { + if (videoPlayer != null) + { + videoPlayer.AddToGUIUpdateList(order: 100); + } + + if (GUI.DisableHUD) return; + if (GameMain.GraphicsWidth != screenResolution.X || GameMain.GraphicsHeight != screenResolution.Y || prevUIScale != GUI.Scale) + { + CreateObjectiveFrame(); + } + + if (objectiveFrame != null && activeObjectives.Count > 0) + { + objectiveFrame.AddToGUIUpdateList(order: -1); + } + base.AddToGUIUpdateList(); + } + public override void Update(float deltaTime) { - base.Update(deltaTime); + if (videoPlayer != null) + { + videoPlayer.Update(); + } + + if (infoBox != null) + { + if (PlayerInput.KeyHit(Keys.Enter) || PlayerInput.KeyHit(Keys.Escape)) + { + CloseInfoFrame(null, null); + } + } if (!started || ContentRunning) return; @@ -171,12 +285,93 @@ namespace Barotrauma.Tutorials for (int i = 0; i < segments.Count; i++) { - if (segments[i].IsTriggered || HasObjective(segments[i])) continue; + if (segments[i].IsTriggered || activeObjectives.Contains(segments[i])) continue; if (CheckContextualTutorials(i, deltaTime)) // Found a relevant tutorial, halt finding new ones { break; } } + + for (int i = 0; i < activeObjectives.Count; i++) + { + CheckActiveObjectives(activeObjectives[i], deltaTime); + } + } + + private void ClosePreTextAndTriggerVideoCallback() + { + videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(activeSegment.VideoContent), new VideoPlayer.TextSettings(activeSegment.VideoContent), activeSegment.Id, true, activeSegment.Objective, CurrentSegmentStopCallback); + } + + private void CurrentSegmentStopCallback() + { + if (!string.IsNullOrEmpty(activeSegment.Objective)) + { + AddNewObjective(activeSegment); + } + + activeSegment = null; + ContentRunning = false; + } + + private void AddNewObjective(TutorialSegment segment) + { + activeObjectives.Add(segment); + CreateObjectiveGUI(segment, activeObjectives.Count - 1); + } + + private void CreateObjectiveGUI(TutorialSegment segment, int index) + { + Point replayButtonSize = new Point((int)(GUI.ObjectiveNameFont.MeasureString(segment.Objective).X * GUI.Scale), (int)(GUI.ObjectiveNameFont.MeasureString(segment.Objective).Y * 1.45f * GUI.Scale)); + + segment.ReplayButton = new GUIButton(new RectTransform(replayButtonSize, objectiveFrame.RectTransform, Anchor.TopRight, Pivot.TopRight) { AbsoluteOffset = new Point(0, (replayButtonSize.Y + (int)(20f * GUI.Scale)) * index) }, style: null); + segment.ReplayButton.OnClicked += (GUIButton btn, object userdata) => + { + ReplaySegmentVideo(segment); + return true; + }; + + int yOffset = (int)((GUI.ObjectiveNameFont.MeasureString(objectiveTranslated).Y / 2f + 5) * GUI.Scale); + segment.LinkedTitle = new GUITextBlock(new RectTransform(new Point(replayButtonSize.X, yOffset), segment.ReplayButton.RectTransform, Anchor.Center, Pivot.BottomCenter) { AbsoluteOffset = new Point((int)(10 * GUI.Scale), 0) }, objectiveTranslated, textColor: Color.White, font: GUI.ObjectiveTitleFont, textAlignment: Alignment.CenterRight); + segment.LinkedText = new GUITextBlock(new RectTransform(new Point(replayButtonSize.X, yOffset), segment.ReplayButton.RectTransform, Anchor.Center, Pivot.TopCenter) { AbsoluteOffset = new Point((int)(10 * GUI.Scale), 0) }, segment.Objective, textColor: new Color(4, 180, 108), font: GUI.ObjectiveNameFont, textAlignment: Alignment.CenterRight); + + segment.LinkedTitle.TextScale = segment.LinkedText.TextScale = GUI.Scale; + + segment.LinkedTitle.Color = segment.LinkedTitle.HoverColor = segment.LinkedTitle.PressedColor = segment.LinkedTitle.SelectedColor = Color.Transparent; + segment.LinkedText.Color = segment.LinkedText.HoverColor = segment.LinkedText.PressedColor = segment.LinkedText.SelectedColor = Color.Transparent; + segment.ReplayButton.Color = segment.ReplayButton.HoverColor = segment.ReplayButton.PressedColor = segment.ReplayButton.SelectedColor = Color.Transparent; + } + + private void RemoveCompletedObjective(TutorialSegment objective) + { + objective.IsTriggered = true; + + int checkMarkHeight = (int)(objective.ReplayButton.Rect.Height * 1.2f); + int checkMarkWidth = (int)(checkMarkHeight * 0.93f); + + Color color = new Color(4, 180, 108); + RectTransform rectTA = new RectTransform(new Point(checkMarkWidth, checkMarkHeight), objective.ReplayButton.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft); + rectTA.AbsoluteOffset = new Point(-rectTA.Rect.Width - 5, 0); + GUIImage checkmark = new GUIImage(rectTA, "CheckMark"); + checkmark.Color = color; + + RectTransform rectTB = new RectTransform(new Vector2(1.1f, .8f), objective.LinkedText.RectTransform, Anchor.Center, Pivot.Center); + GUIImage stroke = new GUIImage(rectTB, "Stroke"); + stroke.Color = color; + + CoroutineManager.StartCoroutine(WaitForObjectiveEnd(objective)); + } + + private IEnumerable WaitForObjectiveEnd(TutorialSegment objective) + { + yield return new WaitForSeconds(2.0f); + objectiveFrame.RemoveChild(objective.ReplayButton); + activeObjectives.Remove(objective); + + for (int i = 0; i < activeObjectives.Count; i++) + { + activeObjectives[i].ReplayButton.RectTransform.AbsoluteOffset = new Point(0, (activeObjectives[i].ReplayButton.Rect.Height + 20) * i); + } } private bool CheckContextualTutorials(int index, float deltaTime) @@ -331,7 +526,17 @@ namespace Barotrauma.Tutorials return true; } - protected override void CheckActiveObjectives(TutorialSegment objective, float deltaTime) + private bool HasObjective(string objectiveName) + { + for (int i = 0; i < activeObjectives.Count; i++) + { + if (activeObjectives[i].Id == objectiveName) return true; + } + + return false; + } + + private void CheckActiveObjectives(TutorialSegment objective, float deltaTime) { switch(objective.Id) { @@ -499,9 +704,50 @@ namespace Barotrauma.Tutorials return characterTimeOnSonar.Find(ct => ct.Second >= requiredTimeOnSonar && !ct.First.IsDead) != null; } - protected override void TriggerTutorialSegment(int index, params object[] args) + private void TriggerTutorialSegment(int index, params object[] args) { - base.TriggerTutorialSegment(index, args); + Inventory.draggingItem = null; + ContentRunning = true; + activeSegment = segments[index]; + + string tutorialText = TextManager.GetFormatted(activeSegment.TextContent.GetAttributeString("tag", ""), true, args); + string objectiveText = string.Empty; + + if (!string.IsNullOrEmpty(activeSegment.Objective)) + { + if (args.Length == 0) + { + objectiveText = activeSegment.Objective; + } + else + { + objectiveText = string.Format(activeSegment.Objective, args); + } + + activeSegment.Objective = objectiveText; + } + else + { + activeSegment.IsTriggered = true; // Complete at this stage only if no related objective + } + + switch (activeSegment.ContentType) + { + case ContentTypes.None: + break; + case ContentTypes.Video: + infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Id), tutorialText, + activeSegment.TextContent.GetAttributeInt("width", 300), + activeSegment.TextContent.GetAttributeInt("height", 80), + activeSegment.TextContent.GetAttributeString("anchor", "Center"), true, ClosePreTextAndTriggerVideoCallback); + break; + case ContentTypes.TextOnly: + infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Id), tutorialText, + activeSegment.TextContent.GetAttributeInt("width", 300), + activeSegment.TextContent.GetAttributeInt("height", 80), + activeSegment.TextContent.GetAttributeString("anchor", "Center"), true, CurrentSegmentStopCallback); + break; + } for (int i = 0; i < segments.Count; i++) { @@ -511,10 +757,17 @@ namespace Barotrauma.Tutorials CoroutineManager.StartCoroutine(WaitToStop()); // Completed } + private void ReplaySegmentVideo(TutorialSegment segment) + { + if (ContentRunning) return; + ContentRunning = true; + videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, callback: () => ContentRunning = false); + } + private IEnumerable WaitToStop() { while (ContentRunning) yield return null; Stop(); } } -}*/ +} diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ScenarioTutorial.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ScenarioTutorial.cs index cbff14dca..025ae979e 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ScenarioTutorial.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ScenarioTutorial.cs @@ -1,118 +1,44 @@ -using Barotrauma.Items.Components; -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; -using System.IO; -using System.Linq; using System.Xml.Linq; namespace Barotrauma.Tutorials { class ScenarioTutorial : Tutorial { - private CoroutineHandle tutorialCoroutine; - private Character character; - private string spawnSub; private SpawnType spawnPointType; private string submarinePath; - private string startOutpostPath; - private string endOutpostPath; private string levelSeed; - private string levelParams; - - private Submarine startOutpost = null; - private Submarine endOutpost = null; - private bool currentTutorialCompleted = false; - private float fadeOutTime = 3f; - protected float waitBeforeFade = 4f; - - // Colors - protected Color highlightColor = Color.OrangeRed; - protected Color uiHighlightColor = new Color(150, 50, 0); - protected Color buttonHighlightColor = new Color(255, 100, 0); - protected Color inaccessibleColor = Color.Red; - protected Color accessibleColor = Color.Green; public ScenarioTutorial(XElement element) : base(element) { submarinePath = element.GetAttributeString("submarinepath", ""); - startOutpostPath = element.GetAttributeString("startoutpostpath", ""); - endOutpostPath = element.GetAttributeString("endoutpostpath", ""); - levelSeed = element.GetAttributeString("levelseed", "tuto"); - levelParams = element.GetAttributeString("levelparams", ""); - - spawnSub = element.GetAttributeString("spawnsub", ""); - Enum.TryParse(element.GetAttributeString("spawnpointtype", "Human"), true, out spawnPointType); + Enum.TryParse(element.GetAttributeString("spawnpointtype", "Human"), true, out spawnPointType); } public override void Initialize() { base.Initialize(); - currentTutorialCompleted = false; GameMain.Instance.ShowLoading(Loading()); } - private IEnumerable Loading() - { - Submarine.MainSub = Submarine.Load(submarinePath, "", true); - - LevelGenerationParams generationParams = LevelGenerationParams.LevelParams.Find(p => p.Name == levelParams); - - yield return CoroutineStatus.Running; - - GameMain.GameSession = new GameSession(Submarine.MainSub, "", - GameModePreset.List.Find(g => g.Identifier == "tutorial")); - (GameMain.GameSession.GameMode as TutorialMode).Tutorial = this; - - if (generationParams != null) - { - Biome biome = LevelGenerationParams.GetBiomes().Find(b => generationParams.AllowedBiomes.Contains(b)); - - if (startOutpostPath != string.Empty) - { - startOutpost = Submarine.Load(startOutpostPath, "", false); - } - - if (endOutpostPath != string.Empty) - { - endOutpost = Submarine.Load(endOutpostPath, "", false); - } - - Level tutorialLevel = new Level(levelSeed, 0, 0, generationParams, biome, startOutpost, endOutpost); - GameMain.GameSession.StartRound(tutorialLevel); - } - else - { - GameMain.GameSession.StartRound(levelSeed); - } - - GameMain.GameSession.EventManager.Events.Clear(); - GameMain.GameSession.EventManager.Enabled = false; - GameMain.GameScreen.Select(); - - yield return CoroutineStatus.Success; - } - public override void Start() { base.Start(); - Submarine.MainSub.GodMode = true; - - CharacterInfo charInfo = configElement.Element("Character") == null ? - new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "engineer")) : - new CharacterInfo(configElement.Element("Character")); - - WayPoint wayPoint = GetSpawnPoint(charInfo); - + WayPoint wayPoint = WayPoint.GetRandom(spawnPointType, null); if (wayPoint == null) { DebugConsole.ThrowError("A waypoint with the spawntype \"" + spawnPointType + "\" is required for the tutorial event"); return; } + CharacterInfo charInfo = configElement.Element("Character") == null ? + new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "engineer")) : + new CharacterInfo(configElement.Element("Character")); + character = Character.Create(charInfo, wayPoint.WorldPosition, "", false, false); Character.Controlled = character; character.GiveJobItems(null); @@ -126,82 +52,22 @@ namespace Barotrauma.Tutorials idCard.AddTag("com"); idCard.AddTag("eng"); - tutorialCoroutine = CoroutineManager.StartCoroutine(UpdateState()); + CoroutineManager.StartCoroutine(UpdateState()); } - public override void AddToGUIUpdateList() + private IEnumerable Loading() { - if (!currentTutorialCompleted) - { - base.AddToGUIUpdateList(); - } - } + Submarine.MainSub = Submarine.Load(submarinePath, "", true); + yield return CoroutineStatus.Running; - private WayPoint GetSpawnPoint(CharacterInfo charInfo) - { - Submarine spawnSub = null; + GameMain.GameSession = new GameSession(Submarine.MainSub, "", + GameModePreset.List.Find(g => g.Identifier == "tutorial")); + (GameMain.GameSession.GameMode as TutorialMode).tutorial = this; + GameMain.GameSession.StartRound(levelSeed); + GameMain.GameSession.EventManager.Events.Clear(); + GameMain.GameScreen.Select(); - if (this.spawnSub != string.Empty) - { - switch (this.spawnSub) - { - case "startoutpost": - spawnSub = startOutpost; - break; - - case "endoutpost": - spawnSub = endOutpost; - break; - - default: - spawnSub = Submarine.MainSub; - break; - } - } - - return WayPoint.GetRandom(spawnPointType, charInfo.Job, spawnSub); - } - - protected bool HasOrder(Character character, string aiTag, string option = null) - { - if (character.CurrentOrder?.AITag == aiTag) - { - if (option == null) - { - return true; - } - else - { - HumanAIController humanAI = character.AIController as HumanAIController; - return humanAI.CurrentOrderOption == option; - } - } - - return false; - } - - protected void SetHighlight(Item item, bool state) - { - if (item.ExternalHighlight == state) return; - item.SpriteColor = (state) ? highlightColor : Color.White; - item.ExternalHighlight = state; - } - - protected void SetHighlight(Structure structure, bool state) - { - structure.SpriteColor = (state) ? highlightColor : Color.White; - structure.ExternalHighlight = state; - } - - protected void SetHighlight(Character character, bool state) - { - character.ExternalHighlight = state; - } - - protected void SetDoorAccess(Door door, LightComponent light, bool state) - { - if (state && door != null) door.requiredItems.Clear(); - if (light != null) light.LightColor = (state) ? accessibleColor : inaccessibleColor; + yield return CoroutineStatus.Success; } public override void Update(float deltaTime) @@ -209,47 +75,27 @@ namespace Barotrauma.Tutorials base.Update(deltaTime); if (character != null) { - if (character.Oxygen < 1) + if (Character.Controlled == null) { - character.Oxygen = 1; - } - if (character.IsDead) - { - CoroutineManager.StartCoroutine(Dead()); - } - else if (Character.Controlled == null) - { - if (tutorialCoroutine != null) - { - CoroutineManager.StopCoroutines(tutorialCoroutine); - } + CoroutineManager.StopCoroutines("TutorialMode.UpdateState"); infoBox = null; } else if (Character.Controlled.IsDead) { + Character.Controlled = null; + + CoroutineManager.StopCoroutines("TutorialMode.UpdateState"); + infoBox = null; CoroutineManager.StartCoroutine(Dead()); } } } - public override void Stop() - { - if (tutorialCoroutine != null) - { - CoroutineManager.StopCoroutines(tutorialCoroutine); - } - base.Stop(); - } - private IEnumerable Dead() { - GUI.PreventPauseMenuToggle = true; - Character.Controlled = character = null; - Stop(); - yield return new WaitForSeconds(3.0f); - var messageBox = new GUIMessageBox(TextManager.Get("Tutorial.TryAgainHeader"), TextManager.Get("Tutorial.TryAgain"), new string[] { TextManager.Get("Yes"), TextManager.Get("No") }); + var messageBox = new GUIMessageBox("You have died", "Do you want to try again?", new string[] { "Yes", "No" }); messageBox.Buttons[0].OnClicked += Restart; messageBox.Buttons[0].OnClicked += messageBox.Close; @@ -260,29 +106,5 @@ namespace Barotrauma.Tutorials yield return CoroutineStatus.Success; } - - protected IEnumerable TutorialCompleted() - { - GUI.PreventPauseMenuToggle = true; - - Character.Controlled.ClearInputs(); - Character.Controlled = null; - - yield return new WaitForSeconds(waitBeforeFade); - - var endCinematic = new RoundEndCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, fadeOutTime); - currentTutorialCompleted = Completed = true; - while (endCinematic.Running) yield return null; - Stop(); - GameMain.MainMenuScreen.ReturnToMainMenu(null, null); - } - - protected void Heal(Character character) - { - character.SetAllDamage(0.0f, 0.0f, 0.0f); - character.Oxygen = 100.0f; - character.Bloodloss = 0.0f; - character.SetStun(0.0f, true); - } } } diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/Tutorial.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/Tutorial.cs index 442b34a43..69a5e98c9 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/Tutorial.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/Tutorial.cs @@ -1,82 +1,23 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Input; using System; using System.Collections.Generic; using System.Reflection; -using System.Linq; using System.Xml.Linq; -using Barotrauma.Items.Components; -using Barotrauma.Extensions; namespace Barotrauma.Tutorials { abstract class Tutorial { - #region Tutorial variables - public static bool Initialized = false; - public static bool ContentRunning = false; public static List Tutorials; - protected bool started = false; protected GUIComponent infoBox; private Action infoBoxClosedCallback; protected XElement configElement; - protected VideoPlayer videoPlayer; - protected enum TutorialContentTypes { None = 0, Video = 1, ManualVideo = 2, TextOnly = 3 }; - protected string playableContentPath; - protected Point screenResolution; - protected float prevUIScale; + private enum TutorialType { None, Scenario, Contextual }; + private TutorialType tutorialType = TutorialType.None; - private GUIFrame holderFrame, objectiveFrame; - private List activeObjectives = new List(); - private string objectiveTranslated; - - protected TutorialSegment activeContentSegment; - protected List segments; - - protected class TutorialSegment - { - public string Id; - public string Objective; - public TutorialContentTypes ContentType; - public XElement TextContent; - public XElement VideoContent; - public bool IsTriggered; - public GUIButton ReplayButton; - public GUITextBlock LinkedTitle, LinkedText; - public object[] Args; - - public TutorialSegment(XElement config) - { - Id = config.GetAttributeString("id", "Missing ID"); - Objective = TextManager.Get(config.GetAttributeString("objective", string.Empty), true); - Enum.TryParse(config.GetAttributeString("contenttype", "None"), true, out ContentType); - IsTriggered = config.GetAttributeBool("istriggered", false); - - switch (ContentType) - { - case TutorialContentTypes.None: - break; - case TutorialContentTypes.Video: - case TutorialContentTypes.ManualVideo: - VideoContent = config.Element("Video"); - TextContent = config.Element("Text"); - break; - case TutorialContentTypes.TextOnly: - TextContent = config.Element("Text"); - break; - } - } - } - - public string Identifier - { - get; - protected set; - } - - public string DisplayName + public string Name { get; protected set; @@ -93,9 +34,7 @@ namespace Barotrauma.Tutorials GameMain.Config.SaveNewPlayerConfig(); } } - #endregion - #region Tutorial Controls public static void Init() { Tutorials = new List(); @@ -165,88 +104,29 @@ namespace Barotrauma.Tutorials public Tutorial(XElement element) { configElement = element; - Identifier = element.GetAttributeString("identifier", "unknown"); - DisplayName = TextManager.Get(Identifier); - completed = GameMain.Config.CompletedTutorialNames.Contains(Identifier); - playableContentPath = element.GetAttributeString("playablecontentpath", ""); - - segments = new List(); - - foreach (var segment in element.Elements("Segment")) - { - segments.Add(new TutorialSegment(segment)); - } + Name = element.GetAttributeString("name", "Unnamed"); + completed = GameMain.Config.CompletedTutorialNames.Contains(Name); + Enum.TryParse(element.GetAttributeString("tutorialtype", "Scenario"), true, out tutorialType); } public virtual void Initialize() { - if (Initialized) return; - Initialized = true; - videoPlayer = new VideoPlayer(); + } public virtual void Start() { - activeObjectives.Clear(); - objectiveTranslated = TextManager.Get("Tutorial.Objective"); - CreateObjectiveFrame(); - - // Setup doors: Clear all requirements, unless the door is setup as locked. - foreach (var item in Item.ItemList) - { - var door = item.GetComponent(); - if (door != null) - { - if (door.requiredItems.Values.None(ris => ris.None(ri => ri.Identifiers.None(i => i == "locked")))) - { - door.requiredItems.Clear(); - } - } - } + } public virtual void AddToGUIUpdateList() { - if (GameMain.GraphicsWidth != screenResolution.X || GameMain.GraphicsHeight != screenResolution.Y || prevUIScale != GUI.Scale) - { - CreateObjectiveFrame(); - } - - if (objectiveFrame != null && activeObjectives.Count > 0) - { - objectiveFrame.AddToGUIUpdateList(order: -1); - } - if (infoBox != null) infoBox.AddToGUIUpdateList(order: 100); - if (videoPlayer != null) videoPlayer.AddToGUIUpdateList(order: 100); } public virtual void Update(float deltaTime) { - if (videoPlayer != null) - { - videoPlayer.Update(); - } - - if (activeObjectives != null) - { - for (int i = 0; i < activeObjectives.Count; i++) - { - CheckActiveObjectives(activeObjectives[i], deltaTime); - } - } - } - - public void CloseActiveContentGUI() - { - if (videoPlayer.IsPlaying) - { - videoPlayer.Stop(); - } - else if (infoBox != null) - { - CloseInfoFrame(null, null); - } + } public virtual IEnumerable UpdateState() @@ -254,232 +134,6 @@ namespace Barotrauma.Tutorials yield return CoroutineStatus.Success; } - protected bool Restart(GUIButton button, object obj) - { - GUI.PreventPauseMenuToggle = false; - TutorialMode.StartTutorial(this); - return true; - } - - protected virtual void TriggerTutorialSegment(int index, params object[] args) - { - Inventory.draggingItem = null; - ContentRunning = true; - activeContentSegment = segments[index]; - segments[index].Args = args; - - string tutorialText = TextManager.GetFormatted(activeContentSegment.TextContent.GetAttributeString("tag", ""), true, args); - tutorialText = TextManager.ParseInputTypes(tutorialText); - string objectiveText = string.Empty; - - if (!string.IsNullOrEmpty(activeContentSegment.Objective)) - { - if (args.Length == 0) - { - objectiveText = activeContentSegment.Objective; - } - else - { - objectiveText = string.Format(activeContentSegment.Objective, args); - } - objectiveText = TextManager.ParseInputTypes(objectiveText); - activeContentSegment.Objective = objectiveText; - } - else - { - activeContentSegment.IsTriggered = true; // Complete at this stage only if no related objective - } - - - switch (activeContentSegment.ContentType) - { - case TutorialContentTypes.None: - break; - case TutorialContentTypes.Video: - infoBox = CreateInfoFrame(TextManager.Get(activeContentSegment.Id), tutorialText, - activeContentSegment.TextContent.GetAttributeInt("width", 300), - activeContentSegment.TextContent.GetAttributeInt("height", 80), - activeContentSegment.TextContent.GetAttributeString("anchor", "Center"), true, () => LoadVideo(activeContentSegment)); - break; - case TutorialContentTypes.ManualVideo: - infoBox = CreateInfoFrame(TextManager.Get(activeContentSegment.Id), tutorialText, - activeContentSegment.TextContent.GetAttributeInt("width", 300), - activeContentSegment.TextContent.GetAttributeInt("height", 80), - activeContentSegment.TextContent.GetAttributeString("anchor", "Center"), true, StopCurrentContentSegment, () => LoadVideo(activeContentSegment)); - break; - case TutorialContentTypes.TextOnly: - infoBox = CreateInfoFrame(TextManager.Get(activeContentSegment.Id), tutorialText, - activeContentSegment.TextContent.GetAttributeInt("width", 300), - activeContentSegment.TextContent.GetAttributeInt("height", 80), - activeContentSegment.TextContent.GetAttributeString("anchor", "Center"), true, StopCurrentContentSegment); - break; - } - } - - public virtual void Stop() - { - started = ContentRunning = Initialized = false; - infoBox = null; - if (videoPlayer != null) - { - videoPlayer.Remove(); - videoPlayer = null; - } - } - #endregion - - #region Objectives - private void CreateObjectiveFrame() - { - holderFrame = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.Canvas, Anchor.Center)); - objectiveFrame = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ObjectiveAnchor, holderFrame.RectTransform), style: null); - - for (int i = 0; i < activeObjectives.Count; i++) - { - CreateObjectiveGUI(activeObjectives[i], i, activeObjectives[i].ContentType); - } - - screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight); - prevUIScale = GUI.Scale; - } - - protected void StopCurrentContentSegment() - { - if (!string.IsNullOrEmpty(activeContentSegment.Objective)) - { - AddNewObjective(activeContentSegment, activeContentSegment.ContentType); - } - - activeContentSegment = null; - ContentRunning = false; - } - - protected virtual void CheckActiveObjectives(TutorialSegment objective, float deltaTime) - { - - } - - protected bool HasObjective(TutorialSegment segment) - { - return activeObjectives.Contains(segment); - } - - protected void AddNewObjective(TutorialSegment segment, TutorialContentTypes type) - { - activeObjectives.Add(segment); - CreateObjectiveGUI(segment, activeObjectives.Count - 1, type); - } - - private void CreateObjectiveGUI(TutorialSegment segment, int index, TutorialContentTypes type) - { - Point replayButtonSize = new Point((int)(GUI.ObjectiveNameFont.MeasureString(segment.Objective).X * GUI.Scale), (int)(GUI.ObjectiveNameFont.MeasureString(segment.Objective).Y * 1.45f * GUI.Scale)); - - segment.ReplayButton = new GUIButton(new RectTransform(replayButtonSize, objectiveFrame.RectTransform, Anchor.TopRight, Pivot.TopRight) { AbsoluteOffset = new Point(0, (replayButtonSize.Y + (int)(20f * GUI.Scale)) * index) }, style: null); - segment.ReplayButton.OnClicked += (GUIButton btn, object userdata) => - { - if (type == TutorialContentTypes.Video) - { - ReplaySegmentVideo(segment); - } - else - { - ShowSegmentText(segment); - } - return true; - }; - - string objectiveText = TextManager.ParseInputTypes(objectiveTranslated); - int yOffset = (int)((GUI.ObjectiveNameFont.MeasureString(objectiveText).Y / 2f + 5)); - segment.LinkedTitle = new GUITextBlock(new RectTransform(new Point((int)GUI.ObjectiveNameFont.MeasureString(objectiveText).X, yOffset), segment.ReplayButton.RectTransform, Anchor.CenterRight, Pivot.BottomRight) { AbsoluteOffset = new Point((int)(-10 * GUI.Scale), 0) }, - objectiveText, textColor: Color.White, font: GUI.ObjectiveTitleFont, textAlignment: Alignment.CenterRight); - segment.LinkedText = new GUITextBlock(new RectTransform(new Point(replayButtonSize.X, yOffset), segment.ReplayButton.RectTransform, Anchor.Center, Pivot.TopCenter) { AbsoluteOffset = new Point((int)(10 * GUI.Scale), 0) }, - TextManager.ParseInputTypes(segment.Objective), textColor: new Color(4, 180, 108), font: GUI.ObjectiveNameFont, textAlignment: Alignment.CenterRight); - - segment.LinkedTitle.Color = segment.LinkedTitle.HoverColor = segment.LinkedTitle.PressedColor = segment.LinkedTitle.SelectedColor = Color.Transparent; - segment.LinkedText.Color = segment.LinkedText.HoverColor = segment.LinkedText.PressedColor = segment.LinkedText.SelectedColor = Color.Transparent; - segment.ReplayButton.Color = segment.ReplayButton.HoverColor = segment.ReplayButton.PressedColor = segment.ReplayButton.SelectedColor = Color.Transparent; - } - - private void ReplaySegmentVideo(TutorialSegment segment) - { - if (ContentRunning) return; - ContentRunning = true; - LoadVideo(segment); - //videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, callback: () => ContentRunning = false); - } - - private void ShowSegmentText(TutorialSegment segment) - { - if (ContentRunning) return; - Inventory.draggingItem = null; - ContentRunning = true; - - string tutorialText = TextManager.GetFormatted(segment.TextContent.GetAttributeString("tag", ""), true, segment.Args); - - Action videoAction = null; - - if (segment.ContentType != TutorialContentTypes.TextOnly) - { - videoAction = () => LoadVideo(segment); - } - - infoBox = CreateInfoFrame(TextManager.Get(segment.Id), tutorialText, - segment.TextContent.GetAttributeInt("width", 300), - segment.TextContent.GetAttributeInt("height", 80), - segment.TextContent.GetAttributeString("anchor", "Center"), true, () => ContentRunning = false, videoAction); - } - - protected void RemoveCompletedObjective(TutorialSegment segment) - { - if (!HasObjective(segment)) return; - segment.IsTriggered = true; - segment.ReplayButton.OnClicked = null; - - int checkMarkHeight = (int)(segment.ReplayButton.Rect.Height * 1.2f); - int checkMarkWidth = (int)(checkMarkHeight * 0.93f); - - Color color = new Color(4, 180, 108); - - int objectiveTextWidth = segment.LinkedText.Rect.Width; - int objectiveTitleWidth = segment.LinkedTitle.Rect.Width; - - RectTransform rectTA; - if (objectiveTextWidth > objectiveTitleWidth) - { - rectTA = new RectTransform(new Point(checkMarkWidth, checkMarkHeight), segment.ReplayButton.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft); - rectTA.AbsoluteOffset = new Point(-rectTA.Rect.Width - 5, 0); - } - else - { - rectTA = new RectTransform(new Point(checkMarkWidth, checkMarkHeight), segment.ReplayButton.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft); - rectTA.AbsoluteOffset = new Point(-rectTA.Rect.Width - 5 - (objectiveTitleWidth), 0); - } - - GUIImage checkmark = new GUIImage(rectTA, "CheckMark"); - checkmark.Color = checkmark.SelectedColor = checkmark.HoverColor = checkmark.PressedColor = color; - - RectTransform rectTB = new RectTransform(new Vector2(1.1f, .8f), segment.LinkedText.RectTransform, Anchor.Center, Pivot.Center); - GUIImage stroke = new GUIImage(rectTB, "Stroke"); - stroke.Color = stroke.SelectedColor = stroke.HoverColor = stroke.PressedColor = color; - - CoroutineManager.StartCoroutine(WaitForObjectiveEnd(segment)); - } - - private IEnumerable WaitForObjectiveEnd(TutorialSegment objective) - { - yield return new WaitForSeconds(2.0f); - objectiveFrame.RemoveChild(objective.ReplayButton); - activeObjectives.Remove(objective); - - for (int i = 0; i < activeObjectives.Count; i++) - { - activeObjectives[i].ReplayButton.RectTransform.AbsoluteOffset = new Point(0, (activeObjectives[i].ReplayButton.Rect.Height + 20) * i); - } - } - - #endregion - - #region InfoFrame protected bool CloseInfoFrame(GUIButton button, object userData) { infoBox = null; @@ -487,130 +141,87 @@ namespace Barotrauma.Tutorials return true; } - protected GUIComponent CreateInfoFrame(string title, string text, int width = 300, int height = 80, string anchorStr = "", bool hasButton = false, Action callback = null, Action showVideo = null) + protected GUIComponent CreateInfoFrame(string text, bool hasButton = false, Action callback = null) { - if (hasButton) height += 60; + int width = 300; + int height = hasButton ? 110 : 80; + + string wrappedText = ToolBox.WrapText(text, width, GUI.Font); + + height += wrappedText.Split('\n').Length * 25; + + var infoBlock = new GUIFrame(new RectTransform(new Point(width, height), GUI.Canvas, Anchor.TopRight) { AbsoluteOffset = new Point(20) }); + infoBlock.Flash(Color.Green); + + var textBlock = new GUITextBlock(new RectTransform(new Vector2(0.9f, 0.7f), infoBlock.RectTransform, Anchor.Center), + text, wrap: true); + + infoBoxClosedCallback = callback; + + if (hasButton) + { + var okButton = new GUIButton(new RectTransform(new Point(160, 50), infoBlock.RectTransform, Anchor.BottomCenter, Pivot.TopCenter) { AbsoluteOffset = new Point(0, -10) }, + TextManager.Get("OK")) + { + OnClicked = CloseInfoFrame + }; + } + GUI.PlayUISound(GUISoundType.UIMessage); + + return infoBlock; + } + + protected GUIComponent CreateInfoFrame(string title, string text, int width, int height, string anchorStr, bool hasButton = false, Action callback = null) + { + if (hasButton) height += 30; + string wrappedText = ToolBox.WrapText(text, width, GUI.Font); - height += (int)(GUI.Font.MeasureString(wrappedText).Y + 50); + height += wrappedText.Split('\n').Length * 25; + if (title.Length > 0) { height += 35; } Anchor anchor = Anchor.TopRight; + Enum.TryParse(anchorStr, out anchor); - if (anchorStr != string.Empty) - { - Enum.TryParse(anchorStr, out anchor); - } - - var background = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.Canvas, Anchor.Center), "InnerFrame", new Color(0, 0, 0, 1f)); - - var infoBlock = new GUIFrame(new RectTransform(new Point((int)(width * GUI.Scale), (int)(height * GUI.Scale)), background.RectTransform, anchor) { AbsoluteOffset = new Point(20) }); + var infoBlock = new GUIFrame(new RectTransform(new Point((int)(width * GUI.Scale), (int)(height * GUI.Scale)), GUI.Canvas, anchor) { AbsoluteOffset = new Point(20) }); infoBlock.Flash(Color.Green); - var infoContent = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.8f), infoBlock.RectTransform, Anchor.Center)) - { - Stretch = true, - AbsoluteSpacing = 5 - }; - if (title.Length > 0) { - var titleBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoContent.RectTransform), - title, font: GUI.VideoTitleFont, textAlignment: Alignment.Center, textColor: new Color(253, 174, 0)); - titleBlock.RectTransform.IsFixedSize = true; + var titleBlock = new GUITextBlock(new RectTransform(new Vector2(1f, .35f), infoBlock.RectTransform, Anchor.TopCenter, + Pivot.TopCenter), title, font: GUI.VideoTitleFont, textAlignment: Alignment.Center, textColor: new Color(253, 174, 0)); + titleBlock.TextScale = GUI.Scale; } - var textBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoContent.RectTransform), text, wrap: true); - textBlock.RectTransform.IsFixedSize = true; + var textBlock = new GUITextBlock(new RectTransform(new Vector2(0.9f, 1f), infoBlock.RectTransform, Anchor.BottomCenter), + text, wrap: true); + textBlock.TextScale = GUI.Scale; infoBoxClosedCallback = callback; if (hasButton) { - var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.3f), infoContent.RectTransform) { MinSize = new Point(0, 30), MaxSize = new Point((int) infoContent.Rect.X, 60) }, isHorizontal: true) - { - Stretch = true, - RelativeSpacing = 0.1f - }; - buttonContainer.RectTransform.IsFixedSize = true; - - if (showVideo != null) - { - var videoButton = new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonContainer.RectTransform), - TextManager.Get("Video"), style: "GUIButtonLarge") - { - OnClicked = (GUIButton button, object obj) => - { - showVideo(); - return true; - } - }; - } - - var okButton = new GUIButton(new RectTransform(new Vector2(0.6f, 1.0f), buttonContainer.RectTransform), - TextManager.Get("OK"), style: "GUIButtonLarge") + var okButton = new GUIButton(new RectTransform(new Point(160, 50), infoBlock.RectTransform, Anchor.BottomCenter, Pivot.TopCenter) { AbsoluteOffset = new Point(0, -10) }, + TextManager.Get("OK")) { OnClicked = CloseInfoFrame }; } - infoBlock.RectTransform.NonScaledSize = new Point(infoBlock.Rect.Width, (int)(infoContent.Children.Sum(c => c.Rect.Height + infoContent.AbsoluteSpacing) / infoContent.RectTransform.RelativeSize.Y)); - GUI.PlayUISound(GUISoundType.UIMessage); - return background; - } - #endregion - - #region Video - protected void LoadVideo(TutorialSegment segment) - { - if (videoPlayer == null) videoPlayer = new VideoPlayer(); - if (segment.ContentType != TutorialContentTypes.ManualVideo) - { - videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, segment.Objective, StopCurrentContentSegment); - } - else - { - videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), null, segment.Id, true, string.Empty, null); - } - } - #endregion - - #region Highlights - protected void HighlightInventorySlot(Inventory inventory, string identifier, Color color, float fadeInDuration, float fadeOutDuration, float scaleUpAmount) - { - if (inventory.slots == null) { return; } - for (int i = 0; i < inventory.Items.Length; i++) - { - if (inventory.Items[i] != null && inventory.Items[i].Prefab.Identifier == identifier) - { - HighlightInventorySlot(inventory, i, color, fadeInDuration, fadeOutDuration, scaleUpAmount); - } - } + return infoBlock; } - protected void HighlightInventorySlotWithTag(Inventory inventory, string tag, Color color, float fadeInDuration, float fadeOutDuration, float scaleUpAmount) + protected bool Restart(GUIButton button, object obj) { - if (inventory.slots == null) { return; } - for (int i = 0; i < inventory.Items.Length; i++) - { - if (inventory.Items[i] != null && inventory.Items[i].HasTag(tag)) - { - HighlightInventorySlot(inventory, i, color, fadeInDuration, fadeOutDuration, scaleUpAmount); - } - } + TutorialMode.StartTutorial(this); + return true; } - - protected void HighlightInventorySlot(Inventory inventory, int index, Color color, float fadeInDuration, float fadeOutDuration, float scaleUpAmount) - { - if (inventory.slots == null || index < 0 || inventory.slots[index].HighlightTimer > 0) return; - inventory.slots[index].ShowBorderHighlight(color, fadeInDuration, fadeOutDuration, scaleUpAmount); - } - #endregion } } diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/TutorialMode.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/TutorialMode.cs index 407f742e9..942168cfb 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/TutorialMode.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/TutorialMode.cs @@ -4,7 +4,7 @@ namespace Barotrauma { class TutorialMode : GameMode { - public Tutorial Tutorial; + public Tutorial tutorial; public static void StartTutorial(Tutorial tutorial) { @@ -19,20 +19,18 @@ namespace Barotrauma public override void Start() { base.Start(); - GameMain.GameSession.CrewManager = new CrewManager(true); - Tutorial.Start(); + tutorial.Start(); } public override void AddToGUIUpdateList() { - base.AddToGUIUpdateList(); - Tutorial.AddToGUIUpdateList(); + tutorial.AddToGUIUpdateList(); } public override void Update(float deltaTime) { base.Update(deltaTime); - Tutorial.Update(deltaTime); + tutorial.Update(deltaTime); } } } diff --git a/Barotrauma/BarotraumaClient/Source/GameSettings.cs b/Barotrauma/BarotraumaClient/Source/GameSettings.cs index 8658a7ba1..ce5b6744b 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSettings.cs @@ -81,17 +81,10 @@ namespace Barotrauma var leftPanel = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 1.0f), settingsFramePadding.RectTransform, Anchor.TopLeft)); - var settingsTitle = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftPanel.RectTransform), + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftPanel.RectTransform), TextManager.Get("Settings"), textAlignment: Alignment.TopLeft, font: GUI.LargeFont) { ForceUpperCase = true }; - //TODO: enable when new texts can be added - /*new GUIButton(new RectTransform(new Vector2(1.0f, 0.75f), settingsTitle.RectTransform, Anchor.CenterRight), style: "GUIBugButton") - { - ToolTip = "Bug Reporter", - OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; } - };*/ - var generalLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), leftPanel.RectTransform, Anchor.TopLeft)); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), generalLayoutGroup.RectTransform), TextManager.Get("ContentPackages")); @@ -132,23 +125,18 @@ namespace Barotrauma var languageDD = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.045f), generalLayoutGroup.RectTransform)); foreach (string language in TextManager.AvailableLanguages) { - languageDD.AddItem(TextManager.Get("Language." + language, returnNull: true) ?? language, language); + languageDD.AddItem(TextManager.Get("Language." + language), language); } languageDD.SelectItem(TextManager.Language); languageDD.OnSelected = (guiComponent, obj) => { string newLanguage = obj as string; if (newLanguage == Language) return true; - - Language = newLanguage; - ApplySettings(); - var msgBox = new GUIMessageBox(TextManager.Get("RestartRequiredLabel"), TextManager.Get("RestartRequiredLanguage")); - //change fonts to the default font of the new language to make sure - //they can be displayed when for example changing from English to Chinese - var defaultFont = GUI.Style.LoadCurrentDefaultFont(); - msgBox.Header.Font = defaultFont; - msgBox.Text.Font = defaultFont; + UnsavedSettings = true; + Language = newLanguage; + + new GUIMessageBox(TextManager.Get("RestartRequiredLabel"), TextManager.Get("RestartRequiredLanguage")); return true; }; @@ -169,7 +157,7 @@ namespace Barotrauma { UserData = tab }; - tabButtons[(int)tab] = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tabButtonHolder.RectTransform), + tabButtons[(int)tab] = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tabButtonHolder.RectTransform), TextManager.Get("SettingsTab." + tab.ToString()), style: "GUITabButton") { UserData = tab, @@ -207,7 +195,7 @@ namespace Barotrauma var resolutionDD = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), elementCount: supportedDisplayModes.Count) { OnSelected = SelectResolution, -#if !LINUX +#if OSX ButtonEnabled = GameMain.Config.WindowMode == WindowMode.Windowed #endif }; @@ -247,7 +235,7 @@ namespace Barotrauma { UnsavedSettings = true; GameMain.Config.WindowMode = (WindowMode)guiComponent.UserData; -#if !LINUX +#if OSX resolutionDD.ButtonEnabled = GameMain.Config.WindowMode == WindowMode.Windowed; #endif return true; @@ -268,18 +256,6 @@ namespace Barotrauma Selected = VSyncEnabled }; - //TODO: remove hardcoded texts after the texts have been added to localization - GUITickBox pauseOnFocusLostBox = new GUITickBox(new RectTransform(new Point(32, 32), leftColumn.RectTransform), - TextManager.Get("PauseOnFocusLost", returnNull: true) ?? "Pause on focus lost"); - pauseOnFocusLostBox.Selected = PauseOnFocusLost; - pauseOnFocusLostBox.ToolTip = TextManager.Get("PauseOnFocusLostToolTip", returnNull: true) ?? "Pauses the game when its window is not in focus. Note that the game won't be paused when a multiplayer session is active."; - pauseOnFocusLostBox.OnSelected = (tickBox) => - { - PauseOnFocusLost = tickBox.Selected; - UnsavedSettings = true; - return true; - }; - GUITextBlock particleLimitText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), rightColumn.RectTransform), TextManager.Get("ParticleLimit")); GUIScrollBar particleScrollBar = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.05f), rightColumn.RectTransform), barSize: 0.1f) @@ -455,7 +431,7 @@ namespace Barotrauma UnsavedSettings = true; return true; }; - + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), TextManager.Get("VoiceChat")); IList deviceNames = Alc.GetString((IntPtr)null, AlcGetStringList.CaptureDeviceSpecifier); @@ -664,7 +640,7 @@ namespace Barotrauma return true; } }; - + var inputFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.75f), controlsLayoutGroup.RectTransform), isHorizontal: true) { Stretch = true, RelativeSpacing = 0.03f }; @@ -674,15 +650,13 @@ namespace Barotrauma { Stretch = true, RelativeSpacing = 0.02f }; var inputNames = Enum.GetValues(typeof(InputType)); - var inputNameBlocks = new List(); for (int i = 0; i < inputNames.Length; i++) { var inputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.06f),(i <= (inputNames.Length / 2.2f) ? inputColumnLeft : inputColumnRight).RectTransform)) { Stretch = true, IsHorizontal = true, RelativeSpacing = 0.05f, Color = new Color(12, 14, 15, 215) }; - var inputName = new GUITextBlock(new RectTransform(new Vector2(0.7f, 1.0f), inputContainer.RectTransform, Anchor.TopLeft) { MinSize = new Point(150, 0) }, + new GUITextBlock(new RectTransform(new Vector2(0.3f, 1.0f), inputContainer.RectTransform, Anchor.TopLeft) { MinSize = new Point(150, 0) }, TextManager.Get("InputType." + ((InputType)i)) + ": ", font: GUI.SmallFont) { ForceUpperCase = true }; - inputNameBlocks.Add(inputName); - var keyBox = new GUITextBox(new RectTransform(new Vector2(0.3f, 1.0f), inputContainer.RectTransform), + var keyBox = new GUITextBox(new RectTransform(new Vector2(0.7f, 1.0f), inputContainer.RectTransform), text: keyMapping[i].ToString(), font: GUI.SmallFont) { UserData = i @@ -691,14 +665,12 @@ namespace Barotrauma keyBox.SelectedColor = Color.Gold * 0.3f; } - GUITextBlock.AutoScaleAndNormalize(inputNameBlocks); - var resetControlsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.07f), controlsLayoutGroup.RectTransform), isHorizontal: true) { RelativeSpacing = 0.02f }; - var defaultBindingsButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetDefaultBindings")) + new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetDefaultBindings")) { ToolTip = TextManager.Get("SetDefaultBindingsToolTip"), OnClicked = (button, data) => @@ -708,7 +680,7 @@ namespace Barotrauma } }; - var legacyBindingsButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetLegacyBindings")) + new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetLegacyBindings")) { ToolTip = TextManager.Get("SetLegacyBindingsToolTip"), OnClicked = (button, data) => @@ -718,11 +690,6 @@ namespace Barotrauma } }; - legacyBindingsButton.TextBlock.RectTransform.SizeChanged += () => - { - GUITextBlock.AutoScaleAndNormalize(defaultBindingsButton.TextBlock, legacyBindingsButton.TextBlock); - }; - //spacing new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null); diff --git a/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs index 0ea60b4a5..4be33d829 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs @@ -19,7 +19,7 @@ namespace Barotrauma Right, Center } - + private enum QuickUseAction { None, @@ -34,8 +34,6 @@ namespace Barotrauma } private static Dictionary limbSlotIcons; - - const InvSlotType PersonalSlots = InvSlotType.Card | InvSlotType.Headset | InvSlotType.InnerClothes | InvSlotType.OuterClothes | InvSlotType.Head; private Point screenResolution; @@ -53,42 +51,11 @@ namespace Barotrauma } } public bool Hidden { get; set; } - - private bool hidePersonalSlots; - private float hidePersonalSlotsState; - private GUIButton hideButton; - private Rectangle personalSlotArea; - public bool HidePersonalSlots - { - get { return hidePersonalSlots; } - } - - public Rectangle PersonalSlotArea - { - get { return personalSlotArea; } - } - partial void InitProjSpecific(XElement element) { Hidden = true; - hideButton = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), (int)(60 * GUI.Scale)), GUI.Canvas) - { AbsoluteOffset = HUDLayoutSettings.CrewArea.Location }, - "", 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; - }; - - hidePersonalSlots = false; - if (limbSlotIcons == null) { limbSlotIcons = new Dictionary(); @@ -100,13 +67,13 @@ namespace Barotrauma limbSlotIcons.Add(InvSlotType.Head, new Sprite("Content/UI/IconAtlas.png", new Rectangle(896 + margin, 128 + margin, 128 - margin * 2, 128 - margin * 2))); limbSlotIcons.Add(InvSlotType.LeftHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(640 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2))); limbSlotIcons.Add(InvSlotType.RightHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(768 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2))); - limbSlotIcons.Add(InvSlotType.OuterClothes, new Sprite("Content/UI/IconAtlas.png", new Rectangle(768 + margin, 896 + margin, 128 - margin * 2, 128 - margin * 2))); } + SlotPositions = new Vector2[SlotTypes.Length]; CurrentLayout = Layout.Default; SetSlotPositions(layout); } - + protected override void PutItem(Item item, int i, Character user, bool removeItem = true, bool createNetworkEvent = true) { base.PutItem(item, i, user, removeItem, createNetworkEvent); @@ -192,11 +159,6 @@ namespace Barotrauma { if (slots[i].Disabled || (hideEmptySlot[i] && Items[i] == null)) return true; - if (layout == Layout.Default) - { - if (PersonalSlots.HasFlag(SlotTypes[i]) && !personalSlotArea.Contains(slots[i].Rect.Center + slots[i].DrawOffset.ToPoint())) return true; - } - //no need to draw the right hand slot if the item is in both hands if (Items[i] != null && SlotTypes[i] == InvSlotType.RightHand && IsInLimbSlot(Items[i], InvSlotType.LeftHand)) { @@ -214,6 +176,7 @@ namespace Barotrauma return false; } + private void SetSlotPositions(Layout layout) { int spacing = (int)(10 * UIScale); @@ -222,32 +185,27 @@ namespace Barotrauma if (slots == null) CreateSlots(); - hideButton.Visible = false; + var upperSlots = InvSlotType.Card | InvSlotType.Headset | InvSlotType.InnerClothes | InvSlotType.Head | InvSlotType.OuterClothes; switch (layout) { case Layout.Default: { - int personalSlotCount = SlotTypes.Count(s => PersonalSlots.HasFlag(s)); - int normalSlotCount = SlotTypes.Count(s => !PersonalSlots.HasFlag(s)); + int personalSlotCount = SlotTypes.Count(s => upperSlots.HasFlag(s)); + int normalSlotCount = SlotTypes.Count(s => !upperSlots.HasFlag(s)); int x = GameMain.GraphicsWidth / 2 - normalSlotCount * (slotSize.X + spacing) / 2; - int upperX = HUDLayoutSettings.PortraitArea.X - slotSize.X * 2; + int upperX = HUDLayoutSettings.PortraitArea.X - slotSize.X; //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); - int hideButtonSlotIndex = -1; for (int i = 0; i < SlotPositions.Length; i++) { - if (PersonalSlots.HasFlag(SlotTypes[i])) + if (upperSlots.HasFlag(SlotTypes[i])) { SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset); upperX -= slotSize.X + spacing; - personalSlotArea = (hideButtonSlotIndex == -1) ? - new Rectangle(SlotPositions[i].ToPoint(), slotSize) : - Rectangle.Union(personalSlotArea, new Rectangle(SlotPositions[i].ToPoint(), slotSize)); - hideButtonSlotIndex = i; } else { @@ -255,29 +213,19 @@ namespace Barotrauma x += slotSize.X + spacing; } } - - if (hideButtonSlotIndex > -1) - { - hideButton.RectTransform.SetPosition(Anchor.TopLeft, Pivot.TopLeft); - hideButton.RectTransform.NonScaledSize = new Point(slotSize.X / 2, slotSize.Y + slots[hideButtonSlotIndex].EquipButtonRect.Height); - hideButton.RectTransform.AbsoluteOffset = new Point( - personalSlotArea.Right + spacing, - personalSlotArea.Y - slots[hideButtonSlotIndex].EquipButtonRect.Height); - hideButton.Visible = true; - } } break; case Layout.Right: { int extraOffset = 0; int x = HUDLayoutSettings.InventoryAreaLower.Right; - int personalSlotX = HUDLayoutSettings.InventoryAreaLower.Right - slotSize.X - spacing; + int upperX = HUDLayoutSettings.InventoryAreaLower.Right; for (int i = 0; i < slots.Length; i++) { if (HideSlot(i)) continue; - if (PersonalSlots.HasFlag(SlotTypes[i])) + if (upperSlots.HasFlag(SlotTypes[i])) { - //upperX -= slotSize.X + spacing; + upperX -= slotSize.X + spacing; } else { @@ -289,10 +237,10 @@ namespace Barotrauma for (int i = 0; i < SlotPositions.Length; i++) { if (HideSlot(i)) continue; - if (PersonalSlots.HasFlag(SlotTypes[i])) + if (upperSlots.HasFlag(SlotTypes[i])) { - SlotPositions[i] = new Vector2(personalSlotX, GameMain.GraphicsHeight - bottomOffset * 2 - extraOffset - spacing * 2); - personalSlotX -= slots[i].Rect.Width + spacing; + SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset * 2 - extraOffset - spacing * 2); + upperX += slots[i].Rect.Width + spacing; } else { @@ -313,14 +261,14 @@ namespace Barotrauma case Layout.Left: { int x = HUDLayoutSettings.InventoryAreaLower.X; - int personalSlotX = x; + int upperX = x; for (int i = 0; i < SlotPositions.Length; i++) { if (HideSlot(i)) continue; - if (PersonalSlots.HasFlag(SlotTypes[i])) + if (upperSlots.HasFlag(SlotTypes[i])) { - SlotPositions[i] = new Vector2(personalSlotX, GameMain.GraphicsHeight - bottomOffset * 2 - spacing * 2); - personalSlotX += slots[i].Rect.Width + spacing; + SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset * 2 - spacing * 2); + upperX += slots[i].Rect.Width + spacing; } else { @@ -406,27 +354,6 @@ namespace Barotrauma ((selectedSlot != null && selectedSlot.IsSubSlot) || (draggingItem != null && (draggingSlot == null || !draggingSlot.MouseOn()))); if (CharacterHealth.OpenHealthWindow != null) hoverOnInventory = true; - if (layout == Layout.Default && hideButton.Visible) - { - hideButton.AddToGUIUpdateList(); - hideButton.UpdateManually(deltaTime, alsoChildren: true); - - hidePersonalSlotsState = hidePersonalSlots ? - Math.Min(hidePersonalSlotsState + deltaTime * 5.0f, 1.0f) : - Math.Max(hidePersonalSlotsState - deltaTime * 5.0f, 0.0f); - - for (int i = 0; i < slots.Length; i++) - { - if (!PersonalSlots.HasFlag(SlotTypes[i])) { continue; } - if (HidePersonalSlots) - { - if (selectedSlot?.Slot == slots[i]) { selectedSlot = null; } - highlightedSubInventorySlots.RemoveWhere(s => s.Slot == slots[i]); - } - slots[i].DrawOffset = Vector2.Lerp(Vector2.Zero, new Vector2(personalSlotArea.Width, 0.0f), hidePersonalSlotsState); - } - } - if (hoverOnInventory) HideTimer = 0.5f; if (HideTimer > 0.0f) HideTimer -= deltaTime; @@ -439,23 +366,7 @@ namespace Barotrauma QuickUseItem(Items[i], true, false, true); } } - - //force personal slots open if an item is running out of battery/fuel/oxygen/etc - if (hidePersonalSlots) - { - for (int i = 0; i < slots.Length; i++) - { - if (Items[i]?.OwnInventory != null && Items[i].OwnInventory.Capacity == 1 && PersonalSlots.HasFlag(SlotTypes[i])) - { - if (Items[i].OwnInventory.Items[0].Condition > 0.0f && - Items[i].OwnInventory.Items[0].Condition / Items[i].OwnInventory.Items[0].MaxCondition < 0.15f) - { - hidePersonalSlots = false; - } - } - } - } - + List hideSubInventories = new List(); foreach (var highlightedSubInventorySlot in highlightedSubInventorySlots) { @@ -792,12 +703,7 @@ namespace Barotrauma } base.Draw(spriteBatch); - - if (hideButton != null && hideButton.Visible && !Locked) - { - hideButton.DrawManually(spriteBatch, alsoChildren: true); - } - + InventorySlot highlightedQuickUseSlot = null; for (int i = 0; i < capacity; i++) { @@ -811,7 +717,7 @@ namespace Barotrauma if (limbSlotIcons.ContainsKey(SlotTypes[i])) { var icon = limbSlotIcons[SlotTypes[i]]; - icon.Draw(spriteBatch, slots[i].Rect.Center.ToVector2() + slots[i].DrawOffset, Color.White * 0.3f, origin: icon.size / 2, scale: slots[i].Rect.Width / icon.size.X); + icon.Draw(spriteBatch, slots[i].Rect.Center.ToVector2(), Color.White * 0.3f, origin: icon.size / 2, scale: slots[i].Rect.Width / icon.size.X); } continue; } @@ -821,12 +727,12 @@ namespace Barotrauma if (IsInLimbSlot(Items[i], InvSlotType.LeftHand)) { var icon = limbSlotIcons[InvSlotType.LeftHand]; - icon.Draw(spriteBatch, new Vector2(slots[i].Rect.X, slots[i].Rect.Bottom) + slots[i].DrawOffset, Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.35f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f); + icon.Draw(spriteBatch, new Vector2(slots[i].Rect.X, slots[i].Rect.Bottom), Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.35f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f); } if (IsInLimbSlot(Items[i], InvSlotType.RightHand)) { var icon = limbSlotIcons[InvSlotType.RightHand]; - icon.Draw(spriteBatch, new Vector2(slots[i].Rect.Right, slots[i].Rect.Bottom) + slots[i].DrawOffset, Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.65f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f); + icon.Draw(spriteBatch, new Vector2(slots[i].Rect.Right, slots[i].Rect.Bottom), Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.65f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f); } Color color = slots[i].EquipButtonState == GUIComponent.ComponentState.Pressed ? Color.Gray : Color.White * 0.8f; @@ -835,7 +741,6 @@ namespace Barotrauma color = Color.White; highlightedQuickUseSlot = slots[i]; } - if (Locked) { color *= 0.3f; } var quickUseIndicator = Items[i].AllowedSlots.Any(a => a == InvSlotType.Any) ? EquipIndicator : DropIndicator; diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs index c5ecaf754..68997c299 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs @@ -227,9 +227,10 @@ namespace Barotrauma.Items.Components } return; } - + + if (!sounds.TryGetValue(type, out List matchingSounds)) return; + ItemSound itemSound = null; - var matchingSounds = sounds[type]; if (loopingSoundChannel == null || !loopingSoundChannel.IsPlaying) { SoundSelectionMode soundSelectionMode = soundSelectionModes[type]; @@ -264,7 +265,7 @@ namespace Barotrauma.Items.Components private void PlaySound(ItemSound itemSound, Vector2 position, Character user = null) { - if (Vector2.DistanceSquared(new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y), position) > itemSound.Range * itemSound.Range) + if (Vector3.DistanceSquared(GameMain.SoundManager.ListenerPosition, new Vector3(position.X, position.Y, 0.0f)) > itemSound.Range * itemSound.Range) { return; } @@ -292,7 +293,7 @@ namespace Barotrauma.Items.Components { float volume = GetSoundVolume(itemSound); if (volume <= 0.0f) return; - SoundPlayer.PlaySound(itemSound.RoundSound.Sound, position, volume, itemSound.Range, item.CurrentHull); + SoundPlayer.PlaySound(itemSound.RoundSound.Sound, volume, itemSound.Range, position, item.CurrentHull); } } @@ -379,13 +380,9 @@ namespace Barotrauma.Items.Components public virtual void UpdateHUD(Character character, float deltaTime, Camera cam) { } - public virtual void CreateEditingHUD(SerializableEntityEditor editor) + public ItemComponent GetLinkUIToComponent() { - } - - private bool LoadElemProjSpecific(XElement subElement) - { - switch (subElement.Name.ToString().ToLowerInvariant()) + if (string.IsNullOrEmpty(LinkUIToComponent)) { case "guiframe": if (subElement.Attribute("rect") != null) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs index 10eb66e95..5bdd103f3 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs @@ -28,7 +28,7 @@ namespace Barotrauma.Items.Components } private string text; - [Serialize("", true, translationTextTag: "Label."), Editable(100)] + [Serialize("", true), Editable(100)] public string Text { get { return text; } @@ -40,10 +40,9 @@ namespace Barotrauma.Items.Components { textBlock = null; } - + text = value; - DisplayText = TextManager.Get(text, returnNull: true) ?? value; - TextBlock.Text = DisplayText; + TextBlock.Text = value; SetScrollingText(); } } @@ -122,7 +121,7 @@ namespace Barotrauma.Items.Components { if (!scrollable) return; - float totalWidth = textBlock.Font.MeasureString(DisplayText).X; + float totalWidth = textBlock.Font.MeasureString(text).X; float textAreaWidth = Math.Max(textBlock.Rect.Width - textBlock.Padding.X - textBlock.Padding.Z, 0); if (totalWidth >= textAreaWidth) { @@ -130,13 +129,13 @@ namespace Barotrauma.Items.Components //(so the text can scroll entirely out of view before we reset it back to start) needsScrolling = true; float spaceWidth = textBlock.Font.MeasureChar(' ').X; - scrollingText = new string(' ', (int)Math.Ceiling(textAreaWidth / spaceWidth)) + DisplayText; + scrollingText = new string(' ', (int)Math.Ceiling(textAreaWidth / spaceWidth)) + text; } else { //whole text can fit in the textblock, no need to scroll needsScrolling = false; - scrollingText = DisplayText; + scrollingText = text; scrollAmount = 0.0f; scrollIndex = 0; return; @@ -152,7 +151,7 @@ namespace Barotrauma.Items.Components charWidths[i] = charWidth; } - scrollIndex = MathHelper.Clamp(scrollIndex, 0, DisplayText.Length); + scrollIndex = MathHelper.Clamp(scrollIndex, 0, text.Length); } public override void Update(float deltaTime, Camera cam) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/LightComponent.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/LightComponent.cs index 7f676175e..141433f4e 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/LightComponent.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/LightComponent.cs @@ -23,7 +23,7 @@ namespace Barotrauma.Items.Components { if (light.LightSprite != null && (item.body == null || item.body.Enabled) && lightBrightness > 0.0f) { - light.LightSprite.Draw(spriteBatch, new Vector2(item.DrawPosition.X, -item.DrawPosition.Y), lightColor * lightBrightness, 0.0f, item.Scale, SpriteEffects.None, item.SpriteDepth - 0.0001f); + light.LightSprite.Draw(spriteBatch, new Vector2(item.DrawPosition.X, -item.DrawPosition.Y), lightColor * lightBrightness, 0.0f, 1.0f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, item.SpriteDepth - 0.0001f); } } diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Deconstructor.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Deconstructor.cs index cb8889292..85150941e 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Deconstructor.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Deconstructor.cs @@ -9,10 +9,6 @@ namespace Barotrauma.Items.Components { partial class Deconstructor : Powered, IServerSerializable, IClientSerializable { - public GUIButton ActivateButton - { - get { return activateButton; } - } private GUIButton activateButton; private GUIComponent inputInventoryHolder, outputInventoryHolder; private GUICustomComponent inputInventoryOverlay; @@ -48,6 +44,7 @@ namespace Barotrauma.Items.Components Visible = false, CanBeFocused = false }; + outputInventoryHolder = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.3f), paddedFrame.RectTransform), style: null); } @@ -74,7 +71,7 @@ namespace Barotrauma.Items.Components public override void UpdateHUD(Character character, float deltaTime, Camera cam) { inSufficientPowerWarning.Visible = powerConsumption > 0 && voltage < minVoltage; - //activateButton.Enabled = !inSufficientPowerWarning.Visible; + activateButton.Enabled = !inSufficientPowerWarning.Visible; } private bool ToggleActive(GUIButton button, object obj) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Engine.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Engine.cs index fe1b9aa82..b55286f50 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Engine.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Engine.cs @@ -30,25 +30,25 @@ namespace Barotrauma.Items.Components partial void InitProjSpecific(XElement element) { - var content = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.8f), GuiFrame.RectTransform, Anchor.Center)) - { - Stretch = true, - RelativeSpacing = 0.05f - }; - - powerIndicator = new GUITickBox(new RectTransform(new Point(30, 30), content.RectTransform), + powerIndicator = new GUITickBox(new RectTransform(new Point(30, 30), GuiFrame.RectTransform) { RelativeOffset = new Vector2(0.05f, 0.15f) }, TextManager.Get("EnginePowered"), style: "IndicatorLightGreen") { CanBeFocused = false }; string powerLabel = TextManager.Get("EngineForce"); - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), content.RectTransform), "", textAlignment: Alignment.Center) + new GUITextBlock(new RectTransform(new Vector2(0.9f, 0.3f), GuiFrame.RectTransform, Anchor.BottomCenter) + { RelativeOffset = new Vector2(0.0f, 0.4f) }, "", textAlignment: Alignment.Center) { TextGetter = () => { return powerLabel + ": " + (int)(targetForce) + " %"; } }; - forceSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.3f), content.RectTransform), barSize: 0.2f, style: "GUISlider") + var sliderArea = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.25f), GuiFrame.RectTransform, Anchor.BottomCenter) + { RelativeOffset = new Vector2(0.0f, 0.2f) }, isHorizontal: true); + + new GUITextBlock(new RectTransform(new Vector2(0.2f, 1.0f), sliderArea.RectTransform), TextManager.Get("EngineBackwards"), + font: GUI.SmallFont, textAlignment: Alignment.Center); + forceSlider = new GUIScrollBar(new RectTransform(new Vector2(0.6f, 1.0f), sliderArea.RectTransform), barSize: 0.25f, style: "GUISlider") { Step = 0.05f, OnMoved = (GUIScrollBar scrollBar, float barScroll) => @@ -66,16 +66,8 @@ namespace Barotrauma.Items.Components return true; } }; - - var textArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.2f), content.RectTransform), isHorizontal: true) - { - Stretch = true - }; - - new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), textArea.RectTransform), TextManager.Get("EngineBackwards"), - font: GUI.SmallFont, textAlignment: Alignment.CenterLeft); - new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), textArea.RectTransform), TextManager.Get("EngineForwards"), - font: GUI.SmallFont, textAlignment: Alignment.CenterRight); + new GUITextBlock(new RectTransform(new Vector2(0.2f, 1.0f), sliderArea.RectTransform), TextManager.Get("EngineForwards"), + font: GUI.SmallFont, textAlignment: Alignment.Center); foreach (XElement subElement in element.Elements()) { diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs index 6b447391c..4dc0b89a1 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs @@ -15,10 +15,6 @@ namespace Barotrauma.Items.Components private GUIFrame selectedItemFrame; - public GUIButton ActivateButton - { - get { return activateButton; } - } private GUIButton activateButton; private GUITextBox itemFilterBox; @@ -26,10 +22,6 @@ namespace Barotrauma.Items.Components private GUIComponent inputInventoryHolder, outputInventoryHolder; private GUICustomComponent inputInventoryOverlay, outputInventoryOverlay; - public FabricationRecipe SelectedItem - { - get { return selectedItem; } - } private FabricationRecipe selectedItem; private GUIComponent inSufficientPowerWarning; @@ -81,31 +73,7 @@ namespace Barotrauma.Items.Components { CanBeFocused = false }; - - CreateRecipes(); - - activateButton = new GUIButton(new RectTransform(new Vector2(0.8f, 0.07f), paddedFrame.RectTransform), - TextManager.Get("FabricatorCreate"), style: "GUIButtonLarge") - { - OnClicked = StartButtonClicked, - UserData = selectedItem, - Enabled = false - }; - - inSufficientPowerWarning = new GUITextBlock(new RectTransform(Vector2.One, activateButton.RectTransform), TextManager.Get("FabricatorNoPower"), - textColor: Color.Orange, textAlignment: Alignment.Center, color: Color.Black, style: "OuterGlow") - { - HoverColor = Color.Black, - IgnoreLayoutGroups = true, - Visible = false, - CanBeFocused = false - }; - } - - partial void CreateRecipes() - { - itemList.Content.RectTransform.ClearChildren(); - + foreach (FabricationRecipe fi in fabricationRecipes) { GUIFrame frame = new GUIFrame(new RectTransform(new Point(itemList.Rect.Width, 30), itemList.Content.RectTransform), style: null) @@ -133,6 +101,23 @@ namespace Barotrauma.Items.Components }; } } + + activateButton = new GUIButton(new RectTransform(new Vector2(0.8f, 0.07f), paddedFrame.RectTransform), + TextManager.Get("FabricatorCreate"), style: "GUIButtonLarge") + { + OnClicked = StartButtonClicked, + UserData = selectedItem, + Enabled = false + }; + + inSufficientPowerWarning = new GUITextBlock(new RectTransform(Vector2.One, activateButton.RectTransform), TextManager.Get("FabricatorNoPower"), + textColor: Color.Orange, textAlignment: Alignment.Center, color: Color.Black, style: "OuterGlow") + { + HoverColor = Color.Black, + IgnoreLayoutGroups = true, + Visible = false, + CanBeFocused = false + }; } partial void OnItemLoadedProjSpecific() @@ -164,15 +149,13 @@ namespace Barotrauma.Items.Components return string.Compare(item1.DisplayName, item2.DisplayName); }); - var sufficientSkillsText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.15f), itemList.Content.RectTransform), - TextManager.Get("fabricatorsufficientskills", returnNull: true) ?? "Sufficient skills to fabricate", textColor: Color.LightGreen) + var sufficientSkillsText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.15f), itemList.Content.RectTransform), "Sufficient skills to fabricate:", textColor: Color.LightGreen) { CanBeFocused = false }; sufficientSkillsText.RectTransform.SetAsFirstChild(); - var insufficientSkillsText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.15f), itemList.Content.RectTransform), - TextManager.Get("fabricatorinsufficientskills", returnNull: true) ?? "Insufficient skills to fabricate", textColor: Color.Orange) + var insufficientSkillsText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.15f), itemList.Content.RectTransform), "Insufficient skills to fabricate:", textColor: Color.Orange) { CanBeFocused = false }; @@ -258,7 +241,6 @@ namespace Barotrauma.Items.Components } } } - private void DrawOutputOverLay(SpriteBatch spriteBatch, GUICustomComponent overlayComponent) { overlayComponent.RectTransform.SetAsLastChild(); @@ -381,29 +363,6 @@ namespace Barotrauma.Items.Components return true; } - public void HighlightRecipe(string identifier, Color color) - { - foreach (GUIComponent child in itemList.Content.Children) - { - FabricationRecipe recipe = child.UserData as FabricationRecipe; - if (recipe?.DisplayName == null) { continue; } - if (recipe.TargetItem.Identifier == identifier) - { - if (child.FlashTimer > 0.0f) return; - child.Flash(color, 1.5f, false); - - for (int i = 0; i < child.CountChildren; i++) - { - var grandChild = child.GetChild(i); - if (grandChild is GUITextBlock) continue; - grandChild.Flash(color, 1.5f, false); - } - - return; - } - } - } - private bool StartButtonClicked(GUIButton button, object obj) { if (selectedItem == null) { return false; } diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/MiniMap.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/MiniMap.cs index 5967624a1..cd5c74d3e 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/MiniMap.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/MiniMap.cs @@ -221,7 +221,7 @@ namespace Barotrauma.Items.Components { hullInfoFrame.RectTransform.ScreenSpaceOffset = hullFrame.Rect.Center; hullInfoFrame.Visible = true; - hullNameText.Text = hull.DisplayName; + hullNameText.Text = hull.RoomName; foreach (Hull linkedHull in hullData.LinkedHulls) { diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs index 8b885cab9..b13727818 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs @@ -10,10 +10,6 @@ namespace Barotrauma.Items.Components { partial class Pump : Powered, IServerSerializable, IClientSerializable { - public GUIScrollBar IsActiveSlider - { - get { return isActiveSlider; } - } private GUIScrollBar isActiveSlider; private GUIScrollBar pumpSpeedSlider; private GUITickBox powerIndicator; @@ -53,6 +49,7 @@ namespace Barotrauma.Items.Components }; var sliderHandle = isActiveSlider.GetChild(); sliderHandle.RectTransform.NonScaledSize = new Point(84, sliderHandle.Rect.Height); + isActiveSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) => { bool active = scrollBar.BarScroll < 0.5f; @@ -78,8 +75,8 @@ namespace Barotrauma.Items.Components CanBeFocused = false }; - var pumpSpeedText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), rightArea.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.0f) }, - "", textAlignment: Alignment.BottomLeft, wrap: true); + var pumpSpeedText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), rightArea.RectTransform) { RelativeOffset = new Vector2(0.25f, 0.0f) }, + "", textAlignment: Alignment.BottomLeft); string pumpSpeedStr = TextManager.Get("PumpSpeed"); pumpSpeedText.TextGetter = () => { return pumpSpeedStr + ": " + (int)flowPercentage + " %"; }; @@ -90,7 +87,7 @@ namespace Barotrauma.Items.Components }; new GUITextBlock(new RectTransform(new Vector2(0.15f, 1.0f), sliderArea.RectTransform), - TextManager.Get("PumpOut"), textAlignment: Alignment.Center, wrap: true); + TextManager.Get("PumpOut"), textAlignment: Alignment.Center); pumpSpeedSlider = new GUIScrollBar(new RectTransform(new Vector2(0.8f, 1.0f), sliderArea.RectTransform), barSize: 0.25f, style: "GUISlider") { Step = 0.05f, @@ -111,7 +108,7 @@ namespace Barotrauma.Items.Components }; new GUITextBlock(new RectTransform(new Vector2(0.15f, 1.0f), sliderArea.RectTransform), - TextManager.Get("PumpIn"), textAlignment: Alignment.Center, wrap: true); + TextManager.Get("PumpIn"), textAlignment: Alignment.Center); } public override void OnItemLoaded() diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Reactor.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Reactor.cs index 1fc3955ca..d46b2029a 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Reactor.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Reactor.cs @@ -11,16 +11,7 @@ namespace Barotrauma.Items.Components { partial class Reactor : Powered, IServerSerializable, IClientSerializable { - public GUIScrollBar AutoTempSlider - { - get { return autoTempSlider; } - } private GUIScrollBar autoTempSlider; - - public GUIScrollBar OnOffSwitch - { - get { return onOffSwitch; } - } private GUIScrollBar onOffSwitch; private const int GraphSize = 25; @@ -36,16 +27,7 @@ namespace Barotrauma.Items.Components private Sprite graphLine; - public GUIScrollBar FissionRateScrollBar - { - get { return fissionRateScrollBar; } - } private GUIScrollBar fissionRateScrollBar; - - public GUIScrollBar TurbineOutputScrollBar - { - get { return turbineOutputScrollBar; } - } private GUIScrollBar turbineOutputScrollBar; private float[] outputGraph = new float[GraphSize]; @@ -110,8 +92,8 @@ namespace Barotrauma.Items.Components GUIFrame columnLeft = new GUIFrame(new RectTransform(new Vector2(0.2f, 1.0f), paddedFrame.RectTransform), style: null); leftHUDColumn = columnLeft; - GUIFrame columnMid = new GUIFrame(new RectTransform(new Vector2(0.5f, 1.0f), paddedFrame.RectTransform), style: null); - GUIFrame columnRight = new GUIFrame(new RectTransform(new Vector2(0.3f, 1.0f), paddedFrame.RectTransform), style: null); + GUIFrame columnMid = new GUIFrame(new RectTransform(new Vector2(0.45f, 1.0f), paddedFrame.RectTransform), style: null); + GUIFrame columnRight = new GUIFrame(new RectTransform(new Vector2(0.35f, 1.0f), paddedFrame.RectTransform), style: null); //---------------------------------------------------------- //left column @@ -136,7 +118,6 @@ namespace Barotrauma.Items.Components btnText.SetTextPos(); warningButtons.Add(warningTexts[i], warningBtn); } - GUITextBlock.AutoScaleAndNormalize(warningButtons.Values.Select(b => b.TextBlock)); inventoryContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.45f), columnLeft.RectTransform, Anchor.BottomLeft), style: null); @@ -144,37 +125,33 @@ namespace Barotrauma.Items.Components //mid column //---------------------------------------------------------- - criticalHeatWarning = new GUITickBox(new RectTransform(new Point(columnMid.Rect.Width / 3, 30), columnMid.RectTransform), + criticalHeatWarning = new GUITickBox(new RectTransform(new Point(30, 30), columnMid.RectTransform), TextManager.Get("ReactorWarningCriticalTemp"), font: GUI.SmallFont, style: "IndicatorLightRed") { CanBeFocused = false }; - lowTemperatureWarning = new GUITickBox(new RectTransform(new Point(columnMid.Rect.Width / 3, 30), columnMid.RectTransform) { RelativeOffset = new Vector2(0.27f, 0.0f) }, + lowTemperatureWarning = new GUITickBox(new RectTransform(new Point(30, 30), columnMid.RectTransform) { RelativeOffset = new Vector2(0.3f, 0.0f) }, TextManager.Get("ReactorWarningCriticalLowTemp"), font: GUI.SmallFont, style: "IndicatorLightRed") { CanBeFocused = false }; - criticalOutputWarning = new GUITickBox(new RectTransform(new Point(columnMid.Rect.Width / 3, 30), columnMid.RectTransform) { RelativeOffset = new Vector2(0.66f, 0.0f) }, + criticalOutputWarning = new GUITickBox(new RectTransform(new Point(30, 30), columnMid.RectTransform) { RelativeOffset = new Vector2(0.75f, 0.0f) }, TextManager.Get("ReactorWarningCriticalOutput"), font: GUI.SmallFont, style: "IndicatorLightRed") { CanBeFocused = false }; - - GUITextBlock.AutoScaleAndNormalize(criticalHeatWarning.TextBlock, lowTemperatureWarning.TextBlock, criticalOutputWarning.TextBlock); - - float gaugeOffset = criticalHeatWarning.Rect.Height / (float)columnMid.Rect.Height + 0.05f; - new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), columnMid.RectTransform) { RelativeOffset = new Vector2(0.0f, gaugeOffset) }, + new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), columnMid.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.25f) }, TextManager.Get("ReactorFissionRate")); - new GUICustomComponent(new RectTransform(new Vector2(0.5f, 0.5f), columnMid.RectTransform) { RelativeOffset = new Vector2(0.0f, gaugeOffset + 0.05f) }, + new GUICustomComponent(new RectTransform(new Vector2(0.5f, 0.5f), columnMid.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.3f) }, DrawFissionRateMeter, null) { ToolTip = TextManager.Get("ReactorTipFissionRate") }; - new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), columnMid.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, gaugeOffset) }, + new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), columnMid.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.25f) }, TextManager.Get("ReactorTurbineOutput")); - new GUICustomComponent(new RectTransform(new Vector2(0.5f, 0.5f), columnMid.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, gaugeOffset + 0.05f) }, + new GUICustomComponent(new RectTransform(new Vector2(0.5f, 0.5f), columnMid.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.3f) }, DrawTurbineOutputMeter, null) { ToolTip = TextManager.Get("ReactorTipTurbineOutput") @@ -214,13 +191,12 @@ namespace Barotrauma.Items.Components //right column //---------------------------------------------------------- - new GUITextBlock(new RectTransform(new Vector2(0.7f, 0.1f), columnRight.RectTransform), TextManager.Get("ReactorAutoTemp")) + new GUITextBlock(new RectTransform(new Point(100, 20), columnRight.RectTransform), TextManager.Get("ReactorAutoTemp")) { - ToolTip = TextManager.Get("ReactorTipAutoTemp"), - AutoScale = true + ToolTip = TextManager.Get("ReactorTipAutoTemp") }; - autoTempSlider = new GUIScrollBar(new RectTransform(new Vector2(0.6f, 0.15f), columnRight.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.1f) }, - barSize: 0.55f, style: "OnOffSlider", isHorizontal: true) + autoTempSlider = new GUIScrollBar(new RectTransform(new Point(100, 30), columnRight.RectTransform) { AbsoluteOffset = new Point(0, 30) }, + barSize: 0.5f, style: "OnOffSlider") { ToolTip = TextManager.Get("ReactorTipAutoTemp"), IsBooleanSwitch = true, @@ -232,11 +208,9 @@ namespace Barotrauma.Items.Components return true; } }; - var sliderSprite = autoTempSlider.Frame.Style.Sprites[GUIComponent.ComponentState.None].First(); - autoTempSlider.RectTransform.MaxSize = sliderSprite.Sprite.SourceRect.Size; - - onOffSwitch = new GUIScrollBar(new RectTransform(new Vector2(0.4f, 0.3f), columnRight.RectTransform, Anchor.TopRight), - barSize: 0.2f, style: "OnOffLever", isHorizontal: false) + + onOffSwitch = new GUIScrollBar(new RectTransform(new Point(50, 80), columnRight.RectTransform, Anchor.TopRight), + barSize: 0.2f, style: "OnOffLever") { IsBooleanSwitch = true, MinValue = 0.25f, @@ -248,8 +222,6 @@ namespace Barotrauma.Items.Components return true; } }; - var switchSprite = onOffSwitch.Frame.Style.Sprites[GUIComponent.ComponentState.None].First(); - onOffSwitch.RectTransform.MaxSize = switchSprite.Sprite.SourceRect.Size; var lever = onOffSwitch.GetChild(); lever.RectTransform.NonScaledSize = new Point(lever.Rect.Width + 30, lever.Rect.Height); @@ -582,8 +554,6 @@ namespace Barotrauma.Items.Components fissionRateScrollBar.BarScroll = targetFissionRate / 100.0f; turbineOutputScrollBar.BarScroll = targetTurbineOutput / 100.0f; onOffSwitch.BarScroll = shutDown ? Math.Max(onOffSwitch.BarScroll, 0.55f) : Math.Min(onOffSwitch.BarScroll, 0.45f); - - IsActive = true; } } } diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Sonar.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Sonar.cs index e7e032352..6a8ee3d51 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Sonar.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Sonar.cs @@ -17,15 +17,9 @@ namespace Barotrauma.Items.Components Passive }; - private bool dynamicDockingIndicator = true; - private bool unsentChanges; private float networkUpdateTimer; - public GUITickBox ActiveTickBox - { - get { return activeTickBox; } - } private GUITickBox activeTickBox, passiveTickBox; private GUITextBlock signalWarningText; @@ -66,8 +60,6 @@ namespace Barotrauma.Items.Components new Color(255, 255, 255) }; - private float prevDockingDist; - public Vector2 DisplayOffset { get; private set; } public float DisplayRadius { get; private set; } @@ -175,31 +167,6 @@ namespace Barotrauma.Items.Components sonarMode.Selected = Mode.Passive; GuiFrame.CanBeFocused = false; - - foreach (XElement subElement in element.Elements()) - { - switch (subElement.Name.ToString().ToLowerInvariant()) - { - case "pingcircle": - pingCircle = new Sprite(subElement); - break; - case "directionalpingcircle": - directionalPingCircle = new Sprite(subElement); - break; - case "screenoverlay": - screenOverlay = new Sprite(subElement); - break; - case "screenbackground": - screenBackground = new Sprite(subElement); - break; - case "blip": - sonarBlip = new Sprite(subElement); - break; - case "linesprite": - lineSprite = new Sprite(subElement); - break; - } - } } public override void OnItemLoaded() @@ -264,7 +231,8 @@ namespace Barotrauma.Items.Components return; } - Vector2 transducerCenter = GetTransducerPos() + DisplayOffset; + Vector2 transducerCenter = UseTransducers ? GetTransducerCenter() : item.WorldPosition; + transducerCenter += DisplayOffset; if (Level.Loaded != null) { @@ -313,31 +281,8 @@ namespace Barotrauma.Items.Components sonarBlips.Add(flowBlip); } } - } - - Steering steering = item.GetComponent(); - if (steering != null && steering.DockingModeEnabled) - { - float dockingDist = Vector2.Distance(steering.DockingSource.Item.WorldPosition, steering.DockingTarget.Item.WorldPosition); - if (prevDockingDist > steering.DockingAssistThreshold && dockingDist <= steering.DockingAssistThreshold) - { - zoom = Math.Max(zoom, MathHelper.Lerp(MinZoom, MaxZoom, 0.25f)); - } - else if (prevDockingDist > steering.DockingAssistThreshold * 0.75f && dockingDist <= steering.DockingAssistThreshold * 0.75f) - { - zoom = Math.Max(zoom, MathHelper.Lerp(MinZoom, MaxZoom, 0.5f)); - } - else if (prevDockingDist > steering.DockingAssistThreshold * 0.5f && dockingDist <= steering.DockingAssistThreshold * 0.5f) - { - zoom = Math.Max(zoom, MathHelper.Lerp(MinZoom, MaxZoom, 0.25f)); - } - prevDockingDist = Math.Min(dockingDist, prevDockingDist); - } - else - { - prevDockingDist = float.MaxValue; - } - + } + if (IsActive) { float pingRadius = DisplayRadius * pingState / zoom; @@ -408,7 +353,7 @@ namespace Barotrauma.Items.Components } } - Vector2 transducerCenter = GetTransducerPos(); + Vector2 transducerCenter = UseTransducers && connectedTransducers.Count > 0 ? GetTransducerCenter() : item.WorldPosition; if (item.Submarine != null && !DetectSubmarineWalls) { @@ -421,6 +366,7 @@ namespace Barotrauma.Items.Components DisplayOffset = Vector2.Zero; } + if (sonarBlips.Count > 0) { zoomSqrt = (float)Math.Sqrt(zoom); @@ -441,8 +387,8 @@ namespace Barotrauma.Items.Components { Vector2 sector1 = MathUtils.RotatePointAroundTarget(pingDirection * DisplayRadius, Vector2.Zero, DirectionalPingSector * 0.5f); Vector2 sector2 = MathUtils.RotatePointAroundTarget(pingDirection * DisplayRadius, Vector2.Zero, -DirectionalPingSector * 0.5f); - DrawLine(spriteBatch, center, center + sector1, Color.LightCyan * 0.2f * directionalPingVisibility, width: 3); - DrawLine(spriteBatch, center, center + sector2, Color.LightCyan * 0.2f * directionalPingVisibility, width: 3); + GUI.DrawLine(spriteBatch, center, center + sector1, Color.LightCyan * 0.2f * directionalPingVisibility, width: 3); + GUI.DrawLine(spriteBatch, center, center + sector2, Color.LightCyan * 0.2f * directionalPingVisibility, width: 3); } if (GameMain.DebugDraw) @@ -493,14 +439,11 @@ namespace Barotrauma.Items.Components { var mission = GameMain.GameSession.Mission; - if (!string.IsNullOrWhiteSpace(mission.SonarLabel)) + if (!string.IsNullOrWhiteSpace(mission.SonarLabel) && mission.SonarPosition != Vector2.Zero) { - foreach (Vector2 sonarPosition in mission.SonarPositions) - { - DrawMarker(spriteBatch, - mission.SonarLabel, - sonarPosition - transducerCenter, displayScale, center, (rect.Width * 0.47f)); - } + DrawMarker(spriteBatch, + mission.SonarLabel, + mission.SonarPosition - transducerCenter, displayScale, center, (rect.Width * 0.47f)); } } @@ -545,7 +488,7 @@ namespace Barotrauma.Items.Components Vector2 end = (submarine.HullVertices[(i + 1) % submarine.HullVertices.Count] + offset) * simScale; end.Y = -end.Y; - DrawLine(spriteBatch, start, end, Color.LightBlue * signalStrength * 0.5f, width: 4); + DrawLine(spriteBatch, start, end, Color.LightBlue * signalStrength * 0.5f, width: 3); } } } @@ -562,38 +505,22 @@ namespace Barotrauma.Items.Components { if (MathUtils.GetLineCircleIntersections(Vector2.Zero, DisplayRadius, end, start, true, out Vector2? intersection1, out Vector2? intersection2) == 1) { - DrawLineSprite(spriteBatch, center + intersection1.Value, center + end, color, width: width); + GUI.DrawLine(spriteBatch, center + intersection1.Value, center + end, color, width: width); } } else if (endOutside) { if (MathUtils.GetLineCircleIntersections(Vector2.Zero, DisplayRadius, start, end, true, out Vector2? intersection1, out Vector2? intersection2) == 1) { - DrawLineSprite(spriteBatch, center + start, center + intersection1.Value, color, width: width); + GUI.DrawLine(spriteBatch, center + start, center + intersection1.Value, color, width: width); } } else { - DrawLineSprite(spriteBatch, center + start, center + end, color, width: width); + GUI.DrawLine(spriteBatch, center + start, center + end, color, width: width); } } - private void DrawLineSprite(SpriteBatch spriteBatch, Vector2 start, Vector2 end, Color color, int width) - { - if (lineSprite == null) - { - GUI.DrawLine(spriteBatch, start, end, color, width: width); - } - else - { - Vector2 dir = end - start; - float angle = (float)Math.Atan2(dir.Y, dir.X); - lineSprite.Draw(spriteBatch, start, color, origin: lineSprite.Origin, rotate: angle, - scale: new Vector2(dir.Length() / lineSprite.size.X, 1.0f)); - } - } - - private void DrawDockingPorts(SpriteBatch spriteBatch, Vector2 transducerCenter, float signalStrength) { float scale = displayScale * zoom; @@ -601,12 +528,61 @@ namespace Barotrauma.Items.Components Steering steering = item.GetComponent(); if (steering != null && steering.DockingModeEnabled) { - DrawDockingIndicator(spriteBatch, steering, ref transducerCenter); + DisplayOffset = + Vector2.Lerp(DisplayOffset, + (steering.DockingSource.Item.WorldPosition + steering.DockingTarget.Item.WorldPosition) / 2.0f - transducerCenter, + 0.1f); + transducerCenter += DisplayOffset; + + Vector2 sourcePortDiff = (steering.DockingSource.Item.WorldPosition - transducerCenter) * scale; + Vector2 sourcePortPos = new Vector2(sourcePortDiff.X, -sourcePortDiff.Y); + Vector2 targetPortDiff = (steering.DockingTarget.Item.WorldPosition - transducerCenter) * scale; + Vector2 targetPortPos = new Vector2(targetPortDiff.X, -targetPortDiff.Y); + + Vector2 midPos = (sourcePortPos + targetPortPos) / 2.0f; + + System.Diagnostics.Debug.Assert(steering.DockingSource.IsHorizontal == steering.DockingTarget.IsHorizontal); + + float xDist = Math.Abs(steering.DockingSource.Item.WorldPosition.X - steering.DockingTarget.Item.WorldPosition.X); + float normalizedXDist = xDist / steering.DockingSource.DistanceTolerance.X; + float yDist = Math.Abs(steering.DockingSource.Item.WorldPosition.Y - steering.DockingTarget.Item.WorldPosition.Y); + float normalizedYDist = yDist / steering.DockingSource.DistanceTolerance.Y; + + Color xColor = normalizedXDist <= 1.0f ? Color.Lime : Color.Lerp(Color.Orange, Color.Red, normalizedXDist - 1.0f); + Color yColor = normalizedYDist <= 1.0f ? Color.Lime : Color.Lerp(Color.Orange, Color.Red, normalizedYDist - 1.0f); + + if (steering.DockingSource.IsHorizontal) + { + if (yDist < steering.DockingSource.DistanceTolerance.Y) + { + DrawLine(spriteBatch, sourcePortPos, new Vector2(targetPortPos.X, sourcePortPos.Y), xColor, width: 3); + } + else + { + DrawLine(spriteBatch, sourcePortPos, new Vector2(midPos.X, sourcePortPos.Y), xColor, width: 3); + DrawLine(spriteBatch, targetPortPos, new Vector2(midPos.X, targetPortPos.Y), xColor, width: 3); + DrawLine(spriteBatch, new Vector2(midPos.X, sourcePortPos.Y), new Vector2(midPos.X, targetPortPos.Y), yColor, width: 3); + } + } + else + { + if (xDist < steering.DockingSource.DistanceTolerance.X) + { + DrawLine(spriteBatch, sourcePortPos, new Vector2(sourcePortPos.X, targetPortPos.Y), yColor, width: 3); + } + else + { + DrawLine(spriteBatch, sourcePortPos, new Vector2(sourcePortPos.X, midPos.Y), yColor, width: 3); + DrawLine(spriteBatch, targetPortPos, new Vector2(targetPortPos.X, midPos.Y), yColor, width: 3); + DrawLine(spriteBatch, new Vector2(sourcePortPos.X, midPos.Y), new Vector2(targetPortPos.X, midPos.Y), xColor, width: 3); + } + } } else { DisplayOffset = Vector2.Lerp(DisplayOffset, Vector2.Zero, 0.1f); - } + } + foreach (DockingPort dockingPort in DockingPort.List) { @@ -625,102 +601,9 @@ namespace Barotrauma.Items.Components { size.Y = 0.0f; } - GUI.DrawLine(spriteBatch, center + offset - size, center + offset + size, Color.LightGreen, width: (int)(zoom * 2.5f)); - } - } - - private void DrawDockingIndicator(SpriteBatch spriteBatch, Steering steering, ref Vector2 transducerCenter) - { - float scale = displayScale * zoom; - - Vector2 worldFocusPos = (steering.DockingSource.Item.WorldPosition + steering.DockingTarget.Item.WorldPosition) / 2.0f; - worldFocusPos.X = steering.DockingTarget.Item.WorldPosition.X; - - DisplayOffset = Vector2.Lerp(DisplayOffset, worldFocusPos - transducerCenter, 0.1f); - transducerCenter += DisplayOffset; - - Vector2 sourcePortDiff = (steering.DockingSource.Item.WorldPosition - transducerCenter) * scale; - Vector2 sourcePortPos = new Vector2(sourcePortDiff.X, -sourcePortDiff.Y); - Vector2 targetPortDiff = (steering.DockingTarget.Item.WorldPosition - transducerCenter) * scale; - Vector2 targetPortPos = new Vector2(targetPortDiff.X, -targetPortDiff.Y); - - Vector2 midPos = (sourcePortPos + targetPortPos) / 2.0f; - - System.Diagnostics.Debug.Assert(steering.DockingSource.IsHorizontal == steering.DockingTarget.IsHorizontal); - Vector2 diff = steering.DockingTarget.Item.WorldPosition - steering.DockingSource.Item.WorldPosition; - float dist = diff.Length(); - bool readyToDock = - Math.Abs(diff.X) < steering.DockingTarget.DistanceTolerance.X && - Math.Abs(diff.Y) < steering.DockingTarget.DistanceTolerance.Y; - - Vector2 dockingDir = sourcePortPos - targetPortPos; - Vector2 normalizedDockingDir = Vector2.Normalize(dockingDir); - if (!dynamicDockingIndicator) - { - if (steering.DockingSource.IsHorizontal) - { - normalizedDockingDir = new Vector2(Math.Sign(normalizedDockingDir.X), 0.0f); - } - else - { - normalizedDockingDir = new Vector2(0.0f, Math.Sign(normalizedDockingDir.Y)); - } + GUI.DrawLine(spriteBatch, center + offset - size / 2, center + offset + size / 2, Color.LightGreen, width: (int)(zoom)); } - Color staticLineColor = Color.White * 0.2f; - - float sector = MathHelper.ToRadians(MathHelper.Lerp(10.0f, 45.0f, MathHelper.Clamp(dist / steering.DockingAssistThreshold, 0.0f, 1.0f))); - float sectorLength = DisplayRadius; - //use law of cosines to calculate the length of the center line - float midLength = (float)(Math.Cos(sector) * sectorLength); - - Vector2 midNormal = new Vector2(-normalizedDockingDir.Y, normalizedDockingDir.X); - - DrawLine(spriteBatch, targetPortPos, targetPortPos + normalizedDockingDir * midLength, readyToDock ? Color.LightGreen : staticLineColor, width: 2); - DrawLine(spriteBatch, targetPortPos, - targetPortPos + MathUtils.RotatePoint(normalizedDockingDir, sector) * sectorLength, staticLineColor, width: 2); - DrawLine(spriteBatch, targetPortPos, - targetPortPos + MathUtils.RotatePoint(normalizedDockingDir, -sector) * sectorLength, staticLineColor, width: 2); - - for (float z = 0; z < 1.0f; z += 0.1f * zoom) - { - Vector2 linePos = targetPortPos + normalizedDockingDir * midLength * z; - DrawLine(spriteBatch, linePos + midNormal * 3.0f, linePos - midNormal * 3.0f, staticLineColor, width: 3); - } - - if (readyToDock) - { - Color indicatorColor = Color.LightGreen * 0.8f; - - float indicatorSize = (float)Math.Sin((float)Timing.TotalTime * 5.0f) * DisplayRadius * 0.75f; - Vector2 midPoint = (sourcePortPos + targetPortPos) / 2.0f; - DrawLine(spriteBatch, - midPoint + Vector2.UnitY * indicatorSize, - midPoint - Vector2.UnitY * indicatorSize, - indicatorColor, width: 3); - DrawLine(spriteBatch, - midPoint + Vector2.UnitX * indicatorSize, - midPoint - Vector2.UnitX * indicatorSize, - indicatorColor, width: 3); - } - else - { - float indicatorSector = sector * 0.75f; - float indicatorSectorLength = (float)(midLength / Math.Cos(indicatorSector)); - - bool withinSector = - (Math.Abs(diff.X) < steering.DockingSource.DistanceTolerance.X && Math.Abs(diff.Y) < steering.DockingSource.DistanceTolerance.Y) || - Vector2.Dot(normalizedDockingDir, MathUtils.RotatePoint(normalizedDockingDir, indicatorSector)) < - Vector2.Dot(normalizedDockingDir, Vector2.Normalize(dockingDir)); - - Color indicatorColor = withinSector ? Color.LightGreen * 0.8f : Color.Red * 0.8f; - - DrawLine(spriteBatch, targetPortPos, - targetPortPos + MathUtils.RotatePoint(normalizedDockingDir,indicatorSector) * indicatorSectorLength, indicatorColor, width: 3); - DrawLine(spriteBatch, targetPortPos, - targetPortPos + MathUtils.RotatePoint(normalizedDockingDir, -indicatorSector) * indicatorSectorLength, indicatorColor, width: 3); - } - } private void UpdateDisruptions(Vector2 pingSource, float worldPingRadius, float worldPrevPingRadius) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Steering.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Steering.cs index d6958531c..42e370fa7 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Steering.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Steering.cs @@ -4,9 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Graphics; using System; -using System.Linq; using System.Collections.Generic; -using System.Xml.Linq; namespace Barotrauma.Items.Components { @@ -27,11 +25,6 @@ namespace Barotrauma.Items.Components }; private GUITickBox maintainPosTickBox, levelEndTickBox, levelStartTickBox; - private GUIComponent statusContainer, dockingContainer; - - private GUIButton dockingButton; - private string dockText, undockText; - private GUIFrame autoPilotControlsDisabler; private GUIComponent steerArea; @@ -42,14 +35,9 @@ namespace Barotrauma.Items.Components private string noPowerTip, autoPilotMaintainPosTip, autoPilotLevelStartTip, autoPilotLevelEndTip; - private Sprite maintainPosIndicator, maintainPosOriginIndicator; - private Sprite steeringIndicator; - private Vector2 keyboardInput = Vector2.Zero; private float inputCumulation; - private bool? swapDestinationOrder; - private bool levelStartSelected; public bool LevelStartSelected { @@ -76,12 +64,10 @@ namespace Barotrauma.Items.Components get; set; } - + public DockingPort DockingSource, DockingTarget; - private bool searchedConnectedDockingPort; - - partial void InitProjSpecific(XElement element) + partial void InitProjSpecific() { int viewSize = (int)Math.Min(GuiFrame.Rect.Width - 150, GuiFrame.Rect.Height * 0.9f); var controlContainer = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.35f), GuiFrame.RectTransform, Anchor.CenterLeft) @@ -92,7 +78,7 @@ namespace Barotrauma.Items.Components Stretch = true }; - statusContainer = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.25f), GuiFrame.RectTransform, Anchor.BottomLeft) + var statusContainer = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.25f), GuiFrame.RectTransform, Anchor.BottomLeft) { MinSize = new Point(150, 0), AbsoluteOffset = new Point((int)(viewSize * 0.9f), 0) }, "SonarFrame"); var paddedStatusContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), statusContainer.RectTransform, Anchor.Center)) { @@ -121,9 +107,7 @@ namespace Barotrauma.Items.Components AutoPilot = box.Selected; if (AutoPilot && MaintainPos) { - posToMaintain = controlledSub != null ? - controlledSub.WorldPosition : - item.Submarine == null ? item.WorldPosition : item.Submarine.WorldPosition; + posToMaintain = controlledSub == null ? item.WorldPosition : controlledSub.WorldPosition; } unsentChanges = true; user = Character.Controlled; @@ -294,80 +278,6 @@ namespace Barotrauma.Items.Components steerArea = new GUICustomComponent(new RectTransform(new Point(viewSize), GuiFrame.RectTransform, Anchor.CenterLeft), (spriteBatch, guiCustomComponent) => { DrawHUD(spriteBatch, guiCustomComponent.Rect); }, null); - - //docking interface ---------------------------------------------------- - dockingContainer = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.25f), GuiFrame.RectTransform, Anchor.BottomLeft) - { MinSize = new Point(150, 0), AbsoluteOffset = new Point((int)(viewSize * 0.9f), 0) }, style: null); - var paddedDockingContainer = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.9f), dockingContainer.RectTransform, Anchor.Center), style: null); - - //TODO: add new texts for these ("Dock" & "Undock") - dockText = TextManager.Get("captain.dock"); - undockText = TextManager.Get("captain.undock"); - dockingButton = new GUIButton(new RectTransform(new Vector2(0.5f, 0.5f), paddedDockingContainer.RectTransform, Anchor.Center), dockText, style: "GUIButtonLarge") - { - OnClicked = (btn, userdata) => - { - item.SendSignal(0, "1", "toggle_docking", sender: Character.Controlled); - return true; - } - }; - dockingButton.Font = GUI.SmallFont; - - var leftButton = new GUIButton(new RectTransform(new Vector2(0.2f, 0.5f), paddedDockingContainer.RectTransform, Anchor.CenterLeft), "") - { - OnClicked = NudgeButtonClicked, - UserData = -Vector2.UnitX - }; - new GUIImage(new RectTransform(new Vector2(0.7f), leftButton.RectTransform, Anchor.Center), "GUIButtonHorizontalArrow").SpriteEffects = SpriteEffects.FlipHorizontally; - var rightButton = new GUIButton(new RectTransform(new Vector2(0.2f, 0.5f), paddedDockingContainer.RectTransform, Anchor.CenterRight), "") - { - OnClicked = NudgeButtonClicked, - UserData = Vector2.UnitX - }; - new GUIImage(new RectTransform(new Vector2(0.7f), rightButton.RectTransform, Anchor.Center), "GUIButtonHorizontalArrow"); - var upButton = new GUIButton(new RectTransform(new Vector2(0.5f, 0.2f), paddedDockingContainer.RectTransform, Anchor.TopCenter), "") - { - OnClicked = NudgeButtonClicked, - UserData = Vector2.UnitY - }; - new GUIImage(new RectTransform(new Vector2(0.7f), upButton.RectTransform, Anchor.Center), "GUIButtonVerticalArrow"); - var downButton = new GUIButton(new RectTransform(new Vector2(0.5f, 0.2f), paddedDockingContainer.RectTransform, Anchor.BottomCenter), "") - { - OnClicked = NudgeButtonClicked, - UserData = -Vector2.UnitY - }; - new GUIImage(new RectTransform(new Vector2(0.7f), downButton.RectTransform, Anchor.Center), "GUIButtonVerticalArrow").SpriteEffects = SpriteEffects.FlipVertically; - - foreach (XElement subElement in element.Elements()) - { - switch (subElement.Name.ToString().ToLowerInvariant()) - { - case "steeringindicator": - steeringIndicator = new Sprite(subElement); - break; - case "maintainposindicator": - maintainPosIndicator = new Sprite(subElement); - break; - case "maintainposoriginindicator": - maintainPosOriginIndicator = new Sprite(subElement); - break; - } - } - } - - private void FindConnectedDockingPort() - { - DockingSource = - (item.linkedTo.FirstOrDefault(l => l is Item item && item.GetComponent() != null) as Item)?.GetComponent(); - if (DockingSource == null) - { - var dockingConnection = item.Connections.FirstOrDefault(c => c.Name == "toggle_docking"); - if (dockingConnection != null) - { - var connectedPorts = item.GetConnectedComponentsRecursive(dockingConnection); - DockingSource = connectedPorts.Find(p => p.Item.Submarine == item.Submarine); - } - } } /// @@ -384,15 +294,15 @@ namespace Barotrauma.Items.Components int width = rect.Width, height = rect.Height; int x = rect.X; int y = rect.Y; - + if (voltage < minVoltage && currPowerConsumption > 0.0f) return; - Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40); - Vector2 displaySubPos = (-sonar.DisplayOffset * sonar.Zoom) / sonar.Range * sonar.DisplayRadius * sonar.Zoom; - displaySubPos.Y = -displaySubPos.Y; - displaySubPos = displaySubPos.ClampLength(velRect.Width / 2); - displaySubPos = steerArea.Rect.Center.ToVector2() + displaySubPos; - + Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40); + GUI.DrawLine(spriteBatch, + new Vector2(velRect.Center.X, velRect.Center.Y), + new Vector2(velRect.Center.X + currVelocity.X, velRect.Center.Y - currVelocity.Y), + Color.Gray); + if (!AutoPilot) { Vector2 unitSteeringInput = steeringInput / 100.0f; @@ -400,24 +310,20 @@ namespace Barotrauma.Items.Components Vector2 steeringInputPos = new Vector2( steeringInput.X * (float)Math.Sqrt(1.0f - 0.5f * unitSteeringInput.Y * unitSteeringInput.Y), -steeringInput.Y * (float)Math.Sqrt(1.0f - 0.5f * unitSteeringInput.X * unitSteeringInput.X)); - steeringInputPos += displaySubPos; + steeringInputPos.X += velRect.Center.X; + steeringInputPos.Y += velRect.Center.Y; - if (steeringIndicator != null) - { - Vector2 dir = steeringInputPos - displaySubPos; - float angle = (float)Math.Atan2(dir.Y, dir.X); - steeringIndicator.Draw(spriteBatch, displaySubPos, Color.White, origin: steeringIndicator.Origin, rotate: angle, - scale: new Vector2(dir.Length() / steeringIndicator.size.X, 1.0f)); - } - else - { - GUI.DrawLine(spriteBatch, displaySubPos, steeringInputPos, Color.LightGray); - GUI.DrawRectangle(spriteBatch, new Rectangle((int)steeringInputPos.X - 5, (int)steeringInputPos.Y - 5, 10, 10), Color.White); - } + GUI.DrawLine(spriteBatch, + new Vector2(velRect.Center.X, velRect.Center.Y), + steeringInputPos, + Color.LightGray); + GUI.DrawRectangle(spriteBatch, new Rectangle((int)steeringInputPos.X - 5, (int)steeringInputPos.Y - 5, 10, 10), Color.White); + + //if (keyboardInput.Length() > 0 || Vector2.Distance(PlayerInput.MousePosition, new Vector2(velRect.Center.X, velRect.Center.Y)) < 200.0f) if (velRect.Contains(PlayerInput.MousePosition)) { - GUI.DrawRectangle(spriteBatch, new Rectangle((int)steeringInputPos.X - 4, (int)steeringInputPos.Y - 4, 8, 8), Color.Red, thickness: 2); + GUI.DrawRectangle(spriteBatch, new Rectangle((int)steeringInputPos.X - 10, (int)steeringInputPos.Y - 10, 20, 20), Color.Red); } } else if (posToMaintain.HasValue && !LevelStartSelected && !LevelEndSelected) @@ -428,53 +334,35 @@ namespace Barotrauma.Items.Components Vector2 displayPosToMaintain = ((posToMaintain.Value - sonar.DisplayOffset * sonar.Zoom - controlledSub.WorldPosition)) / sonar.Range * sonar.DisplayRadius * sonar.Zoom; displayPosToMaintain.Y = -displayPosToMaintain.Y; displayPosToMaintain = displayPosToMaintain.ClampLength(velRect.Width / 2); - displayPosToMaintain = steerArea.Rect.Center.ToVector2() + displayPosToMaintain; + displayPosToMaintain = velRect.Center.ToVector2() + displayPosToMaintain; + float crossHairSize = 8.0f; Color crosshairColor = Color.Orange * (0.5f + ((float)Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) / 4.0f); - if (maintainPosIndicator != null) - { - maintainPosIndicator.Draw(spriteBatch, displayPosToMaintain, crosshairColor, scale: 0.5f * sonar.Zoom); - } - else - { - float crossHairSize = 8.0f; - GUI.DrawLine(spriteBatch, displayPosToMaintain + Vector2.UnitY * crossHairSize, displayPosToMaintain - Vector2.UnitY * crossHairSize, crosshairColor, width: 3); - GUI.DrawLine(spriteBatch, displayPosToMaintain + Vector2.UnitX * crossHairSize, displayPosToMaintain - Vector2.UnitX * crossHairSize, crosshairColor, width: 3); - } - if (maintainPosOriginIndicator != null) - { - maintainPosOriginIndicator.Draw(spriteBatch, displaySubPos, Color.Orange, scale: 0.5f * sonar.Zoom); - } - else - { - GUI.DrawRectangle(spriteBatch, new Rectangle((int)displaySubPos.X - 5, (int)displaySubPos.Y - 5, 10, 10), Color.Orange); - } + GUI.DrawLine(spriteBatch, displayPosToMaintain + Vector2.UnitY * crossHairSize, displayPosToMaintain - Vector2.UnitY * crossHairSize, crosshairColor, width: 3); + GUI.DrawLine(spriteBatch, displayPosToMaintain + Vector2.UnitX * crossHairSize, displayPosToMaintain - Vector2.UnitX * crossHairSize, crosshairColor, width: 3); + + Vector2 neutralPos = ((controlledSub.WorldPosition - sonar.DisplayOffset * sonar.Zoom - controlledSub.WorldPosition)) / sonar.Range * sonar.DisplayRadius * sonar.Zoom; + + neutralPos.Y = -neutralPos.Y; + neutralPos = neutralPos.ClampLength(velRect.Width / 2); + neutralPos = velRect.Center.ToVector2() + neutralPos; + GUI.DrawRectangle(spriteBatch, new Rectangle((int)neutralPos.X - 5, (int)neutralPos.Y - 5, 10, 10), Color.Orange); } } - + //map velocity from rectangle to circle Vector2 unitTargetVel = targetVelocity / 100.0f; Vector2 steeringPos = new Vector2( targetVelocity.X * 0.9f * (float)Math.Sqrt(1.0f - 0.5f * unitTargetVel.Y * unitTargetVel.Y), -targetVelocity.Y * 0.9f * (float)Math.Sqrt(1.0f - 0.5f * unitTargetVel.X * unitTargetVel.X)); - steeringPos += displaySubPos; + steeringPos.X += velRect.Center.X; + steeringPos.Y += velRect.Center.Y; - - if (steeringIndicator != null) - { - Vector2 dir = steeringPos - displaySubPos; - float angle = (float)Math.Atan2(dir.Y, dir.X); - steeringIndicator.Draw(spriteBatch, displaySubPos, Color.Gray, origin: steeringIndicator.Origin, rotate: angle, - scale: new Vector2(dir.Length() / steeringIndicator.size.X, 0.7f)); - } - else - { - GUI.DrawLine(spriteBatch, - displaySubPos, - steeringPos, - Color.CadetBlue, 0, 2); - } + GUI.DrawLine(spriteBatch, + new Vector2(velRect.Center.X, velRect.Center.Y), + steeringPos, + Color.CadetBlue, 0, 2); } public void DebugDrawHUD(SpriteBatch spriteBatch, Vector2 transducerCenter, float displayScale, float displayRadius, Vector2 center) @@ -535,21 +423,6 @@ namespace Barotrauma.Items.Components public override void UpdateHUD(Character character, float deltaTime, Camera cam) { - if (swapDestinationOrder == null) - { - swapDestinationOrder = item.Submarine != null && item.Submarine.FlippedX; - if (swapDestinationOrder.Value) - { - levelStartTickBox.RectTransform.SetAsLastChild(); - } - } - - if (!searchedConnectedDockingPort) - { - FindConnectedDockingPort(); - searchedConnectedDockingPort = true; - } - if (steerArea.Rect.Contains(PlayerInput.MousePosition)) { if (!PlayerInput.KeyDown(InputType.Deselect) && !PlayerInput.KeyHit(InputType.Deselect)) @@ -558,38 +431,6 @@ namespace Barotrauma.Items.Components } } - dockingContainer.Visible = DockingModeEnabled; - statusContainer.Visible = !DockingModeEnabled; - - if (DockingModeEnabled) - { - if (Math.Abs(DockingSource.Item.WorldPosition.X - DockingTarget.Item.WorldPosition.X) < DockingSource.DistanceTolerance.X && - Math.Abs(DockingSource.Item.WorldPosition.Y - DockingTarget.Item.WorldPosition.Y) < DockingSource.DistanceTolerance.Y) - { - dockingButton.Text = dockText; - if (dockingButton.FlashTimer <= 0.0f) - { - dockingButton.Flash(Color.LightGreen, 0.5f); - dockingButton.Pulsate(Vector2.One, Vector2.One * 1.2f, dockingButton.FlashTimer); - } - } - } - else if (DockingSource != null && DockingSource.Docked) - { - dockingButton.Text = undockText; - dockingContainer.Visible = true; - statusContainer.Visible = false; - if (dockingButton.FlashTimer <= 0.0f) - { - dockingButton.Flash(Color.OrangeRed); - dockingButton.Pulsate(Vector2.One, Vector2.One * 1.2f, dockingButton.FlashTimer); - } - } - else - { - dockingButton.Text = dockText; - } - autoPilotControlsDisabler.Visible = !AutoPilot; if (voltage < minVoltage && currPowerConsumption > 0.0f) @@ -627,17 +468,13 @@ namespace Barotrauma.Items.Components { if (PlayerInput.LeftButtonHeld()) { - Vector2 displaySubPos = (-sonar.DisplayOffset * sonar.Zoom) / sonar.Range * sonar.DisplayRadius * sonar.Zoom; - displaySubPos.Y = -displaySubPos.Y; - displaySubPos = steerArea.Rect.Center.ToVector2() + displaySubPos; - - Vector2 inputPos = PlayerInput.MousePosition - displaySubPos; + Vector2 inputPos = PlayerInput.MousePosition - steerArea.Rect.Center.ToVector2(); inputPos.Y = -inputPos.Y; if (AutoPilot && !LevelStartSelected && !LevelEndSelected) { - posToMaintain = controlledSub != null ? - controlledSub.WorldPosition + inputPos / sonar.DisplayRadius * sonar.Range / sonar.Zoom : - item.Submarine == null ? item.WorldPosition : item.Submarine.WorldPosition; + posToMaintain = controlledSub == null ? + item.WorldPosition : + controlledSub.WorldPosition + (sonar.DisplayOffset * sonar.Zoom) + inputPos / sonar.DisplayRadius * sonar.Range / sonar.Zoom; } else { @@ -703,6 +540,16 @@ namespace Barotrauma.Items.Components if (sourcePort.Docked || sourcePort.Item.Submarine == null) { continue; } if (sourcePort.Item.Submarine != controlledSub) { continue; } + + float closestDist = DockingAssistThreshold * DockingAssistThreshold; + DockingModeEnabled = false; + DockingSource = null; + DockingTarget = null; + foreach (DockingPort sourcePort in DockingPort.List) + { + if (sourcePort.Docked || sourcePort.Item.Submarine == null) { continue; } + if (sourcePort.Item.Submarine != controlledSub) { continue; } + int sourceDir = sourcePort.IsHorizontal ? Math.Sign(sourcePort.Item.WorldPosition.X - sourcePort.Item.Submarine.WorldPosition.X) : Math.Sign(sourcePort.Item.WorldPosition.Y - sourcePort.Item.Submarine.WorldPosition.Y); @@ -730,27 +577,6 @@ namespace Barotrauma.Items.Components } } - private bool NudgeButtonClicked(GUIButton btn, object userdata) - { - if (!MaintainPos || !AutoPilot) - { - AutoPilot = true; - posToMaintain = item.Submarine.WorldPosition; - } - MaintainPos = true; - if (userdata is Vector2) - { - Sonar sonar = item.GetComponent(); - Vector2 nudgeAmount = (Vector2)userdata; - if (sonar != null) - { - nudgeAmount *= sonar == null ? 500.0f : 500.0f / sonar.Zoom; - } - PosToMaintain += nudgeAmount; - } - return true; - } - protected override void RemoveComponentSpecific() { maintainPosIndicator?.Remove(); diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Repairable.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Repairable.cs index 5cde6d3ec..ddd2ffb29 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Repairable.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Repairable.cs @@ -10,10 +10,6 @@ namespace Barotrauma.Items.Components { partial class Repairable : ItemComponent, IDrawableComponent { - public GUIButton RepairButton - { - get { return repairButton; } - } private GUIButton repairButton; private GUIProgressBar progressBar; diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Connection.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Connection.cs index f5a3c8999..53c247abe 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Connection.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Connection.cs @@ -18,14 +18,6 @@ namespace Barotrauma.Items.Components private static Wire draggingConnected; - private Color flashColor; - private float flashDuration = 1.5f; - public float FlashTimer - { - get { return flashTimer; } - } - private float flashTimer; - public static void DrawConnections(SpriteBatch spriteBatch, ConnectionPanel panel, Character character) { Rectangle panelRect = panel.GuiFrame.Rect; @@ -182,38 +174,14 @@ namespace Barotrauma.Items.Components } } } - - if (flashTimer > 0.0f) - { - //the number of flashes depends on the duration, 1 flash per 1 full second - int flashCycleCount = (int)Math.Max(flashDuration, 1); - float flashCycleDuration = flashDuration / flashCycleCount; - - //MathHelper.Pi * 0.8f -> the curve goes from 144 deg to 0, - //i.e. quickly bumps up from almost full brightness to full and then fades out - connectionSpriteHighlight.Draw(spriteBatch, position, flashColor * (float)Math.Sin(flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f)); - } - + if (Wires.Any(w => w != null && w != draggingConnected)) { int screwIndex = (int)Math.Floor(position.Y / 30.0f) % screwSprites.Count; screwSprites[screwIndex].Draw(spriteBatch, position); } } - - public void Flash(Color? color = null, float flashDuration = 1.5f) - { - flashTimer = flashDuration; - this.flashDuration = flashDuration; - flashColor = (color == null) ? Color.Red : (Color)color; - } - - public void UpdateFlashTimer(float deltaTime) - { - if (flashTimer <= 0) return; - flashTimer -= deltaTime; - } - + private static void DrawWire(SpriteBatch spriteBatch, Wire wire, Item item, Vector2 end, Vector2 start, bool mouseIn, Wire equippedWire, ConnectionPanel panel, string label) { if (draggingConnected == wire) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/CustomInterface.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/CustomInterface.cs index e3480c50a..a74b5d3b8 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/CustomInterface.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/CustomInterface.cs @@ -3,7 +3,6 @@ using Lidgren.Network; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; using System.Xml.Linq; @@ -17,22 +16,16 @@ namespace Barotrauma.Items.Components { uiElements.Clear(); - var visibleElements = customInterfaceElementList.Where(ciElement => !string.IsNullOrEmpty(ciElement.Label)); - GUILayoutGroup paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.8f), GuiFrame.RectTransform, Anchor.Center), childAnchor: customInterfaceElementList.Count > 1 ? Anchor.TopCenter : Anchor.Center) - { - RelativeSpacing = 0.05f, - Stretch = visibleElements.Count() > 2 - }; + { RelativeSpacing = 0.05f }; - float elementSize = Math.Min(1.0f / visibleElements.Count(), 0.5f); - foreach (CustomInterfaceElement ciElement in visibleElements) + float elementSize = Math.Min(1.0f / customInterfaceElementList.Count, 0.5f); + foreach (CustomInterfaceElement ciElement in customInterfaceElementList) { if (ciElement.ContinuousSignal) { - var tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform), - TextManager.Get(ciElement.Label, returnNull: true) ?? ciElement.Label) + var tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform), ciElement.Label) { UserData = ciElement }; @@ -52,8 +45,7 @@ namespace Barotrauma.Items.Components } else { - var btn = new GUIButton(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform), - TextManager.Get(ciElement.Label, returnNull: true) ?? ciElement.Label, style: "GUIButtonLarge") + var btn = new GUIButton(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform), ciElement.Label, style: "GUIButtonLarge") { UserData = ciElement }; @@ -74,54 +66,17 @@ namespace Barotrauma.Items.Components } } - public override void CreateEditingHUD(SerializableEntityEditor editor) - { - base.CreateEditingHUD(editor); - - PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(customInterfaceElementList[0]); - PropertyDescriptor labelProperty = properties.Find("Label", false); - PropertyDescriptor signalProperty = properties.Find("Signal", false); - for (int i = 0; i< customInterfaceElementList.Count; i++) - { - editor.CreateStringField(customInterfaceElementList[i], - new SerializableProperty(labelProperty, customInterfaceElementList[i]), - customInterfaceElementList[i].Label, "Label #" + (i + 1), ""); - editor.CreateStringField(customInterfaceElementList[i], - new SerializableProperty(signalProperty, customInterfaceElementList[i]), - customInterfaceElementList[i].Signal, "Signal #" + (i + 1), ""); - } - } - - public void HighlightElement(int index, Color color, float duration, float pulsateAmount = 0.0f) - { - if (index < 0 || index >= uiElements.Count) { return; } - uiElements[index].Flash(color, duration); - - if (pulsateAmount > 0.0f) - { - if (uiElements[index] is GUIButton button) - { - button.Frame.Pulsate(Vector2.One, Vector2.One * (1.0f + pulsateAmount), duration); - button.Frame.RectTransform.SetPosition(Anchor.Center); - } - else - { - uiElements[index].Pulsate(Vector2.One, Vector2.One * (1.0f + pulsateAmount), duration); - } - } - } - partial void UpdateLabelsProjSpecific() { for (int i = 0; i < labels.Length && i < uiElements.Count; i++) { if (uiElements[i] is GUIButton button) { - button.Text = customInterfaceElementList[i].Label; + button.Text = labels[i]; } else if (uiElements[i] is GUITickBox tickBox) { - tickBox.Text = customInterfaceElementList[i].Label; + tickBox.Text = labels[i]; } } } diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Wire.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Wire.cs index 61d5bcc62..0927e57ef 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Wire.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/Wire.cs @@ -271,11 +271,19 @@ namespace Barotrauma.Items.Components } } } - } + } if (highlighted != null) { highlighted.item.IsHighlighted = true; + + if (Character.Controlled != null) + { + Character.Controlled.FocusedItem = null; + Character.Controlled.ResetInteract = true; + Character.Controlled.ClearInputs(); + } + if (PlayerInput.LeftButtonClicked()) { MapEntity.DisableSelect = true; diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs index b79bcda92..2e5a6dd04 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs @@ -150,14 +150,14 @@ namespace Barotrauma.Items.Components { if (moveSoundChannel == null && startMoveSound != null) { - moveSoundChannel = SoundPlayer.PlaySound(startMoveSound.Sound, item.WorldPosition, startMoveSound.Volume, startMoveSound.Range); + moveSoundChannel = SoundPlayer.PlaySound(startMoveSound.Sound, startMoveSound.Volume, startMoveSound.Range, item.WorldPosition); } else if (moveSoundChannel == null || !moveSoundChannel.IsPlaying) { if (moveSound != null) { moveSoundChannel.FadeOutAndDispose(); - moveSoundChannel = SoundPlayer.PlaySound(moveSound.Sound, item.WorldPosition, moveSound.Volume, moveSound.Range); + moveSoundChannel = SoundPlayer.PlaySound(moveSound.Sound, moveSound.Volume, moveSound.Range, item.WorldPosition); if (moveSoundChannel != null) moveSoundChannel.Looping = true; } } @@ -169,7 +169,7 @@ namespace Barotrauma.Items.Components if (endMoveSound != null && moveSoundChannel.Sound != endMoveSound.Sound) { moveSoundChannel.FadeOutAndDispose(); - moveSoundChannel = SoundPlayer.PlaySound(endMoveSound.Sound, item.WorldPosition, endMoveSound.Volume, endMoveSound.Range); + moveSoundChannel = SoundPlayer.PlaySound(endMoveSound.Sound, endMoveSound.Volume, endMoveSound.Range, item.WorldPosition); if (moveSoundChannel != null) moveSoundChannel.Looping = false; } else if (!moveSoundChannel.IsPlaying) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs index e3c4ea985..9f6de7fde 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs @@ -26,7 +26,6 @@ namespace Barotrauma public Color Color; public Color HighlightColor; - public float HighlightScaleUpAmount; private CoroutineHandle highlightCoroutine; public float HighlightTimer; @@ -81,7 +80,7 @@ namespace Barotrauma return rect.Contains(PlayerInput.MousePosition); } - public void ShowBorderHighlight(Color color, float fadeInDuration, float fadeOutDuration, float scaleUpAmount = 0.5f) + public void ShowBorderHighlight(Color color, float fadeInDuration, float fadeOutDuration) { if (highlightCoroutine != null) { @@ -89,7 +88,6 @@ namespace Barotrauma highlightCoroutine = null; } - HighlightScaleUpAmount = scaleUpAmount; highlightCoroutine = CoroutineManager.StartCoroutine(UpdateBorderHighlight(color, fadeInDuration, fadeOutDuration)); } @@ -156,6 +154,8 @@ namespace Barotrauma public SlotReference(Inventory parentInventory, InventorySlot slot, int slotIndex, bool isSubSlot, Inventory subInventory = null) { + + ParentInventory = parentInventory; Slot = slot; SlotIndex = slotIndex; @@ -714,15 +714,12 @@ namespace Barotrauma float scale = Math.Min(Math.Min(iconSize / sprite.size.X, iconSize / sprite.size.Y), 1.5f); Vector2 itemPos = PlayerInput.MousePosition; - bool mouseOnHealthInterface = CharacterHealth.OpenHealthWindow != null && CharacterHealth.OpenHealthWindow.MouseOnElement; - - if ((GUI.MouseOn == null || mouseOnHealthInterface) && selectedSlot == null) + if (GUI.MouseOn == null && selectedSlot == null) { var shadowSprite = GUI.Style.GetComponentStyle("OuterGlow").Sprites[GUIComponent.ComponentState.None][0]; - string toolTip = mouseOnHealthInterface ? TextManager.Get("QuickUseAction.UseTreatment") : - Character.Controlled.FocusedItem != null ? - TextManager.Get("PutItemIn").Replace("[itemname]", Character.Controlled.FocusedItem.Name) : - TextManager.Get("DropItem"); + string toolTip = Character.Controlled.FocusedItem != null ? + TextManager.Get("PutItemIn").Replace("[itemname]", Character.Controlled.FocusedItem.Name) : + TextManager.Get("DropItem"); int textWidth = (int)Math.Max(GUI.Font.MeasureString(draggingItem.Name).X, GUI.SmallFont.MeasureString(toolTip).X); int textSpacing = (int)(15 * GUI.Scale); Point shadowBorders = (new Point(40, 10)).Multiply(GUI.Scale); @@ -730,7 +727,7 @@ namespace Barotrauma new Rectangle(itemPos.ToPoint() - new Point(iconSize / 2) - shadowBorders, new Point(iconSize + textWidth + textSpacing, iconSize) + shadowBorders.Multiply(2)), Color.Black * 0.8f); GUI.DrawString(spriteBatch, new Vector2(itemPos.X + iconSize / 2 + textSpacing, itemPos.Y - iconSize / 2), draggingItem.Name, Color.White); GUI.DrawString(spriteBatch, new Vector2(itemPos.X + iconSize / 2 + textSpacing, itemPos.Y), toolTip, - color: Character.Controlled.FocusedItem == null && !mouseOnHealthInterface ? Color.Red : Color.LightGreen, + color: Character.Controlled.FocusedItem == null ? Color.Red : Color.LightGreen, font: GUI.SmallFont); } sprite.Draw(spriteBatch, itemPos + Vector2.One * 2, Color.Black, scale: scale); @@ -802,7 +799,8 @@ namespace Barotrauma if (slot.HighlightColor.A > 0) { - float inflateAmount = (slot.HighlightColor.A / 255.0f) * slot.HighlightScaleUpAmount * 0.5f; + float scaleUpAmount = 0.5f; + float inflateAmount = (slot.HighlightColor.A / 255.0f) * scaleUpAmount * 0.5f; rect.Inflate(rect.Width * inflateAmount, rect.Height * inflateAmount); } @@ -820,9 +818,8 @@ namespace Barotrauma else { Sprite slotSprite = slot.SlotSprite ?? slotSpriteSmall; - Color slotColor = slot.IsHighlighted ? Color.White : Color.White * 0.8f; - if (inventory != null && inventory.Locked) { slotColor = Color.Gray * 0.5f; } - spriteBatch.Draw(slotSprite.Texture, rect, slotSprite.SourceRect, slotColor); + + spriteBatch.Draw(slotSprite.Texture, rect, slotSprite.SourceRect, slot.IsHighlighted ? Color.White : Color.White * 0.8f); if (item != null && drawItem) { @@ -856,7 +853,7 @@ namespace Barotrauma if (itemContainer.ContainedStateIndicator?.Texture == null) { containedIndicatorArea.Inflate(0, -2); - GUI.DrawRectangle(spriteBatch, containedIndicatorArea, Color.DarkGray * 0.9f, true); + GUI.DrawRectangle(spriteBatch, containedIndicatorArea, Color.DarkGray * 0.8f, true); GUI.DrawRectangle(spriteBatch, new Rectangle(containedIndicatorArea.X, containedIndicatorArea.Y, (int)(containedIndicatorArea.Width * containedState), containedIndicatorArea.Height), Color.Lerp(Color.Red, Color.Green, containedState) * 0.8f, true); @@ -870,21 +867,18 @@ namespace Barotrauma if (containedState > 0.0f && containedState < 0.25f) { - indicatorScale += ((float)Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) * 0.25f; + indicatorScale += ((float)Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) * 0.1f; } indicatorSprite.Draw(spriteBatch, containedIndicatorArea.Center.ToVector2(), - (inventory != null && inventory.Locked) ? Color.DarkGray * 0.5f : Color.DarkGray * 0.9f, + Color.DarkGray * 0.6f, origin: indicatorSprite.size / 2, rotate: 0.0f, scale: indicatorScale); - - Color indicatorColor = ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.Green); - if (inventory != null && inventory.Locked) { indicatorColor *= 0.5f; } - + spriteBatch.Draw(indicatorSprite.Texture, containedIndicatorArea.Center.ToVector2(), sourceRectangle: new Rectangle(indicatorSprite.SourceRect.Location, new Point((int)(indicatorSprite.SourceRect.Width * containedState), indicatorSprite.SourceRect.Height)), - color: indicatorColor, + color: ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.Green), rotation: 0.0f, origin: indicatorSprite.size / 2, scale: indicatorScale, @@ -924,7 +918,6 @@ namespace Barotrauma } Color spriteColor = sprite == item.Sprite ? item.GetSpriteColor() : item.GetInventoryIconColor(); - if (inventory != null && inventory.Locked) { spriteColor *= 0.5f; } if (CharacterHealth.OpenHealthWindow != null && !item.UseInHealthInterface) { spriteColor = Color.Lerp(spriteColor, Color.TransparentBlack, 0.5f); @@ -936,10 +929,7 @@ namespace Barotrauma sprite.Draw(spriteBatch, itemPos, spriteColor, rotation, scale); } - if (inventory != null && - !inventory.Locked && - Character.Controlled?.Inventory == inventory && - slot.QuickUseKey != Keys.None) + if (inventory != null && Character.Controlled?.Inventory == inventory && slot.QuickUseKey != Keys.None) { GUI.DrawString(spriteBatch, rect.Location.ToVector2(), slot.QuickUseKey.ToString().Substring(1, 1), diff --git a/Barotrauma/BarotraumaClient/Source/Items/Item.cs b/Barotrauma/BarotraumaClient/Source/Items/Item.cs index a155700b2..6a8918041 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Item.cs @@ -41,6 +41,8 @@ namespace Barotrauma { get { return activeSprite; } } + + public float SpriteRotation; private GUITextBlock itemInUseWarning; private GUITextBlock ItemInUseWarning @@ -184,7 +186,7 @@ namespace Barotrauma if (!Visible || (!editing && hiddenInGame)) return; if (editing && !ShowItems) return; - Color color = IsHighlighted && !GUI.DisableItemHighlights && Screen.Selected != GameMain.GameScreen ? Color.Orange : GetSpriteColor(); + Color color = isHighlighted && !GUI.DisableItemHighlights && Screen.Selected != GameMain.GameScreen ? Color.Orange : GetSpriteColor(); //if (IsSelected && editing) color = Color.Lerp(color, Color.Gold, 0.5f); BrokenItemSprite fadeInBrokenSprite = null; @@ -384,7 +386,7 @@ namespace Barotrauma Timing.TotalTime > LastImpactSoundTime + ImpactSoundInterval) { LastImpactSoundTime = (float)Timing.TotalTime; - SoundPlayer.PlaySound(Prefab.ImpactSoundTag, WorldPosition, hullGuess: CurrentHull); + SoundPlayer.PlaySound(Prefab.ImpactSoundTag, 1.0f, 500.0f, WorldPosition, CurrentHull); } } @@ -562,7 +564,6 @@ namespace Barotrauma } }; itemEditor.AddCustomContent(buttonContainer, itemEditor.ContentCount); - GUITextBlock.AutoScaleAndNormalize(buttonContainer.Children.Select(b => ((GUIButton)b).TextBlock)); } foreach (ItemComponent ic in components) @@ -578,13 +579,8 @@ namespace Barotrauma } var componentEditor = new SerializableEntityEditor(listBox.Content.RectTransform, ic, inGame, showName: !inGame); - - if (inGame) - { - ic.CreateEditingHUD(componentEditor); - componentEditor.Recalculate(); - continue; - } + + if (inGame) continue; foreach (var kvp in ic.requiredItems) { @@ -618,10 +614,6 @@ namespace Barotrauma } } - ic.CreateEditingHUD(componentEditor); - componentEditor.Recalculate(); - } - PositionEditingHUD(); SetHUDLayout(); @@ -838,28 +830,14 @@ namespace Barotrauma case NetEntityEvent.Type.ComponentState: { int componentIndex = msg.ReadRangedInteger(0, components.Count - 1); - if (components[componentIndex] is IServerSerializable serverSerializable) - { - serverSerializable.ClientRead(type, msg, sendingTime); - } - else - { - throw new Exception("Failed to read component state - " + components[componentIndex].GetType() + " is not IServerSerializable."); - } + (components[componentIndex] as IServerSerializable).ClientRead(type, msg, sendingTime); } break; - + case NetEntityEvent.Type.InventoryState: - { + { int containerIndex = msg.ReadRangedInteger(0, components.Count - 1); - if (components[containerIndex] is ItemContainer container) - { - container.Inventory.ClientRead(type, msg, sendingTime); - } - else - { - throw new Exception("Failed to read inventory state - " + components[containerIndex].GetType() + " is not an ItemContainer."); - } + (components[containerIndex] as ItemContainer).Inventory.ClientRead(type, msg, sendingTime); } break; case NetEntityEvent.Type.Status: diff --git a/Barotrauma/BarotraumaClient/Source/Items/ItemPrefab.cs b/Barotrauma/BarotraumaClient/Source/Items/ItemPrefab.cs index d57d32a62..76a9c235f 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/ItemPrefab.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/ItemPrefab.cs @@ -233,11 +233,11 @@ namespace Barotrauma } } - public override void DrawPlacing(SpriteBatch spriteBatch, Rectangle placeRect, float scale = 1.0f, SpriteEffects spriteEffects = SpriteEffects.None) + public override void DrawPlacing(SpriteBatch spriteBatch, Rectangle placeRect, float scale = 1.0f) { if (!ResizeHorizontal && !ResizeVertical) { - sprite.Draw(spriteBatch, new Vector2(placeRect.Center.X, -(placeRect.Y - placeRect.Height / 2)), SpriteColor * 0.8f, scale: scale); + sprite.Draw(spriteBatch, new Vector2(placeRect.Center.X, -(placeRect.Y - placeRect.Height / 2)), SpriteColor * 0.8f, scale: Scale * scale); } else { diff --git a/Barotrauma/BarotraumaClient/Source/Map/Hull.cs b/Barotrauma/BarotraumaClient/Source/Map/Hull.cs index 252662461..6f5fad842 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Hull.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Hull.cs @@ -326,6 +326,33 @@ namespace Barotrauma Color.Green, width: 2); } } + + foreach (MapEntity e in linkedTo) + { + if (e is Hull) + { + Hull linkedHull = (Hull)e; + Rectangle connectedHullRect = e.Submarine == null ? + linkedHull.rect : + new Rectangle( + (int)(Submarine.DrawPosition.X + linkedHull.WorldPosition.X), + (int)(Submarine.DrawPosition.Y + linkedHull.WorldPosition.Y), + linkedHull.WorldRect.Width, linkedHull.WorldRect.Height); + + //center of the hull + Rectangle currentHullRect = Submarine == null ? + WorldRect : + new Rectangle( + (int)(Submarine.DrawPosition.X + WorldPosition.X), + (int)(Submarine.DrawPosition.Y + WorldPosition.Y), + WorldRect.Width, WorldRect.Height); + + GUI.DrawLine(spriteBatch, + new Vector2(currentHullRect.X, -currentHullRect.Y), + new Vector2(connectedHullRect.X, -connectedHullRect.Y), + Color.Green, width: 2); + } + } } public static void UpdateVertices(GraphicsDevice graphicsDevice, Camera cam, WaterRenderer renderer) diff --git a/Barotrauma/BarotraumaClient/Source/Map/ItemAssemblyPrefab.cs b/Barotrauma/BarotraumaClient/Source/Map/ItemAssemblyPrefab.cs index 02184babd..7c8bfc1e6 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/ItemAssemblyPrefab.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/ItemAssemblyPrefab.cs @@ -22,7 +22,7 @@ namespace Barotrauma drawRect = new Rectangle( (int)(drawRect.X * scale) + drawArea.Center.X, -((int)((drawRect.Y - drawRect.Height) * scale) + drawArea.Center.Y), (int)(drawRect.Width * scale), (int)(drawRect.Height * scale)); - entity.First.DrawPlacing(spriteBatch, drawRect, entity.First.Scale * scale); + entity.First.DrawPlacing(spriteBatch, drawRect, scale); } } @@ -34,7 +34,7 @@ namespace Barotrauma { Rectangle drawRect = entity.Second; drawRect.Location += Submarine.MouseToWorldGrid(cam, Submarine.MainSub).ToPoint(); - entity.First.DrawPlacing(spriteBatch, drawRect, entity.First.Scale); + entity.First.DrawPlacing(spriteBatch, drawRect); } } diff --git a/Barotrauma/BarotraumaClient/Source/Map/Levels/Level.cs b/Barotrauma/BarotraumaClient/Source/Map/Levels/Level.cs index 4f94c4362..0b4f41505 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Levels/Level.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Levels/Level.cs @@ -105,7 +105,7 @@ namespace Barotrauma if (Vector2.DistanceSquared(bodyPos, levelWall.Body.Position) > 0.5f) { - levelWall.Body.SetTransformIgnoreContacts(ref bodyPos, levelWall.Body.Rotation); + levelWall.Body.SetTransform(bodyPos, levelWall.Body.Rotation); } } } diff --git a/Barotrauma/BarotraumaClient/Source/Map/Map/Map.cs b/Barotrauma/BarotraumaClient/Source/Map/Map/Map.cs index b72b49029..4abd51d76 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Map/Map.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Map/Map.cs @@ -255,9 +255,9 @@ namespace Barotrauma Duration = CurrentLocation == location ? 1.0f : 2.0f, StartDelay = 1.0f }; - if (change.Messages != null && change.Messages.Count > 0) + if (change.Messages.Count > 0) { - mapAnim.EndMessage = change.Messages[Rand.Range(0, change.Messages.Count)] + mapAnim.EndMessage = change.Messages[Rand.Range(0,change.Messages.Count)] .Replace("[previousname]", prevName) .Replace("[name]", location.Name); } @@ -380,10 +380,7 @@ namespace Barotrauma zoom += PlayerInput.ScrollWheelSpeed / 1000.0f; zoom = MathHelper.Clamp(zoom, 1.0f, 4.0f); - if (PlayerInput.MidButtonHeld() || (highlightedLocation == null && PlayerInput.LeftButtonHeld())) - { - drawOffset += PlayerInput.MouseSpeed / zoom; - } + if (PlayerInput.MidButtonHeld()) { drawOffset += PlayerInput.MouseSpeed / zoom; } #if DEBUG if (PlayerInput.DoubleClicked() && highlightedLocation != null) { @@ -624,9 +621,7 @@ namespace Barotrauma if (mouseOn && PlayerInput.LeftButtonClicked() && !messageBoxOpen) { - //TODO: translate or replace var messageBox = new GUIMessageBox("Mysteries lie ahead...", "This area is unreachable in this version of Barotrauma. Please wait for future updates!"); - messageBoxOpen = true; CoroutineManager.StartCoroutine(WaitForMessageBoxClosed(messageBox)); } } diff --git a/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs b/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs index cfa1a5486..a49b60add 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs @@ -504,19 +504,8 @@ namespace Barotrauma { foreach (MapEntity e in selectedList) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (e is Item item) - { - if (item.FlippedX && item.Prefab.CanSpriteFlipX) spriteEffects ^= SpriteEffects.FlipHorizontally; - if (item.flippedY && item.Prefab.CanSpriteFlipY) spriteEffects ^= SpriteEffects.FlipVertically; - } - else if (e is Structure structure) - { - if (structure.FlippedX && structure.Prefab.CanSpriteFlipX) spriteEffects ^= SpriteEffects.FlipHorizontally; - if (structure.flippedY && structure.Prefab.CanSpriteFlipY) spriteEffects ^= SpriteEffects.FlipVertically; - } e.prefab?.DrawPlacing(spriteBatch, - new Rectangle(e.WorldRect.Location + new Point((int)moveAmount.X, (int)-moveAmount.Y), e.WorldRect.Size), e.Scale, spriteEffects); + new Rectangle(e.WorldRect.Location + new Point((int)moveAmount.X, (int)-moveAmount.Y), e.WorldRect.Size)); GUI.DrawRectangle(spriteBatch, new Vector2(e.WorldRect.X, -e.WorldRect.Y) + moveAmount, new Vector2(e.rect.Width, e.rect.Height), diff --git a/Barotrauma/BarotraumaClient/Source/Map/MapEntityPrefab.cs b/Barotrauma/BarotraumaClient/Source/Map/MapEntityPrefab.cs index 97786e794..2d2a03e2b 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/MapEntityPrefab.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/MapEntityPrefab.cs @@ -37,7 +37,7 @@ namespace Barotrauma } } - public virtual void DrawPlacing(SpriteBatch spriteBatch, Rectangle drawRect, float scale = 1.0f, SpriteEffects spriteEffects = SpriteEffects.None) + public virtual void DrawPlacing(SpriteBatch spriteBatch, Rectangle drawRect, float scale = 1.0f) { if (Submarine.MainSub != null) { diff --git a/Barotrauma/BarotraumaClient/Source/Map/Structure.cs b/Barotrauma/BarotraumaClient/Source/Map/Structure.cs index 99b7bbedd..3bf4ae5f1 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Structure.cs @@ -1,9 +1,6 @@ using Barotrauma.Extensions; using Barotrauma.Lights; using Barotrauma.Networking; -using FarseerPhysics; -using FarseerPhysics.Dynamics; -using FarseerPhysics.Dynamics.Contacts; using Lidgren.Network; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -46,14 +43,6 @@ namespace Barotrauma } } - private string specialTag; - [Editable, Serialize("", true)] - public string SpecialTag - { - get { return specialTag; } - set { specialTag = value; } - } - // Only for testing in the debug build. Not saved. #if DEBUG [Editable, Serialize(true, false)] @@ -113,7 +102,7 @@ namespace Barotrauma editingHUD = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.25f), GUI.Canvas, Anchor.CenterRight) { MinSize = new Point(400, 0) }) { UserData = this }; GUIListBox listBox = new GUIListBox(new RectTransform(new Vector2(0.95f, 0.8f), editingHUD.RectTransform, Anchor.Center), style: null); var editor = new SerializableEntityEditor(listBox.Content.RectTransform, this, inGame, showName: true, elementHeight: 20); - + var buttonContainer = new GUILayoutGroup(new RectTransform(new Point(listBox.Content.Rect.Width, 20)), isHorizontal: true) { Stretch = true, @@ -168,20 +157,6 @@ namespace Barotrauma { Vector2 pos = ConvertUnits.ToDisplayUnits(f2.Body.Position); - int section = FindSectionIndex(pos); - if (section > -1) - { - Vector2 normal = contact.Manifold.LocalNormal; - - float impact = Vector2.Dot(f2.Body.LinearVelocity, -normal) * f2.Body.Mass * 0.1f; - if (impact > 10.0f) - { - SoundPlayer.PlayDamageSound("StructureBlunt", impact, SectionPosition(section, true), tags: Tags); - } - } - } - } - public override bool IsVisible(Rectangle worldView) { Rectangle worldRect = WorldRect; @@ -218,7 +193,7 @@ namespace Barotrauma if (HasBody && !ShowWalls) return; } - Color color = IsHighlighted ? Color.Orange : spriteColor; + Color color = isHighlighted ? Color.Orange : spriteColor; if (IsSelected && editing) { //color = Color.Lerp(color, Color.Gold, 0.5f); @@ -266,35 +241,62 @@ namespace Barotrauma } dropShadowOffset.Y = -dropShadowOffset.Y; } - - SpriteEffects oldEffects = Prefab.BackgroundSprite.effects; - Prefab.BackgroundSprite.effects ^= SpriteEffects; - Point backGroundOffset = new Point( - MathUtils.PositiveModulo((int)-textureOffset.X, Prefab.BackgroundSprite.SourceRect.Width), - MathUtils.PositiveModulo((int)-textureOffset.Y, Prefab.BackgroundSprite.SourceRect.Height)); - - Prefab.BackgroundSprite.DrawTiled( - spriteBatch, - new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)), - new Vector2(rect.Width, rect.Height), - color: color, - textureScale: TextureScale * Scale, - startOffset: backGroundOffset); - - if (UseDropShadow) + if (DrawTiled) { + SpriteEffects oldEffects = Prefab.BackgroundSprite.effects; + Prefab.BackgroundSprite.effects ^= SpriteEffects; + + Point backGroundOffset = new Point( + MathUtils.PositiveModulo((int)-textureOffset.X, Prefab.BackgroundSprite.SourceRect.Width), + MathUtils.PositiveModulo((int)-textureOffset.Y, Prefab.BackgroundSprite.SourceRect.Height)); + Prefab.BackgroundSprite.DrawTiled( spriteBatch, - new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)) + dropShadowOffset, + new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)), new Vector2(rect.Width, rect.Height), - color: Color.Black * 0.5f, + color: color, textureScale: TextureScale * Scale, - startOffset: backGroundOffset, - depth: (depth + Prefab.BackgroundSprite.Depth) / 2.0f); - } + startOffset: backGroundOffset); - Prefab.BackgroundSprite.effects = oldEffects; + if (UseDropShadow) + { + Prefab.BackgroundSprite.DrawTiled( + spriteBatch, + new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)) + dropShadowOffset, + new Vector2(rect.Width, rect.Height), + color: Color.Black * 0.5f, + textureScale: TextureScale * Scale, + startOffset: backGroundOffset, + depth: (depth + Prefab.BackgroundSprite.Depth) / 2.0f); + } + + Prefab.BackgroundSprite.effects = oldEffects; + } + else + { + Prefab.BackgroundSprite.Draw( + spriteBatch, + new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)), + color, + Vector2.Zero, + scale: Scale, + rotate: 0, + spriteEffect: SpriteEffects); + + if (UseDropShadow) + { + Prefab.BackgroundSprite.Draw( + spriteBatch, + new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)) + dropShadowOffset, + Color.Black * 0.5f, + Vector2.Zero, + scale: Scale, + rotate: 0, + spriteEffect: SpriteEffects, + depth: (depth + Prefab.BackgroundSprite.Depth) / 2.0f); + } + } } } @@ -321,25 +323,39 @@ namespace Barotrauma Submarine.DamageEffectColor = color; } } - - Point sectionOffset = new Point( - Math.Abs(rect.Location.X - Sections[i].rect.Location.X), - Math.Abs(rect.Location.Y - Sections[i].rect.Location.Y)); - if (FlippedX && IsHorizontal) sectionOffset.X = Sections[i].rect.Right - rect.Right; - if (FlippedY && !IsHorizontal) sectionOffset.Y = (rect.Y - rect.Height) - (Sections[i].rect.Y - Sections[i].rect.Height); + if (DrawTiled) + { + Point sectionOffset = new Point( + Math.Abs(rect.Location.X - Sections[i].rect.Location.X), + Math.Abs(rect.Location.Y - Sections[i].rect.Location.Y)); - sectionOffset.X += MathUtils.PositiveModulo((int)-textureOffset.X, prefab.sprite.SourceRect.Width); - sectionOffset.Y += MathUtils.PositiveModulo((int)-textureOffset.Y, prefab.sprite.SourceRect.Height); + if (FlippedX && IsHorizontal) sectionOffset.X = Sections[i].rect.Right - rect.Right; + if (FlippedY && !IsHorizontal) sectionOffset.Y = (rect.Y - rect.Height) - (Sections[i].rect.Y - Sections[i].rect.Height); - prefab.sprite.DrawTiled( - spriteBatch, - new Vector2(Sections[i].rect.X + drawOffset.X, -(Sections[i].rect.Y + drawOffset.Y)), - new Vector2(Sections[i].rect.Width, Sections[i].rect.Height), - color: color, - startOffset: sectionOffset, - depth: depth, - textureScale: TextureScale * Scale); + sectionOffset.X += MathUtils.PositiveModulo((int)-textureOffset.X, prefab.sprite.SourceRect.Width); + sectionOffset.Y += MathUtils.PositiveModulo((int)-textureOffset.Y, prefab.sprite.SourceRect.Height); + + prefab.sprite.DrawTiled( + spriteBatch, + new Vector2(Sections[i].rect.X + drawOffset.X, -(Sections[i].rect.Y + drawOffset.Y)), + new Vector2(Sections[i].rect.Width, Sections[i].rect.Height), + color: color, + startOffset: sectionOffset, + depth: depth, + textureScale: TextureScale * Scale); + } + else + { + prefab.sprite.Draw( + spriteBatch, + new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)), + color, + Vector2.Zero, + scale: Scale, + rotate: 0, + spriteEffect: SpriteEffects); + } } prefab.sprite.effects = oldEffects; } @@ -360,20 +376,6 @@ namespace Barotrauma -Bodies[i].Rotation, Color.White); } } - - if (SectionCount > 0 && HasBody) - { - for (int i = 0; i < SectionCount; i++) - { - if (GetSection(i).damage > 0) - { - var textPos = SectionPosition(i, true); - textPos.Y = -textPos.Y; - GUI.DrawString(spriteBatch, textPos, "Damage: " + (int)((GetSection(i).damage / Health) * 100f) + "%", Color.Yellow); - } - } - } - AiTarget?.Draw(spriteBatch); } } diff --git a/Barotrauma/BarotraumaClient/Source/Map/StructurePrefab.cs b/Barotrauma/BarotraumaClient/Source/Map/StructurePrefab.cs index 36ba5a87c..4863ea754 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/StructurePrefab.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/StructurePrefab.cs @@ -32,19 +32,10 @@ namespace Barotrauma GUI.DrawRectangle(spriteBatch, new Rectangle(newRect.X, -newRect.Y - GameMain.GraphicsHeight, newRect.Width, newRect.Height + GameMain.GraphicsHeight * 2), Color.White); } - public override void DrawPlacing(SpriteBatch spriteBatch, Rectangle placeRect, float scale = 1.0f, SpriteEffects spriteEffects = SpriteEffects.None) + public override void DrawPlacing(SpriteBatch spriteBatch, Rectangle placeRect, float scale = 1.0f) { - SpriteEffects oldEffects = sprite.effects; - sprite.effects ^= spriteEffects; - - sprite.DrawTiled( - spriteBatch, - new Vector2(placeRect.X, -placeRect.Y), - new Vector2(placeRect.Width, placeRect.Height), - color: Color.White * 0.8f, - textureScale: TextureScale * scale); - - sprite.effects = oldEffects; + // TODO: the scale property is not used + sprite.DrawTiled(spriteBatch, new Vector2(placeRect.X, -placeRect.Y), new Vector2(placeRect.Width, placeRect.Height), color: Color.White * 0.8f, textureScale: TextureScale * Scale); } } } diff --git a/Barotrauma/BarotraumaClient/Source/Map/Submarine.cs b/Barotrauma/BarotraumaClient/Source/Map/Submarine.cs index 66c925d4c..bcea54eb8 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Submarine.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Submarine.cs @@ -315,7 +315,7 @@ namespace Barotrauma var dimensionsText = new GUITextBlock(new RectTransform(new Vector2(1, 0), descriptionBox.Content.RectTransform), TextManager.Get("Dimensions"), textAlignment: Alignment.TopLeft, font: GUI.Font, wrap: true) { CanBeFocused = false }; - new GUITextBlock(new RectTransform(new Vector2(0.45f, 0.0f), dimensionsText.RectTransform, Anchor.TopRight), + new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), dimensionsText.RectTransform, Anchor.TopRight), dimensionsStr, textAlignment: Alignment.TopLeft, font: GUI.Font, wrap: true) { CanBeFocused = false }; dimensionsText.RectTransform.MinSize = new Point(0, dimensionsText.Children.First().Rect.Height); @@ -326,7 +326,7 @@ namespace Barotrauma var crewSizeText = new GUITextBlock(new RectTransform(new Vector2(1, 0), descriptionBox.Content.RectTransform), TextManager.Get("RecommendedCrewSize"), textAlignment: Alignment.TopLeft, font: GUI.Font, wrap: true) { CanBeFocused = false }; - new GUITextBlock(new RectTransform(new Vector2(0.45f, 0.0f), crewSizeText.RectTransform, Anchor.TopRight), + new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), crewSizeText.RectTransform, Anchor.TopRight), RecommendedCrewSizeMin + " - " + RecommendedCrewSizeMax, textAlignment: Alignment.TopLeft, font: GUI.Font, wrap: true) { CanBeFocused = false }; crewSizeText.RectTransform.MinSize = new Point(0, crewSizeText.Children.First().Rect.Height); @@ -337,7 +337,7 @@ namespace Barotrauma var crewExperienceText = new GUITextBlock(new RectTransform(new Vector2(1, 0), descriptionBox.Content.RectTransform), TextManager.Get("RecommendedCrewExperience"), textAlignment: Alignment.TopLeft, font: GUI.Font, wrap: true) { CanBeFocused = false }; - new GUITextBlock(new RectTransform(new Vector2(0.45f, 0.0f), crewExperienceText.RectTransform, Anchor.TopRight), + new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), crewExperienceText.RectTransform, Anchor.TopRight), TextManager.Get(RecommendedCrewExperience), textAlignment: Alignment.TopLeft, font: GUI.Font, wrap: true) { CanBeFocused = false }; crewExperienceText.RectTransform.MinSize = new Point(0, crewExperienceText.Children.First().Rect.Height); @@ -348,21 +348,18 @@ namespace Barotrauma var contentPackagesText = new GUITextBlock(new RectTransform(new Vector2(1, 0), descriptionBox.Content.RectTransform), TextManager.Get("RequiredContentPackages"), textAlignment: Alignment.TopLeft, font: GUI.Font) { CanBeFocused = false }; - new GUITextBlock(new RectTransform(new Vector2(0.45f, 0.0f), contentPackagesText.RectTransform, Anchor.TopRight), + new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), contentPackagesText.RectTransform, Anchor.TopRight), string.Join(", ", RequiredContentPackages), textAlignment: Alignment.TopLeft, font: GUI.Font, wrap: true) { CanBeFocused = false }; contentPackagesText.RectTransform.MinSize = new Point(0, contentPackagesText.Children.First().Rect.Height); } - GUITextBlock.AutoScaleAndNormalize(descriptionBox.Content.Children.Where(c => c is GUITextBlock).Cast()); - //space new GUIFrame(new RectTransform(new Vector2(1.0f, 0.05f), descriptionBox.Content.RectTransform), style: null); if (Description.Length != 0) { - new GUITextBlock(new RectTransform(new Vector2(1, 0), descriptionBox.Content.RectTransform), - TextManager.Get("SaveSubDialogDescription", fallBackTag: "WorkshopItemDescription"), font: GUI.Font, wrap: true) { CanBeFocused = false, ForceUpperCase = true }; + new GUITextBlock(new RectTransform(new Vector2(1, 0), descriptionBox.Content.RectTransform), TextManager.Get("SaveSubDialogDescription") + ":", font: GUI.Font, wrap: true) { CanBeFocused = false, ForceUpperCase = true }; } new GUITextBlock(new RectTransform(new Vector2(1, 0), descriptionBox.Content.RectTransform), Description, font: GUI.Font, wrap: true) diff --git a/Barotrauma/BarotraumaClient/Source/Map/SubmarineBody.cs b/Barotrauma/BarotraumaClient/Source/Map/SubmarineBody.cs index 864b9dd92..8c7476ed8 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/SubmarineBody.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/SubmarineBody.cs @@ -42,17 +42,10 @@ namespace Barotrauma bool displace = moveAmount.LengthSquared() > 100.0f * 100.0f; foreach (Submarine sub in subsToMove) { + sub.PhysicsBody.SetTransform(sub.PhysicsBody.SimPosition + ConvertUnits.ToSimUnits(moveAmount), 0.0f); sub.PhysicsBody.LinearVelocity = newVelocity; - if (displace) - { - sub.PhysicsBody.SetTransform(sub.PhysicsBody.SimPosition + ConvertUnits.ToSimUnits(moveAmount), 0.0f); - sub.SubBody.DisplaceCharacters(moveAmount); - } - else - { - sub.PhysicsBody.SetTransformIgnoreContacts(sub.PhysicsBody.SimPosition + ConvertUnits.ToSimUnits(moveAmount), 0.0f); - } + if (displace) sub.SubBody.DisplaceCharacters(moveAmount); } if (closestSub != null && subsToMove.Contains(closestSub)) @@ -62,6 +55,7 @@ namespace Barotrauma if (Character.Controlled != null) Character.Controlled.CursorPosition += moveAmount; } + } } } diff --git a/Barotrauma/BarotraumaClient/Source/Networking/ChatMessage.cs b/Barotrauma/BarotraumaClient/Source/Networking/ChatMessage.cs index 4a560e126..8b80fc766 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/ChatMessage.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/ChatMessage.cs @@ -61,7 +61,7 @@ namespace Barotrauma.Networking { orderOption = order.Options[optionIndex]; } - txt = order.GetChatMessage(targetCharacter?.Name, senderCharacter?.CurrentHull?.DisplayName, givingOrderToSelf: targetCharacter == senderCharacter, orderOption: orderOption); + txt = order.GetChatMessage(targetCharacter?.Name, senderCharacter?.CurrentHull?.RoomName, givingOrderToSelf: targetCharacter == senderCharacter, orderOption: orderOption); if (order.TargetAllCharacters) { diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs index 3cbe63212..fa4a2d3b4 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs @@ -26,7 +26,6 @@ namespace Barotrauma.Networking //TODO: move these to NetLobbyScreen public GUIButton EndRoundButton; public GUITickBox EndVoteTickBox; - private GUIComponent buttonContainer; private NetStats netStats; @@ -130,7 +129,7 @@ namespace Barotrauma.Networking chatBox.OnEnterMessage += EnterChatMessage; chatBox.InputBox.OnTextChanged += TypingChatMessage; - buttonContainer = new GUILayoutGroup(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ButtonAreaTop, inGameHUD.RectTransform), + var buttonContainer = new GUILayoutGroup(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ButtonAreaTop, inGameHUD.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterRight) { AbsoluteSpacing = 5, @@ -631,11 +630,13 @@ namespace Barotrauma.Networking } else { - GameMain.GameSession?.CrewManager?.SetClientSpeaking(myClient); + GameMain.GameSession?.CrewManager?.SetPlayerSpeaking(myClient); } } } + if (gameStarted) SetRadioButtonColor(); + if (ShowNetStats && client?.ServerConnection != null) { netStats.AddValue(NetStats.NetStatType.ReceivedBytes, client.ServerConnection.Statistics.ReceivedBytes); @@ -1079,8 +1080,6 @@ namespace Barotrauma.Networking bool isTraitor = inc.ReadBoolean(); string traitorTargetName = isTraitor ? inc.ReadString() : null; - bool allowRagdollButton = inc.ReadBoolean(); - serverSettings.ReadMonsterEnabled(inc); GameModePreset gameMode = GameModePreset.List.Find(gm => gm.Identifier == modeIdentifier); @@ -1097,7 +1096,6 @@ namespace Barotrauma.Networking GameMain.LightManager.LosMode = (LosMode)losMode; serverSettings.AllowDisguises = disguisesAllowed; - serverSettings.AllowRagdollButton = allowRagdollButton; if (campaign == null) { @@ -2126,7 +2124,9 @@ namespace Barotrauma.Networking protected GUIFrame inGameHUD; protected ChatBox chatBox; public GUIButton ShowLogButton; //TODO: move to NetLobbyScreen - + + private float myCharacterFrameOpenState; + public GUIFrame InGameHUD { get { return inGameHUD; } @@ -2136,7 +2136,22 @@ namespace Barotrauma.Networking { get { return chatBox; } } - + + protected void SetRadioButtonColor() + { + if (Character.Controlled == null || Character.Controlled.SpeechImpediment >= 100.0f) + { + chatBox.RadioButton.GetChild().Color = new Color(60, 60, 60, 255); + } + else + { + var radioItem = Character.Controlled?.Inventory?.Items.FirstOrDefault(i => i?.GetComponent() != null); + chatBox.RadioButton.GetChild().Color = + (radioItem != null && Character.Controlled.HasEquippedItem(radioItem) && radioItem.GetComponent().CanTransmit()) ? + Color.White : new Color(60, 60, 60, 255); + } + } + public bool TypingChatMessage(GUITextBox textBox, string text) { return chatBox.TypingChatMessage(textBox, text); @@ -2168,6 +2183,11 @@ namespace Barotrauma.Networking Screen.Selected == GameMain.GameScreen) { inGameHUD.AddToGUIUpdateList(); + + if (Character.Controlled == null) + { + GameMain.NetLobbyScreen.MyCharacterFrame.AddToGUIUpdateList(); + } } } @@ -2186,17 +2206,24 @@ namespace Barotrauma.Networking if (gameStarted && Screen.Selected == GameMain.GameScreen) { - bool disableButtons = - Character.Controlled != null && - Character.Controlled.SelectedConstruction?.GetComponent() != null; - buttonContainer.Visible = !disableButtons; - if (!GUI.DisableHUD && !GUI.DisableUpperHUD) { inGameHUD.UpdateManually(deltaTime); chatBox.Update(deltaTime); cameraFollowsSub.Visible = Character.Controlled == null; + + if (Character.Controlled == null) + { + myCharacterFrameOpenState = GameMain.NetLobbyScreen.MyCharacterFrameOpen ? myCharacterFrameOpenState + deltaTime * 5 : myCharacterFrameOpenState - deltaTime * 5; + myCharacterFrameOpenState = MathHelper.Clamp(myCharacterFrameOpenState, 0.0f, 1.0f); + + var myCharFrame = GameMain.NetLobbyScreen.MyCharacterFrame; + int padding = GameMain.GraphicsWidth - myCharFrame.Parent.Rect.Right; + + myCharFrame.RectTransform.AbsoluteOffset = + Vector2.SmoothStep(new Vector2(-myCharFrame.Rect.Width - padding, 0.0f), new Vector2(-padding, 0), myCharacterFrameOpenState).ToPoint(); + } } if (Character.Controlled == null || Character.Controlled.IsDead) { diff --git a/Barotrauma/BarotraumaClient/Source/Networking/ServerInfo.cs b/Barotrauma/BarotraumaClient/Source/Networking/ServerInfo.cs index 47d7e552f..034fd96bc 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/ServerInfo.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/ServerInfo.cs @@ -25,7 +25,6 @@ namespace Barotrauma.Networking public SelectionMode? ModeSelectionMode; public SelectionMode? SubSelectionMode; public bool? AllowSpectating; - public bool? VoipEnabled; public bool? AllowRespawn; public YesNoMaybe? TraitorsEnabled; public string GameMode; @@ -151,14 +150,11 @@ namespace Barotrauma.Networking else allowRespawn.Selected = AllowRespawn.Value; - var voipEnabledTickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("serversettingsvoicechatenabled")) + /*new GUITickBox(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListHasPassword")) { + Selected = HasPassword, CanBeFocused = false - }; - if (!VoipEnabled.HasValue) - new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), voipEnabledTickBox.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center); - else - voipEnabledTickBox.Selected = VoipEnabled.Value; + };*/ var usingWhiteList = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListUsingWhitelist")) { diff --git a/Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs b/Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs index e636ac341..85e008a65 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs @@ -24,8 +24,8 @@ namespace Barotrauma.Networking return true; }; - GUIFrame innerFrame = new GUIFrame(new RectTransform(new Vector2(0.5f, 0.5f), LogFrame.RectTransform, Anchor.Center) { MinSize = new Point(700, 500) }); - GUIFrame paddedFrame = new GUIFrame(new RectTransform(new Vector2(0.95f, 0.85f), innerFrame.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, -0.03f) }, style: null); + GUIFrame innerFrame = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.4f), LogFrame.RectTransform, Anchor.Center) { MinSize = new Point(600, 420) }); + GUIFrame paddedFrame = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.85f), innerFrame.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, -0.03f) }, style: null); new GUITextBlock(new RectTransform(new Vector2(0.75f, 0.05f), paddedFrame.RectTransform, Anchor.TopRight), TextManager.Get("ServerLog.Filter"), font: GUI.SmallFont); GUITextBox searchBox = new GUITextBox(new RectTransform(new Vector2(0.6f, 0.05f), paddedFrame.RectTransform, Anchor.TopRight), font: GUI.SmallFont); @@ -45,12 +45,20 @@ namespace Barotrauma.Networking listBox = new GUIListBox(new RectTransform(new Vector2(0.75f, 0.95f), paddedFrame.RectTransform, Anchor.BottomRight)); + var tickBoxContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.2f, 0.95f), paddedFrame.RectTransform, Anchor.BottomLeft)); + var tickBoxContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 0.95f), paddedFrame.RectTransform, Anchor.BottomLeft)); int y = 30; List tickBoxes = new List(); foreach (MessageType msgType in Enum.GetValues(typeof(MessageType))) { - var tickBox = new GUITickBox(new RectTransform(new Point(tickBoxContainer.Rect.Width, 30), tickBoxContainer.RectTransform), TextManager.Get("ServerLog." + messageTypeName[(int)msgType]), font: GUI.SmallFont) + var tickBox = new GUITickBox(new RectTransform(new Point(20, 20), tickBoxContainer.RectTransform), TextManager.Get("ServerLog." + messageTypeName[(int)msgType]), font: GUI.SmallFont) + { + Selected = true, + TextColor = messageColor[(int)msgType] + }; + + tickBox.OnSelected += (GUITickBox tb) => { Selected = true, TextColor = messageColor[(int)msgType], diff --git a/Barotrauma/BarotraumaClient/Source/Networking/ServerSettings.cs b/Barotrauma/BarotraumaClient/Source/Networking/ServerSettings.cs index a4e27b2e1..335964b17 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/ServerSettings.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/ServerSettings.cs @@ -295,7 +295,7 @@ namespace Barotrauma.Networking OnClicked = SelectSettingsTab }; } - GUITextBlock.AutoScaleAndNormalize(tabButtons.Select(b => b.TextBlock)); + SelectSettingsTab(tabButtons[0], 0); //"Close" @@ -388,7 +388,7 @@ namespace Barotrauma.Networking ToolTip = TextManager.Get("ServerSettingsMinRespawnToolTip") }; - string minRespawnLabel = TextManager.Get("ServerSettingsMinRespawn") + " "; + string minRespawnLabel = TextManager.Get("ServerSettingsMinRespawn"); CreateLabeledSlider(roundsTab, "", out slider, out sliderLabel); slider.ToolTip = minRespawnText.ToolTip; slider.UserData = minRespawnText; @@ -407,7 +407,7 @@ namespace Barotrauma.Networking ToolTip = TextManager.Get("ServerSettingsRespawnDurationToolTip") }; - string respawnDurationLabel = TextManager.Get("ServerSettingsRespawnDuration") + " "; + string respawnDurationLabel = TextManager.Get("ServerSettingsRespawnDuration"); CreateLabeledSlider(roundsTab, "", out slider, out sliderLabel); slider.ToolTip = respawnDurationText.ToolTip; slider.UserData = respawnDurationText; @@ -471,7 +471,7 @@ namespace Barotrauma.Networking { string translatedLabel = TextManager.Get($"Character.{s}", true); var monsterEnabledBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), monsterFrame.Content.RectTransform) { MinSize = new Point(0, 25) }, - label: translatedLabel ?? s) + label: translatedLabel != null ? translatedLabel : s) { Selected = tempMonsterEnabled[s], OnSelected = (GUITickBox tb) => @@ -504,8 +504,6 @@ namespace Barotrauma.Networking return true; }; - GUITextBlock.AutoScaleAndNormalize(buttonHolder.Children.Select(c => ((GUIButton)c).TextBlock)); - foreach (ItemPrefab ip in MapEntityPrefab.List.Where(p => p is ItemPrefab).Select(p => p as ItemPrefab)) { if (!ip.CanBeBought && !ip.Tags.Contains("smallitem")) continue; @@ -575,7 +573,7 @@ namespace Barotrauma.Networking //*********************************************** - string autoRestartDelayLabel = TextManager.Get("ServerSettingsAutoRestartDelay") + " "; + string autoRestartDelayLabel = TextManager.Get("ServerSettingsAutoRestartDelay"); var startIntervalText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverTab.RectTransform), autoRestartDelayLabel); var startIntervalSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.05f), serverTab.RectTransform), barSize: 0.1f) { @@ -619,7 +617,7 @@ namespace Barotrauma.Networking GetPropertyData("AllowVoteKick").AssignGUIComponent(voteKickBox); CreateLabeledSlider(serverTab, "ServerSettingsKickVotesRequired", out slider, out sliderLabel); - string votesRequiredLabel = sliderLabel.Text + " "; + string votesRequiredLabel = sliderLabel.Text; slider.Step = 0.2f; slider.Range = new Vector2(0.5f, 1.0f); slider.OnMoved = (GUIScrollBar scrollBar, float barScroll) => @@ -631,7 +629,7 @@ namespace Barotrauma.Networking slider.OnMoved(slider, slider.BarScroll); CreateLabeledSlider(serverTab, "ServerSettingsAutobanTime", out slider, out sliderLabel); - string autobanLabel = sliderLabel.Text + " "; + string autobanLabel = sliderLabel.Text; slider.Step = 0.05f; slider.Range = new Vector2(0.0f, MaxAutoBanTime); slider.OnMoved = (GUIScrollBar scrollBar, float barScroll) => @@ -683,8 +681,8 @@ namespace Barotrauma.Networking traitorRatioSlider.Range = new Vector2(1.0f, maxPlayers); } - string traitorRatioLabel = TextManager.Get("ServerSettingsTraitorRatio") + " "; - string traitorCountLabel = TextManager.Get("ServerSettingsTraitorCount") + " "; + string traitorRatioLabel = TextManager.Get("ServerSettingsTraitorRatio"); + string traitorCountLabel = TextManager.Get("ServerSettingsTraitorCount"); traitorRatioSlider.Range = new Vector2(0.1f, 1.0f); traitorRatioSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) => diff --git a/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs b/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs index 696d6d141..5ec4a4699 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs @@ -11,12 +11,6 @@ namespace Barotrauma.Steam { partial class SteamManager { - private static List initializationErrors = new List(); - public static IEnumerable InitializationErrors - { - get { return initializationErrors; } - } - private SteamManager() { try @@ -32,12 +26,12 @@ namespace Barotrauma.Steam catch (DllNotFoundException) { isInitialized = false; - initializationErrors.Add("SteamDllNotFound"); + new GUIMessageBox(TextManager.Get("Error"), TextManager.Get("SteamDllNotFound")); } catch (Exception) { isInitialized = false; - initializationErrors.Add("SteamClientInitFailed"); + new GUIMessageBox(TextManager.Get("Error"), TextManager.Get("SteamClientInitFailed")); } if (!isInitialized) @@ -220,7 +214,6 @@ namespace Barotrauma.Steam } if (s.Rules.ContainsKey("allowspectating")) serverInfo.AllowSpectating = s.Rules["allowspectating"] == "True"; if (s.Rules.ContainsKey("allowrespawn")) serverInfo.AllowRespawn = s.Rules["allowrespawn"] == "True"; - if (s.Rules.ContainsKey("voicechatenabled")) serverInfo.VoipEnabled = s.Rules["voicechatenabled"] == "True"; if (s.Rules.ContainsKey("traitors")) { if (Enum.TryParse(s.Rules["traitors"], out YesNoMaybe traitorsEnabled)) serverInfo.TraitorsEnabled = traitorsEnabled; @@ -589,23 +582,6 @@ namespace Barotrauma.Steam ContentPackage contentPackage = new ContentPackage(metaDataFilePath); string newContentPackagePath = GetWorkshopItemContentPackagePath(contentPackage); - if (!contentPackage.IsCompatible()) - { - errorMsg = TextManager.Get(contentPackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage") - .Replace("[packagename]", contentPackage.Name) - .Replace("[packageversion]", contentPackage.GameVersion.ToString()) - .Replace("[gameversion]", GameMain.Version.ToString()); - return false; - } - - if (contentPackage.CorePackage && !contentPackage.ContainsRequiredCorePackageFiles(out List missingContentTypes)) - { - errorMsg = TextManager.Get("ContentPackageMissingCoreFiles") - .Replace("[packagename]", contentPackage.Name) - .Replace("[missingfiletypes]", string.Join(", ", missingContentTypes)); - return false; - } - var allPackageFiles = Directory.GetFiles(item.Directory.FullName, "*", SearchOption.AllDirectories); List nonContentFiles = new List(); foreach (string file in allPackageFiles) @@ -622,7 +598,7 @@ namespace Barotrauma.Steam if (!allowFileOverwrite) { - if (File.Exists(newContentPackagePath) && !CheckFileEquality(newContentPackagePath, metaDataFilePath)) + if (File.Exists(newContentPackagePath)) { errorMsg = TextManager.Get("WorkshopErrorOverwriteOnEnable") .Replace("[itemname]", item.Title) @@ -634,7 +610,7 @@ namespace Barotrauma.Steam foreach (ContentFile contentFile in contentPackage.Files) { string sourceFile = Path.Combine(item.Directory.FullName, contentFile.Path); - if (File.Exists(sourceFile) && File.Exists(contentFile.Path) && !CheckFileEquality(sourceFile, contentFile.Path)) + if (File.Exists(sourceFile) && File.Exists(contentFile.Path)) { errorMsg = TextManager.Get("WorkshopErrorOverwriteOnEnable") .Replace("[itemname]", item.Title) @@ -650,41 +626,12 @@ namespace Barotrauma.Steam foreach (ContentFile contentFile in contentPackage.Files) { string sourceFile = Path.Combine(item.Directory.FullName, contentFile.Path); - - //path not allowed -> the content file must be a reference to an external file (such as some vanilla file outside the Mods folder) + if (!File.Exists(sourceFile)) { continue; } if (!ContentPackage.IsModFilePathAllowed(contentFile)) { - //the content package is trying to copy a file to a prohibited path, which is not allowed - if (File.Exists(sourceFile)) - { - errorMsg = TextManager.Get("WorkshopErrorIllegalPathOnEnable").Replace("[filename]", contentFile.Path); - return false; - } - //not trying to copy anything, so this is a reference to an external file - //if the external file doesn't exist, we cannot enable the package - else if (!File.Exists(contentFile.Path)) - { - //TODO: add the error message to localization - errorMsg = TextManager.Get("WorkshopErrorEnableFailed").Replace("[itemname]", item.Title) + " {File \"" + contentFile.Path + "\" not found.}"; - return false; - } + DebugConsole.ThrowError(TextManager.Get("WorkshopErrorIllegalPathOnEnable").Replace("[filename]", contentFile.Path)); continue; } - else if (!File.Exists(sourceFile)) - { - if (File.Exists(contentFile.Path)) - { - //the file is already present in the game folder, all good - continue; - } - else - { - //file not present in either the mod or the game folder -> cannot enable the package - //TODO: add the error message to localization - errorMsg = TextManager.Get("WorkshopErrorEnableFailed").Replace("[itemname]", item.Title) + " {File \"" + contentFile.Path + "\" not found.}"; - return false; - } - } //make sure the destination directory exists Directory.CreateDirectory(Path.GetDirectoryName(contentFile.Path)); @@ -706,7 +653,7 @@ namespace Barotrauma.Steam } catch (Exception e) { - errorMsg = TextManager.Get("WorkshopErrorEnableFailed").Replace("[itemname]", item.Title) + " {" + e.Message + "}"; + errorMsg = TextManager.Get("WorkshopErrorEnableFailed").Replace("[itemname]", item.Title) + " " + e.Message; DebugConsole.NewMessage(errorMsg, Microsoft.Xna.Framework.Color.Red); return false; } @@ -735,22 +682,6 @@ namespace Barotrauma.Steam return true; } - private static bool CheckFileEquality(string filePath1, string filePath2) - { - if (filePath1 == filePath2) - { - return true; - } - - using (FileStream fs1 = File.OpenRead(filePath1)) - using (FileStream fs2 = File.OpenRead(filePath2)) - { - Md5Hash hash1 = new Md5Hash(fs1); - Md5Hash hash2 = new Md5Hash(fs2); - return hash1.Hash == hash2.Hash; - } - } - /// /// Disables a workshop item by removing the files from the game folder. /// @@ -877,7 +808,7 @@ namespace Barotrauma.Steam { foreach (ContentFile contentFile in contentPackage.Files) { - if (!File.Exists(contentFile.Path)) { return false; } + if (!File.Exists(contentFile.Path)) return false; } } diff --git a/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipCapture.cs b/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipCapture.cs index cd0d3352e..bd1df6c87 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipCapture.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipCapture.cs @@ -76,8 +76,7 @@ namespace Barotrauma.Networking if (!GUIMessageBox.MessageBoxes.Any(mb => mb.UserData as string == "capturedevicenotfound")) { GUI.SettingsMenuOpen = false; - new GUIMessageBox(TextManager.Get("Error"), - TextManager.Get("VoipCaptureDeviceNotFound", returnNull: true) ?? "Could not start voice capture, suitable capture device not found.") + new GUIMessageBox(TextManager.Get("Error"), TextManager.Get("VoipCaptureDeviceNotFound")) { UserData = "capturedevicenotfound" }; diff --git a/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipClient.cs index 1ad61e4cd..b1da9bde6 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipClient.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipClient.cs @@ -115,7 +115,7 @@ namespace Barotrauma.Networking } } GameMain.NetLobbyScreen.SetPlayerSpeaking(client); - GameMain.GameSession?.CrewManager?.SetClientSpeaking(client); + GameMain.GameSession?.CrewManager?.SetPlayerSpeaking(client); } } diff --git a/Barotrauma/BarotraumaClient/Source/Program.cs b/Barotrauma/BarotraumaClient/Source/Program.cs index 37646cf3f..b624a2b7a 100644 --- a/Barotrauma/BarotraumaClient/Source/Program.cs +++ b/Barotrauma/BarotraumaClient/Source/Program.cs @@ -30,7 +30,6 @@ namespace Barotrauma [STAThread] static void Main() { - SteamManager.Initialize(); GameMain game = null; #if !DEBUG try @@ -214,10 +213,6 @@ namespace Barotrauma sb.AppendLine("Level seed: " + ((Level.Loaded == null) ? "no level loaded" : Level.Loaded.Seed)); sb.AppendLine("Loaded submarine: " + ((Submarine.MainSub == null) ? "None" : Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash + ")")); sb.AppendLine("Selected screen: " + (Screen.Selected == null ? "None" : Screen.Selected.ToString())); - if (SteamManager.IsInitialized) - { - sb.AppendLine("SteamManager initialized"); - } if (GameMain.Client != null) { diff --git a/Barotrauma/BarotraumaClient/Source/Screens/CampaignSetupUI.cs b/Barotrauma/BarotraumaClient/Source/Screens/CampaignSetupUI.cs index db003ff68..9c0f44c52 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/CampaignSetupUI.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/CampaignSetupUI.cs @@ -16,6 +16,9 @@ namespace Barotrauma private GUIListBox saveList; private GUITextBox saveNameBox, seedBox; + private GUITickBox contextualTutorialBox; + + private GUILayoutGroup subPreviewContainer; private GUILayoutGroup subPreviewContainer; @@ -23,6 +26,14 @@ namespace Barotrauma public Action StartNewGame; public Action LoadGame; + public bool TutorialSelected + { + get + { + if (contextualTutorialBox == null) return false; + return contextualTutorialBox.Selected; + } + } private readonly bool isMultiplayer; @@ -54,31 +65,19 @@ namespace Barotrauma // New game left side new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get("SaveName") + ":"); - saveNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, string.Empty) - { - textFilterFunction = (string str) => { return ToolBox.RemoveInvalidFileNameChars(str); } - }; + saveNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, string.Empty); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get("MapSeed") + ":"); seedBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, ToolBox.RandomSeed(8)); - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get("SelectedSub") + ":"); - var filterContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), isHorizontal: true) + if (!isMultiplayer) { - Stretch = true - }; - subList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.65f), leftColumn.RectTransform)) { ScrollBarVisible = true }; - - var searchTitle = new GUITextBlock(new RectTransform(new Vector2(0.001f, 1.0f), filterContainer.RectTransform), TextManager.Get("FilterMapEntities"), textAlignment: Alignment.CenterLeft, font: GUI.Font); - var searchBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 1.0f), filterContainer.RectTransform, Anchor.CenterRight), font: GUI.Font); - searchBox.OnSelected += (sender, userdata) => { searchTitle.Visible = false; }; - searchBox.OnDeselected += (sender, userdata) => { searchTitle.Visible = true; }; + contextualTutorialBox = new GUITickBox(new RectTransform(new Point(32, 32), leftColumn.RectTransform), TextManager.Get("TutorialActive")); + UpdateTutorialSelection(); + } - searchBox.OnTextChanged += (textBox, text) => { FilterSubs(subList, text); return true; }; - var clearButton = new GUIButton(new RectTransform(new Vector2(0.075f, 1.0f), filterContainer.RectTransform), "x") - { - OnClicked = (btn, userdata) => { searchBox.Text = ""; FilterSubs(subList, ""); searchBox.Flash(Color.White); return true; } - }; + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get("SelectedSub") + ":"); + subList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.65f), leftColumn.RectTransform)) { ScrollBarVisible = true }; if (!isMultiplayer) { subList.OnSelected = OnSubSelected; } @@ -176,20 +175,10 @@ namespace Barotrauma } }; - - if (!isMultiplayer) - { - var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(1.0f, 0.8f), rightColumn.RectTransform, Anchor.TopRight) { AbsoluteOffset = new Point(5) }, style: "GUINotificationButton") - { - IgnoreLayoutGroups = true, - OnClicked = (btn, userdata) => { GameMain.Instance.ShowCampaignDisclaimer(); return true; } - }; - disclaimerBtn.RectTransform.MaxSize = new Point((int)(30 * GUI.Scale)); - } - leftColumn.Recalculate(); rightColumn.Recalculate(); + UpdateSubList(submarines); UpdateLoadMenu(saveFiles); } @@ -199,16 +188,6 @@ namespace Barotrauma seedBox.Text = ToolBox.RandomSeed(8); } - private void FilterSubs(GUIListBox subList, string filter) - { - foreach (GUIComponent child in subList.Content.Children) - { - var sub = child.UserData as Submarine; - if (sub == null) { return; } - child.Visible = string.IsNullOrEmpty(filter) ? true : sub.Name.ToLower().Contains(filter.ToLower()); - } - } - private bool OnSubSelected(GUIComponent component, object obj) { if (subPreviewContainer == null) { return false; } @@ -280,7 +259,7 @@ namespace Barotrauma { IsFixedSize = false }, - TextManager.Get("Shuttle", fallBackTag: "RespawnShuttle"), textAlignment: Alignment.Right, font: GUI.SmallFont) + TextManager.Get("Shuttle"), textAlignment: Alignment.Right, font: GUI.SmallFont) { TextColor = textBlock.TextColor * 0.8f, ToolTip = textBlock.ToolTip @@ -398,7 +377,14 @@ namespace Barotrauma }, Enabled = false }; - } + } + + public void UpdateTutorialSelection() + { + if (isMultiplayer) return; + Tutorial contextualTutorial = Tutorial.Tutorials.Find(t => t is ContextualTutorial); + contextualTutorialBox.Selected = (contextualTutorial != null) ? !GameMain.Config.CompletedTutorialNames.Contains(contextualTutorial.Name) : true; + } private bool SelectSaveFile(GUIComponent component, object obj) { diff --git a/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs b/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs index 95ba8dd5a..f09e7c014 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs @@ -9,14 +9,16 @@ namespace Barotrauma { class CampaignUI { - public enum Tab { Map, Crew, Store, Repair } + public enum Tab { Map, Crew, Store } private Tab selectedTab; private GUIFrame[] tabs; private GUIFrame topPanel; - private GUIListBox characterList; + private GUIButton startButton; + + private GUIFrame topPanel; - private MapEntityCategory selectedItemCategory = MapEntityCategory.Equipment; + private GUIListBox characterList; private GUIListBox myItemList; private GUIListBox storeItemList; @@ -26,8 +28,6 @@ namespace Barotrauma private GUIComponent selectedLocationInfo; private GUIListBox selectedMissionInfo; - private GUIButton repairHullsButton, repairItemsButton; - private GUIFrame characterPreviewFrame; private List tabButtons = new List(); @@ -41,7 +41,10 @@ namespace Barotrauma public GUIComponent MapContainer { get; private set; } - public GUIButton StartButton { get; private set; } + public GUIButton StartButton + { + get { return startButton; } + } public CampaignMode Campaign { get; } @@ -69,7 +72,7 @@ namespace Barotrauma var outpostBtn = new GUIButton(new RectTransform(new Vector2(0.15f, 0.55f), topPanelContent.RectTransform), TextManager.Get("Outpost"), textAlignment: Alignment.Center, style: "GUISlopedHeader") { - OnClicked = (btn, userdata) => { SelectTab(Tab.Map); return true; } + OnClicked = (btn, userdata) => { SelectTab(Tab.Map); return true; } }; outpostBtn.TextBlock.Font = GUI.LargeFont; outpostBtn.TextBlock.AutoScale = true; @@ -78,6 +81,7 @@ namespace Barotrauma int i = 0; var tabValues = Enum.GetValues(typeof(Tab)); + float minTextScale = 1.0f; foreach (Tab tab in tabValues) { var tabButton = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tabButtonContainer.RectTransform), @@ -92,12 +96,17 @@ namespace Barotrauma var buttonSprite = tabButton.Style.Sprites[GUIComponent.ComponentState.None][0]; tabButton.RectTransform.MaxSize = new Point( (int)(tabButton.Rect.Height * (buttonSprite.Sprite.size.X / buttonSprite.Sprite.size.Y)), int.MaxValue); - tabButtons.Add(tabButton); tabButton.Font = GUI.LargeFont; + tabButton.TextBlock.AutoScale = true; + minTextScale = Math.Min(tabButton.TextBlock.TextScale, minTextScale); i++; } - GUITextBlock.AutoScaleAndNormalize(tabButtons.Select(t => t.TextBlock)); + + foreach (GUIButton tabButton in tabButtons) + { + tabButton.TextBlock.TextScale = minTextScale; + } // crew tab ------------------------------------------------------------------------- @@ -105,7 +114,7 @@ namespace Barotrauma tabs[(int)Tab.Crew] = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.7f), container.RectTransform, Anchor.TopLeft) { RelativeOffset = new Vector2(0.0f, topPanel.RectTransform.RelativeSize.Y) - }, color: Color.Black * 0.9f); + }, color: Color.Black * 0.7f); new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), tabs[(int)Tab.Crew].RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f) { CanBeFocused = false @@ -150,7 +159,7 @@ namespace Barotrauma tabs[(int)Tab.Store] = new GUIFrame(new RectTransform(new Vector2(0.5f, 0.7f), container.RectTransform, Anchor.TopLeft) { RelativeOffset = new Vector2(0.1f, topPanel.RectTransform.RelativeSize.Y) - }, color: Color.Black * 0.9f); + }, color: Color.Black * 0.7f); new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), tabs[(int)Tab.Store].RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f) { CanBeFocused = false @@ -167,33 +176,15 @@ namespace Barotrauma RelativeSpacing = 0.02f }; - var storeContentTop = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), storeContent.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft) - { - Stretch = true - }; - - new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), storeContentTop.RectTransform), "", font: GUI.LargeFont) + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), storeContent.RectTransform), "", font: GUI.LargeFont) { TextGetter = GetMoney }; - var filterContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 0.4f), storeContentTop.RectTransform), isHorizontal: true) - { - Stretch = true - }; - var searchTitle = new GUITextBlock(new RectTransform(new Vector2(0.001f, 1.0f), filterContainer.RectTransform), TextManager.Get("FilterMapEntities"), textAlignment: Alignment.CenterLeft, font: GUI.Font); - searchBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 1.0f), filterContainer.RectTransform), font: GUI.Font); - searchBox.OnSelected += (sender, userdata) => { searchTitle.Visible = false; }; - searchBox.OnDeselected += (sender, userdata) => { searchTitle.Visible = true; }; - - searchBox.OnTextChanged += (textBox, text) => { FilterStoreItems(null, text); return true; }; - var clearButton = new GUIButton(new RectTransform(new Vector2(0.1f, 1.0f), filterContainer.RectTransform), "x") - { - OnClicked = (btn, userdata) => { searchBox.Text = ""; FilterStoreItems(selectedItemCategory, ""); searchBox.Flash(Color.White); return true; } - }; var storeItemLists = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.8f), storeContent.RectTransform), isHorizontal: true) { - Stretch = true + Stretch = true, + RelativeSpacing = 0.02f }; myItemList = new GUIListBox(new RectTransform(new Vector2(0.5f, 1.0f), storeItemLists.RectTransform)); storeItemList = new GUIListBox(new RectTransform(new Vector2(0.5f, 1.0f), storeItemLists.RectTransform)) @@ -211,7 +202,7 @@ namespace Barotrauma "", style: "ItemCategory" + category.ToString()) { UserData = category, - OnClicked = (btn, userdata) => { FilterStoreItems((MapEntityCategory)userdata, searchBox.Text); return true; } + OnClicked = (btn, userdata) => { SelectItemCategory((MapEntityCategory)userdata); return true; } }; itemCategoryButtons.Add(categoryButton); @@ -227,115 +218,7 @@ namespace Barotrauma CanBeFocused = false }; } - FillStoreItemList(); - FilterStoreItems(MapEntityCategory.Equipment, ""); - - // repair tab ------------------------------------------------------------------------- - - tabs[(int)Tab.Repair] = new GUIFrame(new RectTransform(new Vector2(0.35f, 0.5f), container.RectTransform, Anchor.TopLeft) - { - RelativeOffset = new Vector2(0.02f, topPanel.RectTransform.RelativeSize.Y) - }, color: Color.Black * 0.9f); - new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), tabs[(int)Tab.Repair].RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f) - { - CanBeFocused = false - }; - - var repairContent = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.85f), tabs[(int)Tab.Repair].RectTransform, Anchor.Center)) - { - RelativeSpacing = 0.05f, - Stretch = true - }; - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), repairContent.RectTransform), "", font: GUI.LargeFont) - { - TextGetter = GetMoney - }; - - var repairHullsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), repairContent.RectTransform), childAnchor: Anchor.TopRight) - { - RelativeSpacing = 0.05f, - Stretch = true - }; - new GUIImage(new RectTransform(new Vector2(0.3f, 1.0f), repairHullsHolder.RectTransform, Anchor.CenterLeft), "RepairHullButton") - { - IgnoreLayoutGroups = true, - CanBeFocused = false - }; - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairHullsHolder.RectTransform), TextManager.Get("RepairAllWalls"), textAlignment: Alignment.Right, font: GUI.LargeFont) - { - ForceUpperCase = true - }; - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairHullsHolder.RectTransform), "500", textAlignment: Alignment.Right, font: GUI.LargeFont); - repairHullsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairHullsHolder.RectTransform), TextManager.Get("Repair"), style: "GUIButtonLarge") - { - OnClicked = (btn, userdata) => - { - if (campaign.PurchasedHullRepairs) - { - campaign.Money += CampaignMode.HullRepairCost; - campaign.PurchasedHullRepairs = false; - } - else - { - if (campaign.Money >= CampaignMode.HullRepairCost) - { - campaign.Money -= CampaignMode.HullRepairCost; - campaign.PurchasedHullRepairs = true; - } - } - GameMain.Client?.SendCampaignState(); - btn.GetChild().Selected = campaign.PurchasedHullRepairs; - - return true; - } - }; - new GUITickBox(new RectTransform(new Vector2(0.65f), repairHullsButton.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point(10, 0) }, "") - { - CanBeFocused = false - }; - - var repairItemsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), repairContent.RectTransform), childAnchor: Anchor.TopRight) - { - RelativeSpacing = 0.05f, - Stretch = true - }; - new GUIImage(new RectTransform(new Vector2(0.3f, 1.0f), repairItemsHolder.RectTransform, Anchor.CenterLeft), "RepairItemsButton") - { - IgnoreLayoutGroups = true, - CanBeFocused = false - }; - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairItemsHolder.RectTransform), TextManager.Get("RepairAllItems"), textAlignment: Alignment.Right, font: GUI.LargeFont) - { - ForceUpperCase = true - }; - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairItemsHolder.RectTransform), "500", textAlignment: Alignment.Right, font: GUI.LargeFont); - repairItemsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairItemsHolder.RectTransform), TextManager.Get("Repair"), style: "GUIButtonLarge") - { - OnClicked = (btn, userdata) => - { - if (campaign.PurchasedItemRepairs) - { - campaign.Money += CampaignMode.ItemRepairCost; - campaign.PurchasedItemRepairs = false; - } - else - { - if (campaign.Money >= CampaignMode.ItemRepairCost) - { - campaign.Money -= CampaignMode.ItemRepairCost; - campaign.PurchasedItemRepairs = true; - } - } - GameMain.Client?.SendCampaignState(); - btn.GetChild().Selected = campaign.PurchasedItemRepairs; - - return true; - } - }; - new GUITickBox(new RectTransform(new Vector2(0.65f), repairItemsButton.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point(10, 0) }, "") - { - CanBeFocused = false - }; + SelectItemCategory(MapEntityCategory.Equipment); // mission info ------------------------------------------------------------------------- @@ -449,7 +332,8 @@ namespace Barotrauma bool purchaseableItemsFound = false; foreach (MapEntityPrefab mapEntityPrefab in MapEntityPrefab.List) { - if (!(mapEntityPrefab is ItemPrefab itemPrefab)) { continue; } + var itemPrefab = mapEntityPrefab as ItemPrefab; + if (itemPrefab == null) { continue; } PriceInfo priceInfo = itemPrefab.GetPrice(Campaign.Map.CurrentLocation); if (priceInfo != null) { purchaseableItemsFound = true; break; } @@ -466,9 +350,9 @@ namespace Barotrauma else { //refresh store view - FillStoreItemList(); - FilterStoreItems(MapEntityCategory.Equipment, searchBox.Text); - } + SelectItemCategory(MapEntityCategory.Equipment); + } + } private void DrawMap(SpriteBatch spriteBatch, GUICustomComponent mapContainer) @@ -570,7 +454,7 @@ namespace Barotrauma RefreshMissionTab(selectedMission); - StartButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.7f), missionContent.RectTransform, Anchor.CenterRight), + startButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.7f), missionContent.RectTransform, Anchor.CenterRight), TextManager.Get("StartCampaignButton"), style: "GUIButtonLarge") { IgnoreLayoutGroups = true, @@ -579,7 +463,7 @@ namespace Barotrauma }; if (GameMain.Client != null) { - StartButton.Visible = !GameMain.Client.GameStarted && + startButton.Visible = !GameMain.Client.GameStarted && (GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign)); } @@ -626,10 +510,10 @@ namespace Barotrauma CanBeFocused = false }; - if (StartButton != null) + if (startButton != null) { - StartButton.Enabled = true; - StartButton.Visible = GameMain.Client == null || + startButton.Enabled = true; + startButton.Visible = GameMain.Client == null || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign); } @@ -715,7 +599,8 @@ namespace Barotrauma private bool BuyItem(GUIComponent component, object obj) { - if (!(obj is PurchasedItem pi) || pi.ItemPrefab == null) return false; + PurchasedItem pi = obj as PurchasedItem; + if (pi == null || pi.ItemPrefab == null) return false; if (GameMain.Client != null && !GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign)) { @@ -733,7 +618,8 @@ namespace Barotrauma private bool SellItem(GUIComponent component, object obj) { - if (!(obj is PurchasedItem pi) || pi.ItemPrefab == null) return false; + PurchasedItem pi = obj as PurchasedItem; + if (pi == null || pi.ItemPrefab == null) return false; if (GameMain.Client != null && !GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign)) { @@ -775,59 +661,35 @@ namespace Barotrauma { button.Selected = (Tab)button.UserData == tab; } - - switch (selectedTab) - { - case Tab.Repair: - repairHullsButton.Enabled = - (Campaign.PurchasedHullRepairs || Campaign.Money >= CampaignMode.HullRepairCost) && - (GameMain.Client == null || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign)); - repairHullsButton.GetChild().Selected = Campaign.PurchasedHullRepairs; - repairItemsButton.Enabled = - (Campaign.PurchasedItemRepairs || Campaign.Money >= CampaignMode.ItemRepairCost) && - (GameMain.Client == null || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign)); - repairItemsButton.GetChild().Selected = Campaign.PurchasedItemRepairs; - break; - } } - private void FillStoreItemList() + private bool SelectItemCategory(MapEntityCategory category) { storeItemList.ClearChildren(); int width = storeItemList.Rect.Width; foreach (MapEntityPrefab mapEntityPrefab in MapEntityPrefab.List) { - if (!(mapEntityPrefab is ItemPrefab itemPrefab)) { continue; } + var itemPrefab = mapEntityPrefab as ItemPrefab; + if (itemPrefab == null || !itemPrefab.Category.HasFlag(category)) continue; + PriceInfo priceInfo = itemPrefab.GetPrice(Campaign.Map.CurrentLocation); if (priceInfo == null) continue; CreateItemFrame(new PurchasedItem(itemPrefab, 0), priceInfo, storeItemList, width); } + storeItemList.Content.RectTransform.SortChildren( (x, y) => (x.GUIComponent.UserData as PurchasedItem).ItemPrefab.Name.CompareTo((y.GUIComponent.UserData as PurchasedItem).ItemPrefab.Name)); - } - private void FilterStoreItems(MapEntityCategory? category, string filter) - { - if (category.HasValue) - { - selectedItemCategory = category.Value; - } - foreach (GUIComponent child in storeItemList.Content.Children) - { - var item = child.UserData as PurchasedItem; - if (item?.ItemPrefab?.Name == null) { continue; } - child.Visible = - (!category.HasValue || item.ItemPrefab.Category.HasFlag(category.Value)) && - (string.IsNullOrEmpty(filter) || item.ItemPrefab.Name.ToLower().Contains(searchBox.Text.ToLower())); - } foreach (GUIButton btn in itemCategoryButtons) { - btn.Selected = (MapEntityCategory)btn.UserData == selectedItemCategory; + btn.Selected = (MapEntityCategory)btn.UserData == category; } - storeItemList.UpdateScrollBarSize(); + storeItemList.BarScroll = 0.0f; + + return true; } public string GetMoney() @@ -847,8 +709,9 @@ namespace Barotrauma } if (prevInfoFrame != null) { tabs[(int)selectedTab].RemoveChild(prevInfoFrame); } - - if (!(selection is CharacterInfo characterInfo)) { return false; } + + CharacterInfo characterInfo = selection as CharacterInfo; + if (characterInfo == null) { return false; } if (Character.Controlled != null && characterInfo == Character.Controlled.Info) { return false; } if (characterPreviewFrame == null || characterPreviewFrame.UserData != characterInfo) @@ -900,9 +763,11 @@ namespace Barotrauma private bool HireCharacter(GUIButton button, object selection) { - if (!(selection is CharacterInfo characterInfo)) { return false; } + CharacterInfo characterInfo = selection as CharacterInfo; + if (characterInfo == null) { return false; } - if (!(Campaign is SinglePlayerCampaign spCampaign)) + SinglePlayerCampaign spCampaign = Campaign as SinglePlayerCampaign; + if (spCampaign == null) { DebugConsole.ThrowError("Characters can only be hired in the single player campaign.\n" + Environment.StackTrace); return false; @@ -921,9 +786,11 @@ namespace Barotrauma private bool FireCharacter(GUIButton button, object selection) { - if (!(selection is CharacterInfo characterInfo)) return false; + CharacterInfo characterInfo = selection as CharacterInfo; + if (characterInfo == null) return false; - if (!(Campaign is SinglePlayerCampaign spCampaign)) + SinglePlayerCampaign spCampaign = Campaign as SinglePlayerCampaign; + if (spCampaign == null) { DebugConsole.ThrowError("Characters can only be fired in the single player campaign.\n" + Environment.StackTrace); return false; diff --git a/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs index 6e1905c0e..8dfbbdd0b 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs @@ -42,16 +42,16 @@ namespace Barotrauma private bool showParamsEditor; private bool showSpritesheet; private bool isFreezed; - private bool autoFreeze; - private bool limbPairEditing; - private bool uniformScaling; - private bool lockSpriteOrigin; + private bool autoFreeze = true; + private bool limbPairEditing = true; + private bool uniformScaling = true; + private bool lockSpriteOrigin = true; private bool lockSpritePosition; private bool lockSpriteSize; private bool recalculateCollider; private bool copyJointSettings; private bool displayColliders; - private bool displayWearables; + private bool displayWearables = true; private bool displayBackgroundColor; private bool ragdollResetRequiresForceLoading; private bool animationResetRequiresForceLoading; @@ -89,16 +89,10 @@ namespace Barotrauma public override void Select() { base.Select(); - - SoundPlayer.OverrideMusicType = "none"; - SoundPlayer.OverrideMusicDuration = null; - GameMain.SoundManager.SetCategoryGainMultiplier("waterambience", 0.0f); - GUI.ForceMouseOn(null); CalculateSpritesheetPosition(); if (Submarine.MainSub == null) { - ResetVariables(); Submarine.MainSub = new Submarine("Content/AnimEditor.sub"); Submarine.MainSub.Load(unloadPrevious: false, showWarningMessages: false); originalWall = new WallGroup(new List(Structure.WallList)); @@ -107,10 +101,6 @@ namespace Barotrauma isEndlessRunner = true; GameMain.LightManager.LightingEnabled = false; } - else if (instance == null) - { - ResetVariables(); - } Submarine.MainSub.GodMode = true; if (Character.Controlled == null) { @@ -126,71 +116,33 @@ namespace Barotrauma OpenDoors(); GameMain.Instance.OnResolutionChanged += OnResolutionChanged; instance = this; - - if (!GameMain.Config.EditorDisclaimerShown) - { - GameMain.Instance.ShowEditorDisclaimer(); - } - } - - private void ResetVariables() - { - editAnimations = false; - editLimbs = false; - editJoints = false; - editIK = false; - showRagdoll = false; - showParamsEditor = false; - showSpritesheet = false; - isFreezed = false; - autoFreeze = true; - limbPairEditing = true; - uniformScaling = true; - lockSpriteOrigin = false; - lockSpritePosition = false; - lockSpriteSize = false; - recalculateCollider = false; - copyJointSettings = false; - displayColliders = false; - displayWearables = true; - displayBackgroundColor = false; - ragdollResetRequiresForceLoading = false; - animationResetRequiresForceLoading = false; - isExtrudingJoint = false; - isDrawingJoint = false; - Wizard.instance = null; } private void Reset() { - ResetVariables(); - if (character != null) + AnimParams.ForEach(a => a.Reset(true)); + RagdollParams.Reset(true); + RagdollParams.ClearHistory(); + CurrentAnimation.ClearHistory(); + if (!character.Removed) { - AnimParams.ForEach(a => a.Reset(true)); - RagdollParams.Reset(true); - RagdollParams.ClearHistory(); - CurrentAnimation.ClearHistory(); - if (!character.Removed) - { - character.Remove(); - } - character = null; + character.Remove(); } + character = null; } public override void Deselect() { base.Deselect(); - - SoundPlayer.OverrideMusicType = null; - GameMain.SoundManager.SetCategoryGainMultiplier("waterambience", GameMain.Config.SoundVolume); - GUI.ForceMouseOn(null); if (isEndlessRunner) { Submarine.MainSub.Remove(); isEndlessRunner = false; - Reset(); + if (character != null) + { + Reset(); + } GameMain.World.ProcessChanges(); } else @@ -223,7 +175,7 @@ namespace Barotrauma { //base.AddToGUIUpdateList(); rightPanel.AddToGUIUpdateList(); - Wizard.instance?.AddToGUIUpdateList(); + Wizard.Instance.AddToGUIUpdateList(); if (displayBackgroundColor) { backgroundColorPanel.AddToGUIUpdateList(); @@ -255,7 +207,7 @@ namespace Barotrauma base.Update(deltaTime); spriteSheetRect = CalculateSpritesheetRectangle(); // Handle shortcut keys - if (GUI.KeyboardDispatcher.Subscriber == null && Wizard.instance == null) + if (GUI.KeyboardDispatcher.Subscriber == null) { if (PlayerInput.KeyDown(Keys.LeftControl)) { @@ -444,7 +396,7 @@ namespace Barotrauma } } } - if (!isFreezed && Wizard.instance == null) + if (!isFreezed) { if (character.AnimController.Invalid) { @@ -1179,22 +1131,7 @@ namespace Barotrauma character = Character.Create(configFile, spawnPosition, ToolBox.RandomSeed(8), hasAi: false, ragdoll: ragdoll); selectedJob = null; } - if (character != null) - { - character.dontFollowCursor = dontFollowCursor; - } - if (character == null) - { - if (currentCharacterConfig == configFile) - { - return null; - } - else - { - // Respawn the current character; - SpawnCharacter(currentCharacterConfig); - } - } + character.dontFollowCursor = dontFollowCursor; OnPostSpawn(); return character; } @@ -1310,33 +1247,27 @@ namespace Barotrauma string speciesName = name; // Config file string configFilePath = Path.Combine(mainFolder, $"{speciesName}.xml").Replace(@"\", @"/"); - if (ContentPackage.GetFilesOfType(GameMain.SelectedPackages, ContentType.Character).Any(path => path.Contains(speciesName))) + if (ContentPackage.GetFilesOfType(GameMain.SelectedPackages, ContentType.Character).None(path => path.Contains(speciesName))) { - GUI.AddMessage(GetCharacterEditorTranslation("ExistingCharacterFound"), Color.Red, font: GUI.LargeFont); - // TODO: add a prompt: "Do you want to replace it?" + functionality - return false; + // Create the config file + XElement mainElement = new XElement("Character", + new XAttribute("name", speciesName), + new XAttribute("humanoid", isHumanoid), + new XElement("ragdolls", new XAttribute("folder", Path.Combine(mainFolder, $"Ragdolls/").Replace(@"\", @"/"))), + new XElement("animations", new XAttribute("folder", Path.Combine(mainFolder, $"Animations/").Replace(@"\", @"/"))), + new XElement("health"), + new XElement("ai")); + XDocument doc = new XDocument(mainElement); + if (!Directory.Exists(mainFolder)) + { + Directory.CreateDirectory(mainFolder); + } + doc.Save(configFilePath); + // Add to the selected content package + contentPackage.AddFile(configFilePath, ContentType.Character); + contentPackage.Save(contentPackage.Path); + DebugConsole.NewMessage(GetCharacterEditorTranslation("ContentPackageSaved").Replace("[path]", contentPackage.Path)); } - - // Create the config file - XElement mainElement = new XElement("Character", - new XAttribute("name", speciesName), - new XAttribute("humanoid", isHumanoid), - new XElement("ragdolls", new XAttribute("folder", Path.Combine(mainFolder, $"Ragdolls/").Replace(@"\", @"/"))), - new XElement("animations", new XAttribute("folder", Path.Combine(mainFolder, $"Animations/").Replace(@"\", @"/"))), - new XElement("health"), - new XElement("ai")); - - XDocument doc = new XDocument(mainElement); - if (!Directory.Exists(mainFolder)) - { - Directory.CreateDirectory(mainFolder); - } - doc.Save(configFilePath); - // Add to the selected content package - contentPackage.AddFile(configFilePath, ContentType.Character); - contentPackage.Save(contentPackage.Path); - DebugConsole.NewMessage(GetCharacterEditorTranslation("ContentPackageSaved").Replace("[path]", contentPackage.Path)); - // Ragdoll string ragdollFolder = RagdollParams.GetFolder(speciesName); string ragdollPath = RagdollParams.GetDefaultFile(speciesName); @@ -1347,20 +1278,12 @@ namespace Barotrauma string animFolder = AnimationParams.GetFolder(speciesName); foreach (AnimationType animType in Enum.GetValues(typeof(AnimationType))) { - switch (animType) + if (animType != AnimationType.NotDefined) { - case AnimationType.Walk: - case AnimationType.Run: - if (!ragdollParams.CanEnterSubmarine) { continue; } - break; - case AnimationType.SwimSlow: - case AnimationType.SwimFast: - break; - default: continue; + Type type = AnimationParams.GetParamTypeFromAnimType(animType, isHumanoid); + string fullPath = AnimationParams.GetDefaultFile(speciesName, animType); + AnimationParams.Create(fullPath, speciesName, animType, type); } - Type type = AnimationParams.GetParamTypeFromAnimType(animType, isHumanoid); - string fullPath = AnimationParams.GetDefaultFile(speciesName, animType); - AnimationParams.Create(fullPath, speciesName, animType, type); } if (!AllFiles.Contains(configFilePath)) { @@ -1779,20 +1702,8 @@ namespace Barotrauma Vector2 buttonSize = new Vector2(1, 0.04f); Vector2 toggleSize = new Vector2(0.03f, 0.03f); Point margin = new Point(40, 60); - rightPanel = new GUIFrame(new RectTransform(new Vector2(0.15f, 1.0f), parent: Frame.RectTransform, anchor: Anchor.CenterRight), style: "GUIFrameRight"); - var layoutGroup = new GUILayoutGroup(new RectTransform(new Point(rightPanel.Rect.Width - margin.X, rightPanel.Rect.Height - margin.Y), rightPanel.RectTransform, Anchor.Center)) - { - Stretch = true - }; - - var disclaimerBtnHolder = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.04f), layoutGroup.RectTransform), style: null); - - var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(1.0f, 0.8f), disclaimerBtnHolder.RectTransform, Anchor.TopRight), style: "GUINotificationButton") - { - OnClicked = (btn, userdata) => { GameMain.Instance.ShowEditorDisclaimer(); return true; } - }; - disclaimerBtn.RectTransform.MaxSize = new Point(disclaimerBtn.Rect.Height); - + rightPanel = new GUIFrame(new RectTransform(new Vector2(0.15f, 0.95f), parent: Frame.RectTransform, anchor: Anchor.CenterRight) { RelativeOffset = new Vector2(0.01f, 0) }); + var layoutGroup = new GUILayoutGroup(new RectTransform(new Point(rightPanel.Rect.Width - margin.X, rightPanel.Rect.Height - margin.Y), rightPanel.RectTransform, Anchor.Center)); var characterDropDown = new GUIDropDown(new RectTransform(new Vector2(1, 0.04f), layoutGroup.RectTransform), elementCount: 10, style: null); characterDropDown.ListBox.Color = new Color(characterDropDown.ListBox.Color.R, characterDropDown.ListBox.Color.G, characterDropDown.ListBox.Color.B, byte.MaxValue); foreach (var file in AllFiles) @@ -1823,16 +1734,14 @@ namespace Barotrauma return true; }; } - var charButtons = new GUIFrame(new RectTransform(new Vector2(buttonSize.X, buttonSize.Y * 1.5f), parent: layoutGroup.RectTransform), style: null); - var prevCharacterButton = new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), charButtons.RectTransform, Anchor.TopLeft), GetCharacterEditorTranslation("PreviousCharacter")); - prevCharacterButton.TextBlock.AutoScale = true; + var charButtons = new GUIFrame(new RectTransform(buttonSize, parent: layoutGroup.RectTransform), style: null); + var prevCharacterButton = new GUIButton(new RectTransform(new Vector2(0.5f, 1), charButtons.RectTransform, Anchor.TopLeft), GetCharacterEditorTranslation("PreviousCharacter")); prevCharacterButton.OnClicked += (b, obj) => { SpawnCharacter(GetPreviousConfigFile()); return true; }; - var nextCharacterButton = new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), charButtons.RectTransform, Anchor.TopRight), GetCharacterEditorTranslation("NextCharacter")); - prevCharacterButton.TextBlock.AutoScale = true; + var nextCharacterButton = new GUIButton(new RectTransform(new Vector2(0.5f, 1), charButtons.RectTransform, Anchor.TopRight), GetCharacterEditorTranslation("NextCharacter")); nextCharacterButton.OnClicked += (b, obj) => { SpawnCharacter(GetNextConfigFile()); @@ -3855,7 +3764,7 @@ namespace Barotrauma void RecalculateCollider(Limb l) { // We want the collider to be slightly smaller than the source rect, because the source rect is usually a bit bigger than the graphic. - float multiplier = 0.85f; + float multiplier = 0.75f; l.body.SetSize(new Vector2(ConvertUnits.ToSimUnits(width), ConvertUnits.ToSimUnits(height)) * RagdollParams.LimbScale * RagdollParams.TextureScale * multiplier); TryUpdateLimbParam(l, "radius", ConvertUnits.ToDisplayUnits(l.body.radius / RagdollParams.LimbScale / RagdollParams.TextureScale)); TryUpdateLimbParam(l, "width", ConvertUnits.ToDisplayUnits(l.body.width / RagdollParams.LimbScale / RagdollParams.TextureScale)); @@ -4374,7 +4283,7 @@ namespace Barotrauma private List jointXElements = new List(); private List jointGUIElements = new List(); - public static Wizard instance; + private static Wizard instance; public static Wizard Instance { get @@ -4405,6 +4314,7 @@ namespace Barotrauma break; case Tab.None: default: + //activeView = null; instance = null; break; } @@ -4433,7 +4343,7 @@ namespace Barotrauma GUITextBox xmlPathElement = null; void UpdatePaths() { - string pathBase = $"Mods/Characters/{Name}/{Name}"; + string pathBase = $"Content/Characters/{Name}/{Name}"; XMLPath = $"{pathBase}.xml"; TexturePath = $"{pathBase}.png"; texturePathElement.Text = TexturePath; @@ -4512,7 +4422,7 @@ namespace Barotrauma // Cancel box.Buttons[0].OnClicked += (b, d) => { - Wizard.Instance.SelectTab(Tab.None); + Instance.SelectTab(Tab.None); return true; }; // Next @@ -4524,7 +4434,7 @@ namespace Barotrauma texturePathElement.Flash(Color.Red); return false; } - Wizard.Instance.SelectTab(Tab.Ragdoll); + Instance.SelectTab(Tab.Ragdoll); return true; }; return box; @@ -4665,7 +4575,7 @@ namespace Barotrauma // Previous box.Buttons[0].OnClicked += (b, d) => { - Wizard.Instance.SelectTab(Tab.Character); + Instance.SelectTab(Tab.Character); return true; }; // Parse and create @@ -4756,7 +4666,7 @@ namespace Barotrauma { GUI.AddMessage(GetCharacterEditorTranslation("CharacterCreated").Replace("[name]", Name), Color.Green, font: GUI.Font); } - Wizard.Instance.SelectTab(Tab.None); + Instance.SelectTab(Tab.None); return true; }; return box; @@ -4936,27 +4846,23 @@ namespace Barotrauma int width = rectInputs[2].IntValue; int height = rectInputs[3].IntValue; var colliderAttributes = new List(); - // Capsules/Circles - //if (width == height) - //{ - // colliderAttributes.Add(new XAttribute("radius", (int)(width / 2 * 0.85f))); - //} - //else - //{ - // if (height > width) - // { - // colliderAttributes.Add(new XAttribute("radius", (int)(width / 2 * 0.85f))); - // colliderAttributes.Add(new XAttribute("height",(int) (height - width * 0.85f))); - // } - // else - // { - // colliderAttributes.Add(new XAttribute("radius", (int)(height / 2 * 0.85f))); - // colliderAttributes.Add(new XAttribute("width", (int)(width - height * 0.85f))); - // } - //} - // Rectangles - colliderAttributes.Add(new XAttribute("height", (int)(height * 0.85f))); - colliderAttributes.Add(new XAttribute("width", (int)(width * 0.85f))); + if (width == height) + { + colliderAttributes.Add(new XAttribute("radius", width / 2)); + } + else + { + if (height > width) + { + colliderAttributes.Add(new XAttribute("radius", width / 2)); + colliderAttributes.Add(new XAttribute("height", height - width)); + } + else + { + colliderAttributes.Add(new XAttribute("radius", height / 2)); + colliderAttributes.Add(new XAttribute("width", width - height)); + } + } idToCodeName.TryGetValue(id, out string notes); LimbXElements.Add(id.ToString(), new XElement("limb", new XAttribute("id", id), diff --git a/Barotrauma/BarotraumaClient/Source/Screens/GameScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/GameScreen.cs index 58712b928..6bf9ad2c3 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/GameScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/GameScreen.cs @@ -149,8 +149,8 @@ namespace Barotrauma //These will be visible through the LOS effect. //Could be drawn with one Submarine.DrawBack call, but we can avoid sorting by depth by doing it like this. spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform); - Submarine.DrawBack(spriteBatch, false, e => e is Structure s && (s.ResizeVertical || s.ResizeHorizontal) && !s.DrawDamageEffect); - Submarine.DrawBack(spriteBatch, false, e => e is Structure s && !(s.ResizeVertical && s.ResizeHorizontal) && s.Prefab.BackgroundSprite != null); + Submarine.DrawBack(spriteBatch, false, s => s is Structure && s.ResizeVertical && s.ResizeHorizontal); + Submarine.DrawBack(spriteBatch, false, s => s is Structure && !(s.ResizeVertical && s.ResizeHorizontal) && ((Structure)s).Prefab.BackgroundSprite != null); spriteBatch.End(); graphics.SetRenderTarget(null); diff --git a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs index 7708c9eb8..a09059539 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs @@ -4,7 +4,9 @@ using Barotrauma.Tutorials; using Lidgren.Network; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; @@ -14,7 +16,7 @@ namespace Barotrauma { class MainMenuScreen : Screen { - public enum Tab { NewGame = 1, LoadGame = 2, HostServer = 3, Settings = 4, Tutorials = 5, JoinServer = 6, CharacterEditor = 7, SubmarineEditor = 8, QuickStartDev = 9, SteamWorkshop = 10, Credits = 11 } + public enum Tab { NewGame = 1, LoadGame = 2, HostServer = 3, Settings = 4, Tutorials = 5, JoinServer = 6, CharacterEditor = 7, SubmarineEditor = 8, QuickStartDev = 9, SteamWorkshop = 10 } private GUIComponent buttonsParent; @@ -34,27 +36,22 @@ namespace Barotrauma private Sprite backgroundSprite; private Sprite backgroundVignette; - private GUIComponent titleText; - - private CreditsPlayer creditsPlayer; - #region Creation public MainMenuScreen(GameMain game) { backgroundVignette = new Sprite("Content/UI/MainMenuVignette.png", Vector2.Zero); new GUIImage(new RectTransform(new Vector2(0.35f, 0.2f), Frame.RectTransform, Anchor.BottomRight) - { RelativeOffset = new Vector2(0.05f, 0.1f), AbsoluteOffset = new Point(-8, -8) }, + { RelativeOffset = new Vector2(0.05f, 0.05f), AbsoluteOffset = new Point(-5, -5) }, style: "TitleText") { Color = Color.Black * 0.5f, CanBeFocused = false }; - titleText = new GUIImage(new RectTransform(new Vector2(0.35f, 0.2f), Frame.RectTransform, Anchor.BottomRight) - { RelativeOffset = new Vector2(0.05f, 0.1f) }, + new GUIImage(new RectTransform(new Vector2(0.35f, 0.2f), Frame.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.05f, 0.05f) }, style: "TitleText"); - buttonsParent = new GUILayoutGroup(new RectTransform(new Vector2(0.3f, 0.85f), parent: Frame.RectTransform, anchor: Anchor.CenterLeft) + buttonsParent = new GUILayoutGroup(new RectTransform(new Vector2(0.3f, 0.85f), parent: Frame.RectTransform, anchor: Anchor.BottomLeft, pivot: Pivot.BottomLeft) { AbsoluteOffset = new Point(50, 0) }) @@ -62,10 +59,10 @@ namespace Barotrauma Stretch = true, RelativeSpacing = 0.02f }; - + // === CAMPAIGN var campaignHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 1.0f), parent: buttonsParent.RectTransform) { RelativeOffset = new Vector2(0.1f, 0.0f) }, isHorizontal: true); - + new GUIImage(new RectTransform(new Vector2(0.2f, 0.7f), campaignHolder.RectTransform), "MainMenuCampaignIcon") { CanBeFocused = false @@ -87,17 +84,6 @@ namespace Barotrauma RelativeSpacing = 0.035f }; - new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), campaignList.RectTransform), TextManager.Get("TutorialButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton") - { - ForceUpperCase = true, - UserData = Tab.Tutorials, - OnClicked = (tb, userdata) => - { - SelectTab(tb, userdata); - return true; - } - }; - new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), campaignList.RectTransform), TextManager.Get("LoadGameButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton") { ForceUpperCase = true, @@ -198,10 +184,6 @@ namespace Barotrauma UserData = Tab.SteamWorkshop, OnClicked = SelectTab }; - -#if OSX && !DEBUG - steamWorkshopButton.Text += " (Not yet available on MacOS)"; -#endif } new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), customizeList.RectTransform), TextManager.Get("SubEditorButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton") @@ -227,7 +209,7 @@ namespace Barotrauma }; // === OPTION - var optionHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.8f), parent: buttonsParent.RectTransform), isHorizontal: true); + var optionHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.5f), parent: buttonsParent.RectTransform), isHorizontal: true); new GUIImage(new RectTransform(new Vector2(0.15f, 0.6f), optionHolder.RectTransform), "MainMenuOptionIcon") { @@ -237,9 +219,9 @@ namespace Barotrauma //spacing new GUIFrame(new RectTransform(new Vector2(0.01f, 0.0f), optionHolder.RectTransform), style: null); - var optionButtons = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 1.0f), parent: optionHolder.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.0f) }); + var optionButtons = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 1.0f), parent: optionHolder.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.05f) }); - var optionList = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 0.25f), parent: optionButtons.RectTransform)) + var optionList = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 0.3f), parent: optionButtons.RectTransform)) { Stretch = false, RelativeSpacing = 0.035f @@ -251,13 +233,6 @@ namespace Barotrauma UserData = Tab.Settings, OnClicked = SelectTab }; - //TODO: translate - new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), optionList.RectTransform), TextManager.Get("CreditsButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton") - { - ForceUpperCase = true, - UserData = Tab.Credits, - OnClicked = SelectTab - }; new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), optionList.RectTransform), TextManager.Get("QuitButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton") { ForceUpperCase = true, @@ -266,9 +241,9 @@ namespace Barotrauma //debug button for quickly starting a new round #if DEBUG - new GUIButton(new RectTransform(new Point(300, 30), Frame.RectTransform, Anchor.TopRight) { AbsoluteOffset = new Point(40, 40) }, + new GUIButton(new RectTransform(new Vector2(0.8f, 0.1f), buttonsParent.RectTransform, Anchor.TopLeft, Pivot.BottomLeft) { AbsoluteOffset = new Point(0, -40) }, "Quickstart (dev)", style: "GUIButtonLarge", color: Color.Red) - { + { IgnoreLayoutGroups = true, UserData = Tab.QuickStartDev, OnClicked = (tb, userdata) => @@ -334,7 +309,7 @@ namespace Barotrauma false, null, ""); foreach (Tutorial tutorial in Tutorial.Tutorials) { - var tutorialText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.15f), tutorialList.Content.RectTransform), tutorial.DisplayName, textAlignment: Alignment.Center, font: GUI.LargeFont) + var tutorialText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.15f), tutorialList.Content.RectTransform), tutorial.Name, textAlignment: Alignment.Center, font: GUI.LargeFont) { UserData = tutorial }; @@ -345,6 +320,8 @@ namespace Barotrauma return true; }; + UpdateTutorialList(); + this.game = game; menuTabs[(int)Tab.Credits] = new GUIFrame(new RectTransform(Vector2.One, GUI.Canvas), style: null, color: Color.Black * 0.5f) @@ -354,9 +331,9 @@ namespace Barotrauma var creditsContainer = new GUIFrame(new RectTransform(new Vector2(0.75f, 1.5f), menuTabs[(int)Tab.Credits].RectTransform, Anchor.CenterRight), style: "OuterGlow", color: Color.Black * 0.8f); creditsPlayer = new CreditsPlayer(new RectTransform(Vector2.One, creditsContainer.RectTransform), "Content/Texts/Credits.xml"); } -#endregion + #endregion -#region Selection + #region Selection public override void Select() { base.Select(); @@ -371,6 +348,10 @@ namespace Barotrauma ResetButtonStates(null); + UpdateTutorialList(); + + ResetButtonStates(null); + GameAnalyticsManager.SetCustomDimension01(""); } @@ -384,8 +365,6 @@ namespace Barotrauma { if (obj is Tab) { - titleText.Visible = true; - if (GameMain.Config.UnsavedSettings) { var applyBox = new GUIMessageBox( @@ -416,14 +395,9 @@ namespace Barotrauma switch (selectedTab) { case Tab.NewGame: - if (!GameMain.Config.CampaignDisclaimerShown) - { - selectedTab = 0; - GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.NewGame); }); - return true; - } campaignSetupUI.CreateDefaultSaveName(); campaignSetupUI.RandomizeSeed(); + campaignSetupUI.UpdateTutorialSelection(); campaignSetupUI.UpdateSubList(Submarine.SavedSubmarines); break; case Tab.LoadGame: @@ -440,13 +414,6 @@ namespace Barotrauma case Tab.HostServer: break; case Tab.Tutorials: - if (!GameMain.Config.CampaignDisclaimerShown) - { - selectedTab = 0; - GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.Tutorials); }); - return true; - } - UpdateTutorialList(); break; case Tab.CharacterEditor: Submarine.MainSub = null; @@ -462,9 +429,6 @@ namespace Barotrauma if (!Steam.SteamManager.IsInitialized) return false; GameMain.SteamWorkshopScreen.Select(); break; - case Tab.Credits: - titleText.Visible = false; - break; } } else @@ -480,8 +444,6 @@ namespace Barotrauma public bool ReturnToMainMenu(GUIButton button, object obj) { - GUI.PreventPauseMenuToggle = false; - if (Selected != this) { Select(); @@ -506,7 +468,7 @@ namespace Barotrauma otherButton.Selected = false; } } -#endregion + #endregion private void QuickStart() { @@ -673,22 +635,21 @@ namespace Barotrauma " -ownerkey " + ownerKey.ToString(); string filename = "DedicatedServer.exe"; -#if LINUX - filename = "./DedicatedServer"; -#elif OSX +#if LINUX || OSX filename = "mono"; arguments = "./DedicatedServer.exe " + arguments; #endif + var processInfo = new ProcessStartInfo { FileName = filename, - Arguments = arguments + Arguments = arguments, #if !DEBUG - , WindowStyle = ProcessWindowStyle.Hidden #endif }; GameMain.ServerChildProcess = Process.Start(processInfo); + Thread.Sleep(1000); //wait until the server is ready before connecting GameMain.Client = new GameClient(name, "127.0.0.1:" + port.ToString(),ownerKey); @@ -718,8 +679,12 @@ namespace Barotrauma public override void Update(double deltaTime) { + GameMain.TitleScreen.TitlePosition = + Vector2.Lerp(GameMain.TitleScreen.TitlePosition, new Vector2( + GameMain.TitleScreen.TitleSize.X / 2.0f * GameMain.TitleScreen.Scale + 30.0f, + GameMain.TitleScreen.TitleSize.Y / 2.0f * GameMain.TitleScreen.Scale + 30.0f), + 0.1f); #if !DEBUG -#if !OSX if (Steam.SteamManager.USE_STEAM) { if (GameMain.Config.UseSteamMatchmaking) @@ -729,16 +694,6 @@ namespace Barotrauma } steamWorkshopButton.Enabled = Steam.SteamManager.IsInitialized; } -#else - if (Steam.SteamManager.USE_STEAM) - { - if (GameMain.Config.UseSteamMatchmaking) - { - joinServerButton.Enabled = Steam.SteamManager.IsInitialized; - hostServerButton.Enabled = Steam.SteamManager.IsInitialized; - } - } -#endif #else joinServerButton.Enabled = true; hostServerButton.Enabled = true; @@ -768,13 +723,6 @@ namespace Barotrauma spriteBatch.End(); } - readonly string[] legalCrap = new string[] - { - "Privacy policy", - "© " + DateTime.Now.Year + " Undertow Games & FakeFish. All rights reserved.", - "© " + DateTime.Now.Year + " Daedalic Entertainment GmbH. The Daedalic logo is a trademark of Daedalic Entertainment GmbH, Germany. All rights reserved." - }; - public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) { DrawBackground(graphics, spriteBatch); @@ -782,7 +730,7 @@ namespace Barotrauma spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, GameMain.ScissorTestEnable); GUI.Draw(Cam, spriteBatch); - + #if DEBUG GUI.Font.DrawString(spriteBatch, "Barotrauma v" + GameMain.Version + " (debug build)", new Vector2(10, GameMain.GraphicsHeight - 20), Color.White); #else @@ -856,11 +804,13 @@ namespace Barotrauma } selectedSub = new Submarine(Path.Combine(SaveUtil.TempPath, selectedSub.Name + ".sub"), ""); - + + ContextualTutorial.Selected = campaignSetupUI.TutorialSelected; GameMain.GameSession = new GameSession(selectedSub, saveName, GameModePreset.List.Find(g => g.Identifier == "singleplayercampaign")); (GameMain.GameSession.GameMode as CampaignMode).GenerateMap(mapSeed); + GameMain.LobbyScreen.Select(); } @@ -882,7 +832,7 @@ namespace Barotrauma GameMain.LobbyScreen.Select(); } -#region UI Methods + #region UI Methods private void CreateHostServerFields() { Vector2 textLabelSize = new Vector2(1.0f, 0.1f); @@ -963,7 +913,7 @@ namespace Barotrauma OnClicked = HostServerClicked }; } -#endregion + #endregion } } diff --git a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs index fd5dfbfd0..a4c6c98f5 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs @@ -158,7 +158,14 @@ namespace Barotrauma get; private set; } - + + public GUIFrame MyCharacterFrame + { + get { return myCharacterFrame; } + } + + public bool MyCharacterFrameOpen; + public GUIFrame InfoFrame { get { return infoFrame; } @@ -286,6 +293,25 @@ namespace Barotrauma myCharacterFrame = new GUIFrame(new RectTransform(new Vector2(0.3f - panelSpacing, 0.65f), defaultModeContainer.RectTransform, Anchor.TopRight)); playerInfoContainer = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.9f), myCharacterFrame.RectTransform, Anchor.Center), style: null); + playYourself = new GUITickBox(new RectTransform(new Vector2(0.06f, 0.06f), myCharacterFrame.RectTransform) { RelativeOffset = new Vector2(0.05f,0.05f) }, + TextManager.Get("PlayYourself")) + { + Selected = true, + OnSelected = TogglePlayYourself, + UserData = "playyourself" + }; + + var toggleMyPlayerFrame = new GUIButton(new RectTransform(new Point(25, 70), myCharacterFrame.RectTransform, Anchor.TopLeft, Pivot.TopRight), "", style: "GUIButtonHorizontalArrow"); + toggleMyPlayerFrame.OnClicked += (GUIButton btn, object userdata) => + { + MyCharacterFrameOpen = !MyCharacterFrameOpen; + foreach (GUIComponent child in btn.Children) + { + child.SpriteEffects = MyCharacterFrameOpen ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + } + return true; + }; + playYourself = new GUITickBox(new RectTransform(new Vector2(0.06f, 0.06f), myCharacterFrame.RectTransform) { RelativeOffset = new Vector2(0.05f,0.05f) }, TextManager.Get("PlayYourself")) { @@ -437,13 +463,9 @@ namespace Barotrauma GUITextBlock textBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), modeList.Content.RectTransform), mode.Name, style: "ListBoxElement", textAlignment: Alignment.CenterLeft) { + ToolTip = mode.Description, UserData = mode }; - //TODO: translate mission descriptions - if (TextManager.Language == "English") - { - textBlock.ToolTip = mode.Description; - } } //mission type ------------------------------------------------------------------ @@ -684,6 +706,7 @@ namespace Barotrauma public override void Deselect() { textBox.Deselect(); + myCharacterFrame.GetChild().Visible = true; CampaignCharacterDiscarded = false; } @@ -698,7 +721,10 @@ namespace Barotrauma textBox.Select(); textBox.OnEnterPressed = GameMain.Client.EnterChatMessage; textBox.OnTextChanged += GameMain.Client.TypingChatMessage; - + + myCharacterFrame.RectTransform.AbsoluteOffset = new Point(0, 0); + myCharacterFrame.GetChild().Visible = false; + subList.Enabled = AllowSubSelection;// || GameMain.Server != null; shuttleList.Enabled = AllowSubSelection;// || GameMain.Server != null; @@ -719,15 +745,11 @@ namespace Barotrauma spectateButton.Visible = GameMain.Client.GameStarted; ReadyToStartBox.Visible = !GameMain.Client.GameStarted; ReadyToStartBox.Selected = false; - if (campaignUI != null) + if (campaignUI?.StartButton != null) { - //SelectTab(Tab.Map); - if (campaignUI.StartButton != null) - { - campaignUI.StartButton.Visible = !GameMain.Client.GameStarted && - (GameMain.Client.HasPermission(ClientPermissions.ManageRound) || - GameMain.Client.HasPermission(ClientPermissions.ManageCampaign)); - } + campaignUI.StartButton.Visible = !GameMain.Client.GameStarted && + (GameMain.Client.HasPermission(ClientPermissions.ManageRound) || + GameMain.Client.HasPermission(ClientPermissions.ManageCampaign)); } GameMain.Client.SetReadyToStart(ReadyToStartBox); } @@ -1220,7 +1242,7 @@ namespace Barotrauma if (sub.HasTag(SubmarineTag.Shuttle)) { new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), frame.RectTransform, Anchor.CenterRight) { RelativeOffset = new Vector2(0.1f, 0.0f) }, - TextManager.Get("Shuttle", fallBackTag: "RespawnShuttle"), textAlignment: Alignment.CenterRight, font: GUI.SmallFont) + TextManager.Get("Shuttle"), textAlignment: Alignment.CenterRight, font: GUI.SmallFont) { TextColor = subTextBlock.TextColor * 0.8f, ToolTip = subTextBlock.ToolTip, diff --git a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs index cbbdff396..f4212dc18 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs @@ -60,10 +60,7 @@ namespace Barotrauma var infoHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), leftColumn.RectTransform)) { RelativeSpacing = 0.05f }; new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), infoHolder.RectTransform, Anchor.Center), TextManager.Get("JoinServer"), font: GUI.LargeFont) - { - ForceUpperCase = true, - AutoScale = true - }; + { ForceUpperCase = true }; new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoHolder.RectTransform), TextManager.Get("YourName")); clientNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), infoHolder.RectTransform), "") diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SpriteEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SpriteEditorScreen.cs index f924e04a8..56adb609f 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/SpriteEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/SpriteEditorScreen.cs @@ -329,8 +329,6 @@ namespace Barotrauma { element.Elements("sprite").ForEach(s => CreateSprite(s)); element.Elements("Sprite").ForEach(s => CreateSprite(s)); - element.Elements("backgroundsprite").ForEach(s => CreateSprite(s)); - element.Elements("BackgroundSprite").ForEach(s => CreateSprite(s)); element.Elements("brokensprite").ForEach(s => CreateSprite(s)); element.Elements("BrokenSprite").ForEach(s => CreateSprite(s)); element.Elements("containedsprite").ForEach(s => CreateSprite(s)); diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs index bd16c716c..a9918309b 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; -using System.Text; using System.Windows.Forms; namespace Barotrauma @@ -44,6 +43,7 @@ namespace Barotrauma private ContentPackage itemContentPackage; private Facepunch.Steamworks.Workshop.Editor itemEditor; + //private Facepunch.Steamworks.Overlay overlay; public SteamWorkshopScreen() { @@ -131,7 +131,7 @@ namespace Barotrauma OutlineColor = new Color(72, 124, 77, 255), OnClicked = (btn, userdata) => { - SteamManager.OverlayCustomURL("steam://url/SteamWorkshopPage/" + SteamManager.AppID); + System.Diagnostics.Process.Start("steam://url/SteamWorkshopPage/" + SteamManager.AppID); return true; } }; @@ -309,23 +309,14 @@ namespace Barotrauma return; } - int prevIndex = -1; var existingFrame = listBox.Content.FindChild(item); - if (existingFrame != null) - { - prevIndex = listBox.Content.GetChildIndex(existingFrame); - listBox.Content.RemoveChild(existingFrame); - } + if (existingFrame != null) { listBox.Content.RemoveChild(existingFrame); } var itemFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.1f), listBox.Content.RectTransform, minSize: new Point(0, 80)), style: "ListBoxElement") { UserData = item }; - if (prevIndex > -1) - { - itemFrame.RectTransform.RepositionChildInHierarchy(prevIndex); - } var innerFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), itemFrame.RectTransform, Anchor.Center), isHorizontal: true) { @@ -338,7 +329,6 @@ namespace Barotrauma { new GUIImage(new RectTransform(new Point(iconSize), innerFrame.RectTransform), itemPreviewSprites[item.PreviewImageUrl], scaleToFit: true) { - UserData = "previewimage", CanBeFocused = false }; } @@ -346,7 +336,6 @@ namespace Barotrauma { new GUIImage(new RectTransform(new Point(iconSize), innerFrame.RectTransform), SteamManager.Instance.DefaultPreviewImage, scaleToFit: true) { - UserData = "previewimage", CanBeFocused = false }; try @@ -381,7 +370,7 @@ namespace Barotrauma catch (Exception e) { pendingPreviewImageDownloads.Remove(item.PreviewImageUrl); - DebugConsole.ThrowError("Downloading the preview image of the Workshop item \"" + EnsureUTF8(item.Title) + "\" failed.", e); + DebugConsole.ThrowError("Downloading the preview image of the Workshop item \"" + item.Title + "\" failed.", e); } } @@ -392,9 +381,8 @@ namespace Barotrauma CanBeFocused = false }; - var titleText = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), rightColumn.RectTransform), EnsureUTF8(item.Title), textAlignment: Alignment.CenterLeft, wrap: true) + var titleText = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), rightColumn.RectTransform), item.Title, textAlignment: Alignment.CenterLeft, wrap: true) { - UserData = "titletext", CanBeFocused = false }; @@ -410,14 +398,14 @@ namespace Barotrauma { if (SteamManager.UpdateWorkshopItem(item, out string errorMsg)) { - new GUIMessageBox("", TextManager.Get("WorkshopItemUpdated").Replace("[itemname]", EnsureUTF8(item.Title))); + new GUIMessageBox("", TextManager.Get("WorkshopItemUpdated").Replace("[itemname]", item.Title)); } else { DebugConsole.ThrowError(errorMsg); new GUIMessageBox( TextManager.Get("Error"), - TextManager.Get("WorkshopItemUpdateFailed").Replace("[itemname]", EnsureUTF8(item.Title)).Replace("[errormessage]", errorMsg)); + TextManager.Get("WorkshopItemUpdateFailed").Replace("[itemname]", item.Title).Replace("[errormessage]", errorMsg)); } btn.Enabled = false; btn.Visible = false; @@ -559,17 +547,7 @@ namespace Barotrauma itemPreviewSprites.Add(item.PreviewImageUrl, newSprite); } - - var previewImage = listBox.Content.FindChild(item)?.GetChildByUserData("previewimage") as GUIImage; - if (previewImage != null) - { - previewImage.Sprite = newSprite; - } - else - { - CreateWorkshopItemFrame(item, listBox); - } - + CreateWorkshopItemFrame(item, listBox); if (modsPreviewFrame.FindChild(item) != null) { ShowItemPreview(item, modsPreviewFrame); @@ -597,7 +575,8 @@ namespace Barotrauma private bool ToggleItemEnabled(GUITickBox tickBox) { - if (!(tickBox.UserData is Facepunch.Steamworks.Workshop.Item item)) { return false; } + Facepunch.Steamworks.Workshop.Item item = tickBox.UserData as Facepunch.Steamworks.Workshop.Item; + if (item == null) { return false; } var updateButton = tickBox.Parent.FindChild("updatebutton"); @@ -606,9 +585,7 @@ namespace Barotrauma { if (!SteamManager.EnableWorkShopItem(item, false, out errorMsg)) { - tickBox.Visible = false; - tickBox.Selected = false; - if (tickBox.Parent.GetChildByUserData("titletext") is GUITextBlock titleText) { titleText.TextColor = Color.Red; } + tickBox.Enabled = false; } } else @@ -617,7 +594,6 @@ namespace Barotrauma { tickBox.Enabled = false; } - GameMain.Config.EnsureCoreContentPackageSelected(); } if (updateButton != null) { @@ -648,11 +624,11 @@ namespace Barotrauma //spacing new GUIFrame(new RectTransform(new Vector2(1.0f, 0.005f), content.RectTransform), style: null); - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), EnsureUTF8(item.Title), textAlignment: Alignment.TopLeft, font: GUI.LargeFont, wrap: true); + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), item.Title, textAlignment: Alignment.TopLeft, font: GUI.LargeFont, wrap: true); var creatorHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.05f), content.RectTransform)) { IsHorizontal = true, Stretch = true }; - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), creatorHolder.RectTransform), TextManager.Get("WorkshopItemCreator") + ": " + EnsureUTF8(item.OwnerName), textAlignment: Alignment.BottomLeft, wrap: true); + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), creatorHolder.RectTransform), TextManager.Get("WorkshopItemCreator") + ": " + item.OwnerName, textAlignment: Alignment.BottomLeft, wrap: true); new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), creatorHolder.RectTransform, Anchor.BottomRight), TextManager.Get("WorkshopShowItemInSteam"), style: null) { @@ -662,7 +638,13 @@ namespace Barotrauma OutlineColor = new Color(72, 124, 77, 255), OnClicked = (btn, userdata) => { - SteamManager.OverlayCustomURL("steam://url/CommunityFilePage/" + item.Id); + // Failed attempt, might have to be activated before accessing because as of now it just throws a null for overlay + /*if (overlay.Enabled) + { + overlay.OpenUrl("steam://url/CommunityFilePage/" + item.Id); + }*/ + + System.Diagnostics.Process.Start("steam://url/CommunityFilePage/" + item.Id); return true; } }; @@ -685,7 +667,7 @@ namespace Barotrauma //spacing new GUIFrame(new RectTransform(new Vector2(1.0f, 0.0f), descriptionContainer.Content.RectTransform) { MinSize = new Point(0, 5) }, style: null); - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), descriptionContainer.Content.RectTransform), EnsureUTF8(item.Description), wrap: true) + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), descriptionContainer.Content.RectTransform), item.Description, wrap: true) { CanBeFocused = false }; @@ -763,28 +745,25 @@ namespace Barotrauma itemEditor.Tags.Add("Submarine"); itemEditor.Description = sub.Description; - if (sub.PreviewImage != null) + string previewImagePath = Path.GetFullPath(Path.Combine(SteamManager.WorkshopItemStagingFolder, SteamManager.PreviewImageName)); + try { - string previewImagePath = Path.GetFullPath(Path.Combine(SteamManager.WorkshopItemStagingFolder, SteamManager.PreviewImageName)); - try + using (Stream s = File.Create(previewImagePath)) { - using (Stream s = File.Create(previewImagePath)) - { - sub.PreviewImage.Texture.SaveAsPng(s, (int)sub.PreviewImage.size.X, (int)sub.PreviewImage.size.Y); - itemEditor.PreviewImage = previewImagePath; - } - if (new FileInfo(previewImagePath).Length > 1024 * 1024) - { - new GUIMessageBox(TextManager.Get("Error"), TextManager.Get("WorkshopItemPreviewImageTooLarge")); - itemEditor.PreviewImage = SteamManager.DefaultPreviewImagePath; - } + sub.PreviewImage.Texture.SaveAsPng(s, (int)sub.PreviewImage.size.X, (int)sub.PreviewImage.size.Y); + itemEditor.PreviewImage = previewImagePath; } - catch (Exception e) + if (new FileInfo(previewImagePath).Length > 1024 * 1024) { - DebugConsole.ThrowError("Saving submarine preview image failed.", e); - itemEditor.PreviewImage = null; + new GUIMessageBox(TextManager.Get("Error"), TextManager.Get("WorkshopItemPreviewImageTooLarge")); + itemEditor.PreviewImage = SteamManager.DefaultPreviewImagePath; } } + catch (Exception e) + { + DebugConsole.ThrowError("Saving submarine preview image failed.", e); + itemEditor.PreviewImage = null; + } } private void CreateWorkshopItem(ContentPackage contentPackage) { @@ -821,7 +800,7 @@ namespace Barotrauma if (!item.Installed) { new GUIMessageBox(TextManager.Get("Error"), - TextManager.Get("WorkshopErrorInstallRequiredToEdit").Replace("[itemname]", EnsureUTF8(item.Title))); + TextManager.Get("WorkshopErrorInstallRequiredToEdit").Replace("[itemname]", item.Title)); return; } SteamManager.CreateWorkshopItemStaging(item, out itemEditor, out itemContentPackage); @@ -1256,7 +1235,7 @@ namespace Barotrauma string pleaseWaitText = TextManager.Get("WorkshopPublishPleaseWait"); var msgBox = new GUIMessageBox( pleaseWaitText, - TextManager.Get("WorkshopPublishInProgress").Replace("[itemname]", EnsureUTF8(item.Title)), + TextManager.Get("WorkshopPublishInProgress").Replace("[itemname]", item.Title), new string[] { TextManager.Get("Cancel") }); msgBox.Buttons[0].OnClicked = (btn, userdata) => @@ -1278,13 +1257,13 @@ namespace Barotrauma if (string.IsNullOrEmpty(item.Error)) { - new GUIMessageBox("", TextManager.Get("WorkshopItemPublished").Replace("[itemname]", EnsureUTF8(item.Title))); + new GUIMessageBox("", TextManager.Get("WorkshopItemPublished").Replace("[itemname]", item.Title)); } else { new GUIMessageBox( TextManager.Get("Error"), - TextManager.Get("WorkshopItemPublishFailed").Replace("[itemname]", EnsureUTF8(item.Title)) + item.Error); + TextManager.Get("WorkshopItemPublishFailed").Replace("[itemname]", item.Title) + item.Error); } createItemFrame.ClearChildren(); @@ -1313,12 +1292,6 @@ namespace Barotrauma { } - private string EnsureUTF8(string text) - { - byte[] bytes = Encoding.Default.GetBytes(text); - return Encoding.UTF8.GetString(bytes); - } - #endregion } } diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs index 504e0330b..cbce18229 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs @@ -183,12 +183,6 @@ namespace Barotrauma TextGetter = GetSubName }; - var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(0.1f, 1.0f), paddedTopPanel.RectTransform, Anchor.CenterRight), style: "GUINotificationButton") - { - OnClicked = (btn, userdata) => { GameMain.Instance.ShowEditorDisclaimer(); return true; } - }; - disclaimerBtn.RectTransform.MaxSize = new Point(disclaimerBtn.Rect.Height); - linkedSubBox = new GUIDropDown(new RectTransform(new Vector2(0.15f, 0.9f), paddedTopPanel.RectTransform) { RelativeOffset = new Vector2(0.385f, 0.0f) }, TextManager.Get("AddSubButton"), elementCount: 20) { @@ -257,12 +251,12 @@ namespace Barotrauma saveAssemblyFrame = new GUIFrame(new RectTransform(new Vector2(0.08f, 0.5f), TopPanel.RectTransform, Anchor.BottomLeft, Pivot.TopLeft) - { MinSize = new Point(200, 40), AbsoluteOffset = new Point(LeftPanel.Rect.Width + hullVolumeFrame.Rect.Width, 0) }, "InnerFrame") + { MinSize = new Point(180, 40), AbsoluteOffset = new Point(LeftPanel.Rect.Width + hullVolumeFrame.Rect.Width, 0) }, "InnerFrame") { Visible = false }; var saveAssemblyButton = new GUIButton(new RectTransform(new Vector2(0.9f, 0.8f), saveAssemblyFrame.RectTransform, Anchor.Center), TextManager.Get("SaveItemAssembly")); - saveAssemblyButton.TextBlock.AutoScale = true; + saveAssemblyFrame.Font = GUI.SmallFont; saveAssemblyButton.OnClicked += (btn, userdata) => { CreateSaveAssemblyScreen(); @@ -317,11 +311,10 @@ namespace Barotrauma Stretch = true }; - entityCategoryButtons.Add( - new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform), TextManager.Get("MapEntityCategory.All"), style: "GUITabButton") - { - OnClicked = (btn, userdata) => { entityCategoryButtons.ForEach(b => b.Selected = b == btn); ClearFilter(); return true; } - }); + new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform), TextManager.Get("MapEntityCategory.All"), style: "GUITabButton") + { + OnClicked = (btn, userdata) => { ClearFilter(); return true; } + }; foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory))) { @@ -338,8 +331,6 @@ namespace Barotrauma }); } - GUITextBlock.AutoScaleAndNormalize(entityCategoryButtons.Select(b => b.TextBlock)); - entityList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.9f), entityListHolder.RectTransform, Anchor.BottomCenter)) { OnSelected = SelectPrefab, @@ -354,7 +345,7 @@ namespace Barotrauma var characterModeTickBoxHolder = new GUILayoutGroup(new RectTransform(new Vector2(paddedLeftPanel.RectTransform.RelativeSize.X, 0.01f), paddedLeftPanel.RectTransform) { MinSize = new Point(0, 32) }) { Color = secondaryColor }; - characterModeTickBox = new GUITickBox(new RectTransform(Vector2.One, characterModeTickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("CharacterModeButton")) + characterModeTickBox = new GUITickBox(new RectTransform(new Point(32, 32), characterModeTickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("CharacterModeButton")) { ToolTip = TextManager.Get("CharacterModeToolTip"), OnSelected = (GUITickBox tBox) => @@ -367,7 +358,7 @@ namespace Barotrauma var wiringModeTickBoxHolder = new GUILayoutGroup(new RectTransform(new Vector2(paddedLeftPanel.RectTransform.RelativeSize.X, 0.01f), paddedLeftPanel.RectTransform) { MinSize = new Point(0, 32) }) { Color = secondaryColor }; - wiringModeTickBox = new GUITickBox(new RectTransform(Vector2.One, wiringModeTickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("WiringModeButton")) + wiringModeTickBox = new GUITickBox(new RectTransform(new Point(32, 32), wiringModeTickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("WiringModeButton")) { ToolTip = TextManager.Get("WiringModeToolTip"), OnSelected = (GUITickBox tBox) => @@ -376,9 +367,7 @@ namespace Barotrauma return true; } }; - - GUITextBlock.AutoScaleAndNormalize(characterModeTickBox.TextBlock, wiringModeTickBox.TextBlock); - + button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.025f), paddedLeftPanel.RectTransform), TextManager.Get("GenerateWaypointsButton"), style: null, color: new Color(70, 100, 122, 255)) { ForceUpperCase = true, @@ -387,18 +376,17 @@ namespace Barotrauma ToolTip = TextManager.Get("GenerateWaypointsToolTip"), OnClicked = GenerateWaypoints }; - button.TextBlock.AutoScale = true; //spacing new GUIFrame(new RectTransform(new Vector2(1.0f, 0.01f), paddedLeftPanel.RectTransform), style: null); - var tickBoxHolder = new GUILayoutGroup(new RectTransform(new Vector2(paddedLeftPanel.RectTransform.RelativeSize.X, 0.3f), paddedLeftPanel.RectTransform)) - { Color = secondaryColor, Stretch = true, RelativeSpacing = 0.05f }; + var showEntitiesHolder = new GUILayoutGroup(new RectTransform(new Vector2(paddedLeftPanel.RectTransform.RelativeSize.X, 0.3f), paddedLeftPanel.RectTransform)) + { Color = secondaryColor, Stretch = true, RelativeSpacing = 0.05f }; //spacing - new GUIFrame(new RectTransform(new Vector2(1.0f, 0.0f), tickBoxHolder.RectTransform) { MinSize = new Point(0, 3) }, style: null); + new GUIFrame(new RectTransform(new Vector2(1.0f, 0.0f), showEntitiesHolder.RectTransform) { MinSize = new Point(0, 3) }, style: null); - var tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), tickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowLighting")) + var tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowLighting")) { Selected = lightingEnabled, OnSelected = (GUITickBox obj) => @@ -420,64 +408,53 @@ namespace Barotrauma return true; } }; - tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), tickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowWalls")) + tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowWalls")) { Selected = Structure.ShowWalls, OnSelected = (GUITickBox obj) => { Structure.ShowWalls = obj.Selected; return true; } }; - tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), tickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowStructures")) + tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowStructures")) { Selected = Structure.ShowStructures, OnSelected = (GUITickBox obj) => { Structure.ShowStructures = obj.Selected; return true; } }; - tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), tickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowItems")) + tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowItems")) { Selected = Item.ShowItems, OnSelected = (GUITickBox obj) => { Item.ShowItems = obj.Selected; return true; } }; - tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), tickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowWaypoints")) + tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowWaypoints")) { Selected = WayPoint.ShowWayPoints, OnSelected = (GUITickBox obj) => { WayPoint.ShowWayPoints = obj.Selected; return true; } }; - tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), tickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowSpawnpoints")) + tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowSpawnpoints")) { Selected = WayPoint.ShowSpawnPoints, OnSelected = (GUITickBox obj) => { WayPoint.ShowSpawnPoints = obj.Selected; return true; } }; - tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), tickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowLinks")) + tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowLinks")) { Selected = Item.ShowLinks, OnSelected = (GUITickBox obj) => { Item.ShowLinks = obj.Selected; return true; } }; - tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), tickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowHulls")) + tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowHulls")) { Selected = Hull.ShowHulls, OnSelected = (GUITickBox obj) => { Hull.ShowHulls = obj.Selected; return true; } }; - tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), tickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowGaps")) + tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowGaps")) { Selected = Gap.ShowGaps, OnSelected = (GUITickBox obj) => { Gap.ShowGaps = obj.Selected; return true; }, }; - tickBoxHolder.Children.ForEach(c => - { - if (c is GUITickBox tb) { tb.RectTransform.MinSize = new Point(0, 32); } - }); - - GUITextBlock.AutoScaleAndNormalize(tickBoxHolder.Children.Where(c => c is GUITickBox).Select(c => ((GUITickBox)c).TextBlock)); - //spacing - new GUIFrame(new RectTransform(new Vector2(1.0f, 0.0f), tickBoxHolder.RectTransform) { MinSize = new Point(0, 3) }, style: null); + new GUIFrame(new RectTransform(new Vector2(1.0f, 0.0f), showEntitiesHolder.RectTransform) { MinSize = new Point(0, 3) }, style: null); - new GUITextBlock(new RectTransform(new Vector2(0.95f, 0.025f), paddedLeftPanel.RectTransform, Anchor.BottomCenter) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("PreviouslyUsedLabel")) + new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.025f), paddedLeftPanel.RectTransform, Anchor.BottomCenter) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("PreviouslyUsedLabel")); + previouslyUsedList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.2f), paddedLeftPanel.RectTransform, Anchor.BottomCenter) { AbsoluteOffset = new Point(10, 0) }) { - AutoScale = true - }; - previouslyUsedList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.2f), paddedLeftPanel.RectTransform, Anchor.BottomCenter)) - { - ScrollBarVisible = true, OnSelected = SelectPrefab }; @@ -830,7 +807,7 @@ namespace Barotrauma { if (dummyCharacter != null) RemoveDummyCharacter(); - dummyCharacter = Character.Create(Character.HumanConfigFile, Vector2.Zero, "", hasAi: false); + dummyCharacter = Character.Create(Character.HumanConfigFile, Vector2.Zero, ""); //make space for the entity menu for (int i = 0; i < dummyCharacter.Inventory.SlotPositions.Length; i++) @@ -909,10 +886,6 @@ namespace Barotrauma GUI.AddMessage(TextManager.Get("SubSavedNotification").Replace("[filepath]", Submarine.MainSub.FilePath), Color.Green); Submarine.RefreshSavedSub(savePath); - if (prevSavePath != null && prevSavePath != savePath) - { - Submarine.RefreshSavedSub(prevSavePath); - } linkedSubBox.ClearChildren(); foreach (Submarine sub in Submarine.SavedSubmarines) @@ -1052,7 +1025,7 @@ namespace Barotrauma var previewImageButtonHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), rightColumn.RectTransform), isHorizontal: true) { Stretch = true, RelativeSpacing = 0.05f }; - new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), previewImageButtonHolder.RectTransform), TextManager.Get("SubPreviewImageCreate")) + new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), previewImageButtonHolder.RectTransform), TextManager.Get("SubPreviewImageGenerate")) { OnClicked = (btn, userdata) => { @@ -1204,6 +1177,7 @@ namespace Barotrauma AbsoluteSpacing = 5, Stretch = true }; +#endif new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedSaveFrame.RectTransform), TextManager.Get("SaveItemAssemblyDialogHeader"), font: GUI.LargeFont); @@ -1304,8 +1278,9 @@ namespace Barotrauma { if (CharacterMode) SetCharacterMode(false); if (WiringMode) SetWiringMode(false); - - + + var innerFrame = new GUIFrame(new RectTransform(new Vector2(0.2f, 0.36f), loadFrame.RectTransform, Anchor.Center) { MinSize = new Point(350, 500) }); + loadFrame = new GUIButton(new RectTransform(Vector2.One, GUI.Canvas), style: "GUIBackgroundBlocker") { OnClicked = (btn, userdata) => { if (GUI.MouseOn == btn || GUI.MouseOn == btn.TextBlock) loadFrame = null; return true; }, @@ -1313,15 +1288,10 @@ namespace Barotrauma var innerFrame = new GUIFrame(new RectTransform(new Vector2(0.2f, 0.36f), loadFrame.RectTransform, Anchor.Center) { MinSize = new Point(350, 500) }); - var paddedLoadFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), innerFrame.RectTransform, Anchor.Center)) { Stretch = true, RelativeSpacing = 0.02f }; + var paddedLoadFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), innerFrame.RectTransform, Anchor.Center)) { Stretch = true, RelativeSpacing = 0.05f }; var deleteButtonHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), paddedLoadFrame.RectTransform, Anchor.Center)); - var filterContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), paddedLoadFrame.RectTransform), isHorizontal: true) - { - Stretch = true - }; - var subList = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), paddedLoadFrame.RectTransform)) { ScrollBarVisible = true, @@ -1332,17 +1302,6 @@ namespace Barotrauma } }; - var searchTitle = new GUITextBlock(new RectTransform(new Vector2(0.001f, 1.0f), filterContainer.RectTransform), TextManager.Get("FilterMapEntities"), textAlignment: Alignment.CenterLeft, font: GUI.Font); - var searchBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 1.0f), filterContainer.RectTransform), font: GUI.Font); - searchBox.OnSelected += (sender, userdata) => { searchTitle.Visible = false; }; - searchBox.OnDeselected += (sender, userdata) => { searchTitle.Visible = true; }; - - searchBox.OnTextChanged += (textBox, text) => { FilterSubs(subList, text); return true; }; - var clearButton = new GUIButton(new RectTransform(new Vector2(0.1f, 1.0f), filterContainer.RectTransform), "x") - { - OnClicked = (btn, userdata) => { searchBox.Text = ""; FilterSubs(subList, ""); searchBox.Flash(Color.White); return true; } - }; - foreach (Submarine sub in Submarine.SavedSubmarines) { GUITextBlock textBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), subList.Content.RectTransform) { MinSize = new Point(0, 30) }, @@ -1355,7 +1314,7 @@ namespace Barotrauma if (sub.HasTag(SubmarineTag.Shuttle)) { var shuttleText = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1.0f), textBlock.RectTransform, Anchor.CenterRight), - TextManager.Get("Shuttle", fallBackTag: "RespawnShuttle"), font: GUI.SmallFont) + TextManager.Get("Shuttle"), font: GUI.SmallFont) { TextColor = textBlock.TextColor * 0.8f, ToolTip = textBlock.ToolTip @@ -1404,16 +1363,6 @@ namespace Barotrauma } private void FilterSubs(GUIListBox subList, string filter) - { - foreach (GUIComponent child in subList.Content.Children) - { - var sub = child.UserData as Submarine; - if (sub == null) { return; } - child.Visible = string.IsNullOrEmpty(filter) ? true : sub.Name.ToLower().Contains(filter.ToLower()); - } - } - - private bool LoadSub(GUIButton button, object obj) { if (loadFrame == null) { @@ -1509,9 +1458,7 @@ namespace Barotrauma ClearFilter(); foreach (GUIButton button in entityCategoryButtons) { - button.Selected = - button.UserData != null && - (MapEntityCategory)button.UserData == selectedCategory; + button.Selected = (MapEntityCategory)button.UserData == selectedCategory; } foreach (GUIComponent child in toggleEntityMenuButton.Children) @@ -2293,11 +2240,6 @@ namespace Barotrauma GameMain.LightManager.UpdateLightMap(graphics, spriteBatch, cam); } - foreach (Submarine sub in Submarine.Loaded) - { - sub.UpdateTransform(); - } - spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, diff --git a/Barotrauma/BarotraumaClient/Source/Serialization/SerializableEntityEditor.cs b/Barotrauma/BarotraumaClient/Source/Serialization/SerializableEntityEditor.cs index fb6a86f1e..0d756b322 100644 --- a/Barotrauma/BarotraumaClient/Source/Serialization/SerializableEntityEditor.cs +++ b/Barotrauma/BarotraumaClient/Source/Serialization/SerializableEntityEditor.cs @@ -277,17 +277,13 @@ namespace Barotrauma { component.RectTransform.Parent = layoutGroup.RectTransform; component.RectTransform.RepositionChildInHierarchy(childIndex); - Recalculate(); - } - public void Recalculate() - { int contentHeight = ContentHeight; RectTransform.NonScaledSize = new Point(RectTransform.NonScaledSize.X, contentHeight); layoutGroup.RectTransform.NonScaledSize = new Point(layoutGroup.RectTransform.NonScaledSize.X, contentHeight); } - public GUIComponent CreateNewField(SerializableProperty property, ISerializableEntity entity) + private GUIComponent CreateNewField(SerializableProperty property, ISerializableEntity entity) { object value = property.GetValue(entity); if (property.PropertyType == typeof(string) && value == null) @@ -355,7 +351,7 @@ namespace Barotrauma return propertyField; } - public GUIComponent CreateBoolField(ISerializableEntity entity, SerializableProperty property, bool value, string displayName, string toolTip) + private GUIComponent CreateBoolField(ISerializableEntity entity, SerializableProperty property, bool value, string displayName, string toolTip) { GUITickBox propertyTickBox = new GUITickBox(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), displayName) { @@ -371,11 +367,11 @@ namespace Barotrauma return true; } }; - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { propertyTickBox }); } + Fields.Add(property.Name, new GUIComponent[] { propertyTickBox }); return propertyTickBox; } - public GUIComponent CreateIntField(ISerializableEntity entity, SerializableProperty property, int value, string displayName, string toolTip) + private GUIComponent CreateIntField(ISerializableEntity entity, SerializableProperty property, int value, string displayName, string toolTip) { var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent); var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont) @@ -399,11 +395,11 @@ namespace Barotrauma TrySendNetworkUpdate(entity, property); } }; - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { numberInput }); } + Fields.Add(property.Name, new GUIComponent[] { numberInput }); return frame; } - public GUIComponent CreateFloatField(ISerializableEntity entity, SerializableProperty property, float value, string displayName, string toolTip) + private GUIComponent CreateFloatField(ISerializableEntity entity, SerializableProperty property, float value, string displayName, string toolTip) { var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent); var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont) @@ -429,11 +425,11 @@ namespace Barotrauma TrySendNetworkUpdate(entity, property); } }; - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { numberInput }); } + Fields.Add(property.Name, new GUIComponent[] { numberInput }); return frame; } - public GUIComponent CreateEnumField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip) + private GUIComponent CreateEnumField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip) { var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), color: Color.Transparent); var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont) @@ -458,11 +454,11 @@ namespace Barotrauma return true; }; enumDropDown.SelectItem(value); - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { enumDropDown }); } + Fields.Add(property.Name, new GUIComponent[] { enumDropDown }); return frame; } - public GUIComponent CreateEnumFlagField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip) + private GUIComponent CreateEnumFlagField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip) { var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), color: Color.Transparent); var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont) @@ -491,26 +487,22 @@ namespace Barotrauma return true; }; - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { enumDropDown }); } + Fields.Add(property.Name, new GUIComponent[] { enumDropDown }); return frame; } - public GUIComponent CreateStringField(ISerializableEntity entity, SerializableProperty property, string value, string displayName, string toolTip) + private GUIComponent CreateStringField(ISerializableEntity entity, SerializableProperty property, string value, string displayName, string toolTip) { - var frame = new GUILayoutGroup(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), isHorizontal: true) - { - Stretch = true - }; + var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), color: Color.Transparent); var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont, textAlignment: Alignment.Left) { ToolTip = toolTip }; - GUITextBox propertyBox = new GUITextBox(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform)) + GUITextBox propertyBox = new GUITextBox(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform, Anchor.TopRight)) { ToolTip = toolTip, Font = GUI.SmallFont, Text = value, - OverflowClip = true, OnEnterPressed = (textBox, text) => { if (property.TrySetValue(entity, text)) @@ -522,36 +514,11 @@ namespace Barotrauma return true; } }; - string translationTextTag = property.GetAttribute()?.translationTextTag; - if (translationTextTag != null) - { - new GUIButton(new RectTransform(new Vector2(0.1f, 1), frame.RectTransform, Anchor.TopRight), "...") - { - OnClicked = (bt, userData) => { CreateTextPicker(translationTextTag, entity, property, propertyBox); return true; } - }; - propertyBox.OnTextChanged += (tb, text) => - { - string translatedText = TextManager.Get(text, returnNull: true); - if (translatedText == null) - { - propertyBox.TextColor = Color.Gray; - propertyBox.ToolTip = TextManager.Get("StringPropertyCannotTranslate").Replace("[tag]", text ?? ""); - } - else - { - propertyBox.TextColor = Color.LightGreen; - propertyBox.ToolTip = TextManager.Get("StringPropertyTranslate").Replace("[translation]", translatedText); - } - return true; - }; - propertyBox.Text = value; - } - - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { propertyBox }); } + Fields.Add(property.Name, new GUIComponent[] { propertyBox }); return frame; } - public GUIComponent CreatePointField(ISerializableEntity entity, SerializableProperty property, Point value, string displayName, string toolTip) + private GUIComponent CreatePointField(ISerializableEntity entity, SerializableProperty property, Point value, string displayName, string toolTip) { var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent); var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont) @@ -599,11 +566,11 @@ namespace Barotrauma }; fields[i] = numberInput; } - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); } + Fields.Add(property.Name, fields); return frame; } - public GUIComponent CreateVector2Field(ISerializableEntity entity, SerializableProperty property, Vector2 value, string displayName, string toolTip) + private GUIComponent CreateVector2Field(ISerializableEntity entity, SerializableProperty property, Vector2 value, string displayName, string toolTip) { var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent); var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont) @@ -653,11 +620,11 @@ namespace Barotrauma }; fields[i] = numberInput; } - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); } + Fields.Add(property.Name, fields); return frame; } - public GUIComponent CreateVector3Field(ISerializableEntity entity, SerializableProperty property, Vector3 value, string displayName, string toolTip) + private GUIComponent CreateVector3Field(ISerializableEntity entity, SerializableProperty property, Vector3 value, string displayName, string toolTip) { var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent); var label = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), frame.RectTransform), displayName, font: GUI.SmallFont) @@ -711,11 +678,11 @@ namespace Barotrauma }; fields[i] = numberInput; } - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); } + Fields.Add(property.Name, fields); return frame; } - public GUIComponent CreateVector4Field(ISerializableEntity entity, SerializableProperty property, Vector4 value, string displayName, string toolTip) + private GUIComponent CreateVector4Field(ISerializableEntity entity, SerializableProperty property, Vector4 value, string displayName, string toolTip) { var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent); var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform), displayName, font: GUI.SmallFont) @@ -773,14 +740,14 @@ namespace Barotrauma }; fields[i] = numberInput; } - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); } + Fields.Add(property.Name, fields); return frame; } - public GUIComponent CreateColorField(ISerializableEntity entity, SerializableProperty property, Color value, string displayName, string toolTip) + private GUIComponent CreateColorField(ISerializableEntity entity, SerializableProperty property, Color value, string displayName, string toolTip) { var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent); - var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform) { MinSize = new Point(80, 26) }, displayName, font: GUI.SmallFont) + var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform) { MinSize = new Point(80, 26)}, displayName, font: GUI.SmallFont) { ToolTip = toolTip }; @@ -840,11 +807,11 @@ namespace Barotrauma colorBox.Color = (Color)property.GetValue(entity); fields[i] = numberInput; } - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); } + Fields.Add(property.Name, fields); return frame; } - public GUIComponent CreateRectangleField(ISerializableEntity entity, SerializableProperty property, Rectangle value, string displayName, string toolTip) + private GUIComponent CreateRectangleField(ISerializableEntity entity, SerializableProperty property, Rectangle value, string displayName, string toolTip) { var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent); var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform), displayName, font: GUI.SmallFont) @@ -900,44 +867,9 @@ namespace Barotrauma }; fields[i] = numberInput; } - if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); } + Fields.Add(property.Name, fields); return frame; } - - public void CreateTextPicker(string textTag, ISerializableEntity entity, SerializableProperty property, GUITextBox textBox) - { - var msgBox = new GUIMessageBox("", "", new string[] { TextManager.Get("Cancel") }, width: 300, height: 400); - msgBox.Buttons[0].OnClicked = msgBox.Close; - - var textList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.8f), msgBox.Content.RectTransform, Anchor.TopCenter)) - { - OnSelected = (component, userData) => - { - string text = userData as string ?? ""; - - if (property.TrySetValue(entity, text)) - { - TrySendNetworkUpdate(entity, property); - textBox.Text = (string)property.GetValue(entity); - textBox.Deselect(); - } - return true; - } - }; - - textTag = textTag.ToLowerInvariant(); - var tagTextPairs = TextManager.GetAllTagTextPairs(); - tagTextPairs.Sort((t1, t2) => { return t1.Value.CompareTo(t2.Value); }); - foreach (KeyValuePair tagTextPair in tagTextPairs) - { - if (!tagTextPair.Key.StartsWith(textTag)) { continue; } - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), textList.Content.RectTransform) { MinSize = new Point(0, 20) }, - ToolBox.LimitString(tagTextPair.Value, GUI.Font, textList.Content.Rect.Width)) - { - UserData = tagTextPair.Key - }; - } - } private void TrySendNetworkUpdate(ISerializableEntity entity, SerializableProperty property) { diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs b/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs index 515bc987a..a2335e8e8 100644 --- a/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs +++ b/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs @@ -35,7 +35,6 @@ namespace Barotrauma { public readonly string File; public readonly string Type; - public readonly bool DuckVolume; public readonly Vector2 IntensityRange; @@ -44,7 +43,6 @@ namespace Barotrauma this.File = Path.GetFullPath(element.GetAttributeString("file", "")); this.Type = element.GetAttributeString("type", "").ToLowerInvariant(); this.IntensityRange = element.GetAttributeVector2("intensityrange", new Vector2(0.0f, 100.0f)); - this.DuckVolume = element.GetAttributeBool("duckvolume", false); } } @@ -238,7 +236,7 @@ namespace Barotrauma } float ambienceVolume = 0.8f; - if (Character.Controlled != null && !Character.Controlled.Removed) + if (Character.Controlled != null) { AnimController animController = Character.Controlled.AnimController; if (animController.HeadInWater) @@ -374,6 +372,167 @@ namespace Barotrauma } } + private static void UpdateFireSounds(float deltaTime) + { + for (int i = 0; i < fireVolumeLeft.Length; i++) + { + fireVolumeLeft[i] = 0.0f; + fireVolumeRight[i] = 0.0f; + } + + Vector2 listenerPos = new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y); + foreach (Hull hull in Hull.hullList) + { + foreach (FireSource fs in hull.FireSources) + { + Vector2 diff = fs.WorldPosition + fs.Size / 2 - listenerPos; + if (Math.Abs(diff.X) < FireSoundRange && Math.Abs(diff.Y) < FireSoundRange) + { + Vector2 diffLeft = (fs.WorldPosition + new Vector2(fs.Size.X, fs.Size.Y / 2)) - listenerPos; + if (diff.X < fs.Size.X / 2.0f) diff.X = 0.0f; + if (diffLeft.X <= 0) + { + float distFallOffLeft = diffLeft.Length() / FireSoundRange; + if (distFallOffLeft < 0.99f) + { + fireVolumeLeft[0] += (1.0f - distFallOffLeft) * (fs.Size.X / FireSoundLargeLimit); + if (fs.Size.X > FireSoundLargeLimit) fireVolumeLeft[1] += (1.0f - distFallOffLeft) * ((fs.Size.X - FireSoundLargeLimit) / FireSoundLargeLimit); + } + } + + Vector2 diffRight = (fs.WorldPosition + new Vector2(0.0f, fs.Size.Y / 2)) - listenerPos; + if (diff.X < fs.Size.X / 2.0f) diff.X = 0.0f; + if (diffRight.X >= 0) + { + float distFallOffRight = diffRight.Length() / FireSoundRange; + if (distFallOffRight < 0.99f) + { + fireVolumeRight[0] += 1.0f - distFallOffRight; + if (fs.Size.X > FireSoundLargeLimit) fireVolumeRight[1] += (1.0f - distFallOffRight) * ((fs.Size.X - FireSoundLargeLimit) / FireSoundLargeLimit); + } + } + } + } + } + + for (int i = 0; i < fireVolumeLeft.Length; i++) + { + if (fireVolumeLeft[i] < 0.05f && fireVolumeRight[i] < 0.05f) + { + if (fireSoundChannels[i] != null) + { + fireSoundChannels[i].FadeOutAndDispose(); + fireSoundChannels[i] = null; + } + } + else + { + Vector2 soundPos = new Vector2(GameMain.SoundManager.ListenerPosition.X + (fireVolumeRight[i] - fireVolumeLeft[i]) * 100, GameMain.SoundManager.ListenerPosition.Y); + if (fireSoundChannels[i] == null || !fireSoundChannels[i].IsPlaying) + { + fireSoundChannels[i] = GetSound(i == 0 ? "fire" : "firelarge").Play(1.0f, FlowSoundRange, soundPos); + fireSoundChannels[i].Looping = true; + } + fireSoundChannels[i].Gain = Math.Max(fireVolumeRight[i], fireVolumeLeft[i]); + fireSoundChannels[i].Position = new Vector3(soundPos, 0.0f); + } + } + } + + if (waterAmbiences.Count > 1) + { + if (waterAmbienceChannels[0] == null || !waterAmbienceChannels[0].IsPlaying) + { + waterAmbienceChannels[0] = waterAmbiences[0].Play(ambienceVolume * (1.0f - movementSoundVolume),"waterambience"); + //waterAmbiences[0].Loop(waterAmbienceIndexes[0], ambienceVolume * (1.0f - movementSoundVolume)); + waterAmbienceChannels[0].Looping = true; + } + else + { + waterAmbienceChannels[0].Gain = ambienceVolume * (1.0f - movementSoundVolume); + } + + if (waterAmbienceChannels[1] == null || !waterAmbienceChannels[1].IsPlaying) + { + waterAmbienceChannels[1] = waterAmbiences[1].Play(ambienceVolume * movementSoundVolume, "waterambience"); + //waterAmbienceIndexes[1] = waterAmbiences[1].Loop(waterAmbienceIndexes[1], ambienceVolume * movementSoundVolume); + waterAmbienceChannels[1].Looping = true; + } + else + { + waterAmbienceChannels[1].Gain = ambienceVolume * movementSoundVolume; + } + } + } + + private static void UpdateWaterFlowSounds(float deltaTime) + { + if (FlowSounds.Count == 0) { return; } + + float[] targetFlowLeft = new float[FlowSounds.Count]; + float[] targetFlowRight = new float[FlowSounds.Count]; + + Vector2 listenerPos = new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y); + foreach (Gap gap in Gap.GapList) + { + if (gap.Open < 0.01f) continue; + float gapFlow = Math.Abs(gap.LerpedFlowForce.X) + Math.Abs(gap.LerpedFlowForce.Y) * 2.5f; + + if (gapFlow < 10.0f) continue; + + int flowSoundIndex = (int)Math.Floor(MathHelper.Clamp(gapFlow / MaxFlowStrength, 0, FlowSounds.Count)); + flowSoundIndex = Math.Min(flowSoundIndex, FlowSounds.Count - 1); + + Vector2 diff = gap.WorldPosition - listenerPos; + if (Math.Abs(diff.X) < FlowSoundRange && Math.Abs(diff.Y) < FlowSoundRange) + { + float dist = diff.Length(); + float distFallOff = dist / FlowSoundRange; + if (distFallOff >= 0.99f) continue; + + //flow at the left side + if (diff.X < 0) + { + targetFlowLeft[flowSoundIndex] = 1.0f - distFallOff; + } + else + { + targetFlowRight[flowSoundIndex] = 1.0f - distFallOff; + } + } + } + + for (int i = 0; i < FlowSounds.Count; i++) + { + flowVolumeLeft[i] = (targetFlowLeft[i] < flowVolumeLeft[i]) ? + Math.Max(targetFlowLeft[i], flowVolumeLeft[i] - deltaTime) : + Math.Min(targetFlowLeft[i], flowVolumeLeft[i] + deltaTime); + flowVolumeRight[i] = (targetFlowRight[i] < flowVolumeRight[i]) ? + Math.Max(targetFlowRight[i], flowVolumeRight[i] - deltaTime) : + Math.Min(targetFlowRight[i], flowVolumeRight[i] + deltaTime); + + if (flowVolumeLeft[i] < 0.05f && flowVolumeRight[i] < 0.05f) + { + if (flowSoundChannels[i] != null) + { + flowSoundChannels[i].Dispose(); + flowSoundChannels[i] = null; + } + } + else + { + Vector2 soundPos = new Vector2(GameMain.SoundManager.ListenerPosition.X + (flowVolumeRight[i] - flowVolumeLeft[i]) * 100, GameMain.SoundManager.ListenerPosition.Y); + if (flowSoundChannels[i] == null || !flowSoundChannels[i].IsPlaying) + { + flowSoundChannels[i] = FlowSounds[i].Play(1.0f, FlowSoundRange, soundPos); + flowSoundChannels[i].Looping = true; + } + flowSoundChannels[i].Gain = Math.Max(flowVolumeRight[i], flowVolumeLeft[i]); + flowSoundChannels[i].Position = new Vector3(soundPos, 0.0f); + } + } + } + private static void UpdateFireSounds(float deltaTime) { for (int i = 0; i < fireVolumeLeft.Length; i++) @@ -453,7 +612,8 @@ namespace Barotrauma "ambient", new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y) + Rand.Vector(100.0f), Rand.Range(0.5f, 1.0f), - 1000.0f); + 1000.0f, + new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y) + Rand.Vector(100.0f)); ambientSoundTimer = Rand.Range(ambientSoundInterval.X, ambientSoundInterval.Y); } @@ -467,31 +627,23 @@ namespace Barotrauma return matchingSounds[Rand.Int(matchingSounds.Count)]; } - /// - /// Play a sound defined in a sound xml file without any positional effects. - /// public static SoundChannel PlaySound(string soundTag, float volume = 1.0f) { var sound = GetSound(soundTag); return sound?.Play(volume); } - /// - /// Play a sound defined in a sound xml file. If the volume or range parameters are omitted, the volume and range defined in the sound xml are used. - /// - public static SoundChannel PlaySound(string soundTag, Vector2 position, float? volume = null, float? range = null, Hull hullGuess = null) + public static SoundChannel PlaySound(string soundTag, float volume, float range, Vector2 position, Hull hullGuess = null) { var sound = GetSound(soundTag); if (sound == null) return null; - return PlaySound(sound, position, volume ?? sound.BaseGain, range ?? sound.BaseFar, hullGuess); + return PlaySound(sound, sound.BaseGain * volume, range, position, hullGuess); } - public static SoundChannel PlaySound(Sound sound, Vector2 position, float? volume = null, float? range = null, Hull hullGuess = null) + public static SoundChannel PlaySound(Sound sound, float volume, float range, Vector2 position, Hull hullGuess = null) { - float far = range ?? sound.BaseFar; - - if (Vector2.DistanceSquared(new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y), position) > far * far) return null; - return sound.Play(volume ?? sound.BaseGain, far, position, muffle: ShouldMuffleSound(Character.Controlled, position, far, hullGuess)); + if (Vector2.DistanceSquared(new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y), position) > range * range) return null; + return sound.Play(sound.BaseGain * volume, range, position, muffle: ShouldMuffleSound(Character.Controlled, position, range, hullGuess)); } private static void UpdateMusic(float deltaTime) @@ -525,7 +677,7 @@ namespace Barotrauma //switch the music if nothing playing atm or the currently playing clip is not suitable anymore else if (targetMusic[0] == null || currentMusic[0] == null || !suitableMusic.Any(m => m.File == currentMusic[0].Filename)) { - targetMusic[0] = suitableMusic.GetRandom(); + targetMusic[0] = suitableMusic.GetRandom(); } //get the appropriate intensity layers for current situation @@ -560,7 +712,6 @@ namespace Barotrauma updateMusicTimer = UpdateMusicInterval; } - int activeTrackCount = targetMusic.Count(m => m != null); for (int i = 0; i < MaxMusicChannels; i++) { //nothing should be playing on this channel @@ -600,12 +751,7 @@ namespace Barotrauma musicChannel[i] = currentMusic[i].Play(0.0f, "music"); musicChannel[i].Looping = true; } - float targetGain = 1.0f; - if (targetMusic[i].DuckVolume) - { - targetGain = (float)Math.Sqrt(1.0f / activeTrackCount); - } - musicChannel[i].Gain = MathHelper.Lerp(musicChannel[i].Gain, targetGain, MusicLerpSpeed * deltaTime); + musicChannel[i].Gain = MathHelper.Lerp(musicChannel[i].Gain, 1.0f, MusicLerpSpeed * deltaTime); } } } @@ -673,7 +819,8 @@ namespace Barotrauma foreach (Character character in Character.CharacterList) { if (character.IsDead || !character.Enabled) continue; - if (!(character.AIController is EnemyAIController enemyAI) || (!enemyAI.AttackHumans && !enemyAI.AttackRooms)) continue; + EnemyAIController enemyAI = character.AIController as EnemyAIController; + if (enemyAI == null || (!enemyAI.AttackHumans && !enemyAI.AttackRooms)) continue; if (targetSubmarine != null) { @@ -691,16 +838,9 @@ namespace Barotrauma } } - if (GameMain.GameSession != null) + if (GameMain.GameSession != null && Timing.TotalTime < GameMain.GameSession.RoundStartTime + 120.0) { - if (Submarine.Loaded != null && Level.Loaded != null && Submarine.MainSub.AtEndPosition) - { - return "levelend"; - } - if (Timing.TotalTime < GameMain.GameSession.RoundStartTime + 120.0) - { - return "start"; - } + return "start"; } return "default"; diff --git a/Barotrauma/BarotraumaClient/Source/Sprite/DeformAnimations/SpriteDeformation.cs b/Barotrauma/BarotraumaClient/Source/Sprite/DeformAnimations/SpriteDeformation.cs index 19097bf21..52d33b786 100644 --- a/Barotrauma/BarotraumaClient/Source/Sprite/DeformAnimations/SpriteDeformation.cs +++ b/Barotrauma/BarotraumaClient/Source/Sprite/DeformAnimations/SpriteDeformation.cs @@ -104,7 +104,14 @@ namespace Barotrauma.SpriteDeformations public Point Resolution { - get { return deformationParams.Resolution; } + get + { + if (deformationParams.Resolution.X != Deformation.GetLength(0) || deformationParams.Resolution.Y != Deformation.GetLength(1)) + { + Deformation = new Vector2[deformationParams.Resolution.X, deformationParams.Resolution.Y]; + } + return deformationParams.Resolution; + } set { SetResolution(value); } } @@ -195,15 +202,6 @@ namespace Barotrauma.SpriteDeformations public static Vector2[,] GetDeformation(IEnumerable animations, Vector2 scale) { - foreach (SpriteDeformation animation in animations) - { - if (animation.deformationParams.Resolution.X != animation.Deformation.GetLength(0) || - animation.deformationParams.Resolution.Y != animation.Deformation.GetLength(1)) - { - animation.Deformation = new Vector2[animation.deformationParams.Resolution.X, animation.deformationParams.Resolution.Y]; - } - } - Point resolution = animations.First().Resolution; if (animations.Any(a => a.Resolution != resolution)) { @@ -213,6 +211,7 @@ namespace Barotrauma.SpriteDeformations } Vector2[,] deformation = new Vector2[resolution.X, resolution.Y]; + foreach (SpriteDeformation animation in animations) { animation.GetDeformation(out Vector2[,] animDeformation, out float multiplier); diff --git a/Barotrauma/BarotraumaClient/Source/StatusEffects/StatusEffect.cs b/Barotrauma/BarotraumaClient/Source/StatusEffects/StatusEffect.cs index 4198d21b7..778e11f82 100644 --- a/Barotrauma/BarotraumaClient/Source/StatusEffects/StatusEffect.cs +++ b/Barotrauma/BarotraumaClient/Source/StatusEffects/StatusEffect.cs @@ -62,7 +62,7 @@ namespace Barotrauma { foreach (RoundSound sound in sounds) { - soundChannel = SoundPlayer.PlaySound(sound.Sound, entity.WorldPosition, sound.Volume, sound.Range, hull); + soundChannel = SoundPlayer.PlaySound(sound.Sound, sound.Volume, sound.Range, entity.WorldPosition, hull); if (soundChannel != null) soundChannel.Looping = loopSound; } } @@ -82,7 +82,7 @@ namespace Barotrauma selectedSoundIndex = Rand.Int(sounds.Count); } var selectedSound = sounds[selectedSoundIndex]; - soundChannel = SoundPlayer.PlaySound(selectedSound.Sound, entity.WorldPosition, selectedSound.Volume, selectedSound.Range, hull); + soundChannel = SoundPlayer.PlaySound(selectedSound.Sound, selectedSound.Volume, selectedSound.Range, entity.WorldPosition, hull); if (soundChannel != null) soundChannel.Looping = loopSound; } } diff --git a/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs b/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs index 7e76d6ad2..67e912b03 100644 --- a/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs +++ b/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs @@ -11,7 +11,7 @@ namespace Barotrauma { private static Regex csvSplit = new Regex("(?:^|,)(\"(?:[^\"])*\"|[^,]*)", RegexOptions.Compiled); // Handling commas inside data fields surrounded by "" private static List conversationClosingIndent = new List(); - private static char[] separator = new char[1] { '|' }; + private static char[] separator = new char[1] { ',' }; private const string conversationsPath = "Content/NPCConversations"; private const string infoTextPath = "Content/Texts"; @@ -48,7 +48,7 @@ namespace Barotrauma DebugConsole.ThrowError("NPCConversation Localization .csv to .xml conversion failed for: " + conversationFiles[i]); continue; } - string xmlFileFullPath = $"{conversationsPath}/NpcConversations_{language}_NEW.xml"; + string xmlFileFullPath = $"{conversationsPath}/NPCConversations_{language}_NEW.xml"; File.WriteAllLines(xmlFileFullPath, xmlContent); DebugConsole.NewMessage("Conversation localization .xml file successfully created at: " + xmlFileFullPath); } @@ -141,8 +141,7 @@ namespace Barotrauma for (int i = 0; i < NPCPersonalityTrait.List.Count; i++) // Traits { - //string[] split = SplitCSV(csvContent[traitStart + i].Trim(separator)); - string[] split = csvContent[traitStart + i].Split(separator); + string[] split = SplitCSV(csvContent[traitStart + i].Trim(separator)); xmlContent.Add( $"true - .pdb ..\BarotraumaShared\Icon.ico @@ -54,32 +53,14 @@ x64 MinimumRecommendedRules.ruleset true - - - - - true - ..\bin\x86\ReleaseWindows\ - TRACE;WINDOWS;CLIENT - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - true - - - true - ..\bin\x86\DebugWindows\ - TRACE;WINDOWS;CLIENT;DEBUG - full - x86 - MinimumRecommendedRules.ruleset - true + + ..\..\Libraries\NuGet\Concentus.1.1.7\lib\portable-net45+win+wpa81+wp80\Concentus.dll + ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll @@ -145,30 +126,10 @@ - - - - - PreserveNewest - freetype6.dll - - - PreserveNewest - - - - - - - PreserveNewest - - - PreserveNewest - - - - + + PreserveNewest + PreserveNewest @@ -215,6 +176,9 @@ + + PreserveNewest + PreserveNewest @@ -251,10 +215,6 @@ - - {0e7fee6a-15e5-4a4e-943c-80276003478c} - Concentus - {3af0347c-5a9b-4421-868c-8ee3dbfaebc6} Facepunch.Steamworks @@ -320,13 +280,7 @@ Other similar extension points exist, see Microsoft.Common.targets. - --> - - - - - - + --> \ No newline at end of file diff --git a/Barotrauma/BarotraumaClient/app.config b/Barotrauma/BarotraumaClient/app.config index f067ae6ac..383108ffa 100644 --- a/Barotrauma/BarotraumaClient/app.config +++ b/Barotrauma/BarotraumaClient/app.config @@ -1,35 +1,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Barotrauma/BarotraumaClient/packages.config b/Barotrauma/BarotraumaClient/packages.config index d637bffbb..695edea35 100644 --- a/Barotrauma/BarotraumaClient/packages.config +++ b/Barotrauma/BarotraumaClient/packages.config @@ -1,5 +1,6 @@  + diff --git a/Barotrauma/BarotraumaServer/Properties/AssemblyInfo.cs b/Barotrauma/BarotraumaServer/Properties/AssemblyInfo.cs index 1c7c140ff..bbde03313 100644 --- a/Barotrauma/BarotraumaServer/Properties/AssemblyInfo.cs +++ b/Barotrauma/BarotraumaServer/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.8.10.0")] -[assembly: AssemblyFileVersion("0.8.10.0")] +[assembly: AssemblyVersion("0.8.9.10")] +[assembly: AssemblyFileVersion("0.8.9.10")] diff --git a/Barotrauma/BarotraumaServer/Server.csproj b/Barotrauma/BarotraumaServer/Server.csproj index 99289cacd..1d344c8fe 100644 --- a/Barotrauma/BarotraumaServer/Server.csproj +++ b/Barotrauma/BarotraumaServer/Server.csproj @@ -91,63 +91,6 @@ MinimumRecommendedRules.ruleset true - - true - bin\x86\ReleaseLinux\ - TRACE;SERVER - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - true - - - true - bin\x86\DebugLinux\ - TRACE;SERVER;DEBUG - full - x86 - MinimumRecommendedRules.ruleset - true - - - true - bin\x86\ReleaseMac\ - TRACE;SERVER - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - true - - - true - bin\x86\DebugMac\ - TRACE;SERVER;DEBUG - full - x86 - MinimumRecommendedRules.ruleset - true - - - true - bin\x86\ReleaseWindows\ - TRACE;SERVER - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - true - - - true - bin\x86\DebugWindows\ - TRACE;SERVER;DEBUG - full - x86 - MinimumRecommendedRules.ruleset - true - @@ -272,23 +215,11 @@ - - + + PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - diff --git a/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs index d00a8d7eb..5f0639ff0 100644 --- a/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs +++ b/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs @@ -21,9 +21,9 @@ namespace Barotrauma { if (!Enabled) { return 1000.0f; } - if (recipient.Character == null || recipient.Character.IsDead) + if (recipient.Character == null) { - return 0.2f; + return 0.1f; } else { diff --git a/Barotrauma/BarotraumaServer/Source/DebugConsole.cs b/Barotrauma/BarotraumaServer/Source/DebugConsole.cs index 904c92a2b..1dd05bae8 100644 --- a/Barotrauma/BarotraumaServer/Source/DebugConsole.cs +++ b/Barotrauma/BarotraumaServer/Source/DebugConsole.cs @@ -26,7 +26,7 @@ namespace Barotrauma NewMessage("Client \"" + client.Name + "\" attempted to use the command \"" + names[0] + "\". Cheats must be enabled using \"enablecheats\" before the command can be used.", Color.Red); GameMain.Server.SendConsoleMessage("You need to enable cheats using the command \"enablecheats\" before you can use the command \"" + names[0] + "\".", client); - if (Steam.SteamManager.USE_STEAM) + if (GameMain.Config.UseSteam) { NewMessage("Enabling cheats will disable Steam achievements during this play session.", Color.Red); GameMain.Server.SendConsoleMessage("Enabling cheats will disable Steam achievements during this play session.", client); @@ -193,7 +193,7 @@ namespace Barotrauma Console.CursorLeft = 0; Console.CursorTop -= cursorLine; Console.Write(input); - Console.CursorLeft = input.Length % consoleWidth; + Console.CursorLeft = input.Length % Console.WindowWidth; } private static void AssignOnClientRequestExecute(string names, Action onClientRequestExecute) @@ -699,7 +699,7 @@ namespace Barotrauma CheatsEnabled = true; SteamAchievementManager.CheatsEnabled = true; NewMessage("Enabled cheat commands.", Color.Red); - if (Steam.SteamManager.USE_STEAM) + if (GameMain.Config.UseSteam) { NewMessage("Steam achievements have been disabled during this play session.", Color.Red); GameMain.Server?.UpdateCheatsEnabled(); @@ -714,7 +714,7 @@ namespace Barotrauma CheatsEnabled = true; SteamAchievementManager.CheatsEnabled = true; NewMessage("Cheat commands have been enabled by \"" + client.Name + "\".", Color.Red); - if (Steam.SteamManager.USE_STEAM) + if (GameMain.Config.UseSteam) { NewMessage("Steam achievements have been disabled during this play session.", Color.Red); GameMain.Server?.UpdateCheatsEnabled(); diff --git a/Barotrauma/BarotraumaServer/Source/GameMain.cs b/Barotrauma/BarotraumaServer/Source/GameMain.cs index 6515b87c6..6d44fd936 100644 --- a/Barotrauma/BarotraumaServer/Source/GameMain.cs +++ b/Barotrauma/BarotraumaServer/Source/GameMain.cs @@ -53,21 +53,6 @@ namespace Barotrauma get { return Config.SelectedContentPackages; } } - - private static ContentPackage vanillaContent; - public static ContentPackage VanillaContent - { - get - { - if (vanillaContent == null) - { - // TODO: Dynamic method for defining and finding the vanilla content package. - vanillaContent = ContentPackage.List.SingleOrDefault(cp => Path.GetFileName(cp.Path).ToLowerInvariant() == "vanilla 0.9.xml"); - } - return vanillaContent; - } - } - public readonly string[] CommandLineArgs; public GameMain(string[] args) @@ -98,7 +83,6 @@ namespace Barotrauma LevelGenerationParams.LoadPresets(); ScriptedEventSet.LoadPrefabs(); - AfflictionPrefab.LoadAll(GetFilesOfType(ContentType.Afflictions)); StructurePrefab.LoadAll(GetFilesOfType(ContentType.Structure)); ItemPrefab.LoadAll(GetFilesOfType(ContentType.Item)); JobPrefab.LoadAll(GetFilesOfType(ContentType.Jobs)); @@ -106,6 +90,7 @@ namespace Barotrauma NPCConversation.LoadAll(GetFilesOfType(ContentType.NPCConversations)); ItemAssemblyPrefab.LoadAll(); LevelObjectPrefab.LoadAll(); + AfflictionPrefab.LoadAll(GetFilesOfType(ContentType.Afflictions)); GameModePreset.Init(); LocationType.Init(); @@ -146,20 +131,11 @@ namespace Barotrauma } /// - /// Returns the file paths of all files of the given type in the content packages. + /// Returns the file paths of all files of the given type in the currently selected content packages. /// - /// - /// If true, also returns files in content packages that are installed but not currently selected. - public IEnumerable GetFilesOfType(ContentType type, bool searchAllContentPackages = false) + public IEnumerable GetFilesOfType(ContentType type) { - if (searchAllContentPackages) - { - return ContentPackage.GetFilesOfType(ContentPackage.List, type); - } - else - { - return ContentPackage.GetFilesOfType(SelectedPackages, type); - } + return ContentPackage.GetFilesOfType(SelectedPackages, type); } public void StartServer() diff --git a/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs b/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs index 35fbb7ea0..0e1667db4 100644 --- a/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs +++ b/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs @@ -3,7 +3,6 @@ using Lidgren.Network; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; -using System.Linq; using System.Xml.Linq; namespace Barotrauma @@ -56,7 +55,7 @@ namespace Barotrauma } else { - var saveFiles = SaveUtil.GetSaveFiles(SaveUtil.SaveType.Multiplayer).ToArray(); + string[] saveFiles = SaveUtil.GetSaveFiles(SaveUtil.SaveType.Multiplayer); DebugConsole.NewMessage("Saved campaigns:", Color.White); for (int i = 0; i < saveFiles.Length; i++) { @@ -169,8 +168,6 @@ namespace Barotrauma msg.Write(isRunning && endWatchman != null ? endWatchman.ID : (UInt16)0); msg.Write(Money); - msg.Write(PurchasedHullRepairs); - msg.Write(PurchasedItemRepairs); msg.Write((UInt16)CargoManager.PurchasedItems.Count); foreach (PurchasedItem pi in CargoManager.PurchasedItems) @@ -195,8 +192,6 @@ namespace Barotrauma { UInt16 selectedLocIndex = msg.ReadUInt16(); byte selectedMissionIndex = msg.ReadByte(); - bool purchasedHullRepairs = msg.ReadBoolean(); - bool purchasedItemRepairs = msg.ReadBoolean(); UInt16 purchasedItemCount = msg.ReadUInt16(); List purchasedItems = new List(); @@ -213,33 +208,6 @@ namespace Barotrauma return; } - if (purchasedHullRepairs != this.PurchasedHullRepairs) - { - if (purchasedHullRepairs && Money >= HullRepairCost) - { - this.PurchasedHullRepairs = true; - Money -= HullRepairCost; - } - else if (!purchasedHullRepairs) - { - this.PurchasedHullRepairs = false; - Money += HullRepairCost; - } - } - if (purchasedItemRepairs != this.PurchasedItemRepairs) - { - if (purchasedItemRepairs && Money >= ItemRepairCost) - { - this.PurchasedItemRepairs = true; - Money -= ItemRepairCost; - } - else if (!purchasedItemRepairs) - { - this.PurchasedItemRepairs = false; - Money += ItemRepairCost; - } - } - Map.SelectLocation(selectedLocIndex == UInt16.MaxValue ? -1 : selectedLocIndex); if (Map.SelectedConnection != null) { diff --git a/Barotrauma/BarotraumaServer/Source/Items/Components/Machines/Reactor.cs b/Barotrauma/BarotraumaServer/Source/Items/Components/Machines/Reactor.cs index 5d6439226..af7fefd81 100644 --- a/Barotrauma/BarotraumaServer/Source/Items/Components/Machines/Reactor.cs +++ b/Barotrauma/BarotraumaServer/Source/Items/Components/Machines/Reactor.cs @@ -20,8 +20,6 @@ namespace Barotrauma.Items.Components if (!item.CanClientAccess(c)) return; - IsActive = true; - if (!autoTemp && AutoTemp) blameOnBroken = c; if (turbineOutput < targetTurbineOutput) blameOnBroken = c; if (fissionRate > targetFissionRate) blameOnBroken = c; diff --git a/Barotrauma/BarotraumaServer/Source/Map/Hull.cs b/Barotrauma/BarotraumaServer/Source/Map/Hull.cs index 3fc9ec6d3..3b10a7a24 100644 --- a/Barotrauma/BarotraumaServer/Source/Map/Hull.cs +++ b/Barotrauma/BarotraumaServer/Source/Map/Hull.cs @@ -33,8 +33,7 @@ namespace Barotrauma //update client hulls if the amount of water has changed by >10% //or if oxygen percentage has changed by 5% if (Math.Abs(lastSentVolume - waterVolume) > Volume * 0.1f || - Math.Abs(lastSentOxygen - OxygenPercentage) > 5f || - FireSources.Count > 0) + Math.Abs(lastSentOxygen - OxygenPercentage) > 5f) { sendUpdateTimer -= deltaTime; if (sendUpdateTimer < 0.0f) diff --git a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs index 5ee4d596f..d9137afc7 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs @@ -1126,7 +1126,7 @@ namespace Barotrauma.Networking UInt16 modeIndex = inc.ReadUInt16(); if (GameMain.NetLobbyScreen.GameModes[modeIndex].Identifier.ToLowerInvariant() == "multiplayercampaign") { - string[] saveFiles = SaveUtil.GetSaveFiles(SaveUtil.SaveType.Multiplayer).ToArray(); + string[] saveFiles = SaveUtil.GetSaveFiles(SaveUtil.SaveType.Multiplayer); for (int i = 0; i < saveFiles.Length; i++) { XDocument doc = SaveUtil.LoadGameSessionDoc(saveFiles[i]); @@ -1960,8 +1960,6 @@ namespace Barotrauma.Networking msg.Write(false); } - msg.Write(serverSettings.AllowRagdollButton); - serverSettings.WriteMonsterEnabled(msg); CompressOutgoingMessage(msg); diff --git a/Barotrauma/BarotraumaServer/Source/Networking/RespawnManager.cs b/Barotrauma/BarotraumaServer/Source/Networking/RespawnManager.cs index 593bec08f..8b489f1a0 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/RespawnManager.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/RespawnManager.cs @@ -182,15 +182,6 @@ namespace Barotrauma.Networking } else { - //tell the respawning client they're no longer a traitor - if (GameMain.Server.TraitorManager != null && clients[i].Character != null) - { - if (GameMain.Server.TraitorManager.TraitorList.Any(t => t.Character == clients[i].Character)) - { - GameMain.Server.SendDirectChatMessage(TextManager.Get("traitorrespawnmessage"), clients[i], ChatMessageType.MessageBox); - } - } - clients[i].Character = character; character.OwnerClientIP = clients[i].Connection.RemoteEndPoint.Address.ToString(); character.OwnerClientName = clients[i].Name; diff --git a/Barotrauma/BarotraumaServer/Source/Networking/SteamManager.cs b/Barotrauma/BarotraumaServer/Source/Networking/SteamManager.cs index 99b9ac68b..025e42e8b 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/SteamManager.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/SteamManager.cs @@ -56,7 +56,6 @@ namespace Barotrauma.Steam Instance.server.SetKey("usingwhitelist", (server.ServerSettings.Whitelist != null && server.ServerSettings.Whitelist.Enabled).ToString()); Instance.server.SetKey("modeselectionmode", server.ServerSettings.ModeSelectionMode.ToString()); Instance.server.SetKey("subselectionmode", server.ServerSettings.SubSelectionMode.ToString()); - Instance.server.SetKey("voicechatenabled", server.ServerSettings.VoiceChatEnabled.ToString()); Instance.server.SetKey("allowspectating", server.ServerSettings.AllowSpectating.ToString()); Instance.server.SetKey("allowrespawn", server.ServerSettings.AllowRespawn.ToString()); Instance.server.SetKey("traitors", server.ServerSettings.TraitorsEnabled.ToString()); diff --git a/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml b/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml index 3bd2357dd..529a93864 100644 --- a/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml +++ b/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml @@ -5,15 +5,11 @@ - - - - - - - - + + + + @@ -73,23 +69,17 @@ - + - + - - - - - - @@ -103,13 +93,7 @@ - - - - - - - + diff --git a/Barotrauma/BarotraumaShared/Icon.ico b/Barotrauma/BarotraumaShared/Icon.ico index 1c7b910c5..a31034fcd 100644 Binary files a/Barotrauma/BarotraumaShared/Icon.ico and b/Barotrauma/BarotraumaShared/Icon.ico differ diff --git a/Barotrauma/BarotraumaShared/SharedCode.projitems b/Barotrauma/BarotraumaShared/SharedCode.projitems index 8a4a85dc3..f1aa81dab 100644 --- a/Barotrauma/BarotraumaShared/SharedCode.projitems +++ b/Barotrauma/BarotraumaShared/SharedCode.projitems @@ -45,7 +45,6 @@ - @@ -181,12 +180,10 @@ - - diff --git a/Barotrauma/BarotraumaShared/SharedContent.projitems b/Barotrauma/BarotraumaShared/SharedContent.projitems index f9667893d..bd71d9c68 100644 --- a/Barotrauma/BarotraumaShared/SharedContent.projitems +++ b/Barotrauma/BarotraumaShared/SharedContent.projitems @@ -24,10 +24,6 @@ - - - - @@ -361,247 +357,39 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - + PreserveNewest PreserveNewest - - PreserveNewest - PreserveNewest @@ -782,6 +570,15 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -797,94 +594,94 @@ PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest @@ -1259,9 +1056,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -1298,6 +1092,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest @@ -1352,6 +1149,14 @@ PreserveNewest + + PreserveNewest + + + + + PreserveNewest + PreserveNewest @@ -1499,7 +1304,7 @@ PreserveNewest - + PreserveNewest @@ -1541,15 +1346,36 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest PreserveNewest + + PreserveNewest + PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -1745,10 +1571,22 @@ PreserveNewest - + PreserveNewest - + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + PreserveNewest @@ -1757,10 +1595,10 @@ PreserveNewest - + PreserveNewest - + PreserveNewest @@ -2075,24 +1913,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -2111,75 +1931,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -2216,19 +1967,9 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - - Never + PreserveNewest - - Never - - @@ -2726,6 +2467,18 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -3183,6 +2936,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs index bd8df818d..9cc8fc1ff 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs @@ -14,11 +14,6 @@ namespace Barotrauma { public static bool DisableEnemyAI; - /// - /// Enable the character to attack the outposts and the characters inside them. Disabled by default. - /// - public bool TargetOutposts; - class WallTarget { public Vector2 Position; @@ -122,7 +117,6 @@ namespace Barotrauma private readonly float memoryFadeTime = 0.5f; public LatchOntoAI LatchOntoAI { get; private set; } - public SwarmBehavior SwarmBehavior { get; private set; } public bool AttackHumans { @@ -216,10 +210,6 @@ namespace Barotrauma case "latchonto": LatchOntoAI = new LatchOntoAI(subElement, this); break; - case "swarm": - case "swarmbehavior": - SwarmBehavior = new SwarmBehavior(subElement, this); - break; case "targetpriority": targetingPriorities.Add(subElement.GetAttributeString("tag", "").ToLowerInvariant(), new TargetingPriority(subElement)); break; @@ -320,9 +310,8 @@ namespace Barotrauma { State = AIState.Idle; } - else if (Character.Health < fleeHealthThreshold && SwarmBehavior == null) + else if (Character.Health < fleeHealthThreshold) { - // Don't flee from damage if in a swarm. State = AIState.Escape; } else if (targetingPriority != null) @@ -331,6 +320,8 @@ namespace Barotrauma } } + LatchOntoAI?.Update(this, deltaTime); + if (SelectedAiTarget != null && (SelectedAiTarget.Entity == null || SelectedAiTarget.Entity.Removed)) { State = AIState.Idle; @@ -369,14 +360,11 @@ namespace Barotrauma throw new NotImplementedException(); } - LatchOntoAI?.Update(this, deltaTime); - IsSteeringThroughGap = false; - if (SwarmBehavior != null) - { - SwarmBehavior.IsActive = State == AIState.Idle && Character.CurrentHull == null; - SwarmBehavior.Refresh(); - SwarmBehavior.UpdateSteering(deltaTime); - } + // Just some debug code that makes the characters to follow the mouse cursor + //run = true; + //Vector2 mousePos = ConvertUnits.ToSimUnits(Screen.Selected.Cam.ScreenToWorld(PlayerInput.MousePosition)); + //steeringManager.SteeringSeek(mousePos, Character.AnimController.GetCurrentSpeed(run)); + steeringManager.Update(Character.AnimController.GetCurrentSpeed(run)); } @@ -499,7 +487,7 @@ namespace Barotrauma } else { - if (!IsLatchedOnSub) + if (!IsProperlyLatchedOnSub) { UpdateWallTarget(); } @@ -558,7 +546,7 @@ namespace Barotrauma { WallSection section = wallTarget.Structure.GetSection(wallTarget.SectionIndex); Vector2 targetPos = wallTarget.Structure.SectionPosition(wallTarget.SectionIndex, true); - if (section?.gap != null && SteerThroughGap(wallTarget.Structure, section, targetPos, deltaTime)) + if (section?.gap != null && section.gap.IsRoomToRoom && SteerThroughGap(wallTarget.Structure, section, targetPos, deltaTime)) { return; } @@ -799,21 +787,9 @@ namespace Barotrauma } } - public bool IsSteeringThroughGap { get; private set; } private bool SteerThroughGap(Structure wall, WallSection section, Vector2 targetWorldPos, float deltaTime) { - IsSteeringThroughGap = true; - SelectedAiTarget = wall.AiTarget; - wallTarget = null; - LatchOntoAI?.DeattachFromBody(); - Character.AnimController.ReleaseStuckLimbs(); Hull targetHull = section.gap?.FlowTargetHull; - float distance = Vector2.Distance(Character.WorldPosition, targetWorldPos); - float maxDistance = Math.Min(wall.Rect.Width, wall.Rect.Height); - if (distance > maxDistance) - { - return false; - } if (targetHull != null) { if (wall.IsHorizontal) @@ -824,7 +800,16 @@ namespace Barotrauma { targetWorldPos.X = targetHull.WorldRect.Center.X; } - steeringManager.SteeringManual(deltaTime, Vector2.Normalize(targetWorldPos - Character.WorldPosition)); + LatchOntoAI?.DeattachFromBody(); + Character.AnimController.ReleaseStuckLimbs(); + if (steeringManager is IndoorsSteeringManager) + { + steeringManager.SteeringManual(deltaTime, Vector2.Normalize(targetWorldPos - Character.WorldPosition)); + } + else + { + steeringManager.SteeringSeek(ConvertUnits.ToSimUnits(targetWorldPos)); + } return true; } return false; @@ -1056,43 +1041,19 @@ namespace Barotrauma #region Targeting private bool IsLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub; + private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure; + //goes through all the AItargets, evaluates how preferable it is to attack the target, //whether the Character can see/hear the target and chooses the most preferable target within //sight/hearing range public AITarget UpdateTargets(Character character, out TargetingPriority priority) { - if ((SelectedAiTarget != null || wallTarget != null) && IsLatchedOnSub) + if (IsProperlyLatchedOnSub) { - var wall = SelectedAiTarget.Entity as Structure; - if (wall == null) - { - wall = wallTarget?.Structure; - } - // The target is not a wall or it's not the same as we are attached to -> release - bool releaseTarget = wall == null || !wall.Bodies.Contains(LatchOntoAI.AttachJoints[0].BodyB); - if (!releaseTarget) - { - for (int i = 0; i < wall.Sections.Length; i++) - { - if (CanPassThroughHole(wall, i)) - { - releaseTarget = true; - } - } - } - if (releaseTarget) - { - SelectedAiTarget = null; - wallTarget = null; - LatchOntoAI.DeattachFromBody(); - } - else if (SelectedAiTarget?.Entity == wallTarget?.Structure) - { - // If attached to a valid target, just keep the target. - // Priority not used in this case. - priority = null; - return SelectedAiTarget; - } + // If attached to a valid target, just keep the target. + // Priority not used in this case. + priority = null; + return SelectedAiTarget; } AITarget newTarget = null; priority = null; @@ -1107,10 +1068,9 @@ namespace Barotrauma continue; } if (target.Type == AITarget.TargetType.HumanOnly) { continue; } - if (!TargetOutposts) - { - if (target.Entity.Submarine != null && target.Entity.Submarine.IsOutpost) { continue; } - } + // Don't attack outposts. + if (target.Entity.Submarine != null && target.Entity.Submarine.IsOutpost) { continue; } + Character targetCharacter = target.Entity as Character; //ignore the aitarget if it is the Character itself if (targetCharacter == character) continue; @@ -1175,7 +1135,7 @@ namespace Barotrauma else if (target.Entity != null) { //skip the target if it's a room and the character is already inside a sub - if (character.CurrentHull != null && target.Entity is Hull) { continue; } + if (character.CurrentHull != null && target.Entity is Hull) continue; Door door = null; if (target.Entity is Item item) @@ -1204,37 +1164,23 @@ namespace Barotrauma // Ignore structures that doesn't have a body (not walls) continue; } - if (s.IsPlatform) - { - continue; - } - if (character.CurrentHull != null) - { - // Ignore walls when inside. - continue; - } - valueModifier = 1; - float wallMaxHealth = 400; // Anything more than this is ignored -> 200 = 1 - // Prefer weaker targets. - valueModifier *= MathHelper.Lerp(1.5f, 0.5f, MathUtils.InverseLerp(0, 1, s.Health / wallMaxHealth)); + // Ignore walls when inside. + valueModifier = character.CurrentHull == null ? 1 : 0; if (aggressiveBoarding) { - var hulls = s.Submarine.GetHulls(false); for (int i = 0; i < s.Sections.Length; i++) { var section = s.Sections[i]; - if (section.gap != null) + if (CanPassThroughHole(s, i)) { - if (CanPassThroughHole(s, i)) - { - bool leadsInside = !section.gap.IsRoomToRoom && section.gap.FlowTargetHull != null && hulls.Any(h => h.Rect.Intersects(section.rect)); - valueModifier *= leadsInside ? 5 : 0; - } - else - { - // up to 100% priority increase for every gap in the wall - valueModifier *= 1 + section.gap.Open; - } + // Ignore walls that can be passed through + valueModifier = 0; + break; + } + else if (section.gap != null) + { + // up to 100% priority increase for every gap in the wall + valueModifier *= 1 + section.gap.Open; } } } diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs index c2133c51b..e759548fa 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using System.Linq; +using Barotrauma.Extensions; namespace Barotrauma { @@ -54,6 +55,28 @@ namespace Barotrauma objectiveManager = new AIObjectiveManager(c); objectiveManager.AddObjective(new AIObjectiveFindSafety(c)); objectiveManager.AddObjective(new AIObjectiveIdle(c)); + // TODO: do this only when the player hasn't issued an order for a while + foreach (var automaticOrder in c.Info.Job.Prefab.AutomaticOrders) + { + var orderPrefab = Order.PrefabList.Find(o => o.AITag == automaticOrder.aiTag); + // TODO: Similar code is used in CrewManager:815-> DRY + var matchingItems = orderPrefab.ItemIdentifiers.Any() ? + Item.ItemList.FindAll(it => orderPrefab.ItemIdentifiers.Contains(it.Prefab.Identifier) || it.HasTag(orderPrefab.ItemIdentifiers)) : + Item.ItemList.FindAll(it => it.Components.Any(ic => ic.GetType() == orderPrefab.ItemComponentType)); + matchingItems.RemoveAll(it => it.Submarine != c.Submarine); + var item = matchingItems.GetRandom(); + var order = new Order(orderPrefab, item ?? c.CurrentHull as Entity, item?.Components.FirstOrDefault(ic => ic.GetType() == orderPrefab.ItemComponentType)); + SetOrder(order, automaticOrder.option, c, true); + +//#if CLIENT +// GameMain.GameSession?.CrewManager?.SetCharacterOrder(c, order, automaticOrder.option, c); +//#endif + +// if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(order, order.FadeOutTime)) +// { +// Character.Speak(order.GetChatMessage("", Character.CurrentHull?.RoomName, givingOrderToSelf: true), ChatMessageType.Order); +// } + } updateObjectiveTimer = Rand.Range(0.0f, UpdateObjectiveInterval); @@ -267,7 +290,7 @@ namespace Barotrauma if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime)) { Character.Speak( - newOrder.GetChatMessage("", Character.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order); + newOrder.GetChatMessage("", Character.CurrentHull?.RoomName, givingOrderToSelf: false), ChatMessageType.Order); } } } @@ -286,18 +309,18 @@ namespace Barotrauma if (Character.PressureTimer > 50.0f && Character.CurrentHull != null) { - Character.Speak(TextManager.Get("DialogPressure").Replace("[roomname]", Character.CurrentHull.DisplayName), null, 0, "pressure", 30.0f); + Character.Speak(TextManager.Get("DialogPressure").Replace("[roomname]", Character.CurrentHull.RoomName), null, 0, "pressure", 30.0f); } } public override void OnAttacked(Character attacker, AttackResult attackResult) { + // Damage from falling etc. + if (Character.LastDamageSource == null) { return; } float damage = attackResult.Damage; if (damage <= 0) { return; } if (attacker == null || attacker.IsDead || attacker.Removed) { - // Ignore damage from falling etc that we shouldn't react to. - if (Character.LastDamageSource == null) { return; } AddCombatObjective(AIObjectiveCombat.CombatMode.Retreat, Rand.Range(0.5f, 1f, Rand.RandSync.Unsynced)); } else if (IsFriendly(attacker)) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs index 277a8b54c..794dd8443 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs @@ -223,10 +223,8 @@ namespace Barotrauma } } - bool isDiving = character.AnimController.InWater && character.AnimController.HeadInWater; - //only humanoids can climb ladders - if (!isDiving && character.AnimController is HumanoidAnimController && IsNextLadderSameAsCurrent) + if (character.AnimController is HumanoidAnimController && IsNextLadderSameAsCurrent) { if (character.SelectedConstruction != currentPath.CurrentNode.Ladders.Item && currentPath.CurrentNode.Ladders.Item.IsInsideTrigger(character.WorldPosition)) @@ -236,7 +234,7 @@ namespace Barotrauma } var collider = character.AnimController.Collider; - if (character.IsClimbing && !isDiving) + if (character.IsClimbing) { Vector2 diff = currentPath.CurrentNode.SimPosition - pos; bool nextLadderSameAsCurrent = IsNextLadderSameAsCurrent; @@ -280,12 +278,6 @@ namespace Barotrauma } else if (character.AnimController.InWater) { - // If the character is underwater, we don't need the ladders anymore - if (character.IsClimbing && isDiving) - { - character.AnimController.Anim = AnimController.Animation.None; - character.SelectedConstruction = null; - } if (Vector2.DistanceSquared(pos, currentPath.CurrentNode.SimPosition) < MathUtils.Pow(collider.radius * 3, 2)) { currentPath.SkipToNextNode(); @@ -396,18 +388,6 @@ namespace Barotrauma buttonPressCooldown = ButtonPressInterval; break; } - else - { - if (!door.HasRequiredItems(character, false) && shouldBeOpen) - { - currentPath.Unreachable = true; - return; - } - - door.Item.TryInteract(character, false, true, true); - buttonPressCooldown = ButtonPressInterval; - break; - } } } } @@ -428,18 +408,20 @@ namespace Barotrauma //door closed and the character can't open doors -> node can't be traversed if (!canOpenDoors || character.LockHands) { return null; } + if (!canBreakDoors) + { + //door closed and the character can't open doors -> node can't be traversed + if (!canOpenDoors || character.LockHands) return null; + var doorButtons = nextNode.Waypoint.ConnectedDoor.Item.GetConnectedComponents(); - if (!doorButtons.Any()) - { - if (!nextNode.Waypoint.ConnectedDoor.HasRequiredItems(character, false)) { return null; } - } + if (!doorButtons.Any()) return null; foreach (Controller button in doorButtons) { if (Math.Sign(button.Item.Position.X - nextNode.Waypoint.Position.X) != - Math.Sign(node.Position.X - nextNode.Position.X)) { continue; } + Math.Sign(node.Position.X - nextNode.Position.X)) continue; - if (!button.HasRequiredItems(character, false)) { return null; } + if (!button.HasRequiredItems(character, false)) return null; } } } diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/LatchOntoAI.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/LatchOntoAI.cs index e68f9a3a2..c85b2caa7 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/LatchOntoAI.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/LatchOntoAI.cs @@ -54,7 +54,7 @@ namespace Barotrauma get { return attachJoints.Count > 0; } } - public bool IsAttachedToSub => IsAttached && (attachTargetBody?.UserData is Submarine || attachTargetBody?.UserData is Entity entity && entity.Submarine != null); + public bool IsAttachedToSub => IsAttached && attachTargetBody?.UserData is Entity entity && (entity is Submarine sub || entity?.Submarine != null); public LatchOntoAI(XElement element, EnemyAIController enemyAI) { @@ -190,7 +190,7 @@ namespace Barotrauma case AIController.AIState.Attack: if (enemyAI.AttackingLimb != null) { - if (attachToSub && !enemyAI.IsSteeringThroughGap && wallAttachPos != Vector2.Zero && attachTargetBody != null) + if (attachToSub && wallAttachPos != Vector2.Zero && attachTargetBody != null) { // is not attached or is attached to something else if (!IsAttached || IsAttached && attachJoints[0].BodyB == attachTargetBody) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveCombat.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveCombat.cs index 9acf4bc99..128992a3e 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveCombat.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveCombat.cs @@ -44,7 +44,6 @@ namespace Barotrauma private AIObjectiveContainItem reloadWeaponObjective; private Hull retreatTarget; private AIObjectiveGoTo retreatObjective; - private AIObjectiveFindSafety findSafety; private float coolDownTimer; @@ -61,9 +60,7 @@ namespace Barotrauma { Enemy = enemy; coolDownTimer = CoolDown; - findSafety = HumanAIController.ObjectiveManager.GetObjective(); - findSafety.Priority = 0; - findSafety.unreachable.Clear(); + HumanAIController.ObjectiveManager.GetObjective().Priority = 0; Mode = mode; if (Enemy == null) { @@ -178,7 +175,7 @@ namespace Barotrauma { if (retreatTarget == null || (retreatObjective != null && !retreatObjective.CanBeCompleted)) { - retreatTarget = findSafety.FindBestHull(new List() { character.CurrentHull }); + retreatTarget = HumanAIController.ObjectiveManager.GetObjective().FindBestHull(new List() { character.CurrentHull }); } if (retreatTarget != null) { @@ -280,6 +277,7 @@ namespace Barotrauma { abandon = true; SteeringManager.Reset(); + //HumanAIController.ObjectiveManager.GetObjective().Priority = 100; } public override bool IsCompleted() diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveExtinguishFire.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveExtinguishFire.cs index a3e12d61b..f5965df98 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveExtinguishFire.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveExtinguishFire.cs @@ -79,44 +79,26 @@ namespace Barotrauma foreach (FireSource fs in targetHull.FireSources) { bool inRange = fs.IsInDamageRange(character, MathHelper.Clamp(fs.DamageRange * 1.5f, extinguisher.Range * 0.5f, extinguisher.Range)); - bool move = !inRange; - if (inRange || useExtinquisherTimer > 0.0f) + if (targetHull == character.CurrentHull && (inRange || useExtinquisherTimer > 0.0f)) { useExtinquisherTimer += deltaTime; - if (useExtinquisherTimer > 2.0f) - { - useExtinquisherTimer = 0.0f; - } + if (useExtinquisherTimer > 2.0f) useExtinquisherTimer = 0.0f; + character.AIController.SteeringManager.Reset(); character.CursorPosition = fs.Position; if (extinguisher.Item.RequireAimToUse) { character.SetInput(InputType.Aim, false, true); } - Limb sightLimb = null; - if (character.Inventory.IsInLimbSlot(extinguisherItem, InvSlotType.RightHand)) + extinguisher.Use(deltaTime, character); + + if (!targetHull.FireSources.Contains(fs)) { - sightLimb = character.AnimController.GetLimb(LimbType.RightHand); - } - else if (character.Inventory.IsInLimbSlot(extinguisherItem, InvSlotType.LeftHand)) - { - sightLimb = character.AnimController.GetLimb(LimbType.LeftHand); - } - if (!character.CanSeeTarget(fs, sightLimb)) - { - move = true; - } - else - { - move = false; - extinguisher.Use(deltaTime, character); - if (!targetHull.FireSources.Contains(fs)) - { - character.Speak(TextManager.Get("DialogPutOutFire").Replace("[roomname]", targetHull.Name), null, 0, "putoutfire", 10.0f); - } + character.Speak(TextManager.Get("DialogPutOutFire").Replace("[roomname]", targetHull.Name), null, 0, "putoutfire", 10.0f); } + return; } - if (move) + else { //go to the first firesource if (gotoObjective == null || !gotoObjective.CanBeCompleted || gotoObjective.IsCompleted()) @@ -127,8 +109,8 @@ namespace Barotrauma { gotoObjective.TryComplete(deltaTime); } + break; } - break; } } } diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs index 77e9c5901..2ac3ef0ce 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs @@ -18,7 +18,7 @@ namespace Barotrauma const float SearchHullInterval = 3.0f; const float clearUnreachableInterval = 30; - public readonly List unreachable = new List(); + private List unreachable = new List(); private float currenthullSafety; private float unreachableClearTimer; @@ -60,16 +60,11 @@ namespace Barotrauma else { divingGearObjective = null; - // Reduce the timer so that we get a safe hull target faster. - searchHullTimer = Math.Min(1, searchHullTimer); + // Reset the timer so that we get a safe hull target. + searchHullTimer = 0; } } - if (currenthullSafety < HumanAIController.HULL_SAFETY_THRESHOLD) - { - searchHullTimer = Math.Min(1, searchHullTimer); - } - if (unreachableClearTimer > 0) { unreachableClearTimer -= deltaTime; @@ -84,7 +79,7 @@ namespace Barotrauma { searchHullTimer -= deltaTime; } - else + else if (currenthullSafety < HumanAIController.HULL_SAFETY_THRESHOLD) { var bestHull = FindBestHull(); if (bestHull != null && bestHull != currentHull) @@ -193,17 +188,10 @@ namespace Barotrauma float dist = Math.Abs(character.WorldPosition.X - hull.WorldPosition.X) + Math.Abs(character.WorldPosition.Y - hull.WorldPosition.Y) * 2.0f; float distanceFactor = MathHelper.Lerp(1, 0.9f, MathUtils.InverseLerp(0, 10000, dist)); hullSafety *= distanceFactor; - //skip the hull if the safety is already less than the best hull - //(no need to do the expensive pathfinding if we already know we're not going to choose this hull) - if (hullSafety < bestValue) { continue; } // Each unsafe node reduces the hull safety value. // Ignore current hull, because otherwise the would block all paths from the current hull to the target hull. var path = PathSteering.PathFinder.FindPath(character.SimPosition, hull.SimPosition); - if (path.Unreachable) - { - unreachable.Add(hull); - continue; - } + if (path.Unreachable) { continue; } int unsafeNodes = path.Nodes.Count(n => n.CurrentHull != character.CurrentHull && HumanAIController.UnsafeHulls.Contains(n.CurrentHull)); hullSafety /= 1 + unsafeNodes; // If the target is not inside a friendly submarine, considerably reduce the hull safety. @@ -231,6 +219,7 @@ namespace Barotrauma } } } + // Huge preference for closer targets float distance = Vector2.DistanceSquared(character.WorldPosition, hull.WorldPosition); float distanceFactor = MathHelper.Lerp(1, 0.2f, MathUtils.InverseLerp(0, MathUtils.Pow(100000, 2), distance)); diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFixLeak.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFixLeak.cs index b4b41252e..a6edccb86 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFixLeak.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFixLeak.cs @@ -101,22 +101,10 @@ namespace Barotrauma HumanAIController.AnimController.Crouching = true; } + //float reach = HumanAIController.AnimController.ArmLength + ConvertUnits.ToSimUnits(repairTool.Range); float reach = ConvertUnits.ToSimUnits(repairTool.Range); - bool canReach = ConvertUnits.ToSimUnits(gapDiff.Length()) < reach; - if (canReach) - { - Limb sightLimb = null; - if (character.Inventory.IsInLimbSlot(repairTool.Item, InvSlotType.RightHand)) - { - sightLimb = character.AnimController.GetLimb(LimbType.RightHand); - } - else if (character.Inventory.IsInLimbSlot(repairTool.Item, InvSlotType.LeftHand)) - { - sightLimb = character.AnimController.GetLimb(LimbType.LeftHand); - } - canReach = character.CanSeeTarget(leak, sightLimb); - } - else + bool cannotReach = ConvertUnits.ToSimUnits(gapDiff.Length()) > reach; + if (cannotReach) { if (gotoObjective != null) { @@ -142,6 +130,7 @@ namespace Barotrauma AddSubObjective(gotoObjective); } } + canReach = character.CanSeeTarget(leak, sightLimb); } if (gotoObjective == null || gotoObjective.IsCompleted()) { diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs index c03fbef43..865f18203 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs @@ -26,9 +26,6 @@ namespace Barotrauma private float standStillTimer; private float walkDuration; - private readonly List targetHulls = new List(20); - private readonly List hullWeights = new List(20); - public AIObjectiveIdle(Character character) : base(character, "") { standStillTimer = Rand.Range(-10.0f, 10.0f); @@ -109,7 +106,7 @@ namespace Barotrauma if (isCurrentHullOK) { // Check that there is no unsafe or forbidden hulls on the way to the target - // Only do this when the current hull is ok, because otherwise would block all paths from the current hull to the target hull. + // Only do this when the current hull is ok, because otherwise the would block all paths from the current hull to the target hull. var path = PathSteering.PathFinder.FindPath(character.SimPosition, randomHull.SimPosition); if (path.Unreachable || path.Nodes.Any(n => HumanAIController.UnsafeHulls.Contains(n.CurrentHull) || IsForbidden(n.CurrentHull))) @@ -131,8 +128,8 @@ namespace Barotrauma character.AIController.SelectTarget(currentTarget.AiTarget); string errorMsg = null; #if DEBUG - bool isRoomNameFound = currentTarget.DisplayName != null; - errorMsg = "(Character " + character.Name + " idling, target " + (isRoomNameFound ? currentTarget.DisplayName : currentTarget.ToString()) + ")"; + bool isRoomNameFound = currentTarget.RoomName != null; + errorMsg = "(Character " + character.Name + " idling, target " + (isRoomNameFound ? currentTarget.RoomName : currentTarget.ToString()) + ")"; #endif var path = PathSteering.PathFinder.FindPath(character.SimPosition, currentTarget.SimPosition, errorMsg); PathSteering.SetPath(path); @@ -233,9 +230,13 @@ namespace Barotrauma } } + private readonly List targetHulls = new List(20); + private readonly List hullWeights = new List(20); + private void FindTargetHulls() { bool isCurrentHullOK = !HumanAIController.UnsafeHulls.Contains(character.CurrentHull) && !IsForbidden(character.CurrentHull); + targetHulls.Clear(); hullWeights.Clear(); foreach (var hull in Hull.hullList) @@ -265,6 +266,7 @@ namespace Barotrauma hullWeights.Add(weight); } } + } private bool IsForbidden(Hull hull) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRepairItem.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRepairItem.cs index a7d634505..fd2d1c962 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRepairItem.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRepairItem.cs @@ -83,12 +83,12 @@ namespace Barotrauma return; } } - if (repairTool == null) - { - FindRepairTool(); - } - if (character.CurrentHull == Item.CurrentHull && character.CanInteractWith(Item)) + if (character.CanInteractWith(Item)) { + if (repairTool == null) + { + FindRepairTool(); + } if (repairTool != null) { OperateRepairTool(deltaTime); diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs index 72004ee14..943d7110d 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs @@ -83,7 +83,7 @@ namespace Barotrauma if (character.SelectedCharacter == null) { character?.Speak(TextManager.Get("DialogFoundUnconsciousTarget") - .Replace("[targetname]", targetCharacter.Name).Replace("[roomname]", character.CurrentHull.DisplayName), + .Replace("[targetname]", targetCharacter.Name).Replace("[roomname]", character.CurrentHull.RoomName), null, 1.0f, "foundunconscioustarget" + targetCharacter.Name, 60.0f); } diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescueAll.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescueAll.cs index ec4aec869..2dc93f0f4 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescueAll.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescueAll.cs @@ -3,6 +3,7 @@ using System.Linq; namespace Barotrauma { + // TODO: Ensure that this works well enough. Consider using AIObjectiveLoop class. class AIObjectiveRescueAll : AIObjective { public override string DebugTag => "rescue all"; diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Animation/FishAnimController.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/FishAnimController.cs index 1d7ac3ecb..6ccd779c1 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Animation/FishAnimController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/FishAnimController.cs @@ -293,27 +293,6 @@ namespace Barotrauma return; } - if (GameMain.NetworkMember == null || !GameMain.NetworkMember.IsClient) - { - //stop dragging if there's something between the pull limb and the target - Vector2 sourceSimPos = mouthLimb.SimPosition; - Vector2 targetSimPos = target.SimPosition; - if (character.Submarine != null && character.SelectedCharacter.Submarine == null) - { - targetSimPos -= character.Submarine.SimPosition; - } - else if (character.Submarine == null && character.SelectedCharacter.Submarine != null) - { - sourceSimPos -= character.SelectedCharacter.Submarine.SimPosition; - } - var body = Submarine.CheckVisibility(sourceSimPos, targetSimPos, ignoreSubs: true); - if (body != null) - { - character.DeselectCharacter(); - return; - } - } - Character targetCharacter = target; float eatSpeed = character.Mass / targetCharacter.Mass * 0.1f; eatTimer += deltaTime * eatSpeed; @@ -609,7 +588,6 @@ namespace Barotrauma } } - float prevWalkPos = WalkPos; WalkPos -= MainLimb.LinearVelocity.X * (CurrentAnimationParams.CycleSpeed / RagdollParams.JointScale / 100.0f); Vector2 transformedStepSize = Vector2.Zero; @@ -645,11 +623,6 @@ namespace Barotrauma bool playFootstepSound = false; if (limb.type == LimbType.LeftFoot) { - if (Math.Sign(Math.Sin(prevWalkPos)) > 0 && Math.Sign(transformedStepSize.Y) < 0) - { - playFootstepSound = true; - } - limb.DebugRefPos = footPos + Vector2.UnitX * movement.X * 0.1f; limb.DebugTargetPos = footPos + new Vector2( transformedStepSize.X + movement.X * 0.1f, @@ -658,20 +631,13 @@ namespace Barotrauma } else if (limb.type == LimbType.RightFoot) { - if (Math.Sign(Math.Sin(prevWalkPos)) < 0 && Math.Sign(transformedStepSize.Y) > 0) - { - playFootstepSound = true; - } - limb.DebugRefPos = footPos + Vector2.UnitX * movement.X * 0.1f; limb.DebugTargetPos = footPos + new Vector2( -transformedStepSize.X + movement.X * 0.1f, (-transformedStepSize.Y > 0.0f) ? -transformedStepSize.Y : 0.0f); limb.MoveToPos(limb.DebugTargetPos, FootMoveForce); } -#if CLIENT - if (playFootstepSound) { PlayImpactSound(limb); } -#endif + if (CurrentGroundedParams.FootAnglesInRadians.ContainsKey(limb.limbParams.ID)) { SmoothRotateWithoutWrapping(limb, @@ -751,6 +717,22 @@ namespace Barotrauma limb?.body.SmoothRotate(angle, torque, wrapAngle: false); } + private void SmoothRotateWithoutWrapping(Limb limb, float angle, Limb referenceLimb, float torque) + { + //make sure the angle "has the same number of revolutions" as the reference limb + //(e.g. we don't want to rotate the legs to 0 if the torso is at 360, because that'd blow up the hip joints) + while (referenceLimb.Rotation - angle > MathHelper.TwoPi) + { + angle += MathHelper.TwoPi; + } + while (referenceLimb.Rotation - angle < -MathHelper.TwoPi) + { + angle -= MathHelper.TwoPi; + } + + limb?.body.SmoothRotate(angle, torque, wrapAngle: false); + } + public override void Flip() { base.Flip(); diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs index 8935a5168..138cc61d7 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs @@ -534,12 +534,7 @@ namespace Barotrauma Limb leftLeg = GetLimb(LimbType.LeftLeg); Limb rightLeg = GetLimb(LimbType.RightLeg); - - float limpAmount = - character.CharacterHealth.GetAfflictionStrength("damage", leftFoot, true) + - character.CharacterHealth.GetAfflictionStrength("damage", rightFoot, true); - limpAmount = MathHelper.Clamp(limpAmount / 100.0f, 0.0f, 1.0f); - + float walkCycleMultiplier = 1.0f; if (Stairs != null) { @@ -560,8 +555,7 @@ namespace Barotrauma //TODO: take into account that the feet aren't necessarily in CurrentHull //full slowdown (1.5f) when water is up to the torso surfaceY = ConvertUnits.ToSimUnits(currentHull.Surface); - float bottomPos = Math.Max(colliderPos.Y, currentHull.Rect.Y - currentHull.Rect.Height); - slowdownAmount = MathHelper.Clamp((surfaceY - bottomPos) / TorsoPosition.Value, 0.0f, 1.0f) * 1.5f; + slowdownAmount = MathHelper.Clamp((surfaceY - colliderPos.Y) / TorsoPosition.Value, 0.0f, 1.0f) * 1.5f; } float maxSpeed = Math.Max(TargetMovement.Length() - slowdownAmount, 1.0f); @@ -570,10 +564,11 @@ namespace Barotrauma float walkPosX = (float)Math.Cos(WalkPos); float walkPosY = (float)Math.Sin(WalkPos); - + + Vector2 stepSize = StepSize.Value; stepSize.X *= walkPosX; - stepSize.Y *= walkPosY; + stepSize.Y *= walkPosY; float footMid = colliderPos.X; if (limpAmount > 0.0f) @@ -594,7 +589,7 @@ namespace Barotrauma movement.Y = 0.0f; if (torso == null) { return; } - + bool isNotRemote = true; if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) isNotRemote = !character.IsRemotePlayer; @@ -698,7 +693,7 @@ namespace Barotrauma //make the character limp if the feet are damaged float footAfflictionStrength = character.CharacterHealth.GetAfflictionStrength("damage", foot, true); - footPos.X *= MathHelper.Lerp(1.0f, 0.75f, MathHelper.Clamp(footAfflictionStrength / 50.0f, 0.0f, 1.0f)); + footPos *= MathHelper.Lerp(1.0f, 0.5f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f)); if (onSlope && Stairs == null) { @@ -788,19 +783,13 @@ namespace Barotrauma //get the upper arm to point downwards var arm = GetLimb(armType); - if (Math.Abs(arm.body.AngularVelocity) < 10.0f) - { - arm.body.SmoothRotate(MathHelper.Clamp(-arm.body.AngularVelocity, -0.1f, 0.1f), arm.Mass * 10.0f); - } + arm.body.SmoothRotate(MathHelper.Clamp(-arm.body.AngularVelocity, -0.1f, 0.1f), arm.Mass * 10.0f); //get the elbow to a neutral rotation - if (Math.Abs(hand.body.AngularVelocity) < 10.0f) - { - LimbJoint elbow = + LimbJoint elbow = GetJointBetweenLimbs(armType, hand.type) ?? GetJointBetweenLimbs(armType, foreArmType); - hand.body.ApplyTorque(MathHelper.Clamp(-elbow.JointAngle, -MathHelper.PiOver2, MathHelper.PiOver2) * hand.Mass * 10.0f); - } + hand.body.ApplyTorque(-elbow.JointAngle * hand.Mass * 10.0f); } } } @@ -1138,12 +1127,12 @@ namespace Barotrauma #if CLIENT if (Math.Abs(leftFootPos - prevLeftFootPos) > stepHeight && leftFoot.LastImpactSoundTime < Timing.TotalTime - Limb.SoundInterval) { - SoundPlayer.PlaySound("footstep_armor_heavy", leftFoot.WorldPosition, hullGuess: currentHull); + SoundPlayer.PlaySound("footstep_armor_heavy", volume: 0.5f, range: 500.0f, position: leftFoot.WorldPosition); leftFoot.LastImpactSoundTime = (float)Timing.TotalTime; } if (Math.Abs(rightFootPos - prevRightFootPos) > stepHeight && rightFoot.LastImpactSoundTime < Timing.TotalTime - Limb.SoundInterval) { - SoundPlayer.PlaySound("footstep_armor_heavy", rightFoot.WorldPosition, hullGuess: currentHull); + SoundPlayer.PlaySound("footstep_armor_heavy", volume: 0.5f, range: 500.0f, position: rightFoot.WorldPosition); rightFoot.LastImpactSoundTime = (float)Timing.TotalTime; } #endif @@ -1194,8 +1183,7 @@ namespace Barotrauma isClimbing = false; } } - else if ((character.IsKeyDown(InputType.Left) || character.IsKeyDown(InputType.Right)) && - (!character.IsKeyDown(InputType.Up) && !character.IsKeyDown(InputType.Down))) + else if (character.IsKeyDown(InputType.Left) || character.IsKeyDown(InputType.Right)) { isClimbing = false; } diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Params/Ragdoll/RagdollParams.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Params/Ragdoll/RagdollParams.cs index 81677d50f..3f32ca43d 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Params/Ragdoll/RagdollParams.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Params/Ragdoll/RagdollParams.cs @@ -84,7 +84,6 @@ namespace Barotrauma var folder = XMLExtensions.TryLoadXml(Character.GetConfigFile(speciesName))?.Root?.Element("ragdolls")?.GetAttributeString("folder", string.Empty); if (string.IsNullOrEmpty(folder) || folder.ToLowerInvariant() == "default") { - //DebugConsole.NewMessage("[RagollParams] Using the default folder."); folder = GetDefaultFolder(speciesName); } return folder; diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs index 46ff1d502..934e0bd3a 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs @@ -674,6 +674,8 @@ namespace Barotrauma velocity -= ((Submarine)f2.Body.UserData).Velocity; } + if (character.Submarine == null && f2.Body.UserData is Submarine) velocity -= ((Submarine)f2.Body.UserData).Velocity; + float impact = Vector2.Dot(velocity, -normal); if (f1.Body == Collider.FarseerBody || !Collider.Enabled) { @@ -692,11 +694,6 @@ namespace Barotrauma character.AddDamage(impactPos, new List() { AfflictionPrefab.InternalDamage.Instantiate((impact - ImpactTolerance) * 10.0f) }, 0.0f, true); strongestImpact = Math.Max(strongestImpact, impact - ImpactTolerance); character.ApplyStatusEffects(ActionType.OnImpact, 1.0f); - //briefly disable impact damage - //otherwise the character will take damage multiple times when for example falling, - //because we use the velocity of the collider to determine the impact - //(i.e. the character would take damage until the collider hits the floor and stops) - character.DisableImpactDamageTimer = 0.25f; } } } @@ -704,7 +701,7 @@ namespace Barotrauma ImpactProjSpecific(impact, f1.Body); } - public void SeverLimbJoint(LimbJoint limbJoint, bool playSound = true) + public void SeverLimbJoint(LimbJoint limbJoint) { if (!limbJoint.CanBeSevered || limbJoint.IsSevered) { @@ -733,7 +730,7 @@ namespace Barotrauma } } - partial void SeverLimbJointProjSpecific(LimbJoint limbJoint, bool playSound = true); + partial void SeverLimbJointProjSpecific(LimbJoint limbJoint); private void GetConnectedLimbs(List connectedLimbs, List checkedJoints, Limb limb) { diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Attack.cs b/Barotrauma/BarotraumaShared/Source/Characters/Attack.cs index f89ae0d22..0e84aa580 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Attack.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Attack.cs @@ -80,13 +80,13 @@ namespace Barotrauma public HitDetection HitDetectionType { get; private set; } [Serialize(AIBehaviorAfterAttack.FallBack, true), Editable(ToolTip = "The preferred AI behavior after the attack.")] - public AIBehaviorAfterAttack AfterAttack { get; set; } + public AIBehaviorAfterAttack AfterAttack { get; private set; } [Serialize(false, true), Editable(ToolTip = "Should the ai try to reverse when aiming with this attack?")] public bool Reverse { get; private set; } [Serialize(0.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 2000.0f, ToolTip = "Min distance from the attack limb to the target before the AI tries to attack.")] - public float Range { get; set; } + public float Range { get; private set; } [Serialize(0.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 2000.0f, ToolTip = "Min distance from the attack limb to the target to do damage. In distance based hit detection, the hit will be registered as soon as the target is within the damage range, unless the attack duration has expired.")] public float DamageRange { get; set; } @@ -95,19 +95,19 @@ namespace Barotrauma public float Duration { get; private set; } [Serialize(5f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 100.0f, DecimalCount = 2, ToolTip = "How long the AI waits between the attacks.")] - public float CoolDown { get; set; } = 5; + public float CoolDown { get; private set; } = 5; [Serialize(0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 100.0f, DecimalCount = 2, ToolTip = "Used as the attack cooldown between different kind of attacks. Does not have effect, if set to 0.")] - public float SecondaryCoolDown { get; set; } = 0; + public float SecondaryCoolDown { get; private set; } = 0; [Serialize(0f, true), Editable(MinValueFloat = 0, MaxValueFloat = 1, DecimalCount = 2, ToolTip = "Random factor applied to all cooldowns. Example: 0.1 -> adds a random value between -10% and 10% of the cooldown. Min 0 (default), Max 1 (could disable or double the cooldown in extreme cases).")] public float CoolDownRandomFactor { get; private set; } = 0; [Serialize(0.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 10000.0f)] - public float StructureDamage { get; set; } + public float StructureDamage { get; private set; } [Serialize(0.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 1000.0f)] - public float ItemDamage { get; set; } + public float ItemDamage { get; private set; } /// /// Legacy support. Use Afflictions. @@ -283,7 +283,6 @@ namespace Barotrauma if (afflictionPrefab == null) { DebugConsole.ThrowError("Error in Attack (" + parentDebugName + ") - Affliction prefab \"" + afflictionName + "\" not found."); - continue; } } else @@ -293,7 +292,6 @@ namespace Barotrauma if (afflictionPrefab == null) { DebugConsole.ThrowError("Error in Attack (" + parentDebugName + ") - Affliction prefab \"" + afflictionIdentifier + "\" not found."); - continue; } } diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs index b52392f18..720372de4 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs @@ -426,7 +426,7 @@ namespace Barotrauma } } - public bool CanSpeak; + private bool canSpeak; private bool speechImpedimentSet; @@ -436,7 +436,7 @@ namespace Barotrauma { get { - if (!CanSpeak || IsUnconscious || Stun > 0.0f || IsDead) return 100.0f; + if (!canSpeak || IsUnconscious || Stun > 0.0f || IsDead) return 100.0f; return speechImpediment; } set @@ -710,7 +710,7 @@ namespace Barotrauma displayName = TextManager.Get($"Character.{Path.GetFileName(Path.GetDirectoryName(file))}", true); IsHumanoid = doc.Root.GetAttributeBool("humanoid", false); - CanSpeak = doc.Root.GetAttributeBool("canspeak", false); + canSpeak = doc.Root.GetAttributeBool("canspeak", false); needsAir = doc.Root.GetAttributeBool("needsair", false); Noise = doc.Root.GetAttributeFloat("noise", 100f); @@ -853,7 +853,7 @@ namespace Barotrauma { if (characterConfigFiles == null) { - characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character, searchAllContentPackages: true); + characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character); } return characterConfigFiles; } @@ -1103,14 +1103,14 @@ namespace Barotrauma if (leftFoot != null) { float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", leftFoot, true); - speed *= MathHelper.Lerp(1.0f, 0.4f, MathHelper.Clamp(footAfflictionStrength / 80.0f, 0.0f, 1.0f)); + speed *= MathHelper.Lerp(1.0f, 0.25f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f)); } var rightFoot = AnimController.GetLimb(LimbType.RightFoot); if (rightFoot != null) { float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", rightFoot, true); - speed *= MathHelper.Lerp(1.0f, 0.4f, MathHelper.Clamp(footAfflictionStrength / 80.0f, 0.0f, 1.0f)); + speed *= MathHelper.Lerp(1.0f, 0.25f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f)); } return speed; @@ -1428,6 +1428,26 @@ namespace Barotrauma return (wall == null || !wall.CastShadow) && (door == null || door.IsOpen); } + public bool CanSeeCharacter(Character character, Vector2 sourceWorldPos) + { + Vector2 diff = ConvertUnits.ToSimUnits(character.WorldPosition - sourceWorldPos); + + Body closestBody = null; + if (character.Submarine == null) + { + closestBody = Submarine.CheckVisibility(sourceWorldPos, sourceWorldPos + diff); + if (closestBody == null) return true; + } + else + { + closestBody = Submarine.CheckVisibility(character.WorldPosition, character.WorldPosition - diff); + if (closestBody == null) return true; + } + + Structure wall = closestBody.UserData as Structure; + return wall == null || !wall.CastShadow; + } + public bool HasEquippedItem(Item item) { for (int i = 0; i < Inventory.Capacity; i++) @@ -1568,8 +1588,9 @@ namespace Barotrauma } } } - - if (item.InteractDistance == 0.0f && !item.Prefab.Triggers.Any()) { return false; } + + + if (item.InteractDistance == 0.0f && !item.Prefab.Triggers.Any()) return false; Pickable pickableComponent = item.GetComponent(); if (pickableComponent != null && (pickableComponent.Picker != null && !pickableComponent.Picker.IsDead)) { return false; } @@ -2023,10 +2044,6 @@ namespace Barotrauma { IsRagdolled = IsForceRagdolled; } - else if (IsRemotePlayer) - { - IsRagdolled = IsKeyDown(InputType.Ragdoll); - } //Keep us ragdolled if we were forced or we're too speedy to unragdoll else if (allowRagdoll && (!IsRagdolled || AnimController.Collider.LinearVelocity.LengthSquared() < 1f)) { @@ -2155,8 +2172,7 @@ namespace Barotrauma public void Speak(string message, ChatMessageType? messageType = null, float delay = 0.0f, string identifier = "", float minDurationBetweenSimilar = 0.0f) { - if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) { return; } - if (string.IsNullOrEmpty(message)) { return; } + if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) return; //already sent a similar message a moment ago if (!string.IsNullOrEmpty(identifier) && minDurationBetweenSimilar > 0.0f && @@ -2165,6 +2181,7 @@ namespace Barotrauma { return; } + aiChatMessageQueue.Add(new AIChatMessage(message, messageType, identifier, delay)); } @@ -2581,9 +2598,11 @@ namespace Barotrauma GameMain.GameSession?.CrewManager?.RemoveCharacter(this); #endif - CharacterList.Remove(this); +#if CLIENT + GameMain.GameSession?.CrewManager?.RemoveCharacter(this); +#endif - if (Controlled == this) { Controlled = null; } + CharacterList.Remove(this); if (Inventory != null) { diff --git a/Barotrauma/BarotraumaShared/Source/Characters/CharacterInfo.cs b/Barotrauma/BarotraumaShared/Source/Characters/CharacterInfo.cs index f6f4af9ca..8dcf98fce 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/CharacterInfo.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/CharacterInfo.cs @@ -399,7 +399,7 @@ namespace Barotrauma { ID = idCounter; idCounter++; - Name = element.GetAttributeString("name", ""); + Name = element.GetAttributeString("name", "unnamed"); string genderStr = element.GetAttributeString("gender", "male").ToLowerInvariant(); File = element.GetAttributeString("file", ""); SourceElement = GetConfig(File).Root; @@ -423,29 +423,6 @@ namespace Barotrauma element.GetAttributeInt("beardindex", -1), element.GetAttributeInt("moustacheindex", -1), element.GetAttributeInt("faceattachmentindex", -1)); - - if (string.IsNullOrEmpty(Name)) - { - if (SourceElement.Element("name") != null) - { - string firstNamePath = SourceElement.Element("name").GetAttributeString("firstname", ""); - if (firstNamePath != "") - { - firstNamePath = firstNamePath.Replace("[GENDER]", (Head.gender == Gender.Female) ? "female" : "male"); - Name = ToolBox.GetRandomLine(firstNamePath); - } - - string lastNamePath = SourceElement.Element("name").GetAttributeString("lastname", ""); - if (lastNamePath != "") - { - lastNamePath = lastNamePath.Replace("[GENDER]", (Head.gender == Gender.Female) ? "female" : "male"); - if (Name != "") Name += " "; - Name += ToolBox.GetRandomLine(lastNamePath); - } - } - } - - StartItemsGiven = element.GetAttributeBool("startitemsgiven", false); string personalityName = element.GetAttributeString("personality", ""); ragdollFileName = element.GetAttributeString("ragdoll", string.Empty); @@ -729,8 +706,6 @@ namespace Barotrauma partial void LoadAttachmentSprites(); - // TODO: change the formula so that it's not linear and so that it takes into account the usefulness of the skill - // -> give a weight to each skill, because some are much more valuable than others? private int CalculateSalary() { if (Name == null || Job == null) return 0; diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs b/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs index 4f5769f34..9a25fcd52 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs @@ -231,8 +231,7 @@ namespace Barotrauma : afflictions.Concat(limbHealths.SelectMany(lh => lh.Afflictions.Where(limbHealthFilter))); } - private LimbHealth GetMatchingLimbHealth(Limb limb) => limbHealths[limb.HealthIndex]; - private LimbHealth GetMathingLimbHealth(Affliction affliction) => GetMatchingLimbHealth(Character.AnimController.GetLimb(affliction.Prefab.IndicatorLimb)); + private LimbHealth GetMathingLimbHealth(Affliction affliction) => limbHealths[Character.AnimController.GetLimb(affliction.Prefab.IndicatorLimb).HealthIndex]; /// /// Returns the limb afflictions and non-limbspecific afflictions that are set to be displayed on this limb. @@ -266,12 +265,6 @@ namespace Barotrauma public Affliction GetAffliction(string afflictionType, Limb limb) { - if (limb.HealthIndex < 0 || limb.HealthIndex >= limbHealths.Count) - { - DebugConsole.ThrowError("Limb health index out of bounds. Character\"" + Character.Name + - "\" only has health configured for" + limbHealths.Count + " limbs but the limb " + limb.type + " is targeting index " + limb.HealthIndex); - return null; - } foreach (Affliction affliction in limbHealths[limb.HealthIndex].Afflictions) { if (affliction.Prefab.AfflictionType == afflictionType) return affliction; @@ -473,13 +466,7 @@ namespace Barotrauma private void AddLimbAffliction(Limb limb, Affliction newAffliction) { - if (!newAffliction.Prefab.LimbSpecific || limb == null) return; - if (limb.HealthIndex < 0 || limb.HealthIndex >= limbHealths.Count) - { - DebugConsole.ThrowError("Limb health index out of bounds. Character\"" + Character.Name + - "\" only has health configured for" + limbHealths.Count + " limbs but the limb " + limb.type + " is targeting index " + limb.HealthIndex); - return; - } + if (!newAffliction.Prefab.LimbSpecific) return; AddLimbAffliction(limbHealths[limb.HealthIndex], newAffliction); } @@ -624,12 +611,6 @@ namespace Barotrauma partial void UpdateBleedingProjSpecific(AfflictionBleeding affliction, Limb targetLimb, float deltaTime); - public void SetVitality(float newVitality) - { - maxVitality = newVitality; - CalculateVitality(); - } - public void CalculateVitality() { Vitality = MaxVitality; diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Jobs/JobPrefab.cs b/Barotrauma/BarotraumaShared/Source/Characters/Jobs/JobPrefab.cs index 9d144d858..e96a3cc66 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Jobs/JobPrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Jobs/JobPrefab.cs @@ -1,17 +1,32 @@ using Microsoft.Xna.Framework; using System.Collections.Generic; using System.Xml.Linq; +using Barotrauma.Extensions; namespace Barotrauma { + public class AutomaticOrder + { + public string aiTag; + public string option; + public float priority; + + public AutomaticOrder(XElement element) + { + aiTag = element.GetAttributeString("aitag", null); + option = element.GetAttributeString("option", null); + priority = element.GetAttributeFloat("priority", 0); + } + } + partial class JobPrefab { public static List List; - - public readonly XElement Items; - public readonly List ItemNames; - public List Skills; + public readonly XElement Items; + public readonly List ItemNames = new List(); + public readonly List Skills = new List(); + public readonly List AutomaticOrders = new List(); [Serialize("1,1,1,1", false)] public Color UIColor @@ -111,10 +126,6 @@ namespace Barotrauma Name = TextManager.Get("JobName." + Identifier); Description = TextManager.Get("JobDescription." + Identifier); - ItemNames = new List(); - - Skills = new List(); - foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) @@ -155,7 +166,10 @@ namespace Barotrauma foreach (XElement skillElement in subElement.Elements()) { Skills.Add(new SkillPrefab(skillElement)); - } + } + break; + case "automaticorders": + subElement.Elements().ForEach(order => AutomaticOrders.Add(new AutomaticOrder(order))); break; } } diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Limb.cs b/Barotrauma/BarotraumaShared/Source/Characters/Limb.cs index 5b2ec99b9..2814b127c 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Limb.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Limb.cs @@ -94,7 +94,7 @@ namespace Barotrauma } } - partial class Limb : ISerializableEntity, ISpatialEntity + partial class Limb : ISerializableEntity { // Note: not used private const float LimbDensity = 15; @@ -155,8 +155,6 @@ namespace Barotrauma } } - public Submarine Submarine => character.Submarine; - public Vector2 WorldPosition { get { return character.Submarine == null ? Position : Position + character.Submarine.Position; } diff --git a/Barotrauma/BarotraumaShared/Source/ContentPackage.cs b/Barotrauma/BarotraumaShared/Source/ContentPackage.cs index e51a98e27..e7407db0f 100644 --- a/Barotrauma/BarotraumaShared/Source/ContentPackage.cs +++ b/Barotrauma/BarotraumaShared/Source/ContentPackage.cs @@ -217,7 +217,6 @@ namespace Barotrauma { return corePackageRequiredFiles.All(fileType => Files.Any(file => file.Type == fileType)); } - public bool ContainsRequiredCorePackageFiles(out List missingContentTypes) { missingContentTypes = new List(); @@ -231,25 +230,6 @@ namespace Barotrauma return missingContentTypes.Count == 0; } - /// - /// Make sure all the files defined in the content package are present - /// - /// - public bool VerifyFiles(out List errorMessages) - { - errorMessages = new List(); - foreach (ContentFile file in Files) - { - if (!File.Exists(file.Path)) - { - errorMessages.Add("File \"" + file.Path + "\" not found."); - continue; - } - } - - return errorMessages.Count == 0; - } - public static ContentPackage CreatePackage(string name, string path, bool corePackage) { ContentPackage newPackage = new ContentPackage() @@ -418,13 +398,6 @@ namespace Barotrauma return path == "Mods"; } } - /// - /// Are mods allowed to install a file into the specified path. If a content package XML includes files - /// with a prohibited path, they are treated as references to external files. For example, a mod could include - /// some vanilla files in the XML, in which case the game will simply use the vanilla files present in the game folder. - /// - /// - /// public static bool IsModFilePathAllowed(string path) { while (true) @@ -449,6 +422,16 @@ namespace Barotrauma return contentPackages.SelectMany(f => f.Files).Where(f => f.Type == type).Select(f => f.Path); } + public IEnumerable GetFilesOfType(ContentType type) + { + return Files.Where(f => f.Type == type).Select(f => f.Path); + } + + public static IEnumerable GetFilesOfType(IEnumerable contentPackages, ContentType type) + { + return contentPackages.SelectMany(f => f.Files).Where(f => f.Type == type).Select(f => f.Path); + } + public IEnumerable GetFilesOfType(ContentType type) { return Files.Where(f => f.Type == type).Select(f => f.Path); diff --git a/Barotrauma/BarotraumaShared/Source/DebugConsole.cs b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs index 39d8abd87..d6c2f4fce 100644 --- a/Barotrauma/BarotraumaShared/Source/DebugConsole.cs +++ b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs @@ -68,7 +68,7 @@ namespace Barotrauma if (!CheatsEnabled && IsCheat) { NewMessage("You need to enable cheats using the command \"enablecheats\" before you can use the command \"" + names[0] + "\".", Color.Red); - if (Steam.SteamManager.USE_STEAM) + if (GameMain.Config.UseSteam) { NewMessage("Enabling cheats will disable Steam achievements during this play session.", Color.Red); } @@ -228,7 +228,7 @@ namespace Barotrauma { string errorMsg = "Failed to spawn an item. Arguments: \"" + string.Join(" ", args) + "\"."; ThrowError(errorMsg, e); - GameAnalyticsManager.AddErrorEventOnce("DebugConsole.SpawnItem:Error", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg + '\n' + e.Message + '\n' + e.StackTrace); + GameAnalyticsManager.AddErrorEventOnce("DebugConsole.SpawnItem:Error", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); } }, () => @@ -615,7 +615,7 @@ namespace Barotrauma NewMessage(Hull.EditWater ? "Water editing on" : "Water editing off", Color.White); }, isCheat: true)); - commands.Add(new Command("fire|editfire", "fire/editfire: Allows putting up fires by left clicking.", (string[] args) => + commands.Add(new Command("water|editwater", "water/editwater: Toggle water editing. Allows adding water into rooms by holding the left mouse button and removing it by holding the right mouse button.", (string[] args) => { Hull.EditFire = !Hull.EditFire; NewMessage(Hull.EditFire ? "Fire spawning on" : "Fire spawning off", Color.White); diff --git a/Barotrauma/BarotraumaShared/Source/Events/Missions/Mission.cs b/Barotrauma/BarotraumaShared/Source/Events/Missions/Mission.cs index 7df6131cd..c317d6e7a 100644 --- a/Barotrauma/BarotraumaShared/Source/Events/Missions/Mission.cs +++ b/Barotrauma/BarotraumaShared/Source/Events/Missions/Mission.cs @@ -55,9 +55,9 @@ namespace Barotrauma get { return true; } } - public virtual IEnumerable SonarPositions + public virtual Vector2 SonarPosition { - get { return Enumerable.Empty(); } + get { return Vector2.Zero; } } public string SonarLabel diff --git a/Barotrauma/BarotraumaShared/Source/Events/Missions/MonsterMission.cs b/Barotrauma/BarotraumaShared/Source/Events/Missions/MonsterMission.cs index 6e8445416..7da9e0e3f 100644 --- a/Barotrauma/BarotraumaShared/Source/Events/Missions/MonsterMission.cs +++ b/Barotrauma/BarotraumaShared/Source/Events/Missions/MonsterMission.cs @@ -1,6 +1,4 @@ using Microsoft.Xna.Framework; -using System.Collections.Generic; -using System.Linq; namespace Barotrauma { @@ -12,55 +10,30 @@ namespace Barotrauma private int monsterCount; - private readonly List monsters = new List(); - private readonly List sonarPositions = new List(); + private Vector2 sonarPosition; - public override IEnumerable SonarPositions + public override Vector2 SonarPosition { - get - { - return sonarPositions; - } + get { return monster != null && !monster.IsDead ? sonarPosition : Vector2.Zero; } } public MonsterMission(MissionPrefab prefab, Location[] locations) : base(prefab, locations) { monsterFile = prefab.ConfigElement.GetAttributeString("monsterfile", ""); - monsterCount = prefab.ConfigElement.GetAttributeInt("monstercount", 1); } public override void Start(Level level) { Level.Loaded.TryGetInterestingPosition(true, Level.PositionType.MainPath, Level.Loaded.Size.X * 0.3f, out Vector2 spawnPos); - //bool isClient = GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient; - //for (int i = 0; i < monsterCount; i++) - //{ - // monsters.Add(Character.Create(monsterFile, spawnPos, ToolBox.RandomSeed(8), null, isClient, true, false)); - //} - //monsters.ForEach(m => m.Enabled = false); - //SwarmBehavior.CreateSwarm(monsters.Cast()); - //sonarPositions.Add(spawnPos); - - float offsetAmount = 500; - for (int i = 0; i < monsterCount; i++) - { - CoroutineManager.InvokeAfter(() => - { - bool isClient = GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient; - var monster = Character.Create(monsterFile, spawnPos + Rand.Vector(offsetAmount, Rand.RandSync.Server), i.ToString(), null, isClient, true, true); - monster.Enabled = false; - monsters.Add(monster); - if (monsters.Count == monsterCount) - { - //this will do nothing if the monsters have no swarm behavior defined, - //otherwise it'll make the spawned characters act as a swarm - SwarmBehavior.CreateSwarm(monsters.Cast()); - sonarPositions.Add(spawnPos); - } - }, Rand.Range(0f, monsterCount / 2, Rand.RandSync.Server)); - } + bool isClient = false; +#if CLIENT + isClient = GameMain.Client != null; +#endif + monster = Character.Create(monsterFile, spawnPos, ToolBox.RandomSeed(8), null, isClient, true, false); + monster.Enabled = false; + sonarPosition = spawnPos; } public override void Update(float deltaTime) @@ -72,15 +45,7 @@ namespace Barotrauma var activeMonsters = monsters.Where(m => m != null && !m.Removed && !m.IsDead); if (activeMonsters.Any()) { - Vector2 centerOfMass = Vector2.Zero; - foreach (var monster in activeMonsters) - { - //don't add another label if there's another monster roughly at the same spot - if (sonarPositions.All(p => Vector2.DistanceSquared(p, monster.Position) > 1000.0f * 1000.0f)) - { - sonarPositions.Add(monster.Position); - } - } + sonarPosition = monster.Position; } diff --git a/Barotrauma/BarotraumaShared/Source/Events/Missions/SalvageMission.cs b/Barotrauma/BarotraumaShared/Source/Events/Missions/SalvageMission.cs index 7d5d16917..00febbf8a 100644 --- a/Barotrauma/BarotraumaShared/Source/Events/Missions/SalvageMission.cs +++ b/Barotrauma/BarotraumaShared/Source/Events/Missions/SalvageMission.cs @@ -16,18 +16,11 @@ namespace Barotrauma private int state; - public override IEnumerable SonarPositions + public override Vector2 SonarPosition { get { - if (state > 0 ) - { - Enumerable.Empty(); - } - else - { - yield return ConvertUnits.ToDisplayUnits(item.SimPosition); - } + return state > 0 ? Vector2.Zero : ConvertUnits.ToDisplayUnits(item.SimPosition); } } diff --git a/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs b/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs index 6c65cee87..c5db6fa09 100644 --- a/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs +++ b/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs @@ -227,17 +227,17 @@ namespace Barotrauma monsters = new List(); float offsetAmount = spawnPosType == Level.PositionType.MainPath ? 1000 : 100; for (int i = 0; i < amount; i++) - { + { CoroutineManager.InvokeAfter(() => { - bool isClient = GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient; + bool isClient = false; +#if CLIENT + isClient = GameMain.Client != null; +#endif monsters.Add(Character.Create(characterFile, spawnPos + Rand.Vector(offsetAmount, Rand.RandSync.Server), i.ToString(), null, isClient, true, true)); if (monsters.Count == amount) { spawnReady = true; - //this will do nothing if the monsters have no swarm behavior defined, - //otherwise it'll make the spawned characters act as a swarm - SwarmBehavior.CreateSwarm(monsters.Cast()); } }, Rand.Range(0f, amount / 2, Rand.RandSync.Server)); } diff --git a/Barotrauma/BarotraumaShared/Source/Extensions/StringFormatter.cs b/Barotrauma/BarotraumaShared/Source/Extensions/StringFormatter.cs index 9aa6cdada..541879e2d 100644 --- a/Barotrauma/BarotraumaShared/Source/Extensions/StringFormatter.cs +++ b/Barotrauma/BarotraumaShared/Source/Extensions/StringFormatter.cs @@ -8,22 +8,6 @@ namespace Barotrauma { public static class StringFormatter { - public static string Replace(this string s, string replacement, Func predicate) - { - var newString = new string[s.Length]; - for (int i = 0; i < s.Length; i++) - { - char letter = s[i]; - string newLetter = letter.ToString(); - if (predicate(letter)) - { - newLetter = replacement; - } - newString[i] = newLetter; - } - return new string(newString.SelectMany(str => str.ToCharArray()).ToArray()); - } - public static string Remove(this string s, Func predicate) { return new string(s.ToCharArray().Where(c => !predicate(c)).ToArray()); diff --git a/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs b/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs index 271dd6dc1..aa0aa8fda 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs @@ -108,7 +108,7 @@ namespace Barotrauma } #if CLIENT - new GUIMessageBox("", TextManager.Get("CargoSpawnNotification").Replace("[roomname]", cargoRoom.DisplayName)); + new GUIMessageBox("", TextManager.Get("CargoSpawnNotification").Replace("[roomname]", cargoRoom.RoomName)); #endif Dictionary availableContainers = new Dictionary(); diff --git a/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/CampaignMode.cs b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/CampaignMode.cs index cdc0b10cb..220e756cd 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/CampaignMode.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/CampaignMode.cs @@ -12,8 +12,7 @@ namespace Barotrauma public bool CheatsEnabled; - const int InitialMoney = 8700; - public const int HullRepairCost = 500, ItemRepairCost = 500; + const int InitialMoney = 4700; protected bool watchmenSpawned; protected Character startWatchman, endWatchman; @@ -21,8 +20,6 @@ namespace Barotrauma //key = dialog flag, double = Timing.TotalTime when the line was last said private Dictionary dialogLastSpoken = new Dictionary(); - public bool PurchasedHullRepairs, PurchasedItemRepairs; - protected Map map; public Map Map { @@ -73,37 +70,6 @@ namespace Barotrauma watchmenSpawned = false; startWatchman = null; endWatchman = null; - - if (PurchasedHullRepairs) - { - foreach (Structure wall in Structure.WallList) - { - if (wall.Submarine == null || wall.Submarine.IsOutpost) { continue; } - if (wall.Submarine == Submarine.MainSub || Submarine.MainSub.DockedTo.Contains(wall.Submarine)) - { - for (int i = 0; i < wall.SectionCount; i++) - { - wall.AddDamage(i, -100000.0f); - } - } - } - PurchasedHullRepairs = false; - } - if (PurchasedItemRepairs) - { - foreach (Item item in Item.ItemList) - { - if (item.Submarine == null || item.Submarine.IsOutpost) { continue; } - if (item.Submarine == Submarine.MainSub || Submarine.MainSub.DockedTo.Contains(item.Submarine)) - { - if (item.GetComponent() != null) - { - item.Condition = item.Health; - } - } - } - PurchasedItemRepairs = false; - } } public override void Update(float deltaTime) diff --git a/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/MultiPlayerCampaign.cs b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/MultiPlayerCampaign.cs index f172f2760..461209f64 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/MultiPlayerCampaign.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/MultiPlayerCampaign.cs @@ -184,7 +184,7 @@ namespace Barotrauma if (CheatsEnabled) { DebugConsole.CheatsEnabled = true; - if (Steam.SteamManager.USE_STEAM && !SteamAchievementManager.CheatsEnabled) + if (GameMain.Config.UseSteam && !SteamAchievementManager.CheatsEnabled) { SteamAchievementManager.CheatsEnabled = true; #if CLIENT diff --git a/Barotrauma/BarotraumaShared/Source/GameSettings.cs b/Barotrauma/BarotraumaShared/Source/GameSettings.cs index d2faa06c6..763de75fc 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSettings.cs @@ -43,7 +43,6 @@ namespace Barotrauma public bool SpecularityEnabled { get; set; } public bool ChromaticAberrationEnabled { get; set; } - public bool PauseOnFocusLost { get; set; } = true; public bool MuteOnFocusLost { get; set; } public bool UseDirectionalVoiceChat { get; set; } @@ -78,17 +77,24 @@ namespace Barotrauma #if DEBUG //steam functionality can be enabled/disabled in debug builds + public bool UseSteam; public bool RequireSteamAuthentication { - get { return requireSteamAuthentication && Steam.SteamManager.USE_STEAM; } + get { return requireSteamAuthentication && UseSteam; } set { requireSteamAuthentication = value; } } public bool UseSteamMatchmaking { - get { return useSteamMatchmaking && Steam.SteamManager.USE_STEAM; } + get { return useSteamMatchmaking && UseSteam; } set { useSteamMatchmaking = value; } } + #else + //steam functionality determined at compile time + public bool UseSteam + { + get { return Steam.SteamManager.USE_STEAM; } + } public bool RequireSteamAuthentication { get { return requireSteamAuthentication && Steam.SteamManager.USE_STEAM; } @@ -432,6 +438,9 @@ namespace Barotrauma VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false); SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false); +#if DEBUG + UseSteam = doc.Root.GetAttributeBool("usesteam", true); +#endif QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", ""); if (doc == null) @@ -595,14 +604,13 @@ namespace Barotrauma } foreach (ContentPackage contentPackage in SelectedContentPackages) { - bool packageOk = contentPackage.VerifyFiles(out List errorMessages); - if (!packageOk) - { - DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\":\n" + string.Join("\n", errorMessages)); - continue; - } foreach (ContentFile file in contentPackage.Files) { + if (!System.IO.File.Exists(file.Path)) + { + DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\" - file \"" + file.Path + "\" not found."); + continue; + } ToolBox.IsProperFilenameCase(file.Path); } } @@ -841,16 +849,12 @@ namespace Barotrauma EnableSplashScreen = doc.Root.GetAttributeBool("enablesplashscreen", EnableSplashScreen); - PauseOnFocusLost = doc.Root.GetAttributeBool("pauseonfocuslost", PauseOnFocusLost); AimAssistAmount = doc.Root.GetAttributeFloat("aimassistamount", AimAssistAmount); EnableMouseLook = doc.Root.GetAttributeBool("enablemouselook", EnableMouseLook); CrewMenuOpen = doc.Root.GetAttributeBool("crewmenuopen", CrewMenuOpen); ChatOpen = doc.Root.GetAttributeBool("chatopen", ChatOpen); - CampaignDisclaimerShown = doc.Root.GetAttributeBool("campaigndisclaimershown", false); - EditorDisclaimerShown = doc.Root.GetAttributeBool("editordisclaimershown", false); - foreach (XElement subElement in doc.Root.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) @@ -963,19 +967,24 @@ namespace Barotrauma foreach (ContentPackage contentPackage in SelectedContentPackages) { - bool packageOk = contentPackage.VerifyFiles(out List errorMessages); - if (!packageOk) - { - DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\":\n" + string.Join("\n", errorMessages)); - continue; - } foreach (ContentFile file in contentPackage.Files) { + if (!System.IO.File.Exists(file.Path)) + { + DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\" - file \"" + file.Path + "\" not found."); + continue; + } ToolBox.IsProperFilenameCase(file.Path); } } - - EnsureCoreContentPackageSelected(); + if (!SelectedContentPackages.Any()) + { + var availablePackage = ContentPackage.List.FirstOrDefault(cp => cp.IsCompatible() && cp.CorePackage); + if (availablePackage != null) + { + SelectedContentPackages.Add(availablePackage); + } + } //save to get rid of the invalid selected packages in the config file if (missingPackagePaths.Count > 0 || incompatiblePackages.Count > 0) { SaveNewPlayerConfig(); } @@ -994,25 +1003,6 @@ namespace Barotrauma .Replace("[gameversion]", GameMain.Version.ToString())); } } - - public void EnsureCoreContentPackageSelected() - { - if (SelectedContentPackages.Any(cp => cp.CorePackage)) { return; } - - if (GameMain.VanillaContent != null) - { - SelectedContentPackages.Add(GameMain.VanillaContent); - } - else - { - var availablePackage = ContentPackage.List.FirstOrDefault(cp => cp.IsCompatible() && cp.CorePackage); - if (availablePackage != null) - { - SelectedContentPackages.Add(availablePackage); - } - } - } - #endregion #region Save PlayerConfig @@ -1039,13 +1029,10 @@ namespace Barotrauma new XAttribute("quickstartsub", QuickStartSubmarineName), new XAttribute("requiresteamauthentication", requireSteamAuthentication), new XAttribute("autoupdateworkshopitems", AutoUpdateWorkshopItems), - new XAttribute("pauseonfocuslost", PauseOnFocusLost), new XAttribute("aimassistamount", aimAssistAmount), new XAttribute("enablemouselook", EnableMouseLook), new XAttribute("chatopen", ChatOpen), - new XAttribute("crewmenuopen", CrewMenuOpen), - new XAttribute("campaigndisclaimershown", CampaignDisclaimerShown), - new XAttribute("editordisclaimershown", EditorDisclaimerShown)); + new XAttribute("crewmenuopen", CrewMenuOpen)); if (!ShowUserStatisticsPrompt) { @@ -1148,9 +1135,9 @@ namespace Barotrauma { foreach (Tutorial tutorial in Tutorial.Tutorials) { - if (tutorial.Completed && !CompletedTutorialNames.Contains(tutorial.Identifier)) + if (tutorial.Completed && !CompletedTutorialNames.Contains(tutorial.Name)) { - CompletedTutorialNames.Add(tutorial.Identifier); + CompletedTutorialNames.Add(tutorial.Name); } } } diff --git a/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs b/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs index 4b8d00255..12434a1be 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs @@ -176,9 +176,6 @@ namespace Barotrauma { if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item) { -#if CLIENT - if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; } -#endif if (!Items[i].AllowedSlots.Contains(InvSlotType.Any) || !TryPutItem(Items[i], character, new List { InvSlotType.Any }, true)) { free = false; @@ -198,9 +195,6 @@ namespace Barotrauma { if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] == null) { -#if CLIENT - if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; } -#endif bool removeFromOtherSlots = item.ParentInventory != this; if (placedInSlot == -1 && inWrongSlot) { @@ -254,9 +248,7 @@ namespace Barotrauma GameAnalyticsManager.AddErrorEventOnce("CharacterInventory.TryPutItem:IndexOutOfRange", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); return false; } -#if CLIENT - if (PersonalSlots.HasFlag(SlotTypes[index])) { hidePersonalSlots = false; } -#endif + //there's already an item in the slot if (Items[index] != null) { @@ -281,9 +273,7 @@ namespace Barotrauma foreach (InvSlotType allowedSlot in allowedSlots) { if (!allowedSlot.HasFlag(SlotTypes[index])) continue; -#if CLIENT - if (PersonalSlots.HasFlag(allowedSlot)) { hidePersonalSlots = false; } -#endif + for (int i = 0; i < capacity; i++) { if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs index 73b362727..8e632707b 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs @@ -219,29 +219,31 @@ namespace Barotrauma.Items.Components private bool hasValidIdCard; public override bool HasRequiredItems(Character character, bool addMessage, string msg = null) { + if (item.Condition <= RepairThreshold) return true; //For repairing + var idCard = character.Inventory.FindItemByIdentifier("idcard"); hasValidIdCard = requiredItems.Any(ri => ri.Value.Any(r => r.MatchesItem(idCard))); - Msg = requiredItems.None() || hasValidIdCard ? "ItemMsgOpen" : "ItemMsgForceOpenCrowbar"; + Msg = hasValidIdCard ? "ItemMsgOpen" : "ItemMsgForceOpenCrowbar"; ParseMsg(); if (addMessage) { - msg = msg ?? (HasIntegratedButtons ? accessDeniedTxt : cannotOpenText); + msg = msg ?? (requiredItems.Any(ri => ri.Value.Any(r => r.Identifiers.Contains("idcard"))) ? accessDeniedTxt : cannotOpenText); } - if (isBroken) { return true; } - return base.HasRequiredItems(character, addMessage, msg); + + //this is a bit pointless atm because if canBePicked is false it won't allow you to do Pick() anyway, however it's still good for future-proofing. + return requiredItems.Any() ? base.HasRequiredItems(character, addMessage, msg) : canBePicked; } public override bool Pick(Character picker) { if (item.Condition <= RepairThreshold) { return true; } - if (requiredItems.None()) { return false; } if (HasRequiredItems(picker, false) && hasValidIdCard) { return false; } return base.Pick(picker); } public override bool OnPicked(Character picker) { - if (item.Condition <= RepairThreshold) { return true; } + if (item.Condition <= RepairThreshold) return true; //repairs if (requiredItems.Any() && !hasValidIdCard) { ForceOpen(ActionType.OnPicked); @@ -259,24 +261,23 @@ namespace Barotrauma.Items.Components public override bool Select(Character character) { - if (!isBroken) + //can only be selected if the item is broken + if (item.Condition <= RepairThreshold) return true; //repairs + bool hasRequiredItems = HasRequiredItems(character, false); + if (requiredItems.None() || hasRequiredItems && hasValidIdCard) { - bool hasRequiredItems = HasRequiredItems(character, false); - if (requiredItems.None() || hasRequiredItems && hasValidIdCard) - { - float originalPickingTime = PickingTime; - PickingTime = 0; - ForceOpen(ActionType.OnUse); - PickingTime = originalPickingTime; - } - else if (hasRequiredItems) - { -#if CLIENT - GUI.AddMessage(accessDeniedTxt, Color.Red); -#endif - } + float originalPickingTime = PickingTime; + PickingTime = 0; + ForceOpen(ActionType.OnUse); + PickingTime = originalPickingTime; } - return item.Condition <= RepairThreshold; + else if (hasRequiredItems) + { +#if CLIENT + GUI.AddMessage(accessDeniedTxt, Color.Red); +#endif + } + return false; } public override void Update(float deltaTime, Camera cam) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs index b15306910..966bd5761 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs @@ -122,12 +122,10 @@ namespace Barotrauma.Items.Components foreach (Item subItem in containedSubItems) { projectile = subItem.GetComponent(); + //apply OnUse statuseffects to the container in case it has to react to it somehow //(play a sound, spawn more projectiles, reduce condition...) - if (subItem.Condition > 0.0f) - { - subItem.GetComponent()?.Item.ApplyStatusEffects(ActionType.OnUse, deltaTime); - } + subItem.GetComponent()?.Item.ApplyStatusEffects(ActionType.OnUse, deltaTime); if (projectile != null) break; } } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RepairTool.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RepairTool.cs index 188d307c5..36e56362a 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RepairTool.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RepairTool.cs @@ -293,35 +293,10 @@ namespace Barotrauma.Items.Components //steer closer if almost in range if (dist > Range) { - Vector2 standPos = new Vector2(Math.Sign(-fromItemToLeak.X), Math.Sign(-fromItemToLeak.Y)) / 2; - if (!character.AnimController.InWater) - { - if (leak.IsHorizontal) - { - standPos.X *= 2; - standPos.Y = 0; - } - else - { - standPos.X = 0; - } - } - if (character.AIController.SteeringManager is IndoorsSteeringManager indoorSteering) - { - if (indoorSteering.CurrentPath != null && !indoorSteering.IsPathDirty && indoorSteering.CurrentPath.Unreachable) - { - Vector2 dir = Vector2.Normalize(standPos - character.WorldPosition); - character.AIController.SteeringManager.SteeringManual(deltaTime, dir / 2); - } - else - { - character.AIController.SteeringManager.SteeringSeek(standPos); - } - } - else - { - character.AIController.SteeringManager.SteeringSeek(standPos); - } + Vector2 standPos = leak.IsHorizontal ? new Vector2(Math.Sign(-fromItemToLeak.X), 0.0f) : new Vector2(0.0f, Math.Sign(-fromItemToLeak.Y) * 0.5f); + standPos = leak.WorldPosition + standPos * Range; + Vector2 dir = Vector2.Normalize(standPos - character.WorldPosition); + character.AIController.SteeringManager.SteeringManual(deltaTime, dir / 2); } else { @@ -330,29 +305,30 @@ namespace Barotrauma.Items.Components // Too close -> steer away character.AIController.SteeringManager.SteeringManual(deltaTime, Vector2.Normalize(character.SimPosition - leak.SimPosition) / 2); } - else if (dist <= Range) - { - // In range - character.AIController.SteeringManager.Reset(); - } else { - return false; + character.AIController.SteeringManager.Reset(); } } + sinTime += deltaTime; character.CursorPosition = leak.Position + VectorExtensions.Forward(Item.body.TransformedRotation + (float)Math.Sin(sinTime), dist); if (item.RequireAimToUse) { character.SetInput(InputType.Aim, false, true); } + // Press the trigger only when the tool is approximately facing the target. - var angle = VectorExtensions.Angle(VectorExtensions.Forward(item.body.TransformedRotation), fromItemToLeak); - if (angle < MathHelper.PiOver4) + // If the character is climbing, ignore the check, because we cannot aim while climbing. + if (VectorExtensions.Angle(VectorExtensions.Forward(item.body.TransformedRotation), fromItemToLeak) < MathHelper.PiOver4) { character.SetInput(InputType.Shoot, false, true); Use(deltaTime, character); } + else + { + sinTime -= deltaTime * 2; + } bool leakFixed = (leak.Open <= 0.0f || leak.Removed) && (leak.ConnectedWall == null || leak.ConnectedWall.Sections.Average(s => s.damage) < 1); @@ -362,11 +338,11 @@ namespace Barotrauma.Items.Components sinTime = 0; if (!leak.FlowTargetHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f)) { - character.Speak(TextManager.Get("DialogLeaksFixed").Replace("[roomname]", leak.FlowTargetHull.DisplayName), null, 0.0f, "leaksfixed", 10.0f); + character.Speak(TextManager.Get("DialogLeaksFixed").Replace("[roomname]", leak.FlowTargetHull.RoomName), null, 0.0f, "leaksfixed", 10.0f); } else { - character.Speak(TextManager.Get("DialogLeakFixed").Replace("[roomname]", leak.FlowTargetHull.DisplayName), null, 0.0f, "leakfixed", 10.0f); + character.Speak(TextManager.Get("DialogLeakFixed").Replace("[roomname]", leak.FlowTargetHull.RoomName), null, 0.0f, "leakfixed", 10.0f); } } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs index 76daa7efe..6f0ace085 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs @@ -190,7 +190,7 @@ namespace Barotrauma.Items.Components get { return name; } } - [Editable, Serialize("", true, translationTextTag: "ItemMsg")] + [Editable, Serialize("", true)] public string Msg { get; @@ -580,8 +580,8 @@ namespace Barotrauma.Items.Components public virtual bool HasRequiredItems(Character character, bool addMessage, string msg = null) { - if (!requiredItems.Any()) { return true; } - if (character.Inventory == null) { return false; } + if (!requiredItems.Any()) return true; + if (character.Inventory == null) return false; bool hasRequiredItems = false; bool canContinue = true; if (requiredItems.ContainsKey(RelatedItem.RelationType.Equipped)) @@ -615,15 +615,7 @@ namespace Barotrauma.Items.Components { bool Predicate(Item it) => it != null && it.Condition > 0.0f && relatedItem.MatchesItem(it); bool shouldBreak = false; - bool inEditor = false; -#if CLIENT - inEditor = Screen.Selected == GameMain.SubEditorScreen; -#endif - if (relatedItem.IgnoreInEditor && inEditor) - { - hasRequiredItems = true; - } - else if (relatedItem.IsOptional) + if (relatedItem.IsOptional) { if (!hasRequiredItems) { @@ -792,7 +784,6 @@ namespace Barotrauma.Items.Components newRequiredItem.statusEffects = prevRequiredItem.statusEffects; newRequiredItem.Msg = prevRequiredItem.Msg; newRequiredItem.IsOptional = prevRequiredItem.IsOptional; - newRequiredItem.IgnoreInEditor = prevRequiredItem.IgnoreInEditor; } if (!requiredItems.ContainsKey(newRequiredItem.Type)) @@ -810,7 +801,10 @@ namespace Barotrauma.Items.Components string msg = TextManager.Get(Msg, true); if (msg != null) { - msg = TextManager.ParseInputTypes(msg); + foreach (InputType inputType in Enum.GetValues(typeof(InputType))) + { + msg = msg.Replace("[" + inputType.ToString().ToLowerInvariant() + "]", GameMain.Config.KeyBind(inputType).ToString()); + } DisplayMsg = msg; } else diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Deconstructor.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Deconstructor.cs index fb4392e3c..6fe79715c 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Deconstructor.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Deconstructor.cs @@ -13,11 +13,6 @@ namespace Barotrauma.Items.Components private ItemContainer inputContainer, outputContainer; - public ItemContainer InputContainer - { - get { return inputContainer; } - } - public ItemContainer OutputContainer { get { return outputContainer; } @@ -76,10 +71,8 @@ namespace Barotrauma.Items.Components var targetItem = inputContainer.Inventory.Items.LastOrDefault(i => i != null); if (targetItem == null) { return; } - float deconstructTime = targetItem.Prefab.DeconstructItems.Any() ? targetItem.Prefab.DeconstructTime : 1.0f; - - progressState = Math.Min(progressTimer / deconstructTime, 1.0f); - if (progressTimer > deconstructTime) + progressState = Math.Min(progressTimer / targetItem.Prefab.DeconstructTime, 1.0f); + if (progressTimer > targetItem.Prefab.DeconstructTime) { foreach (DeconstructItem deconstructProduct in targetItem.Prefab.DeconstructItems) { @@ -107,24 +100,10 @@ namespace Barotrauma.Items.Components } } - if (targetItem.Prefab.DeconstructItems.Any()) - { - inputContainer.Inventory.RemoveItem(targetItem); - Entity.Spawner.AddToRemoveQueue(targetItem); - MoveInputQueue(); - PutItemsToLinkedContainer(); - } - else - { - if (outputContainer.Inventory.Items.All(i => i != null)) - { - targetItem.Drop(dropper: null); - } - else - { - outputContainer.Inventory.TryPutItem(targetItem, user: null, createNetworkEvent: true); - } - } + inputContainer.Inventory.RemoveItem(targetItem); + Entity.Spawner.AddToRemoveQueue(targetItem); + MoveInputQueue(); + PutItemsToLinkedContainer(); if (inputContainer.Inventory.Items.Any(i => i != null)) { diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Fabricator.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Fabricator.cs index cd1b0e081..7ade916d4 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Fabricator.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Fabricator.cs @@ -23,16 +23,6 @@ namespace Barotrauma.Items.Components private ItemContainer inputContainer, outputContainer; - public ItemContainer InputContainer - { - get { return inputContainer; } - } - - public ItemContainer OutputContainer - { - get { return outputContainer; } - } - private float progressState; public Fabricator(Item item, XElement element) @@ -108,23 +98,7 @@ namespace Barotrauma.Items.Components { return (picker != null); } - - public void RemoveFabricationRecipes(List allowedIdentifiers) - { - for (int i = 0; i < fabricationRecipes.Count; i++) - { - if (!allowedIdentifiers.Contains(fabricationRecipes[i].TargetItem.Identifier)) - { - fabricationRecipes.RemoveAt(i); - i--; - } - } - - CreateRecipes(); - } - - partial void CreateRecipes(); - + private void StartFabricating(FabricationRecipe selectedItem, Character user) { if (selectedItem == null) return; diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Reactor.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Reactor.cs index ee38171f6..a26222b4b 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Reactor.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Reactor.cs @@ -473,8 +473,6 @@ namespace Barotrauma.Items.Components { if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) { return false; } - IsActive = true; - float degreeOfSuccess = DegreeOfSuccess(character); //characters with insufficient skill levels don't refuel the reactor diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Sonar.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Sonar.cs index c18e1ad02..40e97dfe5 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Sonar.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Sonar.cs @@ -47,9 +47,8 @@ namespace Barotrauma.Items.Components //was the last ping sent with directional pinging private bool isLastPingDirectional; - private Sprite pingCircle, directionalPingCircle, screenOverlay, screenBackground; - private Sprite sonarBlip; - private Sprite lineSprite; + private readonly Sprite pingCircle, directionalPingCircle, screenOverlay, screenBackground; + private readonly Sprite sonarBlip; private bool aiPingCheckPending; @@ -86,7 +85,7 @@ namespace Barotrauma.Items.Components { get { return zoom; } } - + public override bool IsActive { get @@ -112,7 +111,29 @@ namespace Barotrauma.Items.Components : base(item, element) { connectedTransducers = new List(); - + + foreach (XElement subElement in element.Elements()) + { + switch (subElement.Name.ToString().ToLowerInvariant()) + { + case "pingcircle": + pingCircle = new Sprite(subElement); + break; + case "directionalpingcircle": + directionalPingCircle = new Sprite(subElement); + break; + case "screenoverlay": + screenOverlay = new Sprite(subElement); + break; + case "screenbackground": + screenBackground = new Sprite(subElement); + break; + case "blip": + sonarBlip = new Sprite(subElement); + break; + } + } + IsActive = false; InitProjSpecific(element); } @@ -184,7 +205,6 @@ namespace Barotrauma.Items.Components directionalPingCircle?.Remove(); screenOverlay?.Remove(); screenBackground?.Remove(); - lineSprite?.Remove(); } public override bool AIOperate(float deltaTime, Character character, AIObjectiveOperateItem objective) @@ -239,24 +259,15 @@ namespace Barotrauma.Items.Components int clockDir = (int)Math.Round((angle / MathHelper.TwoPi) * 12); if (clockDir == 0) clockDir = 12; - return TextManager.Get("roomname.subdiroclock").Replace("[dir]", clockDir.ToString()); + return TextManager.Get("SubDirOClock").Replace("[dir]", clockDir.ToString()); } - private Vector2 GetTransducerPos() + private Vector2 GetTransducerCenter() { - if (!UseTransducers || connectedTransducers.Count == 0) - { - //use the position of the sub if the item is static (no body) and inside a sub - return item.Submarine != null && item.body == null ? item.Submarine.WorldPosition : item.WorldPosition; - } - + if (!UseTransducers || connectedTransducers.Count == 0) return Vector2.Zero; Vector2 transducerPosSum = Vector2.Zero; foreach (ConnectedTransducer transducer in connectedTransducers) { - if (transducer.Transducer.Item.Submarine != null) - { - return transducer.Transducer.Item.Submarine.WorldPosition; - } transducerPosSum += transducer.Transducer.Item.WorldPosition; } return transducerPosSum / connectedTransducers.Count; diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Steering.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Steering.cs index f2400c5a0..c090837a7 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Steering.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Steering.cs @@ -172,6 +172,19 @@ namespace Barotrauma.Items.Components return true; } + public override void OnItemLoaded() + { + sonar = item.GetComponent(); + } + + public override bool Select(Character character) + { + if (!CanBeSelected) return false; + + user = character; + return true; + } + public override void Update(float deltaTime, Camera cam) { networkUpdateTimer -= deltaTime; @@ -474,9 +487,7 @@ namespace Barotrauma.Items.Components if (!posToMaintain.HasValue) { unsentChanges = true; - posToMaintain = controlledSub != null ? - controlledSub.WorldPosition : - item.Submarine == null ? item.WorldPosition : item.Submarine.WorldPosition; + posToMaintain = controlledSub == null ? item.WorldPosition : controlledSub.WorldPosition; } if (!AutoPilot || !MaintainPos) unsentChanges = true; diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerTransfer.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerTransfer.cs index 097e26985..157e5f8c8 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerTransfer.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerTransfer.cs @@ -201,7 +201,7 @@ namespace Barotrauma.Items.Components if (sparkSounds.Count > 0) { var sparkSound = sparkSounds[Rand.Int(sparkSounds.Count)]; - SoundPlayer.PlaySound(sparkSound.Sound, pt.item.WorldPosition, sparkSound.Volume, sparkSound.Range, pt.item.CurrentHull); + SoundPlayer.PlaySound(sparkSound.Sound, sparkSound.Volume, sparkSound.Range, pt.item.WorldPosition, pt.item.CurrentHull); } Vector2 baseVel = Rand.Vector(300.0f); diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Power/Powered.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/Powered.cs index 7f3ee64e6..00ec9ae00 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Power/Powered.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/Powered.cs @@ -103,7 +103,7 @@ namespace Barotrauma.Items.Components ApplyStatusEffects(ActionType.OnActive, deltaTime, null); if (!powerOnSoundPlayed && powerOnSound != null) { - SoundPlayer.PlaySound(powerOnSound.Sound, item.WorldPosition, powerOnSound.Volume, powerOnSound.Range, item.CurrentHull); + SoundPlayer.PlaySound(powerOnSound.Sound, powerOnSound.Volume, powerOnSound.Range, item.WorldPosition, item.CurrentHull); powerOnSoundPlayed = true; } } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Repairable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Repairable.cs index 8c6420e91..706317e0e 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Repairable.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Repairable.cs @@ -241,12 +241,5 @@ namespace Barotrauma.Items.Components { character.AnimController.UpdateUseItem(false, item.WorldPosition + new Vector2(0.0f, 100.0f) * ((item.Condition / item.MaxCondition) % 0.1f)); } - - public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power = 0, float signalStrength = 1) - { - //do nothing - //Repairables should always stay active, so we don't want to use the default behavior - //where set_active/set_state signals can disable the component - } } } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/CustomInterface.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/CustomInterface.cs index c521952de..1fd9ca9e6 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/CustomInterface.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/CustomInterface.cs @@ -8,19 +8,11 @@ namespace Barotrauma.Items.Components { partial class CustomInterface : ItemComponent, IClientSerializable, IServerSerializable { - class CustomInterfaceElement : ISerializableEntity + class CustomInterfaceElement { public bool ContinuousSignal; public bool State; - public string Connection; - [Serialize("", false, translationTextTag = "Label.")] - public string Label { get; set; } - [Serialize("1", false)] - public string Signal { get; set; } - - public string Name => "CustomInterfaceElement"; - - public Dictionary SerializableProperties { get; set; } + public string Label, Connection, Signal; public List StatusEffects = new List(); @@ -41,7 +33,7 @@ namespace Barotrauma.Items.Components } private string[] labels; - [Serialize("", true)] + [Serialize("", true), Editable()] public string Labels { get { return string.Join(",", labels); } @@ -56,7 +48,7 @@ namespace Barotrauma.Items.Components } } private string[] signals; - [Serialize("", true)] + [Serialize("", true), Editable()] public string Signals { //use semicolon as a separator because comma may be needed in the signals (for color or vector values for example) @@ -125,7 +117,7 @@ namespace Barotrauma.Items.Components for (int i = 0; i < labels.Length; i++) { labels[i] = i < newLabels.Length ? newLabels[i] : customInterfaceElementList[i].Label; - customInterfaceElementList[i].Label = TextManager.Get(labels[i], returnNull: true) ?? labels[i]; + customInterfaceElementList[i].Label = labels[i]; } UpdateLabelsProjSpecific(); } @@ -170,12 +162,5 @@ namespace Barotrauma.Items.Components } } } - - public override XElement Save(XElement parentElement) - { - labels = customInterfaceElementList.Select(ci => ci.Label).ToArray(); - signals = customInterfaceElementList.Select(ci => ci.Signal).ToArray(); - return base.Save(parentElement); - } } } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs index 4b68000a9..6e6b4915f 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs @@ -219,7 +219,7 @@ namespace Barotrauma.Items.Components if (voltage > 0.1f && sparkSounds.Count > 0) { var sparkSound = sparkSounds[Rand.Int(sparkSounds.Count)]; - SoundPlayer.PlaySound(sparkSound.Sound, item.WorldPosition, sparkSound.Volume, sparkSound.Range, item.CurrentHull); + SoundPlayer.PlaySound(sparkSound.Sound, sparkSound.Volume, sparkSound.Range, item.WorldPosition, item.CurrentHull); } #endif lightBrightness = 0.0f; diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs index 1befb10a5..4bee0e644 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs @@ -5,7 +5,6 @@ using System.IO; using System.Linq; using System.Xml.Linq; using Barotrauma.Items.Components; -using Barotrauma.Extensions; namespace Barotrauma { @@ -67,8 +66,6 @@ namespace Barotrauma public LightComponent LightComponent { get; set; } - public int Variant { get; set; } - private Gender _gender; /// /// None = Any/Not Defined -> no effect. @@ -115,65 +112,30 @@ namespace Barotrauma /// /// Note: this constructor cannot initialize automatically, because the gender is unknown at this point. We only know it when the item is equipped. /// - public WearableSprite(XElement subElement, Wearable wearable, int variant = 0) + public WearableSprite(XElement subElement, Wearable wearable) { Type = WearableType.Item; WearableComponent = wearable; - Variant = Math.Max(variant, 0); SpritePath = ParseSpritePath(subElement.GetAttributeString("texture", string.Empty)); SourceElement = subElement; } private string ParseSpritePath(string texturePath) => texturePath.Contains("/") ? texturePath : $"{Path.GetDirectoryName(WearableComponent.Item.Prefab.ConfigFile)}/{texturePath}"; - public void RefreshPath() - { - if (Variant > 0) - { - // Restore the tag so that we can parse it again. - ReplaceNumbersWith("[VARIANT]"); - } - ParsePath(true); - } - - private void ReplaceNumbersWith(string replacement) - { - var fileName = Path.GetFileName(SpritePath); - var path = Path.GetDirectoryName(SpritePath); - fileName = fileName.Replace(replacement, c => char.IsNumber(c)); - SpritePath = Path.Combine(path, fileName); - } - - private void ParsePath(bool parseSpritePath) - { - if (_gender != Gender.None) - { - SpritePath = SpritePath.Replace("[GENDER]", (_gender == Gender.Female) ? "female" : "male"); - } - SpritePath = SpritePath.Replace("[VARIANT]", Variant.ToString()); - if (!File.Exists(SpritePath)) - { - // If the variant does not exist, parse the path so that it uses first variant. - Variant = 1; - ReplaceNumbersWith(Variant.ToString()); - } - if (parseSpritePath) - { - Sprite.ParseTexturePath(file: SpritePath); - } - } - public bool IsInitialized { get; private set; } public void Init(Gender gender = Gender.None) { if (IsInitialized) { return; } _gender = SpritePath.Contains("[GENDER]") ? gender : Gender.None; - ParsePath(false); + if (_gender != Gender.None) + { + SpritePath = SpritePath.Replace("[GENDER]", (_gender == Gender.Female) ? "female" : "male"); + } if (Sprite != null) { Sprite.Remove(); } - Sprite = new Sprite(SourceElement, file: SpritePath); + Sprite = new Sprite(SourceElement, "", SpritePath); Limb = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("limb", "Head"), true); HideLimb = SourceElement.GetAttributeBool("hidelimb", false); HideOtherWearables = SourceElement.GetAttributeBool("hideotherwearables", false); @@ -208,7 +170,7 @@ namespace Barotrauma.Items.Components get { return damageModifiers; } } - public Wearable(Item item, XElement element) : base(item, element) + public Wearable (Item item, XElement element) : base(item, element) { this.item = item; @@ -235,7 +197,7 @@ namespace Barotrauma.Items.Components limbType[i] = (LimbType)Enum.Parse(typeof(LimbType), subElement.GetAttributeString("limb", "Head"), true); - wearableSprites[i] = new WearableSprite(subElement, this, variant); + wearableSprites[i] = new WearableSprite(subElement, this); foreach (XElement lightElement in subElement.Elements()) { diff --git a/Barotrauma/BarotraumaShared/Source/Items/Inventory.cs b/Barotrauma/BarotraumaShared/Source/Items/Inventory.cs index 85d352153..e6e6a9541 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Inventory.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Inventory.cs @@ -206,16 +206,6 @@ namespace Barotrauma return true; } - public bool IsFull() - { - for (int i = 0; i < capacity; i++) - { - if (Items[i] == null) return false; - } - - return true; - } - protected bool TrySwapping(int index, Item item, Character user, bool createNetworkEvent) { if (item?.ParentInventory == null || Items[index] == null) return false; diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs index 13b38e817..7d32387b4 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs @@ -928,9 +928,14 @@ namespace Barotrauma public void ApplyStatusEffects(ActionType type, float deltaTime, Character character = null, Limb limb = null, bool isNetworkEvent = false) { - if (!hasStatusEffectsOfType[(int)type]) { return; } - foreach (StatusEffect effect in statusEffectLists[type]) + if (statusEffectLists == null) return; + + if (!statusEffectLists.TryGetValue(type, out List statusEffects)) return; + + bool broken = condition <= 0.0f; + foreach (StatusEffect effect in statusEffects) { + if (broken && effect.type != ActionType.OnBroken) continue; ApplyStatusEffect(effect, type, deltaTime, character, limb, isNetworkEvent, false); } } @@ -1047,8 +1052,6 @@ namespace Barotrauma aiTarget.SoundRange -= deltaTime * 1000.0f; } - bool broken = condition <= 0.0f; - if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer) { sendConditionUpdateTimer -= deltaTime; @@ -1124,10 +1127,7 @@ namespace Barotrauma container = container.Container; } } - if (!broken) - { - ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime); - } + ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime); if (body == null || !body.Enabled || !inWater || ParentInventory != null || Removed) { return; } @@ -1149,10 +1149,6 @@ namespace Barotrauma { body.SetTransform(body.SimPosition - Submarine.SimPosition, body.Rotation); } - else if (Submarine != null && prevSub != null && Submarine != prevSub) - { - body.SetTransform(body.SimPosition + prevSub.SimPosition - Submarine.SimPosition, body.Rotation); - } Vector2 displayPos = ConvertUnits.ToDisplayUnits(body.SimPosition); rect.X = (int)(displayPos.X - rect.Width / 2.0f); @@ -1210,7 +1206,7 @@ namespace Barotrauma if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) { return true; } - if (ImpactTolerance > 0.0f && condition > 0.0f && impact > ImpactTolerance) + if (ImpactTolerance > 0.0f && impact > ImpactTolerance) { ApplyStatusEffects(ActionType.OnImpact, 1.0f); #if SERVER @@ -1269,7 +1265,7 @@ namespace Barotrauma if (recursive) { - HashSet alreadySearched = new HashSet(); + List alreadySearched = new List() { this }; GetConnectedComponentsRecursive(alreadySearched, connectedComponents); return connectedComponents; @@ -1291,7 +1287,7 @@ namespace Barotrauma return connectedComponents; } - private void GetConnectedComponentsRecursive(HashSet alreadySearched, List connectedComponents) where T : ItemComponent + private void GetConnectedComponentsRecursive(List alreadySearched, List connectedComponents) where T : ItemComponent { ConnectionPanel connectionPanel = GetComponent(); if (connectionPanel == null) { return; } @@ -1315,35 +1311,28 @@ namespace Barotrauma } } + recipient.Item.GetConnectedComponentsRecursive(alreadySearched, connectedComponents); + } + } + } + public List GetConnectedComponentsRecursive(Connection c) where T : ItemComponent { - List connectedComponents = new List(); - HashSet alreadySearched = new HashSet(); + List connectedComponents = new List(); + List alreadySearched = new List() { this }; GetConnectedComponentsRecursive(c, alreadySearched, connectedComponents); return connectedComponents; } - - private static readonly Pair[] connectionPairs = new Pair[] - { - new Pair("power_in", "power_out"), - new Pair("signal_in1", "signal_out1"), - new Pair("signal_in2", "signal_out2"), - new Pair("signal_in3", "signal_out3"), - new Pair("signal_in4", "signal_out4"), - new Pair("signal_in", "signal_out"), - new Pair("signal_in1", "signal_out"), - new Pair("signal_in2", "signal_out") - }; - private void GetConnectedComponentsRecursive(Connection c, HashSet alreadySearched, List connectedComponents) where T : ItemComponent + private void GetConnectedComponentsRecursive(Connection c, List alreadySearched, List connectedComponents) where T : ItemComponent { - alreadySearched.Add(c); + alreadySearched.Add(this); var recipients = c.Recipients; foreach (Connection recipient in recipients) { - if (alreadySearched.Contains(recipient)) { continue; } + if (alreadySearched.Contains(recipient.Item)) continue; var component = recipient.Item.GetComponent(); if (component != null) @@ -1352,29 +1341,7 @@ namespace Barotrauma } recipient.Item.GetConnectedComponentsRecursive(recipient, alreadySearched, connectedComponents); - } - - foreach (Pair connectionPair in connectionPairs) - { - if (connectionPair.First == c.Name) - { - var pairedConnection = c.Item.Connections.FirstOrDefault(c2 => c2.Name == connectionPair.Second); - if (pairedConnection != null) - { - if (alreadySearched.Contains(pairedConnection)) { continue; } - GetConnectedComponentsRecursive(pairedConnection, alreadySearched, connectedComponents); - } - } - else if (connectionPair.Second == c.Name) - { - var pairedConnection = c.Item.Connections.FirstOrDefault(c2 => c2.Name == connectionPair.First); - if (pairedConnection != null) - { - if (alreadySearched.Contains(pairedConnection)) { continue; } - GetConnectedComponentsRecursive(pairedConnection, alreadySearched, connectedComponents); - } - } - } + } } diff --git a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs index f79b5d338..e6ff07bc4 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs @@ -138,6 +138,16 @@ namespace Barotrauma private Dictionary prices; + //an area next to the construction + //the construction can be Activated() by a Character inside the area + public List Triggers; + + private List fabricationRecipeElements = new List(); + + private bool canSpriteFlipX, canSpriteFlipY; + + private Dictionary prices; + /// /// Defines areas where the item can be interacted with. If RequireBodyInsideTrigger is set to true, the character /// has to be within the trigger to interact. If it's set to false, having the cursor within the trigger is enough. @@ -460,11 +470,11 @@ namespace Barotrauma DeconstructItems = new List(); FabricationRecipes = new List(); DeconstructTime = 1.0f; - - Tags = new HashSet(element.GetAttributeStringArray("tags", new string[0], convertToLowerInvariant: true)); + + Tags = element.GetAttributeStringArray("tags", new string[0], convertToLowerInvariant: true).ToHashSet(); if (Tags.None()) { - Tags = new HashSet(element.GetAttributeStringArray("Tags", new string[0], convertToLowerInvariant: true)); + Tags = element.GetAttributeStringArray("Tags", new string[0], convertToLowerInvariant: true).ToHashSet(); } if (element.Attribute("cargocontainername") != null) @@ -626,25 +636,10 @@ namespace Barotrauma string treatmentIdentifier = subElement.GetAttributeString("identifier", "").ToLowerInvariant(); - List matchingAfflictions = AfflictionPrefab.List.FindAll(a => a.Identifier == treatmentIdentifier || a.AfflictionType == treatmentIdentifier); - if (matchingAfflictions.Count == 0) + var matchingAffliction = AfflictionPrefab.List.Find(a => a.Identifier == treatmentIdentifier); + if (matchingAffliction != null) { - DebugConsole.ThrowError("Error in item prefab \"" + Name + "\" - couldn't define as a treatment, no treatments with the identifier or type \"" + treatmentIdentifier + "\" were found."); - continue; - } - - float suitability = subElement.GetAttributeFloat("suitability", 0.0f); - foreach (AfflictionPrefab matchingAffliction in matchingAfflictions) - { - if (matchingAffliction.TreatmentSuitability.ContainsKey(identifier)) - { - matchingAffliction.TreatmentSuitability[identifier] = - Math.Max(matchingAffliction.TreatmentSuitability[identifier], suitability); - } - else - { - matchingAffliction.TreatmentSuitability.Add(identifier, suitability); - } + matchingAffliction.TreatmentSuitability.Add(identifier, subElement.GetAttributeFloat("suitability", 0.0f)); } break; } diff --git a/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs b/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs index c6db98cbc..bbbfc6705 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs @@ -17,8 +17,8 @@ namespace Barotrauma } public bool IsOptional { get; set; } - - public bool IgnoreInEditor { get; set; } + + private string[] identifiers; private string[] excludedIdentifiers; @@ -35,20 +35,23 @@ namespace Barotrauma public string JoinedIdentifiers { - get { return string.Join(",", Identifiers); } + get { return string.Join(",", identifiers); } set { if (value == null) return; - Identifiers = value.Split(','); - for (int i = 0; i < Identifiers.Length; i++) + identifiers = value.Split(','); + for (int i = 0; i < identifiers.Length; i++) { - Identifiers[i] = Identifiers[i].Trim().ToLowerInvariant(); + identifiers[i] = identifiers[i].Trim().ToLowerInvariant(); } } } - - public string[] Identifiers { get; private set; } + + public string[] Identifiers + { + get { return identifiers; } + } public string JoinedExcludedIdentifiers { @@ -69,7 +72,7 @@ namespace Barotrauma { if (item == null) return false; if (excludedIdentifiers.Any(id => item.Prefab.Identifier == id || item.HasTag(id))) return false; - return Identifiers.Any(id => item.Prefab.Identifier == id || item.HasTag(id)); + return identifiers.Any(id => item.Prefab.Identifier == id || item.HasTag(id)); } public RelatedItem(string[] identifiers, string[] excludedIdentifiers) @@ -78,7 +81,7 @@ namespace Barotrauma { identifiers[i] = identifiers[i].Trim().ToLowerInvariant(); } - this.Identifiers = identifiers; + this.identifiers = identifiers; for (int i = 0; i < excludedIdentifiers.Length; i++) { @@ -138,8 +141,7 @@ namespace Barotrauma element.Add( new XAttribute("identifiers", JoinedIdentifiers), new XAttribute("type", type.ToString()), - new XAttribute("optional", IsOptional), - new XAttribute("ignoreineditor", IgnoreInEditor)); + new XAttribute("optional", IsOptional)); if (excludedIdentifiers.Length > 0) { @@ -221,7 +223,6 @@ namespace Barotrauma } ri.IsOptional = element.GetAttributeBool("optional", false); - ri.IgnoreInEditor = element.GetAttributeBool("ignoreineditor", false); return ri; } } diff --git a/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs b/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs index 40f2acd92..a73ac8907 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs @@ -40,7 +40,7 @@ namespace Barotrauma flames = true; underwaterBubble = true; } - + public Explosion(XElement element, string parentDebugName) { attack = new Attack(element, parentDebugName + ", Explosion"); @@ -62,16 +62,6 @@ namespace Barotrauma CameraShake = element.GetAttributeFloat("camerashake", attack.Range * 0.1f); } - public void DisableParticles() - { - sparks = false; - shockwave = false; - smoke = false; - flash = false; - flames = false; - underwaterBubble = false; - } - public List> GetRecentExplosions(float maxSecondsAgo) { return prevExplosions.FindAll(e => e.Third >= Timing.TotalTime - maxSecondsAgo); diff --git a/Barotrauma/BarotraumaShared/Source/Map/FireSource.cs b/Barotrauma/BarotraumaShared/Source/Map/FireSource.cs index 50f3b9554..b87ca0149 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/FireSource.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/FireSource.cs @@ -15,17 +15,16 @@ namespace Barotrauma { const float OxygenConsumption = 50.0f; const float GrowSpeed = 5.0f; - - protected Hull hull; - - protected Vector2 position; - protected Vector2 size; + + private Hull hull; private readonly Submarine submarine; public Submarine Submarine => submarine; protected bool removed; + private bool removed; + #if CLIENT private List burnDecals = new List(); #endif @@ -87,7 +86,7 @@ namespace Barotrauma position = worldPosition - new Vector2(-5.0f, 5.0f); if (hull.Submarine != null) { - submarine = hull.Submarine; + Submarine = hull.Submarine; position -= Submarine.Position; } @@ -186,16 +185,6 @@ namespace Barotrauma } } - protected virtual void ReduceOxygen(float deltaTime) - { - hull.Oxygen -= size.X * deltaTime * OxygenConsumption; - } - - protected virtual void AdjustXPos(float growModifier, float deltaTime) - { - position.X -= GrowSpeed * growModifier * 0.5f * deltaTime; - } - partial void UpdateProjSpecific(float growModifier); private void OnChangeHull(Vector2 pos, Hull particleHull) diff --git a/Barotrauma/BarotraumaShared/Source/Map/Hull.cs b/Barotrauma/BarotraumaShared/Source/Map/Hull.cs index 23fc81dce..798b322b6 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Hull.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Hull.cs @@ -63,6 +63,13 @@ namespace Barotrauma return "Hull"; } } + + [Editable, Serialize("", true)] + public string RoomName + { + get; + set; + } public string DisplayName { @@ -417,6 +424,11 @@ namespace Barotrauma public void AddFireSource(FireSource fireSource) { FireSources.Add(fireSource); + + if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer && !IdFreed) + { + GameMain.NetworkMember.CreateEntityEvent(this); + } } public override void Update(float deltaTime, Camera cam) @@ -584,6 +596,11 @@ namespace Barotrauma public void RemoveFire(FireSource fire) { FireSources.Remove(fire); + + if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer && !Removed && !IdFreed) + { + GameMain.NetworkMember.CreateEntityEvent(this); + } } public IEnumerable GetConnectedHulls(int? searchDepth) @@ -800,17 +817,17 @@ namespace Barotrauma } if (roomItems.Contains("reactor")) - return "RoomName.ReactorRoom"; + return TextManager.Get("ReactorRoom"); else if (roomItems.Contains("engine")) - return "RoomName.EngineRoom"; + return TextManager.Get("EngineRoom"); else if (roomItems.Contains("steering") && roomItems.Contains("sonar")) - return "RoomName.CommandRoom"; + return TextManager.Get("CommandRoom"); else if (roomItems.Contains("ballast")) - return "RoomName.Ballast"; + return TextManager.Get("Ballast"); if (ConnectedGaps.Any(g => !g.IsRoomToRoom && g.ConnectedDoor != null)) { - return "RoomName.Airlock"; + return TextManager.Get("Airlock"); } Rectangle subRect = Submarine.CalculateDimensions(); @@ -830,7 +847,7 @@ namespace Barotrauma else roomPos |= Alignment.Right; - return "RoomName.Sub" + roomPos.ToString(); + return TextManager.Get("Sub" + roomPos.ToString()); } public static Hull Load(XElement element, Submarine submarine) diff --git a/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs index 695b56df0..5bace8352 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs @@ -138,9 +138,6 @@ namespace Barotrauma public Submarine StartOutpost { get; private set; } public Submarine EndOutpost { get; private set; } - private Submarine preSelectedStartOutpost; - private Submarine preSelectedEndOutpost; - public string Seed { get { return seed; } @@ -212,7 +209,7 @@ namespace Barotrauma /// /// A scalar between 0-100 /// A scalar between 0-1 (0 = the minimum width defined in the generation params is used, 1 = the max width is used) - public Level(string seed, float difficulty, float sizeFactor, LevelGenerationParams generationParams, Biome biome, Submarine startOutpost = null, Submarine endOutPost = null) + public Level(string seed, float difficulty, float sizeFactor, LevelGenerationParams generationParams, Biome biome) : base(null) { @@ -228,9 +225,6 @@ namespace Barotrauma (width / GridCellSize) * GridCellSize, (generationParams.Height / GridCellSize) * GridCellSize); - preSelectedStartOutpost = startOutpost; - preSelectedEndOutpost = endOutPost; - //remove from entity dictionary base.Remove(); } @@ -1516,24 +1510,14 @@ namespace Barotrauma continue; } - //only create a starting outpost in campaign and tutorial modes - if (!IsModeStartOutpostCompatible() && ((i == 0) == !Mirrored)) + //only create a starting outpost in campaign mode + if (GameMain.GameSession?.GameMode as CampaignMode == null && ((i == 0) == !Mirrored)) { continue; } - - Submarine outpost = null; - - if (i == 0 && preSelectedStartOutpost == null || i == 1 && preSelectedEndOutpost == null) - { - string outpostFile = outpostFiles.GetRandom(Rand.RandSync.Server); - outpost = new Submarine(outpostFile, tryLoad: false); - } - else - { - outpost = (i == 0) ? preSelectedStartOutpost : preSelectedEndOutpost; - } - + + string outpostFile = outpostFiles.GetRandom(Rand.RandSync.Server); + var outpost = new Submarine(outpostFile, tryLoad: false); outpost.Load(unloadPrevious: false); outpost.MakeOutpost(); @@ -1585,15 +1569,6 @@ namespace Barotrauma } } - private bool IsModeStartOutpostCompatible() - { -#if CLIENT - return GameMain.GameSession?.GameMode as CampaignMode != null || GameMain.GameSession?.GameMode as TutorialMode != null; -#else - return GameMain.GameSession?.GameMode as CampaignMode != null; -#endif - } - public override void Remove() { base.Remove(); diff --git a/Barotrauma/BarotraumaShared/Source/Map/Map/LocationTypeChange.cs b/Barotrauma/BarotraumaShared/Source/Map/Map/LocationTypeChange.cs index 85f101d09..71cf8dc39 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Map/LocationTypeChange.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Map/LocationTypeChange.cs @@ -27,13 +27,7 @@ namespace Barotrauma DisallowedAdjacentLocations = element.GetAttributeStringArray("disallowedadjacentlocations", new string[0]).ToList(); RequiredAdjacentLocations = element.GetAttributeStringArray("requiredadjacentlocations", new string[0]).ToList(); - string messageTag = element.GetAttributeString("messagetag", "LocationChange." + currentType + ".ChangeTo." + ChangeToType); - - Messages = TextManager.GetAll(messageTag); - if (Messages == null) - { - DebugConsole.ThrowError("No messages defined for the location type change " + currentType + " -> " + ChangeToType); - } + Messages = TextManager.GetAll("LocationChange." + currentType + ".ChangeTo." + ChangeToType); } } } diff --git a/Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs b/Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs index a239508b9..d55c8c0e8 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs @@ -522,9 +522,15 @@ namespace Barotrauma } } } - + + // The value should always be copied from the prefab. Editing is enabled only for testing the scale in the sub editor (changes are not saved). + +#if DEBUG [Serialize(1f, false), Editable(0.1f, 10f, DecimalCount = 3, ValueStep = 0.1f)] - public virtual float Scale { get; set; } = 1; +#else + [Serialize(1f, false)] +#endif + public float Scale { get; set; } = 1; #endregion } } diff --git a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs index ad9a18c72..c7704d343 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs @@ -159,32 +159,6 @@ namespace Barotrauma private set; } - private float scale = 1.0f; - public override float Scale - { - get { return scale; } - set - { - if (scale == value) { return; } - scale = MathHelper.Clamp(value, 0.1f, 10.0f); - - float relativeScale = scale / prefab.Scale; - - if (!ResizeHorizontal || !ResizeVertical) - { - int newWidth = ResizeHorizontal ? rect.Width : (int)(defaultRect.Width * relativeScale); - int newHeight = ResizeVertical ? rect.Height : (int)(defaultRect.Height * relativeScale); - Rect = new Rectangle(rect.X, rect.Y, newWidth, newHeight); - if (Sections != null) - { - UpdateSections(); - } - } - } - } - - private Rectangle defaultRect; - public override Rectangle Rect { get @@ -195,13 +169,9 @@ namespace Barotrauma { Rectangle oldRect = Rect; base.Rect = value; - if (Prefab.Body) - { - CreateSections(); - } + if (Prefab.Body) CreateSections(); else { - if (Sections == null) { return; } foreach (WallSection sec in Sections) { Rectangle secRect = sec.rect; @@ -219,11 +189,11 @@ namespace Barotrauma public float BodyWidth { - get { return Prefab.BodyWidth > 0.0f ? Prefab.BodyWidth * scale : rect.Width; } + get { return Prefab.BodyWidth > 0.0f ? Prefab.BodyWidth : rect.Width; } } public float BodyHeight { - get { return Prefab.BodyHeight > 0.0f ? Prefab.BodyHeight * scale : rect.Height; } + get { return Prefab.BodyHeight > 0.0f ? Prefab.BodyHeight : rect.Height; } } /// @@ -344,8 +314,8 @@ namespace Barotrauma } } - // Only add ai targets automatically to submarine/outpost walls - if (aiTarget == null && HasBody && Tags.Contains("wall") && submarine != null) + // Only add ai targets automatically to walls + if (aiTarget == null && HasBody && Tags.Contains("wall")) { aiTarget = new AITarget(this); } @@ -635,6 +605,24 @@ namespace Barotrauma var character = ((Limb)f2.Body.UserData).character; if (character.DisableImpactDamageTimer > 0.0f || ((Limb)f2.Body.UserData).Mass < 100.0f) return true; } + + if (!Prefab.Platform && Prefab.StairDirection == Direction.None) + { + Vector2 pos = ConvertUnits.ToDisplayUnits(f2.Body.Position); + + int section = FindSectionIndex(pos); + if (section > -1) + { + Vector2 normal = contact.Manifold.LocalNormal; + + float impact = Vector2.Dot(f2.Body.LinearVelocity, -normal) * f2.Body.Mass * 0.1f; + if (impact < 10.0f) return true; +#if CLIENT + SoundPlayer.PlayDamageSound("StructureBlunt", impact, SectionPosition(section, true), tags: Tags); +#endif + AddDamage(section, impact); + } + } OnImpactProjSpecific(f1, f2, contact); @@ -977,7 +965,6 @@ namespace Barotrauma private void UpdateSections() { - if (Bodies == null) return; foreach (Body b in Bodies) { GameMain.World.RemoveBody(b); @@ -1041,9 +1028,9 @@ namespace Barotrauma if (BodyWidth > 0.0f) rect.Width = (int)BodyWidth; if (BodyHeight > 0.0f) rect.Height = Math.Max((int)Math.Round(BodyHeight * (rect.Height / (float)this.rect.Height)), 1); } - if (FlippedX) { diffFromCenter = -diffFromCenter; } + if (FlippedX) diffFromCenter = -diffFromCenter; - Vector2 bodyOffset = ConvertUnits.ToSimUnits(Prefab.BodyOffset) * scale; + Vector2 bodyOffset = ConvertUnits.ToSimUnits(Prefab.BodyOffset); if (FlippedX) { bodyOffset.X = -bodyOffset.X; } if (FlippedY) { bodyOffset.Y = -bodyOffset.Y; } @@ -1063,8 +1050,7 @@ namespace Barotrauma { newBody.Position = structureCenter + bodyOffset + new Vector2( (float)Math.Cos(IsHorizontal ? -BodyRotation : MathHelper.PiOver2 - BodyRotation), - (float)Math.Sin(IsHorizontal ? -BodyRotation : MathHelper.PiOver2 - BodyRotation)) - * ConvertUnits.ToSimUnits(diffFromCenter); + (float)Math.Sin(IsHorizontal ? -BodyRotation : MathHelper.PiOver2 - BodyRotation)) * ConvertUnits.ToSimUnits(diffFromCenter); newBody.Rotation = -BodyRotation; } else @@ -1205,9 +1191,6 @@ namespace Barotrauma { XElement element = new XElement("Structure"); - int width = ResizeHorizontal ? rect.Width : defaultRect.Width; - int height = ResizeVertical ? rect.Height : defaultRect.Height; - element.Add( new XAttribute("name", prefab.Name), new XAttribute("identifier", prefab.Identifier), diff --git a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs index b8ccb1b25..ada123764 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs @@ -417,10 +417,7 @@ namespace Barotrauma if (me.Submarine != this) { continue; } if (me is Item item) { - if (item.GetComponent() != null) - { - item.Indestructible = true; - } + item.Indestructible = true; foreach (ItemComponent ic in item.Components) { if (ic is ConnectionPanel connectionPanel) @@ -428,17 +425,11 @@ namespace Barotrauma //prevent rewiring connectionPanel.Locked = true; } - else if (ic is Holdable holdable && holdable.Attached) + else if (ic is Pickable pickable) { - //prevent deattaching items from walls -#if CLIENT - if (GameMain.GameSession?.GameMode is TutorialMode) - { - continue; - } -#endif - holdable.CanBePicked = false; - holdable.CanBeSelected = false; + //prevent picking up (or deattaching) items + pickable.CanBePicked = false; + pickable.CanBeSelected = false; } } } @@ -542,6 +533,20 @@ namespace Barotrauma { maxX = Math.Min(maxX, ruin.Area.X - 100.0f); } + else + { + maxX = Math.Min(maxX, ruin.Area.X - 100.0f); + } + } + + if (minX < 0.0f && maxX > Level.Loaded.Size.X) + { + //no walls found at either side, just use the initial spawnpos and hope for the best + } + else if (minX < 0) + { + //no wall found at the left side, spawn to the left from the right-side wall + spawnPos.X = maxX - minWidth - 100.0f + subDockingPortOffset; } if (minX < 0.0f && maxX > Level.Loaded.Size.X) @@ -1123,7 +1128,6 @@ namespace Barotrauma } } savedSubmarines.Add(new Submarine(filePath)); - savedSubmarines = savedSubmarines.OrderBy(s => s.filePath ?? "").ToList(); } public static void RefreshSavedSubs() diff --git a/Barotrauma/BarotraumaShared/Source/Map/SubmarineBody.cs b/Barotrauma/BarotraumaShared/Source/Map/SubmarineBody.cs index 95575a22c..d423f76a6 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/SubmarineBody.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/SubmarineBody.cs @@ -468,7 +468,7 @@ namespace Barotrauma var gaps = newHull?.ConnectedGaps ?? Gap.GapList.Where(g => g.Submarine == submarine); targetPos = character.WorldPosition; - Gap adjacentGap = Gap.FindAdjacent(gaps, targetPos, 500.0f); + Gap adjacentGap = Gap.FindAdjacent(gaps, targetPos, 200.0f); if (adjacentGap == null) return true; if (newHull != null) diff --git a/Barotrauma/BarotraumaShared/Source/Networking/EntitySpawner.cs b/Barotrauma/BarotraumaShared/Source/Networking/EntitySpawner.cs index e89da30e1..c2cd7710d 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/EntitySpawner.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/EntitySpawner.cs @@ -102,7 +102,7 @@ namespace Barotrauma { string errorMsg = "Attempted to add a null item to entity spawn queue.\n" + Environment.StackTrace; DebugConsole.ThrowError(errorMsg); - GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue1:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); + GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue3:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); return; } spawnQueue.Enqueue(new ItemSpawnInfo(itemPrefab, worldPosition, condition)); @@ -115,7 +115,7 @@ namespace Barotrauma { string errorMsg = "Attempted to add a null item to entity spawn queue.\n" + Environment.StackTrace; DebugConsole.ThrowError(errorMsg); - GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue2:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); + GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue3:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); return; } spawnQueue.Enqueue(new ItemSpawnInfo(itemPrefab, position, sub, condition)); diff --git a/Barotrauma/BarotraumaShared/Source/Networking/OrderChatMessage.cs b/Barotrauma/BarotraumaShared/Source/Networking/OrderChatMessage.cs index 85523d2fa..0f8f53bd7 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/OrderChatMessage.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/OrderChatMessage.cs @@ -20,7 +20,7 @@ namespace Barotrauma.Networking public OrderChatMessage(Order order, string orderOption, Entity targetEntity, Character targetCharacter, Character sender) : this(order, orderOption, - order.GetChatMessage(targetCharacter?.Name, sender?.CurrentHull?.DisplayName, givingOrderToSelf: targetCharacter == sender, orderOption: orderOption), + order.GetChatMessage(targetCharacter?.Name, sender?.CurrentHull?.RoomName, givingOrderToSelf: targetCharacter == sender, orderOption: orderOption), targetEntity, targetCharacter, sender) { } diff --git a/Barotrauma/BarotraumaShared/Source/Networking/ServerSettings.cs b/Barotrauma/BarotraumaShared/Source/Networking/ServerSettings.cs index 5dd5f1546..3a4f36a23 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/ServerSettings.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/ServerSettings.cs @@ -377,12 +377,6 @@ namespace Barotrauma.Networking private set; } - [Serialize(true, true)] - public bool VoipEnabled { - get; - private set; - } - [Serialize(true, true)] public bool EndRoundAtLevelEnd { @@ -401,7 +395,7 @@ namespace Barotrauma.Networking public bool AllowRagdollButton { get; - set; + private set; } [Serialize(true, true)] diff --git a/Barotrauma/BarotraumaShared/Source/Networking/SteamManager.cs b/Barotrauma/BarotraumaShared/Source/Networking/SteamManager.cs index f72c8354b..3928675b6 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/SteamManager.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/SteamManager.cs @@ -7,7 +7,15 @@ namespace Barotrauma.Steam { partial class SteamManager { +#if DEBUG + public static bool USE_STEAM + { + get { return GameMain.Config.UseSteam; } + } +#else + //cannot enable/disable steam in release builds public const bool USE_STEAM = true; +#endif public const uint AppID = 602960; @@ -58,16 +66,6 @@ namespace Barotrauma.Steam if (!USE_STEAM) return; instance = new SteamManager(); } - - public static void OverlayCustomURL(string url) - { - if (instance == null || !instance.isInitialized || instance.client == null) - { - return; - } - - instance.client.Overlay.OpenUrl(url); - } public static bool UnlockAchievement(string achievementName) { diff --git a/Barotrauma/BarotraumaShared/Source/PlayerInput.cs b/Barotrauma/BarotraumaShared/Source/PlayerInput.cs index 0e611ebbb..8ad826eea 100644 --- a/Barotrauma/BarotraumaShared/Source/PlayerInput.cs +++ b/Barotrauma/BarotraumaShared/Source/PlayerInput.cs @@ -88,7 +88,7 @@ namespace Barotrauma public override bool Equals(object obj) { - if (obj is KeyOrMouse keyOrMouse) + if (obj is KeyOrMouse keyOrMouse ) { if (MouseButton.HasValue) { @@ -162,6 +162,21 @@ namespace Barotrauma get { return binding; } } + public void SetState() + { + hit = binding.IsHit(); + if (hit) hitQueue = true; + + held = binding.IsDown(); + if (held) heldQueue = true; + } +#endif + + public KeyOrMouse State + { + get { return binding; } + } + public void SetState() { hit = binding.IsHit(); diff --git a/Barotrauma/BarotraumaShared/Source/Serialization/XMLExtensions.cs b/Barotrauma/BarotraumaShared/Source/Serialization/XMLExtensions.cs index 10b3691c6..8f9090ae9 100644 --- a/Barotrauma/BarotraumaShared/Source/Serialization/XMLExtensions.cs +++ b/Barotrauma/BarotraumaShared/Source/Serialization/XMLExtensions.cs @@ -46,15 +46,7 @@ namespace Barotrauma if (File.Exists(filePath)) { - try - { - doc = XDocument.Load(filePath, LoadOptions.SetBaseUri); - } - catch - { - return null; - } - + doc = XDocument.Load(filePath, LoadOptions.SetBaseUri); if (doc.Root == null) return null; } diff --git a/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs b/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs index 26059513f..0921bd91d 100644 --- a/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs +++ b/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs @@ -87,6 +87,7 @@ namespace Barotrauma public string FullPath { get; private set; } + public override string ToString() { return FilePath + ": " + sourceRect; @@ -106,14 +107,27 @@ namespace Barotrauma { this.lazyLoad = lazyLoad; SourceElement = element; - if (!ParseTexturePath(path, file)) { return; } + if (file == "") + { + file = SourceElement.GetAttributeString("texture", ""); + } + if (file == "") + { + DebugConsole.ThrowError("Sprite " + SourceElement + " doesn't have a texture specified!"); + return; + } + if (!string.IsNullOrEmpty(path)) + { + LoadTexture(ref sourceVector, ref shouldReturn, preMultipliedAlpha); + } + FilePath = path + file; + if (!string.IsNullOrEmpty(FilePath)) + { + FullPath = Path.GetFullPath(FilePath); + } + Name = SourceElement.GetAttributeString("name", null); Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero); - var overrideElement = GetLocalizationOverrideElement(); - if (overrideElement != null && overrideElement.Attribute("sourcerect") != null) - { - sourceVector = overrideElement.GetAttributeVector4("sourcerect", Vector4.Zero); - } preMultipliedAlpha = preMultiplyAlpha ?? SourceElement.GetAttributeBool("premultiplyalpha", true); bool shouldReturn = false; if (!lazyLoad) @@ -245,12 +259,8 @@ namespace Barotrauma } if (SourceElement != null) { - sourceRect = SourceElement.GetAttributeRect("sourcerect", Rectangle.Empty); - var overrideElement = GetLocalizationOverrideElement(); - if (overrideElement != null && overrideElement.Attribute("sourcerect") != null) - { - sourceRect = overrideElement.GetAttributeRect("sourcerect", Rectangle.Empty); - } + Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero); + sourceRect = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W); size = SourceElement.GetAttributeVector2("size", Vector2.One); size.X *= sourceRect.Width; size.Y *= sourceRect.Height; @@ -259,51 +269,6 @@ namespace Barotrauma ID = GetID(SourceElement); } } - - public bool ParseTexturePath(string path = "", string file = "") - { - if (file == "") - { - file = SourceElement.GetAttributeString("texture", ""); - var overrideElement = GetLocalizationOverrideElement(); - if (overrideElement != null) - { - string overrideFile = overrideElement.GetAttributeString("texture", ""); - if (!string.IsNullOrEmpty(overrideFile)) { file = overrideFile; } - } - } - if (file == "") - { - DebugConsole.ThrowError("Sprite " + SourceElement + " doesn't have a texture specified!"); - return false; - } - if (!string.IsNullOrEmpty(path)) - { - if (!path.EndsWith("/")) path += "/"; - } - FilePath = path + file; - if (!string.IsNullOrEmpty(FilePath)) - { - FullPath = Path.GetFullPath(FilePath); - } - return true; - } - - private XElement GetLocalizationOverrideElement() - { - foreach (XElement subElement in SourceElement.Elements()) - { - if (subElement.Name.ToString().ToLowerInvariant() == "override") - { - string language = subElement.GetAttributeString("language", ""); - if (TextManager.Language.ToLower() == language.ToLower()) - { - return subElement; - } - } - } - return null; - } } } diff --git a/Barotrauma/BarotraumaShared/Source/SteamAchievementManager.cs b/Barotrauma/BarotraumaShared/Source/SteamAchievementManager.cs index 9dfe58a9e..d707be008 100644 --- a/Barotrauma/BarotraumaShared/Source/SteamAchievementManager.cs +++ b/Barotrauma/BarotraumaShared/Source/SteamAchievementManager.cs @@ -336,12 +336,9 @@ namespace Barotrauma UnlockAchievement("survivereactormeltdown"); } #endif - var charactersInSub = Character.CharacterList.FindAll(c => - !c.IsDead && - c.TeamID != Character.TeamType.FriendlyNPC && - !(c.AIController is EnemyAIController) && - (c.Submarine == gameSession.Submarine || (Level.Loaded?.EndOutpost != null && c.Submarine == Level.Loaded.EndOutpost))); + var charactersInSub = Character.CharacterList.FindAll(c => !c.IsDead && + (c.Submarine == gameSession.Submarine || (Level.Loaded?.EndOutpost != null && c.Submarine == Level.Loaded.EndOutpost))); if (charactersInSub.Count == 1) { //there must be some non-enemy casualties to get the last mant standing achievement @@ -349,11 +346,7 @@ namespace Barotrauma { UnlockAchievement(charactersInSub[0], "lastmanstanding"); } - //lone sailor achievement if alone in the sub and there are no other characters with the same team ID - else if (!Character.CharacterList.Any(c => - c != charactersInSub[0] && - c.TeamID == charactersInSub[0].TeamID && - !(c.AIController is EnemyAIController))) + else if (!Character.CharacterList.Any(c => !(c.AIController is EnemyAIController))) { UnlockAchievement(charactersInSub[0], "lonesailor"); } diff --git a/Barotrauma/BarotraumaShared/Source/TextManager.cs b/Barotrauma/BarotraumaShared/Source/TextManager.cs index 27d1966d0..b7a01e523 100644 --- a/Barotrauma/BarotraumaShared/Source/TextManager.cs +++ b/Barotrauma/BarotraumaShared/Source/TextManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; namespace Barotrauma { @@ -16,7 +15,7 @@ namespace Barotrauma private static string[] serverMessageCharacters = new string[] { "~", "[", "]", "=" }; public static string Language; - + private static HashSet availableLanguages = new HashSet(); public static IEnumerable AvailableLanguages { @@ -79,7 +78,7 @@ namespace Barotrauma } } - public static string Get(string textTag, bool returnNull = false, string fallBackTag = null) + public static string Get(string textTag, bool returnNull = false) { if (!textPacks.ContainsKey(Language)) { @@ -94,16 +93,7 @@ namespace Barotrauma foreach (TextPack textPack in textPacks[Language]) { string text = textPack.Get(textTag); - if (text != null) { return text; } - } - - if (!string.IsNullOrEmpty(fallBackTag)) - { - foreach (TextPack textPack in textPacks[Language]) - { - string text = textPack.Get(fallBackTag); - if (text != null) { return text; } - } + if (text != null) return text; } //if text was not found and we're using a language other than English, see if we can find an English version @@ -128,14 +118,138 @@ namespace Barotrauma } } - public static string ParseInputTypes(string text) + public static string GetFormatted(string textTag, bool returnNull = false, params object[] args) { - foreach (InputType inputType in Enum.GetValues(typeof(InputType))) + string text = Get(textTag, returnNull); + + if (text == null || text.Length == 0) { - text = text.Replace("[" + inputType.ToString().ToLowerInvariant() + "]", GameMain.Config.KeyBind(inputType).ToString()); - text = text.Replace("[InputType." + inputType.ToString() + "]", GameMain.Config.KeyBind(inputType).ToString()); + if (returnNull) + { + return null; + } + else + { + DebugConsole.ThrowError("Text \"" + textTag + "\" not found."); + return textTag; + } } - return text; + + return string.Format(text, args); + } + + // Format: ServerMessage.Identifier1/ServerMessage.Indentifier2~[variable1]=value~[variable2]=value + public static string GetServerMessage(string serverMessage) + { + if (!textPacks.ContainsKey(Language)) + { + DebugConsole.ThrowError("No text packs available for the selected language (" + Language + ")! Switching to English..."); + Language = "English"; + if (!textPacks.ContainsKey(Language)) + { + throw new Exception("No text packs available in English!"); + } + } + + string[] messages = serverMessage.Split('/'); + + try + { + for (int i = 0; i < messages.Length; i++) + { + if (!IsServerMessageWithVariables(messages[i])) // No variables, try to translate + { + if (messages[i].Contains(" ")) continue; // Spaces found, do not translate + string msg = Get(messages[i], true); + if (msg != null) // If a translation was found, otherwise use the original + { + messages[i] = msg; + } + } + else + { + string[] messageWithVariables = messages[i].Split('~'); + string msg = Get(messageWithVariables[0], true); + + if (msg != null) // If a translation was found, otherwise use the original + { + messages[i] = msg; + } + else + { + continue; // No translation found, probably caused by player input -> skip variable handling + } + + // First index is always the message identifier -> start at 1 + for (int j = 1; j < messageWithVariables.Length; j++) + { + string[] variableAndValue = messageWithVariables[j].Split('='); + messages[i] = messages[i].Replace(variableAndValue[0], variableAndValue[1]); + } + } + } + + string translatedServerMessage = string.Empty; + for (int i = 0; i < messages.Length; i++) + { + translatedServerMessage += messages[i]; + } + return translatedServerMessage; + } + + catch (IndexOutOfRangeException exception) + { + string errorMsg = "Failed to translate server message \"" + serverMessage + "\"."; +#if DEBUG + DebugConsole.ThrowError(errorMsg, exception); +#endif + GameAnalyticsManager.AddErrorEventOnce("TextManager.GetServerMessage:" + serverMessage, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); + return errorMsg; + } + } + + public static bool IsServerMessageWithVariables(string message) + { + for (int i = 0; i < serverMessageCharacters.Length; i++) + { + if (!message.Contains(serverMessageCharacters[i])) return false; + } + + return true; + } + + public static List GetAll(string textTag) + { + if (!textPacks.ContainsKey(Language)) + { + DebugConsole.ThrowError("No text packs available for the selected language (" + Language + ")! Switching to English..."); + Language = "English"; + if (!textPacks.ContainsKey(Language)) + { + throw new Exception("No text packs available in English!"); + } + } + + List allText; + + foreach (TextPack textPack in textPacks[Language]) + { + allText = textPack.GetAll(textTag); + if (allText != null) return allText; + } + + //if text was not found and we're using a language other than English, see if we can find an English version + //may happen, for example, if a user has selected another language and using mods that haven't been translated to that language + if (Language != "English" && textPacks.ContainsKey("English")) + { + foreach (TextPack textPack in textPacks["English"]) + { + allText = textPack.GetAll(textTag); + if (allText != null) return allText; + } + } + + return null; } public static string GetFormatted(string textTag, bool returnNull = false, params object[] args) diff --git a/Barotrauma/BarotraumaShared/Source/TextPack.cs b/Barotrauma/BarotraumaShared/Source/TextPack.cs index 18b0170d8..91366d043 100644 --- a/Barotrauma/BarotraumaShared/Source/TextPack.cs +++ b/Barotrauma/BarotraumaShared/Source/TextPack.cs @@ -11,8 +11,8 @@ namespace Barotrauma public readonly string Language; private Dictionary> texts; - - private readonly string filePath; + + private string filePath; public TextPack(string filePath) { @@ -37,7 +37,6 @@ namespace Barotrauma text = text.Replace("&", "&"); text = text.Replace("<", "<"); text = text.Replace(">", ">"); - text = text.Replace(""", "\""); infoList.Add(text); } } @@ -63,20 +62,6 @@ namespace Barotrauma return textList; } - public List> GetAllTagTextPairs() - { - var pairs = new List>(); - foreach (KeyValuePair> kvp in texts) - { - foreach (string line in kvp.Value) - { - pairs.Add(new KeyValuePair(kvp.Key, line)); - } - } - - return pairs; - } - #if DEBUG public void CheckForDuplicates(int index) { diff --git a/Barotrauma/BarotraumaShared/Source/Utils/MathUtils.cs b/Barotrauma/BarotraumaShared/Source/Utils/MathUtils.cs index 724c807d2..bb12617b7 100644 --- a/Barotrauma/BarotraumaShared/Source/Utils/MathUtils.cs +++ b/Barotrauma/BarotraumaShared/Source/Utils/MathUtils.cs @@ -795,18 +795,6 @@ namespace Barotrauma return new Vector2((float)x, (float)y); } - /// - /// Rotates a point in 2d space around the origin - /// - public static Vector2 RotatePoint(Vector2 point, float radians) - { - var sin = Math.Sin(radians); - var cos = Math.Cos(radians); - var x = (cos * point.X) - (sin * point.Y); - var y = (sin * point.X) + (cos * point.Y); - return new Vector2((float)x, (float)y); - } - /// /// Returns the corners of an imaginary rectangle. /// Unlike the XNA rectangle, this can be rotated with the up parameter. diff --git a/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs b/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs index ff0357c6a..e608871a6 100644 --- a/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs +++ b/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs @@ -222,6 +222,12 @@ namespace Barotrauma if (fileName.Length == 0) fileName = "Save"; } + if (fileName == "Save_Default") + { + fileName = TextManager.Get("SaveFile.DefaultName", true); + if (fileName.Length == 0) fileName = "Save"; + } + if (!Directory.Exists(folder)) { DebugConsole.ThrowError("Save folder \"" + folder + "\" not found. Created new folder"); diff --git a/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub b/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub index 0963b9725..a0fb19aae 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub and b/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/Dugong.sub b/Barotrauma/BarotraumaShared/Submarines/Dugong.sub index 1faf47a55..2cef11b71 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Dugong.sub and b/Barotrauma/BarotraumaShared/Submarines/Dugong.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/Humpback.sub b/Barotrauma/BarotraumaShared/Submarines/Humpback.sub index 751bb85a9..c57bc40b9 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Humpback.sub and b/Barotrauma/BarotraumaShared/Submarines/Humpback.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/Orca.sub b/Barotrauma/BarotraumaShared/Submarines/Orca.sub index 45b257e88..4d734b45c 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Orca.sub and b/Barotrauma/BarotraumaShared/Submarines/Orca.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/Remora.sub b/Barotrauma/BarotraumaShared/Submarines/Remora.sub index b11988da2..0e552098c 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Remora.sub and b/Barotrauma/BarotraumaShared/Submarines/Remora.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub b/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub index 2f11785db..f546031bf 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub and b/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/Selkie.sub b/Barotrauma/BarotraumaShared/Submarines/Selkie.sub index 2c29b9f4a..72e8f6ace 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Selkie.sub and b/Barotrauma/BarotraumaShared/Submarines/Selkie.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/Typhon.sub b/Barotrauma/BarotraumaShared/Submarines/Typhon.sub index 1123d84b8..14f516834 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Typhon.sub and b/Barotrauma/BarotraumaShared/Submarines/Typhon.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/Venture.sub b/Barotrauma/BarotraumaShared/Submarines/Venture.sub index 7fe946301..e6df2ee70 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Venture.sub and b/Barotrauma/BarotraumaShared/Submarines/Venture.sub differ diff --git a/Barotrauma/BarotraumaShared/changelog.txt b/Barotrauma/BarotraumaShared/changelog.txt index beb985789..a8830200b 100644 --- a/Barotrauma/BarotraumaShared/changelog.txt +++ b/Barotrauma/BarotraumaShared/changelog.txt @@ -1,62 +1,3 @@ ---------------------------------------------------------------------------------------------------------- -v0.8.10.0 ---------------------------------------------------------------------------------------------------------- - -Additions and changes: -- Completely remade tutorials (separate tutorial for each job). -- Added a door and hatch variants with integrated buttons. -- New outpost graphics. -- Added swarm behavior to crawlers. -- Added a new mission where you have to kill a swarm of crawlers. -- Numerous crew AI improvements. -- Balanced item deterioration values. -- Mineral sprites change when collected from the environment. -- Added an option to disable directional voice chat. -- Added automatic submarine repair option to the campaign. -- Added "all" tab to the entity list in the submarine editor. -- Hide the crew area, chat box and server buttons when operating a turret or searchlight. -- Doors can be repaired with a wrench. -- Some new lamp variants. -- Display a progress bar when welding doors shut. -- Items that don't give any materials when deconstructed cannot be deconstructed. -- Added a console command that resets selected items and structures to prefab values ("resetselected"). -- Option to toggle structure drop shadows and edit the position of the shadow in the sub editor. -- Minor physics optimizations. -- Disable background music & ambience in the character editor. -- More pronounced limping animation when a character's legs are injured. -- The inventory slots next to the character portrait (ID card, uniform, etc) can be hidden. -- Some new sound effects and background music. -- All walls can be scaled in the submarine editor. -- Structure damage is visualized when using debugdraw. -- Improved font scaling on different resolutions. -- Added Steam overlay support to Workshop. -- Server list shows which servers have voice chat enabled. -- Show a message box notifying respawning traitors that they're no longer a traitor. -- Added a search bar to the store menu. -- Added search bars to sub lists in campaign setup UI and sub editor. - -Bugfixes: -- Don't allow rewiring and deattaching an item at the same time (happened when interacting with an item -while holding both a screwdriver and a wrench). -- Fixed bots being unable to complete almost any task in the multiplayer due to a bug that caused -them to interpret the sub as another crew's submarine. -- When spawning multiple monsters at the same time, spread them around a bit to prevent the players -from getting attacked by a ball of overlapping crawlers. -- Fixed huge lag spikes when a character tries to escape from an enemy but can't find a path away from it. -- Fixed file transfer progress bars not being visible in the server lobby. -- Fixed crashing when attempting to start a mission round with mission type set to None. -- Fixed ElectricalDischarger electricity effect staying visible if the item breaks or the component -is deactivated from outside (e.g. via a StatusEffect or the parent component). -- Fixed specular maps being rendered on top of characters when outside the sub. -- Fixed excessively bright lights around sonar flora and lava vents. -- Fixes to item collider sizes. -- Fixed inability to scroll through long texts in the sub editor's textboxes. -- Fixed clients not being able to see other characters in spectator if they've died far away from the sub. -- Fixed non-latin characters not being displayed correctly in Workshop item texts. -- Don't prevent selecting items in the sub editor when the cursor is on a wire node, because it makes it -very difficult (or impossible) to select small items in the wiring mode. -- Fixed crashing when attempting to use the "spawnitem" command when a round is not running. - --------------------------------------------------------------------------------------------------------- v0.8.9.10 --------------------------------------------------------------------------------------------------------- diff --git a/Barotrauma_Solution.sln b/Barotrauma_Solution.sln index b2e357682..c35da4735 100644 --- a/Barotrauma_Solution.sln +++ b/Barotrauma_Solution.sln @@ -61,8 +61,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MacClient", "Barotrauma\Bar {85232B20-074D-4723-B0C6-91495391E448} = {85232B20-074D-4723-B0C6-91495391E448} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Concentus", "Libraries\Concentus\CSharp\Concentus\Concentus.csproj", "{0E7FEE6A-15E5-4A4E-943C-80276003478C}" -EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution Barotrauma\BarotraumaClient\ClientCode.projitems*{008c0f83-e914-4966-9135-ea885059edd8}*SharedItemsImports = 4 @@ -83,579 +81,255 @@ Global Barotrauma\BarotraumaShared\SharedContent.projitems*{d7f9fdd3-af03-46ad-a2c2-f590899712b7}*SharedItemsImports = 4 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 DebugLinux|Any CPU = DebugLinux|Any CPU DebugLinux|x64 = DebugLinux|x64 - DebugLinux|x86 = DebugLinux|x86 DebugMac|Any CPU = DebugMac|Any CPU DebugMac|x64 = DebugMac|x64 - DebugMac|x86 = DebugMac|x86 DebugWindows|Any CPU = DebugWindows|Any CPU DebugWindows|x64 = DebugWindows|x64 - DebugWindows|x86 = DebugWindows|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 ReleaseLinux|Any CPU = ReleaseLinux|Any CPU ReleaseLinux|x64 = ReleaseLinux|x64 - ReleaseLinux|x86 = ReleaseLinux|x86 ReleaseMac|Any CPU = ReleaseMac|Any CPU ReleaseMac|x64 = ReleaseMac|x64 - ReleaseMac|x86 = ReleaseMac|x86 ReleaseWindows|Any CPU = ReleaseWindows|Any CPU ReleaseWindows|x64 = ReleaseWindows|x64 - ReleaseWindows|x86 = ReleaseWindows|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {008C0F83-E914-4966-9135-EA885059EDD8}.Debug|Any CPU.ActiveCfg = ReleaseWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.Debug|Any CPU.Build.0 = ReleaseWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.Debug|x64.ActiveCfg = DebugWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.Debug|x64.Build.0 = DebugWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.Debug|x86.ActiveCfg = DebugWindows|x86 - {008C0F83-E914-4966-9135-EA885059EDD8}.Debug|x86.Build.0 = DebugWindows|x86 {008C0F83-E914-4966-9135-EA885059EDD8}.DebugLinux|Any CPU.ActiveCfg = DebugWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.DebugLinux|Any CPU.Build.0 = DebugWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.DebugLinux|x64.ActiveCfg = DebugWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.DebugLinux|x86.ActiveCfg = DebugWindows|x86 - {008C0F83-E914-4966-9135-EA885059EDD8}.DebugLinux|x86.Build.0 = DebugWindows|x86 {008C0F83-E914-4966-9135-EA885059EDD8}.DebugMac|Any CPU.ActiveCfg = DebugWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.DebugMac|Any CPU.Build.0 = DebugWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.DebugMac|x64.ActiveCfg = DebugWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.DebugMac|x86.ActiveCfg = DebugWindows|x86 - {008C0F83-E914-4966-9135-EA885059EDD8}.DebugMac|x86.Build.0 = DebugWindows|x86 {008C0F83-E914-4966-9135-EA885059EDD8}.DebugWindows|Any CPU.ActiveCfg = DebugWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.DebugWindows|x64.ActiveCfg = DebugWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.DebugWindows|x64.Build.0 = DebugWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.DebugWindows|x86.ActiveCfg = DebugWindows|x86 - {008C0F83-E914-4966-9135-EA885059EDD8}.DebugWindows|x86.Build.0 = DebugWindows|x86 - {008C0F83-E914-4966-9135-EA885059EDD8}.Release|Any CPU.ActiveCfg = ReleaseWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.Release|Any CPU.Build.0 = ReleaseWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.Release|x64.ActiveCfg = ReleaseWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.Release|x64.Build.0 = ReleaseWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.Release|x86.ActiveCfg = ReleaseWindows|x86 - {008C0F83-E914-4966-9135-EA885059EDD8}.Release|x86.Build.0 = ReleaseWindows|x86 {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseLinux|Any CPU.ActiveCfg = DebugWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseLinux|Any CPU.Build.0 = DebugWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseLinux|x64.ActiveCfg = ReleaseWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseLinux|x86.ActiveCfg = ReleaseWindows|x86 - {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseLinux|x86.Build.0 = ReleaseWindows|x86 {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseMac|Any CPU.ActiveCfg = DebugWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseMac|Any CPU.Build.0 = DebugWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseMac|x64.ActiveCfg = ReleaseWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseMac|x86.ActiveCfg = ReleaseWindows|x86 - {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseMac|x86.Build.0 = ReleaseWindows|x86 {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseWindows|Any CPU.ActiveCfg = ReleaseWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseWindows|x64.ActiveCfg = ReleaseWindows|x64 {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseWindows|x64.Build.0 = ReleaseWindows|x64 - {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseWindows|x86.ActiveCfg = ReleaseWindows|x86 - {008C0F83-E914-4966-9135-EA885059EDD8}.ReleaseWindows|x86.Build.0 = ReleaseWindows|x86 - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Debug|x64.ActiveCfg = Debug|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Debug|x64.Build.0 = Debug|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Debug|x86.ActiveCfg = Debug|x86 - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Debug|x86.Build.0 = Debug|x86 {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugLinux|Any CPU.ActiveCfg = Debug|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugLinux|Any CPU.Build.0 = Debug|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugLinux|x64.ActiveCfg = Debug|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugLinux|x64.Build.0 = Debug|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugLinux|x86.ActiveCfg = Debug|x86 - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugLinux|x86.Build.0 = Debug|x86 {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugMac|Any CPU.Build.0 = Debug|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugMac|x64.ActiveCfg = Debug|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugMac|x64.Build.0 = Debug|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugMac|x86.ActiveCfg = Debug|x86 - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugMac|x86.Build.0 = Debug|x86 {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugWindows|Any CPU.ActiveCfg = Debug|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugWindows|Any CPU.Build.0 = Debug|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugWindows|x64.ActiveCfg = Debug|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugWindows|x64.Build.0 = Debug|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugWindows|x86.ActiveCfg = Debug|x86 - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.DebugWindows|x86.Build.0 = Debug|x86 - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Release|Any CPU.Build.0 = Release|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Release|x64.ActiveCfg = Release|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Release|x64.Build.0 = Release|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Release|x86.ActiveCfg = Release|x86 - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.Release|x86.Build.0 = Release|x86 {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseLinux|x64.ActiveCfg = Release|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseLinux|x64.Build.0 = Release|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseLinux|x86.ActiveCfg = Release|x86 - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseLinux|x86.Build.0 = Release|x86 {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseMac|x64.ActiveCfg = Release|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseMac|x64.Build.0 = Release|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseMac|x86.ActiveCfg = Release|x86 - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseMac|x86.Build.0 = Release|x86 {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseWindows|Any CPU.ActiveCfg = Release|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseWindows|Any CPU.Build.0 = Release|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseWindows|x64.ActiveCfg = Release|Any CPU {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseWindows|x64.Build.0 = Release|Any CPU - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseWindows|x86.ActiveCfg = Release|x86 - {49BA1C69-6104-41AC-A5D8-B54FA9F696E8}.ReleaseWindows|x86.Build.0 = Release|x86 - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Debug|x64.ActiveCfg = Debug|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Debug|x64.Build.0 = Debug|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Debug|x86.ActiveCfg = Debug|x86 - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Debug|x86.Build.0 = Debug|x86 {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugLinux|Any CPU.ActiveCfg = Debug|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugLinux|Any CPU.Build.0 = Debug|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugLinux|x64.ActiveCfg = Debug|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugLinux|x64.Build.0 = Debug|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugLinux|x86.ActiveCfg = Debug|x86 - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugLinux|x86.Build.0 = Debug|x86 {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugMac|Any CPU.Build.0 = Debug|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugMac|x64.ActiveCfg = Debug|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugMac|x64.Build.0 = Debug|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugMac|x86.ActiveCfg = Debug|x86 - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugMac|x86.Build.0 = Debug|x86 {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugWindows|Any CPU.ActiveCfg = Debug|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugWindows|Any CPU.Build.0 = Debug|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugWindows|x64.ActiveCfg = Debug|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugWindows|x64.Build.0 = Debug|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugWindows|x86.ActiveCfg = Debug|x86 - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.DebugWindows|x86.Build.0 = Debug|x86 - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Release|Any CPU.Build.0 = Release|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Release|x64.ActiveCfg = Release|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Release|x64.Build.0 = Release|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Release|x86.ActiveCfg = Release|x86 - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.Release|x86.Build.0 = Release|x86 {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseLinux|x64.ActiveCfg = Release|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseLinux|x64.Build.0 = Release|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseLinux|x86.ActiveCfg = Release|x86 - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseLinux|x86.Build.0 = Release|x86 {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseMac|x64.ActiveCfg = Release|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseMac|x64.Build.0 = Release|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseMac|x86.ActiveCfg = Release|x86 - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseMac|x86.Build.0 = Release|x86 {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseWindows|Any CPU.ActiveCfg = Release|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseWindows|Any CPU.Build.0 = Release|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseWindows|x64.ActiveCfg = Release|Any CPU {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseWindows|x64.Build.0 = Release|Any CPU - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseWindows|x86.ActiveCfg = Release|x86 - {3B8F9EDB-6E5E-450C-ABC2-EC49075D0B50}.ReleaseWindows|x86.Build.0 = Release|x86 - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Debug|x64.ActiveCfg = Debug|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Debug|x64.Build.0 = Debug|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Debug|x86.ActiveCfg = Debug|x86 - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Debug|x86.Build.0 = Debug|x86 {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugLinux|Any CPU.ActiveCfg = Debug|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugLinux|Any CPU.Build.0 = Debug|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugLinux|x64.ActiveCfg = Debug|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugLinux|x64.Build.0 = Debug|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugLinux|x86.ActiveCfg = Debug|x86 - {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugLinux|x86.Build.0 = Debug|x86 {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugMac|Any CPU.Build.0 = Debug|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugMac|x64.ActiveCfg = Debug|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugMac|x64.Build.0 = Debug|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugMac|x86.ActiveCfg = Debug|x86 - {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugMac|x86.Build.0 = Debug|x86 {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugWindows|Any CPU.ActiveCfg = Debug|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugWindows|Any CPU.Build.0 = Debug|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugWindows|x64.ActiveCfg = Debug|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugWindows|x64.Build.0 = Debug|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugWindows|x86.ActiveCfg = Debug|x86 - {C293DB32-FA42-486D-B128-5A12522FAE4E}.DebugWindows|x86.Build.0 = Debug|x86 - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Release|Any CPU.Build.0 = Release|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Release|x64.ActiveCfg = Release|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Release|x64.Build.0 = Release|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Release|x86.ActiveCfg = Release|x86 - {C293DB32-FA42-486D-B128-5A12522FAE4E}.Release|x86.Build.0 = Release|x86 {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseLinux|x64.ActiveCfg = Release|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseLinux|x64.Build.0 = Release|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseLinux|x86.ActiveCfg = Release|x86 - {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseLinux|x86.Build.0 = Release|x86 {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseMac|x64.ActiveCfg = Release|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseMac|x64.Build.0 = Release|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseMac|x86.ActiveCfg = Release|x86 - {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseMac|x86.Build.0 = Release|x86 {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseWindows|Any CPU.ActiveCfg = Release|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseWindows|Any CPU.Build.0 = Release|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseWindows|x64.ActiveCfg = Release|Any CPU {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseWindows|x64.Build.0 = Release|Any CPU - {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseWindows|x86.ActiveCfg = Release|x86 - {C293DB32-FA42-486D-B128-5A12522FAE4E}.ReleaseWindows|x86.Build.0 = Release|x86 - {85232B20-074D-4723-B0C6-91495391E448}.Debug|Any CPU.ActiveCfg = ReleaseWindows|x64 - {85232B20-074D-4723-B0C6-91495391E448}.Debug|Any CPU.Build.0 = ReleaseWindows|x64 - {85232B20-074D-4723-B0C6-91495391E448}.Debug|x64.ActiveCfg = DebugWindows|x64 - {85232B20-074D-4723-B0C6-91495391E448}.Debug|x64.Build.0 = DebugWindows|x64 - {85232B20-074D-4723-B0C6-91495391E448}.Debug|x86.ActiveCfg = DebugWindows|x86 - {85232B20-074D-4723-B0C6-91495391E448}.Debug|x86.Build.0 = DebugWindows|x86 {85232B20-074D-4723-B0C6-91495391E448}.DebugLinux|Any CPU.ActiveCfg = DebugLinux|x64 {85232B20-074D-4723-B0C6-91495391E448}.DebugLinux|Any CPU.Build.0 = DebugLinux|x64 {85232B20-074D-4723-B0C6-91495391E448}.DebugLinux|x64.ActiveCfg = DebugLinux|x64 {85232B20-074D-4723-B0C6-91495391E448}.DebugLinux|x64.Build.0 = DebugLinux|x64 - {85232B20-074D-4723-B0C6-91495391E448}.DebugLinux|x86.ActiveCfg = DebugLinux|x86 - {85232B20-074D-4723-B0C6-91495391E448}.DebugLinux|x86.Build.0 = DebugLinux|x86 {85232B20-074D-4723-B0C6-91495391E448}.DebugMac|Any CPU.ActiveCfg = DebugMac|x64 {85232B20-074D-4723-B0C6-91495391E448}.DebugMac|x64.ActiveCfg = DebugMac|x64 {85232B20-074D-4723-B0C6-91495391E448}.DebugMac|x64.Build.0 = DebugMac|x64 - {85232B20-074D-4723-B0C6-91495391E448}.DebugMac|x86.ActiveCfg = DebugMac|x86 - {85232B20-074D-4723-B0C6-91495391E448}.DebugMac|x86.Build.0 = DebugMac|x86 {85232B20-074D-4723-B0C6-91495391E448}.DebugWindows|Any CPU.ActiveCfg = DebugWindows|x64 {85232B20-074D-4723-B0C6-91495391E448}.DebugWindows|x64.ActiveCfg = DebugWindows|x64 {85232B20-074D-4723-B0C6-91495391E448}.DebugWindows|x64.Build.0 = DebugWindows|x64 - {85232B20-074D-4723-B0C6-91495391E448}.DebugWindows|x86.ActiveCfg = DebugWindows|x86 - {85232B20-074D-4723-B0C6-91495391E448}.DebugWindows|x86.Build.0 = DebugWindows|x86 - {85232B20-074D-4723-B0C6-91495391E448}.Release|Any CPU.ActiveCfg = ReleaseWindows|x64 - {85232B20-074D-4723-B0C6-91495391E448}.Release|Any CPU.Build.0 = ReleaseWindows|x64 - {85232B20-074D-4723-B0C6-91495391E448}.Release|x64.ActiveCfg = ReleaseWindows|x64 - {85232B20-074D-4723-B0C6-91495391E448}.Release|x64.Build.0 = ReleaseWindows|x64 - {85232B20-074D-4723-B0C6-91495391E448}.Release|x86.ActiveCfg = ReleaseWindows|x86 - {85232B20-074D-4723-B0C6-91495391E448}.Release|x86.Build.0 = ReleaseWindows|x86 {85232B20-074D-4723-B0C6-91495391E448}.ReleaseLinux|Any CPU.ActiveCfg = ReleaseLinux|x64 {85232B20-074D-4723-B0C6-91495391E448}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|x64 {85232B20-074D-4723-B0C6-91495391E448}.ReleaseLinux|x64.Build.0 = ReleaseLinux|x64 - {85232B20-074D-4723-B0C6-91495391E448}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|x86 - {85232B20-074D-4723-B0C6-91495391E448}.ReleaseLinux|x86.Build.0 = ReleaseLinux|x86 {85232B20-074D-4723-B0C6-91495391E448}.ReleaseMac|Any CPU.ActiveCfg = ReleaseMac|x64 {85232B20-074D-4723-B0C6-91495391E448}.ReleaseMac|x64.ActiveCfg = ReleaseMac|x64 {85232B20-074D-4723-B0C6-91495391E448}.ReleaseMac|x64.Build.0 = ReleaseMac|x64 - {85232B20-074D-4723-B0C6-91495391E448}.ReleaseMac|x86.ActiveCfg = ReleaseMac|x86 - {85232B20-074D-4723-B0C6-91495391E448}.ReleaseMac|x86.Build.0 = ReleaseMac|x86 {85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|Any CPU.ActiveCfg = ReleaseWindows|x64 {85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x64.ActiveCfg = ReleaseWindows|x64 {85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x64.Build.0 = ReleaseWindows|x64 - {85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x86.ActiveCfg = ReleaseWindows|x86 - {85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x86.Build.0 = ReleaseWindows|x86 - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|x64.ActiveCfg = Debug|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|x64.Build.0 = Debug|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|x86.ActiveCfg = Debug|x86 - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|x86.Build.0 = Debug|x86 {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugLinux|Any CPU.ActiveCfg = Debug|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugLinux|Any CPU.Build.0 = Debug|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugLinux|x64.ActiveCfg = Debug|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugLinux|x64.Build.0 = Debug|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugLinux|x86.ActiveCfg = Debug|x86 - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugLinux|x86.Build.0 = Debug|x86 {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugMac|Any CPU.Build.0 = Debug|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugMac|x64.ActiveCfg = Debug|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugMac|x64.Build.0 = Debug|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugMac|x86.ActiveCfg = Debug|x86 - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugMac|x86.Build.0 = Debug|x86 {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugWindows|Any CPU.ActiveCfg = Debug|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugWindows|Any CPU.Build.0 = Debug|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugWindows|x64.ActiveCfg = Debug|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugWindows|x64.Build.0 = Debug|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugWindows|x86.ActiveCfg = Debug|x86 - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.DebugWindows|x86.Build.0 = Debug|x86 - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|Any CPU.Build.0 = Release|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|x64.ActiveCfg = Release|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|x64.Build.0 = Release|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|x86.ActiveCfg = Release|x86 - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.Release|x86.Build.0 = Release|x86 {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseLinux|x64.ActiveCfg = Release|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseLinux|x64.Build.0 = Release|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseLinux|x86.ActiveCfg = Release|x86 - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseLinux|x86.Build.0 = Release|x86 {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseMac|x64.ActiveCfg = Release|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseMac|x64.Build.0 = Release|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseMac|x86.ActiveCfg = Release|x86 - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseMac|x86.Build.0 = Release|x86 {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseWindows|Any CPU.ActiveCfg = Release|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseWindows|Any CPU.Build.0 = Release|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseWindows|x64.ActiveCfg = Release|Any CPU {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseWindows|x64.Build.0 = Release|Any CPU - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseWindows|x86.ActiveCfg = Release|x86 - {A4610E4C-DD34-428B-BABB-779CA0B5993A}.ReleaseWindows|x86.Build.0 = Release|x86 - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Debug|x64.ActiveCfg = Debug|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Debug|x64.Build.0 = Debug|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Debug|x86.ActiveCfg = Debug|x86 - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Debug|x86.Build.0 = Debug|x86 {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugLinux|Any CPU.ActiveCfg = Debug|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugLinux|Any CPU.Build.0 = Debug|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugLinux|x64.ActiveCfg = Debug|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugLinux|x64.Build.0 = Debug|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugLinux|x86.ActiveCfg = Debug|x86 - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugLinux|x86.Build.0 = Debug|x86 {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugMac|Any CPU.Build.0 = Debug|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugMac|x64.ActiveCfg = Debug|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugMac|x64.Build.0 = Debug|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugMac|x86.ActiveCfg = Debug|x86 - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugMac|x86.Build.0 = Debug|x86 {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugWindows|Any CPU.ActiveCfg = Debug|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugWindows|Any CPU.Build.0 = Debug|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugWindows|x64.ActiveCfg = Debug|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugWindows|x64.Build.0 = Debug|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugWindows|x86.ActiveCfg = Debug|x86 - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.DebugWindows|x86.Build.0 = Debug|x86 - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Release|Any CPU.Build.0 = Release|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Release|x64.ActiveCfg = Release|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Release|x64.Build.0 = Release|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Release|x86.ActiveCfg = Release|x86 - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.Release|x86.Build.0 = Release|x86 {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseLinux|x64.ActiveCfg = Release|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseLinux|x64.Build.0 = Release|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseLinux|x86.ActiveCfg = Release|x86 - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseLinux|x86.Build.0 = Release|x86 {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseMac|x64.ActiveCfg = Release|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseMac|x64.Build.0 = Release|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseMac|x86.ActiveCfg = Release|x86 - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseMac|x86.Build.0 = Release|x86 {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseWindows|Any CPU.ActiveCfg = Release|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseWindows|Any CPU.Build.0 = Release|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseWindows|x64.ActiveCfg = Release|Any CPU {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseWindows|x64.Build.0 = Release|Any CPU - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseWindows|x86.ActiveCfg = Release|x86 - {3AF0347C-5A9B-4421-868C-8EE3DBFAEBC6}.ReleaseWindows|x86.Build.0 = Release|x86 - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Debug|Any CPU.ActiveCfg = DebugWindows|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Debug|Any CPU.Build.0 = DebugWindows|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Debug|x64.ActiveCfg = DebugWindows|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Debug|x64.Build.0 = DebugWindows|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Debug|x86.ActiveCfg = DebugMac|x86 - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Debug|x86.Build.0 = DebugMac|x86 {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugLinux|Any CPU.ActiveCfg = DebugLinux|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugLinux|Any CPU.Build.0 = DebugLinux|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugLinux|x64.ActiveCfg = DebugLinux|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugLinux|x64.Build.0 = DebugLinux|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugLinux|x86.ActiveCfg = DebugLinux|x86 - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugLinux|x86.Build.0 = DebugLinux|x86 {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugMac|Any CPU.Build.0 = DebugMac|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugMac|x64.ActiveCfg = DebugMac|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugMac|x64.Build.0 = DebugMac|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugMac|x86.ActiveCfg = DebugMac|x86 - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugMac|x86.Build.0 = DebugMac|x86 {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugWindows|Any CPU.ActiveCfg = DebugWindows|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugWindows|Any CPU.Build.0 = DebugWindows|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugWindows|x64.ActiveCfg = DebugWindows|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugWindows|x86.ActiveCfg = DebugWindows|x86 - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.DebugWindows|x86.Build.0 = DebugWindows|x86 - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Release|Any CPU.ActiveCfg = ReleaseWindows|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Release|Any CPU.Build.0 = ReleaseWindows|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Release|x64.ActiveCfg = ReleaseWindows|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Release|x64.Build.0 = ReleaseWindows|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Release|x86.ActiveCfg = ReleaseMac|x86 - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Release|x86.Build.0 = ReleaseMac|x86 {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseLinux|Any CPU.ActiveCfg = ReleaseLinux|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseLinux|Any CPU.Build.0 = ReleaseLinux|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseLinux|x64.Build.0 = ReleaseLinux|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|x86 - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseLinux|x86.Build.0 = ReleaseLinux|x86 {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseMac|Any CPU.ActiveCfg = ReleaseMac|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseMac|Any CPU.Build.0 = ReleaseMac|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseMac|x64.ActiveCfg = ReleaseMac|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseMac|x64.Build.0 = ReleaseMac|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseMac|x86.ActiveCfg = ReleaseMac|x86 - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseMac|x86.Build.0 = ReleaseMac|x86 {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseWindows|Any CPU.ActiveCfg = ReleaseWindows|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseWindows|Any CPU.Build.0 = ReleaseWindows|Any CPU {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseWindows|x64.ActiveCfg = ReleaseWindows|Any CPU - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseWindows|x86.ActiveCfg = ReleaseWindows|x86 - {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.ReleaseWindows|x86.Build.0 = ReleaseWindows|x86 - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Debug|Any CPU.Build.0 = Debug|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Debug|x64.ActiveCfg = Debug|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Debug|x64.Build.0 = Debug|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Debug|x86.ActiveCfg = Debug|x86 - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Debug|x86.Build.0 = Debug|x86 {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugLinux|Any CPU.ActiveCfg = DebugLinux|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugLinux|Any CPU.Build.0 = DebugLinux|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugLinux|x64.ActiveCfg = DebugLinux|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugLinux|x86.ActiveCfg = DebugLinux|x86 - {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugLinux|x86.Build.0 = DebugLinux|x86 {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugMac|Any CPU.ActiveCfg = DebugMac|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugMac|Any CPU.Build.0 = DebugMac|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugMac|x64.ActiveCfg = DebugMac|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugMac|x86.ActiveCfg = DebugMac|x86 - {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugMac|x86.Build.0 = DebugMac|x86 {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugWindows|Any CPU.ActiveCfg = DebugWindows|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugWindows|Any CPU.Build.0 = DebugWindows|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugWindows|x64.ActiveCfg = DebugWindows|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugWindows|x64.Build.0 = DebugWindows|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugWindows|x86.ActiveCfg = DebugWindows|x86 - {830461AA-3E2E-4BDE-9B27-1B3280836521}.DebugWindows|x86.Build.0 = DebugWindows|x86 - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Release|Any CPU.ActiveCfg = Release|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Release|Any CPU.Build.0 = Release|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Release|x64.ActiveCfg = Release|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Release|x64.Build.0 = Release|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Release|x86.ActiveCfg = Release|x86 - {830461AA-3E2E-4BDE-9B27-1B3280836521}.Release|x86.Build.0 = Release|x86 {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseLinux|Any CPU.ActiveCfg = ReleaseLinux|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseLinux|Any CPU.Build.0 = ReleaseLinux|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|x86 - {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseLinux|x86.Build.0 = ReleaseLinux|x86 {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseMac|Any CPU.ActiveCfg = ReleaseMac|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseMac|Any CPU.Build.0 = ReleaseMac|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseMac|x64.ActiveCfg = ReleaseMac|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseMac|x86.ActiveCfg = ReleaseMac|x86 - {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseMac|x86.Build.0 = ReleaseMac|x86 {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseWindows|Any CPU.ActiveCfg = ReleaseWindows|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseWindows|Any CPU.Build.0 = ReleaseWindows|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseWindows|x64.ActiveCfg = ReleaseWindows|Any CPU {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseWindows|x64.Build.0 = ReleaseWindows|Any CPU - {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseWindows|x86.ActiveCfg = ReleaseWindows|x86 - {830461AA-3E2E-4BDE-9B27-1B3280836521}.ReleaseWindows|x86.Build.0 = ReleaseWindows|x86 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Debug|Any CPU.ActiveCfg = ReleaseLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Debug|Any CPU.Build.0 = ReleaseLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Debug|x64.ActiveCfg = DebugLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Debug|x64.Build.0 = DebugLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Debug|x86.ActiveCfg = DebugLinux|x86 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Debug|x86.Build.0 = DebugLinux|x86 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugLinux|Any CPU.ActiveCfg = DebugLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugLinux|x64.ActiveCfg = DebugLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugLinux|x64.Build.0 = DebugLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugLinux|x86.ActiveCfg = DebugLinux|x86 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugLinux|x86.Build.0 = DebugLinux|x86 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugMac|Any CPU.ActiveCfg = DebugLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugMac|Any CPU.Build.0 = DebugLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugMac|x64.ActiveCfg = DebugLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugMac|x86.ActiveCfg = DebugLinux|x86 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugMac|x86.Build.0 = DebugLinux|x86 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugWindows|Any CPU.ActiveCfg = DebugLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugWindows|Any CPU.Build.0 = DebugLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugWindows|x64.ActiveCfg = DebugLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugWindows|x86.ActiveCfg = DebugLinux|x86 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.DebugWindows|x86.Build.0 = DebugLinux|x86 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Release|Any CPU.ActiveCfg = ReleaseLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Release|Any CPU.Build.0 = ReleaseLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Release|x64.ActiveCfg = ReleaseLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Release|x64.Build.0 = ReleaseLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Release|x86.ActiveCfg = ReleaseLinux|x86 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.Release|x86.Build.0 = ReleaseLinux|x86 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseLinux|Any CPU.ActiveCfg = ReleaseLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseLinux|x64.ActiveCfg = ReleaseLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseLinux|x64.Build.0 = ReleaseLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseLinux|x86.ActiveCfg = ReleaseLinux|x86 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseLinux|x86.Build.0 = ReleaseLinux|x86 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseMac|Any CPU.ActiveCfg = DebugLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseMac|Any CPU.Build.0 = DebugLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseMac|x64.ActiveCfg = ReleaseLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseMac|x86.ActiveCfg = ReleaseLinux|x86 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseMac|x86.Build.0 = ReleaseLinux|x86 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseWindows|Any CPU.ActiveCfg = DebugLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseWindows|Any CPU.Build.0 = DebugLinux|x64 {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseWindows|x64.ActiveCfg = ReleaseLinux|x64 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseWindows|x86.ActiveCfg = ReleaseLinux|x86 - {D7F9FDD3-AF03-46AD-A2C2-F590899712B7}.ReleaseWindows|x86.Build.0 = ReleaseLinux|x86 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Debug|Any CPU.ActiveCfg = ReleaseMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Debug|Any CPU.Build.0 = ReleaseMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Debug|x64.ActiveCfg = DebugMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Debug|x64.Build.0 = DebugMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Debug|x86.ActiveCfg = DebugMac|x86 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Debug|x86.Build.0 = DebugMac|x86 {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugLinux|Any CPU.ActiveCfg = DebugMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugLinux|x64.ActiveCfg = DebugMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugLinux|x86.ActiveCfg = DebugMac|x86 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugLinux|x86.Build.0 = DebugMac|x86 {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugMac|Any CPU.ActiveCfg = DebugMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugMac|Any CPU.Build.0 = DebugMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugMac|x64.ActiveCfg = DebugMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugMac|x64.Build.0 = DebugMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugMac|x86.ActiveCfg = DebugMac|x86 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugMac|x86.Build.0 = DebugMac|x86 {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugWindows|Any CPU.ActiveCfg = DebugMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugWindows|Any CPU.Build.0 = DebugMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugWindows|x64.ActiveCfg = DebugMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugWindows|x86.ActiveCfg = DebugMac|x86 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.DebugWindows|x86.Build.0 = DebugMac|x86 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Release|Any CPU.ActiveCfg = ReleaseMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Release|Any CPU.Build.0 = ReleaseMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Release|x64.ActiveCfg = ReleaseMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Release|x64.Build.0 = ReleaseMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Release|x86.ActiveCfg = ReleaseMac|x86 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.Release|x86.Build.0 = ReleaseMac|x86 {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseLinux|Any CPU.ActiveCfg = ReleaseMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseLinux|x64.ActiveCfg = ReleaseMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseLinux|x86.ActiveCfg = ReleaseMac|x86 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseLinux|x86.Build.0 = ReleaseMac|x86 {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseMac|Any CPU.ActiveCfg = DebugMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseMac|Any CPU.Build.0 = DebugMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseMac|x64.ActiveCfg = ReleaseMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseMac|x64.Build.0 = ReleaseMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseMac|x86.ActiveCfg = ReleaseMac|x86 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseMac|x86.Build.0 = ReleaseMac|x86 {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseWindows|Any CPU.ActiveCfg = DebugMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseWindows|Any CPU.Build.0 = DebugMac|x64 {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseWindows|x64.ActiveCfg = ReleaseMac|x64 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseWindows|x86.ActiveCfg = ReleaseMac|x86 - {CC996BB6-3781-4868-B996-07F9CDC936ED}.ReleaseWindows|x86.Build.0 = ReleaseMac|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Debug|x64.ActiveCfg = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Debug|x64.Build.0 = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Debug|x86.ActiveCfg = Debug|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Debug|x86.Build.0 = Debug|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugLinux|Any CPU.ActiveCfg = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugLinux|Any CPU.Build.0 = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugLinux|x64.ActiveCfg = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugLinux|x64.Build.0 = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugLinux|x86.ActiveCfg = Debug|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugLinux|x86.Build.0 = Debug|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugMac|Any CPU.Build.0 = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugMac|x64.ActiveCfg = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugMac|x64.Build.0 = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugMac|x86.ActiveCfg = Debug|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugMac|x86.Build.0 = Debug|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugWindows|Any CPU.ActiveCfg = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugWindows|Any CPU.Build.0 = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugWindows|x64.ActiveCfg = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugWindows|x64.Build.0 = Debug|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugWindows|x86.ActiveCfg = Debug|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.DebugWindows|x86.Build.0 = Debug|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Release|Any CPU.Build.0 = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Release|x64.ActiveCfg = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Release|x64.Build.0 = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Release|x86.ActiveCfg = Release|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.Release|x86.Build.0 = Release|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseLinux|x64.ActiveCfg = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseLinux|x64.Build.0 = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseLinux|x86.ActiveCfg = Release|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseLinux|x86.Build.0 = Release|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseMac|x64.ActiveCfg = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseMac|x64.Build.0 = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseMac|x86.ActiveCfg = Release|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseMac|x86.Build.0 = Release|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseWindows|Any CPU.ActiveCfg = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseWindows|Any CPU.Build.0 = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseWindows|x64.ActiveCfg = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseWindows|x64.Build.0 = Release|Any CPU - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseWindows|x86.ActiveCfg = Release|x86 - {0E7FEE6A-15E5-4A4E-943C-80276003478C}.ReleaseWindows|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -681,7 +355,6 @@ Global {D7F9FDD3-AF03-46AD-A2C2-F590899712B7} = {B2C129F2-8E5C-419A-98EB-161AA5B5FC71} {DBCF6FF0-3DE9-11E9-B3EF-63280FDBDA4A} = {F35DF9BF-0BED-4FEF-A51C-DD83C531882F} {CC996BB6-3781-4868-B996-07F9CDC936ED} = {DBCF6FF0-3DE9-11E9-B3EF-63280FDBDA4A} - {0E7FEE6A-15E5-4A4E-943C-80276003478C} = {DE36F45F-F09E-4719-B953-00D148F7722A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {17032EAB-554B-4B44-A4F6-EFB177ACAB7A} diff --git a/Libraries/Facepunch.Steamworks/Facepunch.Steamworks.csproj b/Libraries/Facepunch.Steamworks/Facepunch.Steamworks.csproj index 75936d8c8..09072c596 100644 --- a/Libraries/Facepunch.Steamworks/Facepunch.Steamworks.csproj +++ b/Libraries/Facepunch.Steamworks/Facepunch.Steamworks.csproj @@ -1,14 +1,15 @@  - + + net45 true - Facepunch.Steamworks - false - false - true - .pdb - AnyCPU;x86 + Facepunch.Steamworks + + true + false + true + @@ -16,27 +17,17 @@ 1701;1702;1705;618;1591 - - TRACE;DEBUG - 1701;1702;1705;618;1591 - - TRACE;RELEASE 1701;1702;1705;618;1591 - - TRACE;RELEASE - 1701;1702;1705;618;1591 - - $(DefineConstants);NET_CORE - + @@ -74,10 +65,5 @@ full true - - - full - true - diff --git a/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame DesktopGL.csproj b/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame DesktopGL.csproj index 627ba0b5b..d2b9e150e 100644 --- a/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame DesktopGL.csproj +++ b/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame DesktopGL.csproj @@ -80,57 +80,6 @@ 4 AnyCPU - - true - bin\x86\ReleaseWindows\ - TRACE;WINDOWS - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - - - true - bin\x86\ReleaseLinux\ - TRACE;LINUX - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - - - true - bin\x86\ReleaseMac\ - TRACE;OSX - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - - - true - bin\x86\DebugWindows\ - TRACE;DEBUG;WINDOWS - full - x86 - MinimumRecommendedRules.ruleset - - - true - bin\x86\DebugLinux\ - TRACE;DEBUG;LINUX - full - x86 - MinimumRecommendedRules.ruleset - - - true - bin\x86\DebugMac\ - TRACE;DEBUG;OSX - full - x86 - MinimumRecommendedRules.ruleset - diff --git a/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame WindowsDX.csproj b/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame WindowsDX.csproj index 631c2a116..dad71b62a 100644 --- a/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame WindowsDX.csproj +++ b/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame WindowsDX.csproj @@ -82,68 +82,6 @@ - - true - bin\x86\ReleaseWindows\ - TRACE;WINDOWS - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - - - true - bin\x86\ReleaseLinux\ - TRACE;LINUX - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - - - true - bin\x86\ReleaseMac\ - TRACE;OSX - true - pdbonly - x86 - MinimumRecommendedRules.ruleset - - - true - bin\x86\DebugWindows\ - TRACE;DEBUG;WINDOWS - full - x86 - MinimumRecommendedRules.ruleset - - - true - bin\x86\DebugLinux\ - TRACE;DEBUG;LINUX - full - x86 - MinimumRecommendedRules.ruleset - - - true - bin\x86\DebugMac\ - TRACE;DEBUG;OSX - full - x86 - MinimumRecommendedRules.ruleset - - - true - bin\x86\Debug\ - x86 - MinimumRecommendedRules.ruleset - - - bin\x86\Release\ - x86 - MinimumRecommendedRules.ruleset - diff --git a/Libraries/Hyper.ComponentModel/Hyper.ComponentModel.csproj b/Libraries/Hyper.ComponentModel/Hyper.ComponentModel.csproj index 8ec0bd909..4dd72588d 100644 --- a/Libraries/Hyper.ComponentModel/Hyper.ComponentModel.csproj +++ b/Libraries/Hyper.ComponentModel/Hyper.ComponentModel.csproj @@ -37,25 +37,6 @@ false AnyCPU - - true - bin\x86\Debug\ - DEBUG;TRACE - full - x86 - prompt - MinimumRecommendedRules.ruleset - - - bin\x86\Release\ - TRACE - bin\Release\Hyper.ComponentModel.XML - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset -