Unstable v0.9.707.0
This commit is contained in:
@@ -535,6 +535,17 @@ namespace Barotrauma
|
||||
return closestCharacter;
|
||||
}
|
||||
|
||||
public bool ShouldLockHud()
|
||||
{
|
||||
if (this != controlled) { return false; }
|
||||
|
||||
//lock if using a controller, except if we're also using a connection panel in the same item
|
||||
return
|
||||
SelectedConstruction != null &&
|
||||
SelectedConstruction?.GetComponent<Controller>()?.User == this &&
|
||||
SelectedConstruction?.GetComponent<ConnectionPanel>()?.User != this;
|
||||
}
|
||||
|
||||
|
||||
partial void UpdateProjSpecific(float deltaTime, Camera cam)
|
||||
{
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Barotrauma
|
||||
|
||||
if (!character.IsUnconscious && character.Stun <= 0.0f)
|
||||
{
|
||||
if (character.Info != null)
|
||||
if (character.Info != null && !character.ShouldLockHud())
|
||||
{
|
||||
bool mouseOnPortrait = HUDLayoutSettings.PortraitArea.Contains(PlayerInput.MousePosition) && GUI.MouseOn == null;
|
||||
if (mouseOnPortrait && PlayerInput.PrimaryMouseButtonClicked())
|
||||
@@ -170,11 +170,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (GUI.DisableHUD) { return; }
|
||||
|
||||
character.CharacterHealth.Alignment = Alignment.Right;
|
||||
/*if (Screen.Selected == GameMain.GameScreen)
|
||||
{
|
||||
GUI.InfoAreaBackground.Draw(spriteBatch, Vector2.Zero, scale: GUI.Scale);
|
||||
}*/
|
||||
character.CharacterHealth.Alignment = Alignment.Right;
|
||||
|
||||
if (GameMain.GameSession?.CrewManager != null)
|
||||
{
|
||||
@@ -309,7 +305,7 @@ namespace Barotrauma
|
||||
character.Info.DrawPortrait(spriteBatch, HUDLayoutSettings.PortraitArea.Location.ToVector2(), targetWidth: HUDLayoutSettings.PortraitArea.Width);
|
||||
character.Info.DrawJobIcon(spriteBatch);
|
||||
}
|
||||
mouseOnPortrait = HUDLayoutSettings.PortraitArea.Contains(PlayerInput.MousePosition);
|
||||
mouseOnPortrait = HUDLayoutSettings.PortraitArea.Contains(PlayerInput.MousePosition) && !character.ShouldLockHud();
|
||||
if (mouseOnPortrait)
|
||||
{
|
||||
GUI.UIGlow.Draw(spriteBatch, HUDLayoutSettings.PortraitArea, GUI.Style.Green * 0.5f);
|
||||
@@ -318,7 +314,7 @@ namespace Barotrauma
|
||||
if (ShouldDrawInventory(character))
|
||||
{
|
||||
character.Inventory.Locked = LockInventory(character);
|
||||
character.Inventory.DrawThis(spriteBatch);
|
||||
character.Inventory.DrawOwn(spriteBatch);
|
||||
character.Inventory.CurrentLayout = CharacterHealth.OpenHealthWindow == null && character.SelectedCharacter == null ?
|
||||
CharacterInventory.Layout.Default :
|
||||
CharacterInventory.Layout.Right;
|
||||
@@ -333,7 +329,7 @@ namespace Barotrauma
|
||||
{
|
||||
///character.Inventory.CurrentLayout = Alignment.Left;
|
||||
character.SelectedCharacter.Inventory.CurrentLayout = CharacterInventory.Layout.Left;
|
||||
character.SelectedCharacter.Inventory.DrawThis(spriteBatch);
|
||||
character.SelectedCharacter.Inventory.DrawOwn(spriteBatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -417,11 +413,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (character?.Inventory == null || !character.AllowInput || character.LockHands) { return true; }
|
||||
|
||||
//lock if using a controller, except if we're also using a connection panel in the same item
|
||||
return
|
||||
character.SelectedConstruction != null &&
|
||||
character.SelectedConstruction?.GetComponent<Controller>()?.User == character &&
|
||||
character.SelectedConstruction?.GetComponent<ConnectionPanel>()?.User != character;
|
||||
return character.ShouldLockHud();
|
||||
}
|
||||
|
||||
private static void DrawOrderIndicator(SpriteBatch spriteBatch, Camera cam, Character character, Order order, float iconAlpha = 1.0f)
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace Barotrauma
|
||||
};
|
||||
healthShadowSize = 1.0f;
|
||||
|
||||
healthInterfaceFrame = new GUIFrame(new RectTransform(new Vector2(0.85f * 1.1f, 0.66f * 0.85f * 1.1f), GUI.Canvas, anchor: Anchor.Center, scaleBasis: ScaleBasis.Smallest), style: "ItemUI");
|
||||
healthInterfaceFrame = new GUIFrame(new RectTransform(new Vector2(0.7f, 0.55f), GUI.Canvas, anchor: Anchor.Center, scaleBasis: ScaleBasis.Smallest), style: "ItemUI");
|
||||
|
||||
var healthInterfaceLayout = new GUILayoutGroup(new RectTransform(Vector2.One / 1.05f, healthInterfaceFrame.RectTransform, anchor: Anchor.Center), true);
|
||||
|
||||
@@ -331,16 +331,15 @@ namespace Barotrauma
|
||||
},
|
||||
(dt, component) =>
|
||||
{
|
||||
medUIExtraAnimState += dt * 10.0f;
|
||||
while (medUIExtraAnimState >= 16.0f)
|
||||
if (!GameMain.Instance.Paused)
|
||||
{
|
||||
medUIExtraAnimState -= 16.0f;
|
||||
medUIExtraAnimState = (medUIExtraAnimState + dt * 10.0f) % 16.0f;
|
||||
}
|
||||
});
|
||||
|
||||
GUILayoutGroup selectedLimbLayout = new GUILayoutGroup(new RectTransform(Vector2.One, rightSide.RectTransform));
|
||||
|
||||
selectedLimbText = new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.08f), selectedLimbLayout.RectTransform), "", font: GUI.LargeFont, textAlignment: Alignment.Center)
|
||||
selectedLimbText = new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.08f), selectedLimbLayout.RectTransform), "", font: GUI.SubHeadingFont, textAlignment: Alignment.Center)
|
||||
{
|
||||
AutoScaleHorizontal = true
|
||||
};
|
||||
@@ -454,11 +453,16 @@ namespace Barotrauma
|
||||
OnClicked = (button, userData) =>
|
||||
{
|
||||
Character selectedCharacter = Character.Controlled?.SelectedCharacter;
|
||||
if (selectedCharacter == null || (!selectedCharacter.IsUnconscious && selectedCharacter.Stun <= 0.0f)) return false;
|
||||
if (selectedCharacter == null || (!selectedCharacter.IsUnconscious && selectedCharacter.Stun <= 0.0f))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Character.Controlled.AnimController.Anim = (Character.Controlled.AnimController.Anim == AnimController.Animation.CPR) ?
|
||||
AnimController.Animation.None : AnimController.Animation.CPR;
|
||||
|
||||
button.Selected = Character.Controlled.AnimController.Anim == AnimController.Animation.CPR;
|
||||
|
||||
selectedCharacter.AnimController.ResetPullJoints();
|
||||
|
||||
if (GameMain.Client != null)
|
||||
@@ -468,6 +472,7 @@ namespace Barotrauma
|
||||
|
||||
return true;
|
||||
},
|
||||
ToolTip = TextManager.Get("doctor.cprobjective"),
|
||||
Visible = false
|
||||
};
|
||||
|
||||
@@ -540,12 +545,10 @@ namespace Barotrauma
|
||||
switch (alignment)
|
||||
{
|
||||
case Alignment.Left:
|
||||
healthInterfaceFrame.RectTransform.Anchor = Anchor.CenterLeft;
|
||||
healthInterfaceFrame.RectTransform.Pivot = Pivot.CenterLeft;
|
||||
healthInterfaceFrame.RectTransform.SetPosition(Anchor.CenterLeft);
|
||||
break;
|
||||
case Alignment.Right:
|
||||
healthInterfaceFrame.RectTransform.Anchor = Anchor.CenterRight;
|
||||
healthInterfaceFrame.RectTransform.Pivot = Pivot.CenterRight;
|
||||
healthInterfaceFrame.RectTransform.SetPosition(Anchor.CenterRight);
|
||||
break;
|
||||
}
|
||||
healthInterfaceFrame.RectTransform.RecalculateChildren(false);
|
||||
@@ -833,7 +836,7 @@ namespace Barotrauma
|
||||
|
||||
treatmentLayout.Recalculate();
|
||||
|
||||
lowSkillIndicator.Color = new Color(lowSkillIndicator.Color, MathHelper.Lerp(0.1f, 1.0f, (float)(Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) / 2.0f));
|
||||
lowSkillIndicator.Color = new Color(lowSkillIndicator.Color, MathHelper.Lerp(0.5f, 1.0f, (float)(Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) / 2.0f));
|
||||
|
||||
if (Inventory.draggingItem != null)
|
||||
{
|
||||
@@ -868,8 +871,8 @@ namespace Barotrauma
|
||||
|
||||
Rectangle hoverArea = Rectangle.Union(HUDLayoutSettings.AfflictionAreaLeft, HUDLayoutSettings.HealthBarAreaLeft);
|
||||
|
||||
if (Character.AllowInput && UseHealthWindow &&
|
||||
Character.SelectedConstruction?.GetComponent<Controller>()?.User != Character &&
|
||||
healthBar.CanBeFocused = healthBarShadow.CanBeFocused = !Character.ShouldLockHud();
|
||||
if (Character.AllowInput && UseHealthWindow && healthBar.Enabled && healthBar.CanBeFocused &&
|
||||
hoverArea.Contains(PlayerInput.MousePosition) && Inventory.SelectedSlot == null)
|
||||
{
|
||||
healthBar.State = GUIComponent.ComponentState.Hover;
|
||||
@@ -983,7 +986,7 @@ namespace Barotrauma
|
||||
AfflictionPrefab afflictionPrefab = affliction.Prefab;
|
||||
|
||||
Rectangle afflictionIconRect = new Rectangle(pos, new Point(iconSize));
|
||||
if (afflictionIconRect.Contains(PlayerInput.MousePosition))
|
||||
if (afflictionIconRect.Contains(PlayerInput.MousePosition) && !Character.ShouldLockHud())
|
||||
{
|
||||
highlightedIcon = statusIcon;
|
||||
highlightedIconPos = afflictionIconRect.Center.ToVector2();
|
||||
@@ -1023,7 +1026,7 @@ namespace Barotrauma
|
||||
if (highlightedIcon != null)
|
||||
{
|
||||
GUI.DrawString(spriteBatch,
|
||||
alignment == Alignment.Left ? highlightedIconPos + new Vector2(60 * GUI.Scale, 5) : highlightedIconPos + new Vector2(-iconSize / 2, iconSize / 2),
|
||||
alignment == Alignment.Left ? highlightedIconPos + new Vector2(60 * GUI.Scale, 5) : highlightedIconPos + new Vector2(iconSize * 0.4f, 0.0f),
|
||||
highlightedIcon.Second,
|
||||
Color.White * 0.8f, Color.Black * 0.5f);
|
||||
}
|
||||
@@ -1127,6 +1130,7 @@ namespace Barotrauma
|
||||
{
|
||||
var child = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.25f), afflictionIconContainer.Content.RectTransform, Anchor.TopCenter))
|
||||
{
|
||||
Stretch = true,
|
||||
UserData = affliction
|
||||
};
|
||||
|
||||
@@ -1145,7 +1149,7 @@ namespace Barotrauma
|
||||
buttonToSelect = button;
|
||||
}
|
||||
|
||||
var afflictionIcon = new GUIImage(new RectTransform(Vector2.One * 0.9f, button.RectTransform, Anchor.Center), affliction.Prefab.Icon, scaleToFit: true)
|
||||
var afflictionIcon = new GUIImage(new RectTransform(Vector2.One * 0.8f, button.RectTransform, Anchor.Center), affliction.Prefab.Icon, scaleToFit: true)
|
||||
{
|
||||
Color = GetAfflictionIconColor(affliction.Prefab, affliction),
|
||||
CanBeFocused = false
|
||||
@@ -1166,7 +1170,11 @@ namespace Barotrauma
|
||||
afflictionEffectColor = GUI.Style.Green;
|
||||
}
|
||||
|
||||
new GUIProgressBar(new RectTransform(new Vector2(1.0f, 0.1f), child.RectTransform), 0.0f, afflictionEffectColor, style: "CharacterHealthBar")
|
||||
var nameText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), child.RectTransform),
|
||||
affliction.Prefab.Name, font: GUI.SmallFont, textAlignment: Alignment.Center, style: "GUIToolTip");
|
||||
nameText.Text = ToolBox.LimitString(nameText.Text, nameText.Font, nameText.Rect.Width);
|
||||
|
||||
new GUIProgressBar(new RectTransform(new Vector2(1.0f, 0.1f), child.RectTransform), 0.0f, afflictionEffectColor, style: "GUIAfflictionBar")
|
||||
{
|
||||
UserData = "afflictionstrength"
|
||||
};
|
||||
@@ -1240,14 +1248,14 @@ namespace Barotrauma
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
var afflictionStrength = new GUITextBlock(new RectTransform(new Vector2(0.35f, 0.6f), labelContainer.RectTransform), "", textAlignment: Alignment.TopRight, font: GUI.LargeFont)
|
||||
var afflictionStrength = new GUITextBlock(new RectTransform(new Vector2(0.35f, 0.6f), labelContainer.RectTransform), "", textAlignment: Alignment.TopRight, font: GUI.SubHeadingFont)
|
||||
{
|
||||
Padding = Vector4.Zero,
|
||||
UserData = "strength",
|
||||
CanBeFocused = false
|
||||
};
|
||||
var vitality = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), labelContainer.RectTransform, Anchor.BottomRight), "", textAlignment: Alignment.BottomRight)
|
||||
{
|
||||
Padding = afflictionStrength.Padding,
|
||||
IgnoreLayoutGroups = true,
|
||||
UserData = "vitality",
|
||||
CanBeFocused = false
|
||||
@@ -1557,7 +1565,10 @@ namespace Barotrauma
|
||||
|
||||
private void UpdateLimbIndicators(float deltaTime, Rectangle drawArea)
|
||||
{
|
||||
limbIndicatorOverlayAnimState += deltaTime * 8.0f;
|
||||
if (!GameMain.Instance.Paused)
|
||||
{
|
||||
limbIndicatorOverlayAnimState += deltaTime * 8.0f;
|
||||
}
|
||||
|
||||
highlightedLimbIndex = -1;
|
||||
int i = 0;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Barotrauma
|
||||
{
|
||||
public GUIButton CreateInfoFrame(int variant)
|
||||
{
|
||||
int width = 500, height = 450;
|
||||
int width = 500, height = 400;
|
||||
|
||||
GUIButton backFrame = new GUIButton(new RectTransform(Vector2.One, GUI.Canvas), style: "GUIBackgroundBlocker");
|
||||
GUIFrame frame = new GUIFrame(new RectTransform(new Point(width, height), backFrame.RectTransform, Anchor.Center));
|
||||
@@ -32,7 +32,7 @@ namespace Barotrauma
|
||||
font: GUI.SmallFont);
|
||||
}
|
||||
|
||||
if (!ItemIdentifiers.TryGetValue(variant, out var itemIdentifiers)) { return backFrame; }
|
||||
/*if (!ItemIdentifiers.TryGetValue(variant, out var itemIdentifiers)) { return backFrame; }
|
||||
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) })
|
||||
{
|
||||
@@ -47,7 +47,7 @@ namespace Barotrauma
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), itemContainer.RectTransform),
|
||||
" - " + (count == 1 ? itemPrefab.Name : itemPrefab.Name + " x" + count),
|
||||
font: GUI.SmallFont);
|
||||
}
|
||||
}*/
|
||||
|
||||
return backFrame;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user