(6d989732) Unstable v0.9.708.0
This commit is contained in:
@@ -302,8 +302,9 @@ namespace Barotrauma
|
||||
{
|
||||
if (character.Info != null)
|
||||
{
|
||||
character.Info.DrawPortrait(spriteBatch, HUDLayoutSettings.PortraitArea.Location.ToVector2(), targetWidth: HUDLayoutSettings.PortraitArea.Width);
|
||||
character.Info.DrawJobIcon(spriteBatch);
|
||||
character.Info.DrawBackground(spriteBatch);
|
||||
character.Info.DrawJobIcon(spriteBatch, scale: 1.25f);
|
||||
character.Info.DrawPortrait(spriteBatch, HUDLayoutSettings.PortraitArea.Location.ToVector2(), new Vector2((int)(-4 * GUI.Scale), (int)(2 * GUI.Scale)), targetWidth: HUDLayoutSettings.PortraitArea.Width, true);
|
||||
}
|
||||
mouseOnPortrait = HUDLayoutSettings.PortraitArea.Contains(PlayerInput.MousePosition) && !character.ShouldLockHud();
|
||||
if (mouseOnPortrait)
|
||||
@@ -352,7 +353,7 @@ namespace Barotrauma
|
||||
GUIComponent.DrawToolTip(
|
||||
spriteBatch,
|
||||
character.Info?.Job == null ? character.DisplayName : character.Name + " (" + character.Info.Job.Name + ")",
|
||||
HUDLayoutSettings.PortraitTooltipArea);
|
||||
HUDLayoutSettings.PortraitArea);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,24 @@ namespace Barotrauma
|
||||
{
|
||||
partial class CharacterInfo
|
||||
{
|
||||
public const float BgScale = 1.2f;
|
||||
private static Sprite infoAreaPortraitBG;
|
||||
private static Vector2 infoBGPosition;
|
||||
private static Vector2 jobIconPos;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
GameMain.Instance.OnResolutionChanged += SetUILayout;
|
||||
infoAreaPortraitBG = new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(833, 298, 142, 98), null, 0);
|
||||
SetUILayout();
|
||||
}
|
||||
|
||||
private static void SetUILayout()
|
||||
{
|
||||
jobIconPos = HUDLayoutSettings.BottomRightInfoArea.Center.ToVector2() + new Vector2(12 * GUI.Scale, 24 * GUI.Scale);
|
||||
infoBGPosition = HUDLayoutSettings.BottomRightInfoArea.Location.ToVector2();
|
||||
}
|
||||
|
||||
public GUIFrame CreateInfoFrame(GUIFrame frame)
|
||||
{
|
||||
var paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), frame.RectTransform, Anchor.TopCenter) { RelativeOffset = new Vector2(0.0f, 0.1f) })
|
||||
@@ -160,24 +178,25 @@ namespace Barotrauma
|
||||
sprite.SourceRect = new Rectangle(location, sprite.SourceRect.Size);
|
||||
}
|
||||
|
||||
public void DrawPortrait(SpriteBatch spriteBatch, Vector2 screenPos, float targetWidth, bool flip = false)
|
||||
public void DrawBackground(SpriteBatch spriteBatch)
|
||||
{
|
||||
infoAreaPortraitBG.Draw(spriteBatch, infoBGPosition, Color.White, Vector2.Zero, 0.0f,
|
||||
scale: new Vector2(
|
||||
HUDLayoutSettings.BottomRightInfoArea.Width / (float)infoAreaPortraitBG.SourceRect.Width,
|
||||
HUDLayoutSettings.BottomRightInfoArea.Height / (float)infoAreaPortraitBG.SourceRect.Height));
|
||||
}
|
||||
|
||||
public void DrawPortrait(SpriteBatch spriteBatch, Vector2 screenPos, Vector2 offset, float targetWidth, bool flip = false)
|
||||
{
|
||||
float backgroundScale = 1;
|
||||
if (PortraitBackground != null)
|
||||
{
|
||||
backgroundScale = targetWidth / PortraitBackground.size.X;
|
||||
PortraitBackground.Draw(spriteBatch, screenPos, scale: backgroundScale);
|
||||
}
|
||||
if (Portrait != null)
|
||||
{
|
||||
// Scale down the head sprite 10%
|
||||
float scale = targetWidth * 0.9f / Portrait.size.X;
|
||||
Vector2 offset = Portrait.size * backgroundScale / 4;
|
||||
if (Head.SheetIndex.HasValue)
|
||||
{
|
||||
Portrait.SourceRect = new Rectangle(CalculateOffset(Portrait, Head.SheetIndex.Value.ToPoint()), Portrait.SourceRect.Size);
|
||||
}
|
||||
Portrait.Draw(spriteBatch, screenPos + offset, scale: scale, spriteEffect: flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
|
||||
Portrait.Draw(spriteBatch, screenPos + offset, Color.White, Portrait.Origin, scale: scale, spriteEffect: flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
|
||||
if (AttachmentSprites != null)
|
||||
{
|
||||
float depthStep = 0.000001f;
|
||||
@@ -216,7 +235,8 @@ namespace Barotrauma
|
||||
public void DrawJobIcon(SpriteBatch spriteBatch, Vector2? pos = null, float scale = 1.0f)
|
||||
{
|
||||
if (jobIcon == null) return;
|
||||
jobIcon.Draw(spriteBatch, pos ?? jobIconPos, Job.Prefab.UIColor, scale: .5f * GUI.Scale * scale);
|
||||
float combinedScale = .5f * GUI.Scale * scale;
|
||||
jobIcon.Draw(spriteBatch, pos ?? jobIconPos, Job.Prefab.UIColor, scale: combinedScale);
|
||||
}
|
||||
|
||||
private void DrawAttachmentSprite(SpriteBatch spriteBatch, WearableSprite attachment, Sprite head, Vector2 drawPos, float scale, float depthStep, SpriteEffects spriteEffects = SpriteEffects.None)
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace Barotrauma
|
||||
if (openHealthWindow == value) return;
|
||||
if (value != null && !value.UseHealthWindow) return;
|
||||
|
||||
var prevOpenHealthWindow = openHealthWindow;
|
||||
var prevOpenHealthWindow = openHealthWindow;
|
||||
|
||||
if (prevOpenHealthWindow != null)
|
||||
{
|
||||
@@ -262,18 +262,21 @@ namespace Barotrauma
|
||||
character.OnAttacked += OnAttacked;
|
||||
|
||||
bool horizontal = true;
|
||||
healthBar = new GUIProgressBar(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.HealthBarAreaLeft, GUI.Canvas),
|
||||
barSize: 1.0f, color: GUIColorSettings.HealthBarColorHigh, style: horizontal ? "CharacterHealthBar" : "GUIProgressBarVertical")
|
||||
|
||||
healthBar = new GUIProgressBar(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.HealthBarArea, GUI.Canvas),
|
||||
barSize: 1.0f, color: GUIColorSettings.HealthBarColorHigh, style: horizontal ? "GUIProgressBar" : "GUIProgressBarVertical")
|
||||
{
|
||||
Enabled = true,
|
||||
HoverCursor = CursorState.Hand,
|
||||
IsHorizontal = horizontal
|
||||
};
|
||||
healthBarShadow = new GUIProgressBar(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.HealthBarAreaLeft, GUI.Canvas),
|
||||
barSize: 1.0f, color: Color.Green, style: horizontal ? "CharacterHealthBar" : "GUIProgressBarVertical", showFrame: false)
|
||||
};
|
||||
|
||||
healthBarShadow = new GUIProgressBar(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.HealthBarArea, GUI.Canvas),
|
||||
barSize: 1.0f, color: Color.Green, style: horizontal ? "GUIProgressBar" : "GUIProgressBarVertical", showFrame: false)
|
||||
{
|
||||
IsHorizontal = horizontal
|
||||
};
|
||||
healthBarShadow.Visible = false;
|
||||
healthShadowSize = 1.0f;
|
||||
|
||||
healthInterfaceFrame = new GUIFrame(new RectTransform(new Vector2(0.7f, 0.55f), GUI.Canvas, anchor: Anchor.Center, scaleBasis: ScaleBasis.Smallest), style: "ItemUI");
|
||||
@@ -390,7 +393,7 @@ namespace Barotrauma
|
||||
new GUICustomComponent(new RectTransform(new Vector2(0.15f, 1.0f), nameContainer.RectTransform),
|
||||
onDraw: (spriteBatch, component) =>
|
||||
{
|
||||
character.Info.DrawPortrait(spriteBatch, new Vector2(component.Rect.X, component.Rect.Center.Y - component.Rect.Width / 2), component.Rect.Width);
|
||||
character.Info.DrawPortrait(spriteBatch, new Vector2(component.Rect.X, component.Rect.Center.Y - component.Rect.Width / 2), character.Info.Portrait.size * .25f, component.Rect.Width);
|
||||
character.Info.DrawJobIcon(spriteBatch, new Vector2(component.Rect.Right + component.Rect.Width, (float)component.Rect.Top + component.Rect.Height * 0.75f), 0.75f);
|
||||
});
|
||||
characterName = new GUITextBlock(new RectTransform(new Vector2(0.85f, 1.0f), nameContainer.RectTransform), "", textAlignment: Alignment.BottomLeft, font: GUI.SubHeadingFont)
|
||||
@@ -542,6 +545,14 @@ namespace Barotrauma
|
||||
inventoryScale = Inventory.UIScale;
|
||||
uiScale = GUI.Scale;
|
||||
|
||||
healthBar.RectTransform.AbsoluteOffset = HUDLayoutSettings.HealthBarArea.Location;
|
||||
healthBar.RectTransform.NonScaledSize = HUDLayoutSettings.HealthBarArea.Size;
|
||||
healthBar.RectTransform.RelativeOffset = Vector2.Zero;
|
||||
|
||||
healthBarShadow.RectTransform.AbsoluteOffset = HUDLayoutSettings.HealthBarArea.Location;
|
||||
healthBarShadow.RectTransform.NonScaledSize = HUDLayoutSettings.HealthBarArea.Size;
|
||||
healthBarShadow.RectTransform.RelativeOffset = Vector2.Zero;
|
||||
|
||||
switch (alignment)
|
||||
{
|
||||
case Alignment.Left:
|
||||
@@ -869,7 +880,7 @@ namespace Barotrauma
|
||||
highlightedLimbIndex = -1;
|
||||
}
|
||||
|
||||
Rectangle hoverArea = Rectangle.Union(HUDLayoutSettings.AfflictionAreaLeft, HUDLayoutSettings.HealthBarAreaLeft);
|
||||
Rectangle hoverArea = Rectangle.Union(HUDLayoutSettings.AfflictionAreaLeft, HUDLayoutSettings.HealthBarArea);
|
||||
|
||||
healthBar.CanBeFocused = healthBarShadow.CanBeFocused = !Character.ShouldLockHud();
|
||||
if (Character.AllowInput && UseHealthWindow && healthBar.Enabled && healthBar.CanBeFocused &&
|
||||
@@ -959,7 +970,7 @@ namespace Barotrauma
|
||||
public void DrawStatusHUD(SpriteBatch spriteBatch)
|
||||
{
|
||||
//Rectangle interactArea = healthBar.Rect;
|
||||
if (openHealthWindow != this)
|
||||
if (Character.Controlled?.SelectedCharacter == null)
|
||||
{
|
||||
List<Pair<Affliction, string>> statusIcons = new List<Pair<Affliction, string>>();
|
||||
if (Character.CurrentHull == null || Character.CurrentHull.LethalPressure > 5.0f)
|
||||
@@ -975,11 +986,12 @@ namespace Barotrauma
|
||||
Pair<Affliction, string> highlightedIcon = null;
|
||||
Vector2 highlightedIconPos = Vector2.Zero;
|
||||
Rectangle afflictionArea = HUDLayoutSettings.AfflictionAreaLeft;
|
||||
Point pos = afflictionArea.Location + healthBar.RectTransform.ScreenSpaceOffset;
|
||||
|
||||
bool horizontal = afflictionArea.Width > afflictionArea.Height;
|
||||
int iconSize = horizontal ? afflictionArea.Height : afflictionArea.Width;
|
||||
|
||||
Point pos = new Point(afflictionArea.Right - iconSize, afflictionArea.Top);
|
||||
|
||||
foreach (Pair<Affliction, string> statusIcon in statusIcons)
|
||||
{
|
||||
Affliction affliction = statusIcon.First;
|
||||
@@ -1018,7 +1030,7 @@ namespace Barotrauma
|
||||
scale: iconSize / afflictionPrefab.Icon.size.X);
|
||||
|
||||
if (horizontal)
|
||||
pos.X += iconSize + (int)(5 * GUI.Scale);
|
||||
pos.X -= iconSize + (int)(5 * GUI.Scale);
|
||||
else
|
||||
pos.Y += iconSize + (int)(5 * GUI.Scale);
|
||||
}
|
||||
@@ -1800,7 +1812,13 @@ namespace Barotrauma
|
||||
(int)(limbHealth.HighlightArea.Width * scale),
|
||||
(int)(limbHealth.HighlightArea.Height * scale));
|
||||
}
|
||||
|
||||
|
||||
public void SetHealthBarVisibility(bool value)
|
||||
{
|
||||
healthBar.Visible = value;
|
||||
healthBarShadow.Visible = value;
|
||||
}
|
||||
|
||||
public void ClientRead(IReadMessage inc)
|
||||
{
|
||||
List<Pair<AfflictionPrefab, float>> newAfflictions = new List<Pair<AfflictionPrefab, float>>();
|
||||
|
||||
@@ -782,6 +782,12 @@ namespace Barotrauma
|
||||
|
||||
commands.Add(new Command("lobby|lobbyscreen", "", (string[] args) =>
|
||||
{
|
||||
if (GameMain.Client != null)
|
||||
{
|
||||
ThrowError("This command cannot be used in multiplayer.");
|
||||
return;
|
||||
}
|
||||
|
||||
GameMain.LobbyScreen.Select();
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -27,14 +28,14 @@ namespace Barotrauma
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(10, y), "EventManager", Color.White, Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 20), "Event cooldown: " + eventCoolDown, Color.White, Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 35), "Current intensity: " + (int)(currentIntensity * 100), Color.Lerp(Color.White, GUI.Style.Red, currentIntensity), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 50), "Target intensity: " + (int)(targetIntensity * 100), Color.Lerp(Color.White, GUI.Style.Red, targetIntensity), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 35), "Current intensity: " + (int)Math.Round(currentIntensity * 100), Color.Lerp(Color.White, GUI.Style.Red, currentIntensity), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 50), "Target intensity: " + (int)Math.Round(targetIntensity * 100), Color.Lerp(Color.White, GUI.Style.Red, targetIntensity), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 65), "AvgHealth: " + (int)(avgCrewHealth * 100), Color.Lerp(GUI.Style.Red, GUI.Style.Green, avgCrewHealth), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 80), "AvgHullIntegrity: " + (int)(avgHullIntegrity * 100), Color.Lerp(GUI.Style.Red, GUI.Style.Green, avgHullIntegrity), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 95), "FloodingAmount: " + (int)(floodingAmount * 100), Color.Lerp(GUI.Style.Green, GUI.Style.Red, floodingAmount), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 110), "FireAmount: " + (int)(fireAmount * 100), Color.Lerp(GUI.Style.Green, GUI.Style.Red, fireAmount), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 125), "EnemyDanger: " + (int)(enemyDanger * 100), Color.Lerp(GUI.Style.Green, GUI.Style.Red, enemyDanger), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 65), "AvgHealth: " + (int)Math.Round(avgCrewHealth * 100), Color.Lerp(GUI.Style.Red, GUI.Style.Green, avgCrewHealth), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 80), "AvgHullIntegrity: " + (int)Math.Round(avgHullIntegrity * 100), Color.Lerp(GUI.Style.Red, GUI.Style.Green, avgHullIntegrity), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 95), "FloodingAmount: " + (int)Math.Round(floodingAmount * 100), Color.Lerp(GUI.Style.Green, GUI.Style.Red, floodingAmount), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 110), "FireAmount: " + (int)Math.Round(fireAmount * 100), Color.Lerp(GUI.Style.Green, GUI.Style.Red, fireAmount), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 125), "EnemyDanger: " + (int)Math.Round(enemyDanger * 100), Color.Lerp(GUI.Style.Green, GUI.Style.Red, enemyDanger), Color.Black * 0.6f, 0, GUI.SmallFont);
|
||||
|
||||
#if DEBUG
|
||||
if (PlayerInput.KeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt) &&
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Barotrauma
|
||||
InputBox.TextBlock.RectTransform.MaxSize
|
||||
= new Point((int)(InputBox.Rect.Width - chatSendButton.Rect.Width * 1.25f - InputBox.TextBlock.Padding.Z), int.MaxValue);
|
||||
|
||||
showNewMessagesButton = new GUIButton(new RectTransform(new Vector2(1f, 0.125f), GUIFrame.RectTransform, Anchor.BottomCenter) { RelativeOffset = new Vector2(0.0f, -0.125f) }, TextManager.Get("chat.shownewmessages"));
|
||||
showNewMessagesButton = new GUIButton(new RectTransform(new Vector2(1f, 0.075f), GUIFrame.RectTransform, Anchor.BottomCenter) { RelativeOffset = new Vector2(0.0f, 0.125f) }, TextManager.Get("chat.shownewmessages"));
|
||||
showNewMessagesButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||
{
|
||||
chatBox.ScrollBar.BarScrollValue = 1f;
|
||||
@@ -239,7 +239,8 @@ namespace Barotrauma
|
||||
{
|
||||
var popupMsg = new GUIFrame(new RectTransform(Vector2.One, GUIFrame.RectTransform), style: "GUIToolTip")
|
||||
{
|
||||
Visible = false
|
||||
Visible = false,
|
||||
CanBeFocused = false
|
||||
};
|
||||
var senderText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), popupMsg.RectTransform, Anchor.TopRight),
|
||||
senderName, textColor: senderColor, font: GUI.SmallFont, textAlignment: Alignment.TopRight)
|
||||
@@ -306,7 +307,7 @@ namespace Barotrauma
|
||||
GUIFrame.RectTransform.NonScaledSize -= new Point(toggleButtonWidth, 0);
|
||||
GUIFrame.RectTransform.AbsoluteOffset += new Point(toggleButtonWidth, 0);
|
||||
|
||||
popupMessageOffset = GameMain.GameSession.CrewManager.ReportButtonFrame.Rect.Width + GUIFrame.Rect.Width;
|
||||
popupMessageOffset = GameMain.GameSession.CrewManager.ReportButtonFrame.Rect.Width + GUIFrame.Rect.Width + (int)(20 * GUI.Scale);
|
||||
}
|
||||
|
||||
public void Update(float deltaTime)
|
||||
|
||||
@@ -233,9 +233,11 @@ namespace Barotrauma
|
||||
{
|
||||
get { return textBlock.WrappedText; }
|
||||
}
|
||||
|
||||
|
||||
public bool Readonly { get; set; }
|
||||
|
||||
public GUITextBox(RectTransform rectT, string text = "", Color? textColor = null, ScalableFont font = null,
|
||||
Alignment textAlignment = Alignment.Left, bool wrap = false, string style = "", Color? color = null, bool createClearButton = false)
|
||||
Alignment textAlignment = Alignment.Left, bool wrap = false, string style = "", Color? color = null, bool createClearButton = false)
|
||||
: base(style, rectT)
|
||||
{
|
||||
HoverCursor = CursorState.IBeam;
|
||||
@@ -670,6 +672,7 @@ namespace Barotrauma
|
||||
|
||||
public void ReceiveTextInput(string input)
|
||||
{
|
||||
if (Readonly) { return; }
|
||||
if (selectedCharacters > 0)
|
||||
{
|
||||
RemoveSelectedText();
|
||||
@@ -693,7 +696,7 @@ namespace Barotrauma
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case '\b': //backspace
|
||||
case '\b' when !Readonly: //backspace
|
||||
if (PlayerInput.KeyDown(Keys.LeftControl) || PlayerInput.KeyDown(Keys.RightControl))
|
||||
{
|
||||
SetText(string.Empty, false);
|
||||
@@ -715,7 +718,7 @@ namespace Barotrauma
|
||||
case (char)0x3: // ctrl-c
|
||||
CopySelectedText();
|
||||
break;
|
||||
case (char)0x16: // ctrl-v
|
||||
case (char)0x16 when !Readonly: // ctrl-v
|
||||
string text = GetCopiedText();
|
||||
RemoveSelectedText();
|
||||
if (SetText(Text.Insert(CaretIndex, text)))
|
||||
@@ -726,12 +729,15 @@ namespace Barotrauma
|
||||
break;
|
||||
case (char)0x18: // ctrl-x
|
||||
CopySelectedText();
|
||||
RemoveSelectedText();
|
||||
if (!Readonly)
|
||||
{
|
||||
RemoveSelectedText();
|
||||
}
|
||||
break;
|
||||
case (char)0x1: // ctrl-a
|
||||
SelectAll();
|
||||
break;
|
||||
case (char)0x1A: // ctrl-z
|
||||
case (char)0x1A when !Readonly: // ctrl-z
|
||||
text = memento.Undo();
|
||||
if (text != Text)
|
||||
{
|
||||
@@ -741,7 +747,7 @@ namespace Barotrauma
|
||||
OnTextChanged?.Invoke(this, Text);
|
||||
}
|
||||
break;
|
||||
case (char)0x12: // ctrl-r
|
||||
case (char)0x12 when !Readonly: // ctrl-r
|
||||
text = memento.Redo();
|
||||
if (text != Text)
|
||||
{
|
||||
@@ -798,7 +804,7 @@ namespace Barotrauma
|
||||
caretTimer = 0;
|
||||
HandleSelection();
|
||||
break;
|
||||
case Keys.Delete:
|
||||
case Keys.Delete when !Readonly:
|
||||
if (selectedCharacters > 0)
|
||||
{
|
||||
RemoveSelectedText();
|
||||
|
||||
@@ -30,7 +30,6 @@ namespace Barotrauma
|
||||
get; private set;
|
||||
}
|
||||
|
||||
|
||||
public static Rectangle CrewArea
|
||||
{
|
||||
get; private set;
|
||||
@@ -55,10 +54,16 @@ namespace Barotrauma
|
||||
{
|
||||
get; private set;
|
||||
}*/
|
||||
public static Rectangle HealthBarAreaLeft
|
||||
public static Rectangle HealthBarArea
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public static Rectangle BottomRightInfoArea
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public static Rectangle AfflictionAreaLeft
|
||||
{
|
||||
get; private set;
|
||||
@@ -74,11 +79,6 @@ namespace Barotrauma
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public static Rectangle PortraitTooltipArea
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public static int Padding
|
||||
{
|
||||
get; private set;
|
||||
@@ -91,6 +91,7 @@ namespace Barotrauma
|
||||
GameMain.Instance.OnResolutionChanged += CreateAreas;
|
||||
GameMain.Config.OnHUDScaleChanged += CreateAreas;
|
||||
CreateAreas();
|
||||
CharacterInfo.Init();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,23 +105,26 @@ namespace Barotrauma
|
||||
|
||||
public static void CreateAreas()
|
||||
{
|
||||
Padding = (int)(10 * GUI.Scale);
|
||||
Padding = (int)(11 * GUI.Scale);
|
||||
|
||||
if (inventoryTopY == 0) { inventoryTopY = GameMain.GraphicsHeight - 30; }
|
||||
|
||||
//slice from the top of the screen for misc buttons (info, end round, server controls)
|
||||
ButtonAreaTop = new Rectangle(Padding, Padding, GameMain.GraphicsWidth - Padding * 2, (int)(50 * GUI.Scale));
|
||||
|
||||
|
||||
int infoAreaWidth = (int)(142 * GUI.Scale * CharacterInfo.BgScale);
|
||||
int infoAreaHeight = (int)(98 * GUI.Scale * CharacterInfo.BgScale);
|
||||
int portraitSize = (int)(125 * GUI.Scale);
|
||||
PortraitArea = new Rectangle(Padding * 2, Padding * 2, portraitSize, portraitSize);
|
||||
PortraitTooltipArea = new Rectangle(PortraitArea.X + portraitSize / 2 + Padding, PortraitArea.Top - portraitSize, portraitSize, portraitSize);
|
||||
BottomRightInfoArea = new Rectangle(GameMain.GraphicsWidth - Padding * 2 - infoAreaWidth, GameMain.GraphicsHeight - Padding * 2 - infoAreaHeight, infoAreaWidth, infoAreaHeight);
|
||||
PortraitArea = new Rectangle(GameMain.GraphicsWidth - Padding - portraitSize, GameMain.GraphicsHeight - Padding - portraitSize, portraitSize, portraitSize);
|
||||
|
||||
//horizontal slices at the corners of the screen for health bar and affliction icons
|
||||
int healthBarWidth = (int)Math.Max(250 * GUI.Scale, 150);
|
||||
int healthBarHeight = (int)Math.Max(15f * GUI.Scale, 12.5f);
|
||||
int healthBarHeight = (int)Math.Max(25f * GUI.Scale, 12.5f);
|
||||
int afflictionAreaHeight = (int)(50 * GUI.Scale);
|
||||
HealthBarAreaLeft = new Rectangle(PortraitArea.X, PortraitArea.Y + Padding / 2 + portraitSize, healthBarWidth, healthBarHeight);
|
||||
AfflictionAreaLeft = new Rectangle(PortraitArea.X, HealthBarAreaLeft.Y + healthBarHeight + Padding, healthBarWidth, afflictionAreaHeight);
|
||||
int healthBarWidth = BottomRightInfoArea.Width;
|
||||
//int healthBarWidth = (int)((BottomRightInfoArea.Width + CharacterInventory.SlotSize.X + CharacterInventory.Spacing) * 1.1f);
|
||||
HealthBarArea = new Rectangle(BottomRightInfoArea.X, BottomRightInfoArea.Y - healthBarHeight - (int)(8 * GUI.Scale), healthBarWidth, healthBarHeight);
|
||||
AfflictionAreaLeft = new Rectangle(HealthBarArea.X, HealthBarArea.Y - Padding - afflictionAreaHeight, HealthBarArea.Width, afflictionAreaHeight);
|
||||
|
||||
//HealthBarAreaRight = new Rectangle(Padding, GameMain.GraphicsHeight - healthBarHeight - Padding, healthBarWidth, healthBarHeight);
|
||||
/*if (HealthBarAreaRight.Y + healthBarHeight * 0.75f < PortraitArea.Y)
|
||||
@@ -134,15 +138,14 @@ namespace Barotrauma
|
||||
|
||||
bool isFourByThree = GUI.IsFourByThree();
|
||||
int chatBoxWidth = !isFourByThree ? (int)(475 * GUI.Scale) : (int)(375 * GUI.Scale);
|
||||
int chatBoxHeight = (int)Math.Max(GameMain.GraphicsHeight * 0.22f, 150);
|
||||
int chatBoxHeight = (int)Math.Max(GameMain.GraphicsHeight * 0.25f, 150);
|
||||
ChatBoxArea = new Rectangle(Padding, GameMain.GraphicsHeight - Padding - chatBoxHeight, chatBoxWidth, chatBoxHeight);
|
||||
|
||||
int objectiveAnchorWidth = (int)(250 * GUI.Scale);
|
||||
int objectiveAnchorOffsetY = (int)(150 * GUI.Scale);
|
||||
ObjectiveAnchor = new Rectangle(Padding, ChatBoxArea.Y - objectiveAnchorOffsetY, objectiveAnchorWidth, 0);
|
||||
|
||||
var crewAreaY = AfflictionAreaLeft.Bottom + Padding;
|
||||
CrewArea = new Rectangle(Padding, crewAreaY, (int)Math.Max(400 * GUI.Scale, 220), ObjectiveAnchor.Top - Padding - crewAreaY);
|
||||
CrewArea = new Rectangle(Padding, Padding, (int)Math.Max(400 * GUI.Scale, 220), ObjectiveAnchor.Top - Padding * 2);
|
||||
|
||||
InventoryAreaLower = new Rectangle(Padding, inventoryTopY, GameMain.GraphicsWidth - Padding * 2, GameMain.GraphicsHeight - inventoryTopY);
|
||||
|
||||
@@ -160,10 +163,11 @@ namespace Barotrauma
|
||||
GUI.DrawRectangle(spriteBatch, MessageAreaTop, GUI.Style.Orange * 0.5f);
|
||||
GUI.DrawRectangle(spriteBatch, CrewArea, Color.Blue * 0.5f);
|
||||
GUI.DrawRectangle(spriteBatch, ChatBoxArea, Color.Cyan * 0.5f);
|
||||
GUI.DrawRectangle(spriteBatch, HealthBarAreaLeft, Color.Red * 0.5f);
|
||||
GUI.DrawRectangle(spriteBatch, HealthBarArea, Color.Red * 0.5f);
|
||||
GUI.DrawRectangle(spriteBatch, AfflictionAreaLeft, Color.Red * 0.5f);
|
||||
GUI.DrawRectangle(spriteBatch, InventoryAreaLower, Color.Yellow * 0.5f);
|
||||
GUI.DrawRectangle(spriteBatch, HealthWindowAreaLeft, Color.Red * 0.5f);
|
||||
GUI.DrawRectangle(spriteBatch, BottomRightInfoArea, Color.Green * 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
ReportButtonFrame = new GUILayoutGroup(new RectTransform(
|
||||
new Point((HUDLayoutSettings.ChatBoxArea.Height - (int)((reports.Count - 1) * 5 * GUI.Scale)) / reports.Count, HUDLayoutSettings.ChatBoxArea.Height - chatBox.ToggleButton.Rect.Height), guiFrame.RectTransform))
|
||||
new Point((HUDLayoutSettings.ChatBoxArea.Height - chatBox.ToggleButton.Rect.Height - (int)((reports.Count - 1) * 5 * GUI.Scale)) / reports.Count, HUDLayoutSettings.ChatBoxArea.Height - chatBox.ToggleButton.Rect.Height), guiFrame.RectTransform))
|
||||
{
|
||||
AbsoluteSpacing = (int)(5 * GUI.Scale),
|
||||
UserData = "reportbuttons",
|
||||
@@ -1604,13 +1604,8 @@ namespace Barotrauma
|
||||
|
||||
private void CreateOrderCategoryNodes()
|
||||
{
|
||||
var points = shortcutCenterNode != null ?
|
||||
GetCircumferencePointCount(availableCategories.Count) :
|
||||
availableCategories.Count;
|
||||
var firstAngle = shortcutCenterNode != null ?
|
||||
GetFirstNodeAngle(availableCategories.Count) :
|
||||
0.0f;
|
||||
var offsets = MathUtils.GetPointsOnCircumference(Vector2.Zero, nodeDistance, points, firstAngle);
|
||||
// TODO: Calculate firstAngle parameter based on category count
|
||||
var offsets = MathUtils.GetPointsOnCircumference(Vector2.Zero, nodeDistance, availableCategories.Count, MathHelper.ToRadians(225));
|
||||
var offsetIndex = 0;
|
||||
availableCategories.ForEach(oc => CreateOrderCategoryNode(oc, offsets[offsetIndex++].ToPoint(), offsetIndex));
|
||||
}
|
||||
@@ -2396,7 +2391,7 @@ namespace Barotrauma
|
||||
var reportButtonParent = ChatBox ?? GameMain.Client?.ChatBox;
|
||||
if (reportButtonParent == null) { return; }
|
||||
|
||||
ReportButtonFrame.RectTransform.AbsoluteOffset = new Point(reportButtonParent.GUIFrame.Rect.Right + (int)(10 * GUI.Scale), reportButtonParent.GUIFrame.Rect.Y - reportButtonParent.ToggleButton.Rect.Height);
|
||||
ReportButtonFrame.RectTransform.AbsoluteOffset = new Point(reportButtonParent.GUIFrame.Rect.Right + (int)(10 * GUI.Scale), reportButtonParent.GUIFrame.Rect.Y);
|
||||
|
||||
bool hasFires = Character.Controlled.CurrentHull.FireSources.Count > 0;
|
||||
ToggleReportButton("reportfire", hasFires);
|
||||
@@ -2445,15 +2440,22 @@ namespace Barotrauma
|
||||
{
|
||||
Character character;
|
||||
character = Character.Create(characterInfos[i], waypoints[i].WorldPosition, characterInfos[i].Name);
|
||||
if (character.Info != null && !character.Info.StartItemsGiven)
|
||||
{
|
||||
character.GiveJobItems(waypoints[i]);
|
||||
character.Info.StartItemsGiven = true;
|
||||
}
|
||||
|
||||
if (character.Info?.InventoryData != null)
|
||||
if (character.Info != null)
|
||||
{
|
||||
character.Info.SpawnInventoryItems(character.Inventory, character.Info.InventoryData);
|
||||
if (!character.Info.StartItemsGiven && character.Info.InventoryData != null)
|
||||
{
|
||||
DebugConsole.ThrowError($"Error when initializing a single player round: character \"{character.Name}\" has not been given their initial items but has saved inventory data. Using the saved inventory data instead of giving the character new items.");
|
||||
}
|
||||
if (character.Info.InventoryData != null)
|
||||
{
|
||||
character.Info.SpawnInventoryItems(character.Inventory, character.Info.InventoryData);
|
||||
}
|
||||
else if (!character.Info.StartItemsGiven)
|
||||
{
|
||||
character.GiveJobItems(waypoints[i]);
|
||||
}
|
||||
character.Info.StartItemsGiven = true;
|
||||
}
|
||||
|
||||
AddCharacter(character);
|
||||
|
||||
+2
-1
@@ -366,7 +366,8 @@ namespace Barotrauma.Tutorials
|
||||
{
|
||||
if (CharacterHealth.OpenHealthWindow != null && doctor.AnimController.Anim != AnimController.Animation.CPR)
|
||||
{
|
||||
CharacterHealth.OpenHealthWindow.CPRButton.Pulsate(Vector2.One, Vector2.One * 1.5f, 1.0f);
|
||||
//Disabled pulse until it's replaced by a better effect
|
||||
//CharacterHealth.OpenHealthWindow.CPRButton.Pulsate(Vector2.One, Vector2.One * 1.5f, 1.0f);
|
||||
CharacterHealth.OpenHealthWindow.CPRButton.Flash();
|
||||
}
|
||||
yield return null;
|
||||
|
||||
+12
@@ -97,6 +97,18 @@ namespace Barotrauma.Tutorials
|
||||
stunbaton.Unequip(officer);
|
||||
officer.Inventory.RemoveItem(stunbaton);
|
||||
|
||||
var smg = FindOrGiveItem(officer, "smg");
|
||||
smg.Unequip(officer);
|
||||
officer.Inventory.RemoveItem(smg);
|
||||
|
||||
var divingknife = FindOrGiveItem(officer, "divingknife");
|
||||
divingknife.Unequip(officer);
|
||||
officer.Inventory.RemoveItem(divingknife);
|
||||
|
||||
var steroids = FindOrGiveItem(officer, "steroids");
|
||||
steroids.Unequip(officer);
|
||||
officer.Inventory.RemoveItem(steroids);
|
||||
|
||||
var ballistichelmet =
|
||||
officer.Inventory.FindItemByIdentifier("ballistichelmet1") ??
|
||||
officer.Inventory.FindItemByIdentifier("ballistichelmet2") ??
|
||||
|
||||
@@ -41,7 +41,9 @@ namespace Barotrauma
|
||||
private Point screenResolution;
|
||||
|
||||
public Vector2[] SlotPositions;
|
||||
|
||||
public static Point SlotSize;
|
||||
public static int Spacing;
|
||||
|
||||
private Layout layout;
|
||||
public Layout CurrentLayout
|
||||
{
|
||||
@@ -245,20 +247,18 @@ namespace Barotrauma
|
||||
}
|
||||
private void SetSlotPositions(Layout layout)
|
||||
{
|
||||
int spacing;
|
||||
|
||||
bool isFourByThree = GUI.IsFourByThree();
|
||||
if (isFourByThree)
|
||||
{
|
||||
spacing = (int)(5 * UIScale);
|
||||
Spacing = (int)(5 * UIScale);
|
||||
}
|
||||
else
|
||||
{
|
||||
spacing = (int)(10 * UIScale);
|
||||
Spacing = (int)(8 * UIScale);
|
||||
}
|
||||
|
||||
Point slotSize = !isFourByThree ? (SlotSpriteSmall.size * UIScale).ToPoint() : (SlotSpriteSmall.size * UIScale * .925f).ToPoint();
|
||||
int bottomOffset = slotSize.Y + spacing * 2 + ContainedIndicatorHeight;
|
||||
SlotSize = !isFourByThree ? (SlotSpriteSmall.size * UIScale).ToPoint() : (SlotSpriteSmall.size * UIScale * .925f).ToPoint();
|
||||
int bottomOffset = SlotSize.Y + Spacing * 2 + ContainedIndicatorHeight;
|
||||
|
||||
if (slots == null) { CreateSlots(); }
|
||||
|
||||
@@ -271,11 +271,12 @@ namespace Barotrauma
|
||||
int personalSlotCount = SlotTypes.Count(s => PersonalSlots.HasFlag(s));
|
||||
int normalSlotCount = SlotTypes.Count(s => !PersonalSlots.HasFlag(s));
|
||||
|
||||
int x = GameMain.GraphicsWidth / 2 - normalSlotCount * (slotSize.X + spacing) / 2;
|
||||
int upperX = GameMain.GraphicsWidth - slotSize.X * 2;
|
||||
int x = GameMain.GraphicsWidth / 2 - normalSlotCount * (SlotSize.X + Spacing) / 2;
|
||||
int upperX = HUDLayoutSettings.BottomRightInfoArea.X - Spacing * 2 - SlotSize.X - SlotSize.X / 2;
|
||||
//int upperX = GameMain.GraphicsWidth - personalSlotCount * (slotSize.X + spacing) + (int)(11 * GUI.Scale) + spacing;
|
||||
|
||||
//make sure the rightmost normal slot doesn't overlap with the personal slots
|
||||
x -= Math.Max((x + normalSlotCount * (slotSize.X + spacing)) - (upperX - personalSlotCount * (slotSize.X + spacing)), 0);
|
||||
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++)
|
||||
@@ -283,26 +284,26 @@ namespace Barotrauma
|
||||
if (PersonalSlots.HasFlag(SlotTypes[i]))
|
||||
{
|
||||
SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset);
|
||||
upperX -= slotSize.X + spacing;
|
||||
upperX -= SlotSize.X + Spacing;
|
||||
personalSlotArea = (hideButtonSlotIndex == -1) ?
|
||||
new Rectangle(SlotPositions[i].ToPoint(), slotSize) :
|
||||
Rectangle.Union(personalSlotArea, new Rectangle(SlotPositions[i].ToPoint(), slotSize));
|
||||
new Rectangle(SlotPositions[i].ToPoint(), SlotSize) :
|
||||
Rectangle.Union(personalSlotArea, new Rectangle(SlotPositions[i].ToPoint(), SlotSize));
|
||||
hideButtonSlotIndex = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
SlotPositions[i] = new Vector2(x, GameMain.GraphicsHeight - bottomOffset);
|
||||
x += slotSize.X + spacing;
|
||||
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.NonScaledSize = new Point(SlotSize.X / 2, HUDLayoutSettings.BottomRightInfoArea.Height);
|
||||
hideButton.RectTransform.AbsoluteOffset = new Point(
|
||||
personalSlotArea.Right + spacing,
|
||||
personalSlotArea.Y - slots[hideButtonSlotIndex].EquipButtonRect.Height);
|
||||
personalSlotArea.Right + Spacing,
|
||||
HUDLayoutSettings.BottomRightInfoArea.Y);
|
||||
hideButton.Visible = true;
|
||||
}
|
||||
}
|
||||
@@ -311,7 +312,7 @@ namespace Barotrauma
|
||||
{
|
||||
int extraOffset = 0;
|
||||
int x = HUDLayoutSettings.InventoryAreaLower.Right;
|
||||
int personalSlotX = HUDLayoutSettings.InventoryAreaLower.Right - slotSize.X - spacing;
|
||||
int personalSlotX = HUDLayoutSettings.InventoryAreaLower.Right - SlotSize.X - Spacing;
|
||||
for (int i = 0; i < slots.Length; i++)
|
||||
{
|
||||
if (HideSlot(i)) continue;
|
||||
@@ -321,7 +322,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
x -= slotSize.X + spacing;
|
||||
x -= SlotSize.X + Spacing;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,13 +332,13 @@ namespace Barotrauma
|
||||
if (HideSlot(i)) continue;
|
||||
if (PersonalSlots.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(personalSlotX, GameMain.GraphicsHeight - bottomOffset * 2 - extraOffset - Spacing * 2);
|
||||
personalSlotX -= slots[i].Rect.Width + Spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
SlotPositions[i] = new Vector2(x, GameMain.GraphicsHeight - bottomOffset - extraOffset);
|
||||
x += slots[i].Rect.Width + spacing;
|
||||
x += slots[i].Rect.Width + Spacing;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,7 +346,7 @@ namespace Barotrauma
|
||||
for (int i = 0; i < SlotPositions.Length; i++)
|
||||
{
|
||||
if (!HideSlot(i)) continue;
|
||||
x -= slots[i].Rect.Width + spacing;
|
||||
x -= slots[i].Rect.Width + Spacing;
|
||||
SlotPositions[i] = new Vector2(x, GameMain.GraphicsHeight - bottomOffset - extraOffset);
|
||||
}
|
||||
}
|
||||
@@ -359,28 +360,28 @@ namespace Barotrauma
|
||||
if (HideSlot(i)) continue;
|
||||
if (PersonalSlots.HasFlag(SlotTypes[i]))
|
||||
{
|
||||
SlotPositions[i] = new Vector2(personalSlotX, GameMain.GraphicsHeight - bottomOffset * 2 - spacing * 2);
|
||||
personalSlotX += slots[i].Rect.Width + spacing;
|
||||
SlotPositions[i] = new Vector2(personalSlotX, GameMain.GraphicsHeight - bottomOffset * 2 - Spacing * 2);
|
||||
personalSlotX += slots[i].Rect.Width + Spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
SlotPositions[i] = new Vector2(x, GameMain.GraphicsHeight - bottomOffset);
|
||||
x += slots[i].Rect.Width + spacing;
|
||||
x += slots[i].Rect.Width + Spacing;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < SlotPositions.Length; i++)
|
||||
{
|
||||
if (!HideSlot(i)) continue;
|
||||
SlotPositions[i] = new Vector2(x, GameMain.GraphicsHeight - bottomOffset);
|
||||
x += slots[i].Rect.Width + spacing;
|
||||
x += slots[i].Rect.Width + Spacing;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Layout.Center:
|
||||
{
|
||||
int columns = 5;
|
||||
int startX = (GameMain.GraphicsWidth / 2) - (slotSize.X * columns + spacing * (columns - 1)) / 2;
|
||||
int startY = GameMain.GraphicsHeight / 2 - (slotSize.Y * 2);
|
||||
int startX = (GameMain.GraphicsWidth / 2) - (SlotSize.X * columns + Spacing * (columns - 1)) / 2;
|
||||
int startY = GameMain.GraphicsHeight / 2 - (SlotSize.Y * 2);
|
||||
int x = startX, y = startY;
|
||||
for (int i = 0; i < SlotPositions.Length; i++)
|
||||
{
|
||||
@@ -388,10 +389,10 @@ namespace Barotrauma
|
||||
if (SlotTypes[i] == InvSlotType.Card || SlotTypes[i] == InvSlotType.Headset || SlotTypes[i] == InvSlotType.InnerClothes)
|
||||
{
|
||||
SlotPositions[i] = new Vector2(x, y);
|
||||
x += slots[i].Rect.Width + spacing;
|
||||
x += slots[i].Rect.Width + Spacing;
|
||||
}
|
||||
}
|
||||
y += slots[0].Rect.Height + spacing + ContainedIndicatorHeight + slots[0].EquipButtonRect.Height;
|
||||
y += slots[0].Rect.Height + Spacing + ContainedIndicatorHeight + slots[0].EquipButtonRect.Height;
|
||||
x = startX;
|
||||
int n = 0;
|
||||
for (int i = 0; i < SlotPositions.Length; i++)
|
||||
@@ -400,12 +401,12 @@ namespace Barotrauma
|
||||
if (SlotTypes[i] != InvSlotType.Card && SlotTypes[i] != InvSlotType.Headset && SlotTypes[i] != InvSlotType.InnerClothes)
|
||||
{
|
||||
SlotPositions[i] = new Vector2(x, y);
|
||||
x += slots[i].Rect.Width + spacing;
|
||||
x += slots[i].Rect.Width + Spacing;
|
||||
n++;
|
||||
if (n >= columns)
|
||||
{
|
||||
x = startX;
|
||||
y += slots[i].Rect.Height + spacing + ContainedIndicatorHeight + slots[i].EquipButtonRect.Height;
|
||||
y += slots[i].Rect.Height + Spacing + ContainedIndicatorHeight + slots[i].EquipButtonRect.Height;
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Barotrauma.Items.Components
|
||||
//left column
|
||||
//----------------------------------------------------------
|
||||
|
||||
GUIFrame inventoryWindow = new GUIFrame(new RectTransform(new Vector2(0.1f, 0.5f), GuiFrame.RectTransform, Anchor.TopLeft, Pivot.TopRight)
|
||||
GUIFrame inventoryWindow = new GUIFrame(new RectTransform(new Vector2(0.1f, 0.75f), GuiFrame.RectTransform, Anchor.TopLeft, Pivot.TopRight)
|
||||
{
|
||||
MinSize = new Point(85, 220),
|
||||
RelativeOffset = new Vector2(-0.02f, 0)
|
||||
@@ -112,8 +112,8 @@ namespace Barotrauma.Items.Components
|
||||
Stretch = true
|
||||
};
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), inventoryContent.RectTransform), "",
|
||||
textAlignment: Alignment.Center, font: GUI.SubHeadingFont, wrap: true);
|
||||
/*new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), inventoryContent.RectTransform), "",
|
||||
textAlignment: Alignment.Center, font: GUI.SubHeadingFont, wrap: true);*/
|
||||
inventoryContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.9f), inventoryContent.RectTransform), style: null);
|
||||
|
||||
//----------------------------------------------------------
|
||||
@@ -381,16 +381,17 @@ namespace Barotrauma.Items.Components
|
||||
var itemContainer = item.GetComponent<ItemContainer>();
|
||||
if (itemContainer != null)
|
||||
{
|
||||
itemContainer.UILabel = "";
|
||||
itemContainer.AllowUIOverlap = true;
|
||||
itemContainer.Inventory.RectTransform = inventoryContainer.RectTransform;
|
||||
var inventoryLabel = inventoryContainer.Parent?.GetChild<GUITextBlock>();
|
||||
/*var inventoryLabel = inventoryContainer.Parent?.GetChild<GUITextBlock>();
|
||||
if (inventoryLabel != null)
|
||||
{
|
||||
inventoryLabel.RectTransform.MinSize = new Point(100, 0);
|
||||
inventoryLabel.Text = itemContainer.GetUILabel();
|
||||
inventoryLabel.CalculateHeightFromText();
|
||||
(inventoryLabel.Parent as GUILayoutGroup).Recalculate();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -663,7 +663,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (Vector2.DistanceSquared(PlayerInput.MousePosition, steerArea.Rect.Center.ToVector2()) < steerRadius * steerRadius)
|
||||
{
|
||||
if (PlayerInput.PrimaryMouseButtonHeld())
|
||||
if (PlayerInput.PrimaryMouseButtonHeld() && !CrewManager.IsCommandInterfaceOpen)
|
||||
{
|
||||
Vector2 displaySubPos = (-sonar.DisplayOffset * sonar.Zoom) / sonar.Range * sonar.DisplayRadius * sonar.Zoom;
|
||||
displaySubPos.Y = -displaySubPos.Y;
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Barotrauma
|
||||
|
||||
float sizeY = Inventory.UnequippedIndicator.size.Y * Inventory.UIScale * Inventory.IndicatorScaleAdjustment;
|
||||
|
||||
Vector2 equipIndicatorPos = new Vector2(Rect.Left, Rect.Center.Y + (Rect.Height / 2 + 25 * Inventory.UIScale) * buttonDir - sizeY / 2f);
|
||||
Vector2 equipIndicatorPos = new Vector2(Rect.Left, Rect.Center.Y + (Rect.Height / 2 + 15 * Inventory.UIScale) * buttonDir - sizeY / 2f);
|
||||
equipIndicatorPos += DrawOffset;
|
||||
|
||||
return new Rectangle((int)equipIndicatorPos.X, (int)equipIndicatorPos.Y, (int)Rect.Width, (int)sizeY);
|
||||
@@ -141,7 +141,7 @@ namespace Barotrauma
|
||||
//TODO: define this in xml
|
||||
slotSpriteSmall = new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(10, 6, 119, 120), null, 0);
|
||||
// Adjustment to match the old size of 75,71
|
||||
SlotSpriteSmall.size = new Vector2(SlotSpriteSmall.SourceRect.Width * 0.625f, SlotSpriteSmall.SourceRect.Height * 0.625f);
|
||||
SlotSpriteSmall.size = new Vector2(SlotSpriteSmall.SourceRect.Width * 0.575f, SlotSpriteSmall.SourceRect.Height * 0.575f);
|
||||
}
|
||||
return slotSpriteSmall;
|
||||
}
|
||||
@@ -152,7 +152,7 @@ namespace Barotrauma
|
||||
{
|
||||
get
|
||||
{
|
||||
return !GUI.IsFourByThree() ? 0.85f : 0.75f;
|
||||
return !GUI.IsFourByThree() ? 0.8f : 0.7f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,10 +773,10 @@ namespace Barotrauma
|
||||
|
||||
if (selInv != null)
|
||||
{
|
||||
foreach (var slot in selInv.slots)
|
||||
for (int i = 0; i < selInv.slots.Length; i++)
|
||||
{
|
||||
if (slot.InteractRect.Contains(PlayerInput.MousePosition) ||
|
||||
slot.EquipButtonRect.Contains(PlayerInput.MousePosition))
|
||||
InventorySlot slot = selInv.slots[i];
|
||||
if (slot.InteractRect.Contains(PlayerInput.MousePosition) || (slot.EquipButtonRect.Contains(PlayerInput.MousePosition) && selInv.Items[i].AllowedSlots.Any(a => a == InvSlotType.Any)))
|
||||
{
|
||||
return CursorState.Hand;
|
||||
}
|
||||
@@ -801,9 +801,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var slot in inv.slots)
|
||||
for (int i = 0; i < inv.slots.Length; i++)
|
||||
{
|
||||
if (slot.EquipButtonRect.Contains(PlayerInput.MousePosition))
|
||||
InventorySlot slot = inv.slots[i];
|
||||
if (slot.EquipButtonRect.Contains(PlayerInput.MousePosition) && inv.Items[i].AllowedSlots.Any(a => a == InvSlotType.Any))
|
||||
{
|
||||
return CursorState.Hand;
|
||||
}
|
||||
|
||||
@@ -60,8 +60,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
private bool connected;
|
||||
|
||||
private bool roundInitialized;
|
||||
|
||||
private byte myID;
|
||||
|
||||
private List<Client> otherClients;
|
||||
@@ -150,8 +148,6 @@ namespace Barotrauma.Networking
|
||||
this.ownerKey = ownerKey;
|
||||
this.steamP2POwner = steamP2POwner;
|
||||
|
||||
roundInitialized = false;
|
||||
|
||||
allowReconnect = true;
|
||||
|
||||
netStats = new NetStats();
|
||||
@@ -467,10 +463,10 @@ namespace Barotrauma.Networking
|
||||
string pwMsg = TextManager.Get("PasswordRequired");
|
||||
|
||||
var msgBox = new GUIMessageBox(pwMsg, "", new string[] { TextManager.Get("OK"), TextManager.Get("Cancel") },
|
||||
relativeSize: new Vector2(0.25f, 0.2f), minSize: new Point(400, 150));
|
||||
var passwordBox = new GUITextBox(new RectTransform(new Vector2(0.8f, 0.1f), msgBox.InnerFrame.RectTransform, Anchor.Center) { MinSize = new Point(0, 20) })
|
||||
relativeSize: new Vector2(0.25f, 0.1f), minSize: new Point(400, 170));
|
||||
var passwordHolder = new GUILayoutGroup(new RectTransform(Vector2.One, msgBox.Content.RectTransform), childAnchor: Anchor.TopCenter);
|
||||
var passwordBox = new GUITextBox(new RectTransform(new Vector2(0.8f, 1f) , passwordHolder.RectTransform) { MinSize = new Point(0, 20) })
|
||||
{
|
||||
IgnoreLayoutGroups = true,
|
||||
UserData = "password",
|
||||
Censor = true
|
||||
};
|
||||
@@ -712,9 +708,6 @@ namespace Barotrauma.Networking
|
||||
case ServerPacketHeader.STARTGAME:
|
||||
startGameCoroutine = GameMain.Instance.ShowLoading(StartGame(inc), false);
|
||||
break;
|
||||
case ServerPacketHeader.STARTGAMEFINALIZE:
|
||||
ReadStartGameFinalize(inc);
|
||||
break;
|
||||
case ServerPacketHeader.ENDGAME:
|
||||
string endMessage = inc.ReadString();
|
||||
bool missionSuccessful = inc.ReadBoolean();
|
||||
@@ -774,26 +767,7 @@ namespace Barotrauma.Networking
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadStartGameFinalize(IReadMessage inc)
|
||||
{
|
||||
int levelEqualityCheckVal = inc.ReadInt32();
|
||||
|
||||
if (Level.Loaded.EqualityCheckVal != levelEqualityCheckVal)
|
||||
{
|
||||
string errorMsg = "Level equality check failed. The level generated at your end doesn't match the level generated by the server (seed: " + Level.Loaded.Seed +
|
||||
", sub: " + Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash.ShortHash + ")" +
|
||||
", mirrored: " + Level.Loaded.Mirrored + ").";
|
||||
GameAnalyticsManager.AddErrorEventOnce("GameClient.StartGame:LevelsDontMatch" + Level.Loaded.Seed, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
GameMain.GameSession.Mission?.ClientReadInitial(inc);
|
||||
|
||||
roundInitialized = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OnDisconnect()
|
||||
{
|
||||
if (SteamManager.IsInitialized)
|
||||
@@ -902,7 +876,6 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
else
|
||||
{
|
||||
connected = false;
|
||||
connectCancelled = true;
|
||||
|
||||
string msg = "";
|
||||
@@ -1145,11 +1118,9 @@ namespace Barotrauma.Networking
|
||||
|
||||
EndVoteTickBox.Selected = false;
|
||||
|
||||
roundInitialized = false;
|
||||
|
||||
int seed = inc.ReadInt32();
|
||||
string levelSeed = inc.ReadString();
|
||||
//int levelEqualityCheckVal = inc.ReadInt32();
|
||||
int levelEqualityCheckVal = inc.ReadInt32();
|
||||
float levelDifficulty = inc.ReadSingle();
|
||||
|
||||
byte losMode = inc.ReadByte();
|
||||
@@ -1185,8 +1156,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
serverSettings.ReadMonsterEnabled(inc);
|
||||
|
||||
bool includesFinalize = inc.ReadBoolean(); inc.ReadPadBits();
|
||||
|
||||
GameModePreset gameMode = GameModePreset.List.Find(gm => gm.Identifier == modeIdentifier);
|
||||
MultiPlayerCampaign campaign =
|
||||
GameMain.NetLobbyScreen.SelectedMode == GameMain.GameSession?.GameMode.Preset && gameMode == GameMain.NetLobbyScreen.SelectedMode ?
|
||||
@@ -1274,44 +1243,7 @@ namespace Barotrauma.Networking
|
||||
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
||||
}
|
||||
|
||||
if (includesFinalize)
|
||||
{
|
||||
ReadStartGameFinalize(inc);
|
||||
}
|
||||
|
||||
//wait for up to 30 seconds for the server to send the STARTGAMEFINALIZE message
|
||||
DateTime timeOut = DateTime.Now + new TimeSpan(0, 0, seconds: 30);
|
||||
while (DateTime.Now < timeOut)
|
||||
{
|
||||
if (!connected)
|
||||
{
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
if (roundInitialized)
|
||||
{
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
clientPeer?.Update((float)Timing.Step);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("There was an error initializing the round.", e, true);
|
||||
roundInitialized = false;
|
||||
break;
|
||||
}
|
||||
|
||||
//waiting for a STARTGAMEFINALIZE message
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
if (!roundInitialized)
|
||||
{
|
||||
DebugConsole.ThrowError("Error while starting the round (did not receive STARTROUNDFINALIZE message from the server). Stopping the round...");
|
||||
CoroutineManager.StartCoroutine(EndGame(""));
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
GameMain.GameSession.Mission?.ClientReadInitial(inc);
|
||||
|
||||
if (GameMain.GameSession.Submarine.IsFileCorrupted)
|
||||
{
|
||||
@@ -1331,12 +1263,23 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
if (Level.Loaded.EqualityCheckVal != levelEqualityCheckVal)
|
||||
{
|
||||
string errorMsg = "Level equality check failed. The level generated at your end doesn't match the level generated by the server (seed: " + Level.Loaded.Seed +
|
||||
", sub: " + Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash.ShortHash + ")" +
|
||||
", mirrored: " + Level.Loaded.Mirrored + ").";
|
||||
DebugConsole.ThrowError(errorMsg, createMessageBox: true);
|
||||
GameAnalyticsManager.AddErrorEventOnce("GameClient.StartGame:LevelsDontMatch" + levelSeed, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
CoroutineManager.StartCoroutine(EndGame(""));
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
|
||||
if (respawnAllowed) { respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.UsingShuttle ? GameMain.NetLobbyScreen.SelectedShuttle : null); }
|
||||
|
||||
GameMain.GameSession.EventManager.PreloadContent(contentToPreload);
|
||||
|
||||
gameStarted = true;
|
||||
ServerSettings.ServerDetailsChanged = true;
|
||||
gameStarted = true;
|
||||
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
@@ -1484,7 +1427,7 @@ namespace Barotrauma.Networking
|
||||
existingClient.Muted = tc.Muted;
|
||||
existingClient.AllowKicking = tc.AllowKicking;
|
||||
GameMain.NetLobbyScreen.SetPlayerNameAndJobPreference(existingClient);
|
||||
if (Screen.Selected != GameMain.NetLobbyScreen && tc.CharacterID > 0)
|
||||
if (tc.CharacterID > 0)
|
||||
{
|
||||
existingClient.Character = Entity.FindEntityByID(tc.CharacterID) as Character;
|
||||
if (existingClient.Character == null)
|
||||
|
||||
+2
-1
@@ -91,7 +91,6 @@ namespace Barotrauma.Networking
|
||||
return;
|
||||
}
|
||||
|
||||
incomingLidgrenMessages.Clear();
|
||||
netClient.ReadMessages(incomingLidgrenMessages);
|
||||
|
||||
foreach (NetIncomingMessage inc in incomingLidgrenMessages)
|
||||
@@ -108,6 +107,8 @@ namespace Barotrauma.Networking
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
incomingLidgrenMessages.Clear();
|
||||
}
|
||||
|
||||
private void HandleDataMessage(NetIncomingMessage inc)
|
||||
|
||||
@@ -107,6 +107,8 @@ namespace Barotrauma
|
||||
|
||||
//elements that can only be used by the host
|
||||
private readonly List<GUIComponent> clientDisabledElements = new List<GUIComponent>();
|
||||
//elements that can't be interacted with but don't look disabled
|
||||
private readonly List<GUITextBox> clientReadonlyElements = new List<GUITextBox>();
|
||||
//elements that aren't shown client-side
|
||||
private readonly List<GUIComponent> clientHiddenElements = new List<GUIComponent>();
|
||||
|
||||
@@ -704,9 +706,12 @@ namespace Barotrauma
|
||||
};
|
||||
ServerName.OnDeselected += (textBox, key) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Name);
|
||||
if (!textBox.Readonly)
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Name);
|
||||
}
|
||||
};
|
||||
clientDisabledElements.Add(ServerName);
|
||||
clientReadonlyElements.Add(ServerName);
|
||||
|
||||
SettingsButton = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), lobbyHeader.RectTransform, Anchor.TopRight),
|
||||
TextManager.Get("ServerSettingsButton"));
|
||||
@@ -755,9 +760,12 @@ namespace Barotrauma
|
||||
};
|
||||
ServerMessage.OnDeselected += (textBox, key) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Message);
|
||||
if (!textBox.Readonly)
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Message);
|
||||
}
|
||||
};
|
||||
clientDisabledElements.Add(ServerMessage);
|
||||
clientReadonlyElements.Add(ServerMessage);
|
||||
|
||||
//submarine list ------------------------------------------------------------------
|
||||
|
||||
@@ -1221,6 +1229,7 @@ namespace Barotrauma
|
||||
|
||||
//disable/hide elements the clients are not supposed to use/see
|
||||
clientDisabledElements.ForEach(c => c.Enabled = false);
|
||||
clientReadonlyElements.ForEach(c => c.Readonly = true);
|
||||
clientHiddenElements.ForEach(c => c.Visible = false);
|
||||
|
||||
UpdatePermissions();
|
||||
@@ -1268,8 +1277,8 @@ namespace Barotrauma
|
||||
|
||||
public void UpdatePermissions()
|
||||
{
|
||||
ServerName.Enabled = GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
ServerMessage.Enabled = GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
ServerName.Readonly = !GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
ServerMessage.Readonly = !GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
missionTypeList.Enabled = GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
foreach (var tickBox in missionTypeTickBoxes)
|
||||
{
|
||||
@@ -1288,8 +1297,8 @@ namespace Barotrauma
|
||||
SettingsButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
SettingsButton.OnClicked = GameMain.Client.ServerSettings.ToggleSettingsFrame;
|
||||
StartButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ManageRound) && !GameMain.Client.GameStarted && !campaignContainer.Visible;
|
||||
ServerName.Enabled = GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
ServerMessage.Enabled = GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
ServerName.Readonly = !GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
ServerMessage.Readonly = !GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
shuttleTickBox.Enabled = GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
SubList.Enabled = GameMain.Client.ServerSettings.Voting.AllowSubVoting || GameMain.Client.HasPermission(ClientPermissions.SelectSub);
|
||||
shuttleList.Enabled = GameMain.Client.HasPermission(ClientPermissions.SelectSub);
|
||||
@@ -1313,8 +1322,6 @@ namespace Barotrauma
|
||||
if (GameMain.Client == null) return;
|
||||
spectateButton.Visible = true;
|
||||
spectateButton.Enabled = true;
|
||||
|
||||
StartButton.Visible = false;
|
||||
}
|
||||
|
||||
public void SetCampaignCharacterInfo(CharacterInfo newCampaignCharacterInfo)
|
||||
|
||||
Reference in New Issue
Block a user