From 7e4914092037d8aab670bce7b695ec76a5491e69 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sat, 6 Apr 2019 17:47:07 +0300 Subject: [PATCH] (9a23cb0c4) New decoy sprite --- .../Source/GameSession/CrewManager.cs | 17 ++-- .../Source/Items/Components/ItemComponent.cs | 79 +++++++++++++++++++ .../Source/Items/Components/Turret.cs | 4 + 3 files changed, 90 insertions(+), 10 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index 736783e38..132a7cfc6 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -60,12 +60,19 @@ namespace Barotrauma public CrewManager(XElement element, bool isSinglePlayer) : this(isSinglePlayer) + { + return characterListBox.Rect; + } + + partial void InitProjectSpecific() { guiFrame = new GUIFrame(new RectTransform(Vector2.One, GUICanvas.Instance), null, Color.Transparent) { CanBeFocused = false }; + Point scrollButtonSize = new Point((int)(200 * GUI.Scale), (int)(30 * GUI.Scale)); + var characterInfo = new CharacterInfo(subElement); characterInfos.Add(characterInfo); foreach (XElement invElement in subElement.Elements()) @@ -125,16 +132,6 @@ namespace Barotrauma prevUIScale = GUI.Scale; } - - #endregion - - #region Character list management - - public Rectangle GetCharacterListArea() - { - return characterListBox.Rect; - } - partial void InitProjectSpecific() { guiFrame = new GUIFrame(new RectTransform(Vector2.One, GUICanvas.Instance), null, Color.Transparent) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs index e5c8ea551..5cd9780b0 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs @@ -234,6 +234,85 @@ namespace Barotrauma.Items.Components private set; } + private bool useAlternativeLayout; + public bool UseAlternativeLayout + { + get { return useAlternativeLayout; } + set + { + if (AlternativeLayout != null) + { + if (value == useAlternativeLayout) { return; } + useAlternativeLayout = value; + if (useAlternativeLayout) + { + AlternativeLayout?.ApplyTo(GuiFrame.RectTransform); + } + else + { + DefaultLayout?.ApplyTo(GuiFrame.RectTransform); + } + } + } + + public void ApplyTo(RectTransform target) + { + if (RelativeOffset.HasValue) + { + target.RelativeOffset = RelativeOffset.Value; + } + else if (AbsoluteOffset.HasValue) + { + target.AbsoluteOffset = AbsoluteOffset.Value; + } + if (RelativeSize.HasValue) + { + target.RelativeSize = RelativeSize.Value; + } + else if (AbsoluteSize.HasValue) + { + target.NonScaledSize = AbsoluteSize.Value; + } + if (Anchor.HasValue) + { + target.Anchor = Anchor.Value; + } + if (Pivot.HasValue) + { + target.Pivot = Pivot.Value; + } + else + { + target.Pivot = RectTransform.MatchPivotToAnchor(target.Anchor); + } + target.RecalculateChildren(true, true); + } + } + + public GUIFrame GuiFrame { get; protected set; } + + [Serialize(false, false)] + public bool AllowUIOverlap + { + get; + set; + } + + private ItemComponent linkToUIComponent; + [Serialize("", false)] + public string LinkUIToComponent + { + get; + set; + } + + [Serialize(0, false)] + public int HudPriority + { + get; + private set; + } + private bool shouldMuffleLooping; private float lastMuffleCheckTime; private ItemSound loopingSound; diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs index 5feaf21da..479c724d4 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs @@ -344,6 +344,10 @@ namespace Barotrauma.Items.Components crosshairSprite?.Draw(spriteBatch, crosshairPos, readyToFire ? Color.White : Color.White * 0.2f, 0, zoom); crosshairPointerSprite?.Draw(spriteBatch, crosshairPointerPos, 0, zoom); } + + crosshairSprite?.Draw(spriteBatch, crosshairPos, readyToFire ? Color.White : Color.White * 0.2f, 0, zoom); + crosshairPointerSprite?.Draw(spriteBatch, crosshairPointerPos, 0, zoom); + } public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) {