Faction Test 100.4.0.0
This commit is contained in:
@@ -32,12 +32,6 @@ namespace Barotrauma
|
||||
|
||||
public static Sprite DamageOverlay => DamageOverlayPrefab.Prefabs.ActivePrefab.DamageOverlay;
|
||||
|
||||
private readonly static LocalizedString[] strengthTexts = new LocalizedString[]
|
||||
{
|
||||
TextManager.Get("AfflictionStrengthLow"),
|
||||
TextManager.Get("AfflictionStrengthMedium"),
|
||||
TextManager.Get("AfflictionStrengthHigh")
|
||||
};
|
||||
|
||||
private Point screenResolution;
|
||||
|
||||
@@ -89,11 +83,23 @@ namespace Barotrauma
|
||||
private int selectedLimbIndex = -1;
|
||||
private LimbHealth currentDisplayedLimb;
|
||||
|
||||
/// <summary>
|
||||
/// Container for the icons above the health bar
|
||||
/// </summary>
|
||||
private GUIComponent afflictionIconContainer;
|
||||
|
||||
private GUIButton showHiddenAfflictionsButton;
|
||||
|
||||
/// <summary>
|
||||
/// Container for passive afflictions that have been hidden from afflictionIconContainer
|
||||
/// </summary>
|
||||
private GUIComponent hiddenAfflictionIconContainer;
|
||||
|
||||
private GUIProgressBar healthWindowHealthBar;
|
||||
private GUIProgressBar healthWindowHealthBarShadow;
|
||||
|
||||
private GUITextBlock characterName;
|
||||
private GUIListBox afflictionIconContainer;
|
||||
private GUIListBox afflictionIconList;
|
||||
private GUILayoutGroup treatmentLayout;
|
||||
private GUIListBox recommendedTreatmentContainer;
|
||||
|
||||
@@ -331,7 +337,7 @@ namespace Barotrauma
|
||||
deadIndicator.AutoScaleHorizontal = true;
|
||||
}
|
||||
|
||||
afflictionIconContainer = new GUIListBox(new RectTransform(new Vector2(0.25f, 1.0f), characterIndicatorArea.RectTransform), style: null);
|
||||
afflictionIconList = new GUIListBox(new RectTransform(new Vector2(0.25f, 1.0f), characterIndicatorArea.RectTransform), style: null);
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), healthWindowVerticalLayout.RectTransform),
|
||||
TextManager.Get("SuitableTreatments"), font: GUIStyle.SubHeadingFont, textAlignment: Alignment.BottomCenter);
|
||||
@@ -379,6 +385,25 @@ namespace Barotrauma
|
||||
Enabled = true
|
||||
};
|
||||
|
||||
afflictionIconContainer = new GUILayoutGroup(
|
||||
HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.HealthBarAfflictionArea, GUI.Canvas),
|
||||
isHorizontal: true, childAnchor: Anchor.CenterRight)
|
||||
{
|
||||
AbsoluteSpacing = GUI.IntScale(5)
|
||||
};
|
||||
|
||||
showHiddenAfflictionsButton = new GUIButton(new RectTransform(new Point(afflictionIconContainer.Rect.Height), afflictionIconContainer.RectTransform), style: "GUIButtonCircular")
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
hiddenAfflictionIconContainer = new GUILayoutGroup(
|
||||
HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.HealthBarAfflictionArea, GUI.Canvas),
|
||||
isHorizontal: true, childAnchor: Anchor.CenterRight)
|
||||
{
|
||||
AbsoluteSpacing = GUI.IntScale(5)
|
||||
};
|
||||
|
||||
UpdateAlignment();
|
||||
|
||||
SuicideButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.02f), GUI.Canvas, Anchor.TopCenter)
|
||||
@@ -596,7 +621,7 @@ namespace Barotrauma
|
||||
|
||||
public void UpdateHUD(float deltaTime)
|
||||
{
|
||||
if (GUI.DisableHUD) return;
|
||||
if (GUI.DisableHUD) { return; }
|
||||
if (openHealthWindow != null)
|
||||
{
|
||||
if (openHealthWindow != Character.Controlled?.CharacterHealth && openHealthWindow != Character.Controlled?.SelectedCharacter?.CharacterHealth)
|
||||
@@ -700,6 +725,8 @@ namespace Barotrauma
|
||||
distortTimer = 0.0f;
|
||||
}
|
||||
|
||||
UpdateStatusHUD(deltaTime);
|
||||
|
||||
if (PlayerInput.KeyHit(InputType.Health) && GUI.KeyboardDispatcher.Subscriber == null &&
|
||||
Character.Controlled.AllowInput && !toggledThisFrame)
|
||||
{
|
||||
@@ -726,9 +753,9 @@ namespace Barotrauma
|
||||
OpenHealthWindow = null;
|
||||
}
|
||||
|
||||
foreach (GUIComponent afflictionIcon in afflictionIconContainer.Content.Children)
|
||||
foreach (GUIComponent afflictionIcon in afflictionIconList.Content.Children)
|
||||
{
|
||||
if (!(afflictionIcon.UserData is Affliction affliction)) { continue; }
|
||||
if (afflictionIcon.UserData is not Affliction affliction) { continue; }
|
||||
if (affliction.AppliedAsFailedTreatmentTime > Timing.TotalTime - 1.0 && afflictionIcon.FlashTimer <= 0.0f)
|
||||
{
|
||||
afflictionIcon.Flash(GUIStyle.Red);
|
||||
@@ -900,7 +927,7 @@ namespace Barotrauma
|
||||
|
||||
healthBarHolder.CanBeFocused = healthBar.CanBeFocused = healthBarShadow.CanBeFocused = !Character.ShouldLockHud();
|
||||
if (Character.AllowInput && UseHealthWindow && !Character.DisableHealthWindow && healthBar.Enabled && healthBar.CanBeFocused &&
|
||||
(GUI.IsMouseOn(healthBar) || highlightedAfflictionIcon != null) && Inventory.SelectedSlot == null)
|
||||
(GUI.IsMouseOn(healthBar) || GUI.MouseOn?.UserData is AfflictionPrefab) && Inventory.SelectedSlot == null)
|
||||
{
|
||||
healthBar.State = GUIComponent.ComponentState.Hover;
|
||||
if (PlayerInput.PrimaryMouseButtonClicked())
|
||||
@@ -960,7 +987,12 @@ namespace Barotrauma
|
||||
}
|
||||
else if (Character.Controlled == Character && !CharacterHUD.IsCampaignInterfaceOpen)
|
||||
{
|
||||
healthBarHolder.AddToGUIUpdateList();
|
||||
healthBarHolder.AddToGUIUpdateList();
|
||||
afflictionIconContainer.AddToGUIUpdateList();
|
||||
if (hiddenAfflictionIconContainer.Visible)
|
||||
{
|
||||
hiddenAfflictionIconContainer.AddToGUIUpdateList();
|
||||
}
|
||||
}
|
||||
if (SuicideButton.Visible && Character == Character.Controlled)
|
||||
{
|
||||
@@ -989,7 +1021,7 @@ namespace Barotrauma
|
||||
if (affliction.Prefab.AfflictionOverlay != null)
|
||||
{
|
||||
Sprite ScreenAfflictionOverlay = affliction.Prefab.AfflictionOverlay;
|
||||
ScreenAfflictionOverlay?.Draw(spriteBatch, Vector2.Zero, Color.White * (affliction.GetAfflictionOverlayMultiplier()), Vector2.Zero, 0.0f,
|
||||
ScreenAfflictionOverlay?.Draw(spriteBatch, Vector2.Zero, Color.White * affliction.GetAfflictionOverlayMultiplier(), Vector2.Zero, 0.0f,
|
||||
new Vector2(GameMain.GraphicsWidth / DamageOverlay.size.X, GameMain.GraphicsHeight / DamageOverlay.size.Y));
|
||||
}
|
||||
}
|
||||
@@ -1021,94 +1053,134 @@ namespace Barotrauma
|
||||
// If manning a turret the portrait doesn't get rendered so we push the health bar to remove the empty gap
|
||||
healthBarHolder.RectTransform.ScreenSpaceOffset = Character.ShouldLockHud() ? new Point(0, HUDLayoutSettings.PortraitArea.Height) : Point.Zero;
|
||||
}
|
||||
|
||||
DrawStatusHUD(spriteBatch);
|
||||
}
|
||||
|
||||
private (Affliction Affliction, LocalizedString NameToolTip)? highlightedAfflictionIcon = null;
|
||||
public void DrawStatusHUD(SpriteBatch spriteBatch)
|
||||
//private (Affliction Affliction, LocalizedString NameToolTip)? highlightedAfflictionIcon = null;
|
||||
|
||||
private readonly List<Affliction> statusIcons = new List<Affliction>();
|
||||
private readonly Dictionary<AfflictionPrefab, float> statusIconVisibleTime = new Dictionary<AfflictionPrefab, float>();
|
||||
private const float HideStatusIconDelay = 5.0f;
|
||||
|
||||
public void UpdateStatusHUD(float deltaTime)
|
||||
{
|
||||
highlightedAfflictionIcon = null;
|
||||
//Rectangle interactArea = healthBar.Rect;
|
||||
if (Character.Controlled?.SelectedCharacter == null && openHealthWindow == null)
|
||||
{
|
||||
var statusIcons = new List<(Affliction Affliction, LocalizedString Warning)>();
|
||||
statusIcons.Clear();
|
||||
if (Character.InPressure)
|
||||
{
|
||||
statusIcons.Add((pressureAffliction, TextManager.Get("PressureHUDWarning")));
|
||||
statusIcons.Add(pressureAffliction);
|
||||
}
|
||||
if (Character.CurrentHull != null && Character.OxygenAvailable < LowOxygenThreshold && oxygenLowAffliction.Strength < oxygenLowAffliction.Prefab.ShowIconThreshold)
|
||||
{
|
||||
statusIcons.Add((oxygenLowAffliction, TextManager.Get("OxygenHUDWarning")));
|
||||
statusIcons.Add(oxygenLowAffliction);
|
||||
}
|
||||
|
||||
foreach (Affliction affliction in currentDisplayedAfflictions)
|
||||
{
|
||||
statusIcons.Add((affliction, affliction.Prefab.Name));
|
||||
statusIcons.Add(affliction);
|
||||
}
|
||||
|
||||
Vector2 highlightedIconPos = Vector2.Zero;
|
||||
Rectangle afflictionArea = HUDLayoutSettings.AfflictionAreaLeft;
|
||||
|
||||
// Push the icons down since the portrait doesn't get rendered
|
||||
int spacing = GUI.IntScale(10);
|
||||
if (Character.ShouldLockHud())
|
||||
{
|
||||
afflictionArea.Y += HUDLayoutSettings.PortraitArea.Height;
|
||||
// Push the icons down since the portrait doesn't get rendered
|
||||
afflictionIconContainer.RectTransform.ScreenSpaceOffset = new Point(0, HUDLayoutSettings.PortraitArea.Height);
|
||||
hiddenAfflictionIconContainer.RectTransform.ScreenSpaceOffset = new Point(0, -hiddenAfflictionIconContainer.Rect.Height - spacing + HUDLayoutSettings.PortraitArea.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
afflictionIconContainer.RectTransform.ScreenSpaceOffset = new Point(0, 0);
|
||||
hiddenAfflictionIconContainer.RectTransform.ScreenSpaceOffset = new Point(0, -hiddenAfflictionIconContainer.Rect.Height - spacing);
|
||||
}
|
||||
//remove affliction icons for afflictions that no longer exist
|
||||
|
||||
bool horizontal = afflictionArea.Width > afflictionArea.Height;
|
||||
int iconSize = horizontal ? afflictionArea.Height : afflictionArea.Width;
|
||||
|
||||
Point pos = new Point(afflictionArea.Right - iconSize, afflictionArea.Top);
|
||||
RemoveNonExistentIcons(afflictionIconContainer);
|
||||
RemoveNonExistentIcons(hiddenAfflictionIconContainer);
|
||||
void RemoveNonExistentIcons(GUIComponent container)
|
||||
{
|
||||
for (int i = container.CountChildren - 1; i >= 0; i--)
|
||||
{
|
||||
var child = container.GetChild(i);
|
||||
if (child.UserData is not AfflictionPrefab afflictionPrefab) { continue; }
|
||||
if (!statusIcons.Any(s => s.Prefab == afflictionPrefab))
|
||||
{
|
||||
container.RemoveChild(child);
|
||||
statusIconVisibleTime.Remove(afflictionPrefab);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var statusIcon in statusIcons)
|
||||
{
|
||||
Affliction affliction = statusIcon.Affliction;
|
||||
Affliction affliction = statusIcon;
|
||||
AfflictionPrefab afflictionPrefab = affliction.Prefab;
|
||||
|
||||
Rectangle afflictionIconRect = new Rectangle(pos, new Point(iconSize));
|
||||
if (afflictionIconRect.Contains(PlayerInput.MousePosition) && !Character.ShouldLockHud() && GUI.MouseOn == null)
|
||||
if (!statusIconVisibleTime.ContainsKey(afflictionPrefab)) { statusIconVisibleTime.Add(afflictionPrefab, 0.0f); }
|
||||
statusIconVisibleTime[afflictionPrefab] += deltaTime;
|
||||
|
||||
var matchingIcon =
|
||||
afflictionIconContainer.GetChildByUserData(afflictionPrefab) ??
|
||||
hiddenAfflictionIconContainer.GetChildByUserData(afflictionPrefab);
|
||||
if (matchingIcon == null)
|
||||
{
|
||||
highlightedAfflictionIcon = statusIcon;
|
||||
highlightedIconPos = afflictionIconRect.Location.ToVector2();
|
||||
matchingIcon = new GUIButton(new RectTransform(new Point(afflictionIconContainer.Rect.Height), afflictionIconContainer.RectTransform), style: null)
|
||||
{
|
||||
UserData = afflictionPrefab,
|
||||
ToolTip = affliction.Prefab.Name,
|
||||
CanBeSelected = false
|
||||
};
|
||||
if (affliction == pressureAffliction)
|
||||
{
|
||||
matchingIcon.ToolTip = TextManager.Get("PressureHUDWarning");
|
||||
}
|
||||
else if (affliction == pressureAffliction)
|
||||
{
|
||||
matchingIcon.ToolTip = TextManager.Get("OxygenHUDWarning");
|
||||
}
|
||||
new GUIImage(new RectTransform(Vector2.One, matchingIcon.RectTransform, Anchor.BottomCenter), afflictionPrefab.Icon, scaleToFit: true)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
}
|
||||
|
||||
if (affliction.DamagePerSecond > 1.0f)
|
||||
if (afflictionPrefab.HideIconAfterDelay && statusIconVisibleTime[afflictionPrefab] > HideStatusIconDelay)
|
||||
{
|
||||
Rectangle glowRect = afflictionIconRect;
|
||||
glowRect.Inflate((int)(20 * GUI.Scale), (int)(20 * GUI.Scale));
|
||||
var glow = GUIStyle.GetComponentStyle("OuterGlowCircular");
|
||||
glow.Sprites[GUIComponent.ComponentState.None][0].Draw(
|
||||
spriteBatch, glowRect,
|
||||
GUIStyle.Red * (float)((Math.Sin(affliction.DamagePerSecondTimer * MathHelper.TwoPi - MathHelper.PiOver2) + 1.0f) * 0.5f));
|
||||
matchingIcon.RectTransform.Parent = hiddenAfflictionIconContainer.RectTransform;
|
||||
}
|
||||
var image = matchingIcon.GetChild<GUIImage>();
|
||||
image.Color = GetAfflictionIconColor(afflictionPrefab, affliction);
|
||||
image.HoverColor = Color.Lerp(image.Color, Color.White, 0.5f);
|
||||
|
||||
float alphaMultiplier = highlightedAfflictionIcon == statusIcon ? 1f : 0.8f;
|
||||
|
||||
afflictionPrefab.Icon?.Draw(spriteBatch,
|
||||
pos.ToVector2(),
|
||||
/*highlightedIcon == statusIcon ? statusIcon.First.Prefab.IconColor : statusIcon.First.Prefab.IconColor * 0.8f,*/ // OLD IMPLEMENTATION
|
||||
GetAfflictionIconColor(afflictionPrefab, affliction) * alphaMultiplier,
|
||||
rotate: 0,
|
||||
scale: iconSize / afflictionPrefab.Icon.size.X);
|
||||
|
||||
if (horizontal)
|
||||
pos.X -= iconSize + (int)(5 * GUI.Scale);
|
||||
else
|
||||
pos.Y += iconSize + (int)(5 * GUI.Scale);
|
||||
if (affliction.DamagePerSecond > 1.0f && matchingIcon.FlashTimer <= 0.0f)
|
||||
{
|
||||
matchingIcon.Flash(useCircularFlash: true, flashDuration: 1.5f, flashRectInflate: Vector2.One * 15.0f * GUI.Scale);
|
||||
image.Pulsate(Vector2.One, Vector2.One * 1.2f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (highlightedAfflictionIcon != null)
|
||||
afflictionIconContainer.RectTransform.SortChildren((r1, r2) =>
|
||||
{
|
||||
LocalizedString nameTooltip = highlightedAfflictionIcon.Value.NameToolTip;
|
||||
Vector2 offset = GUIStyle.Font.MeasureString(nameTooltip);
|
||||
if (r1.GUIComponent.UserData is not AfflictionPrefab prefab1) { return -1; }
|
||||
if (r2.GUIComponent.UserData is not AfflictionPrefab prefab2) { return 1; }
|
||||
var index1 = statusIcons.IndexOf(s => s.Prefab == prefab1);
|
||||
var index2 = statusIcons.IndexOf(s => s.Prefab == prefab2);
|
||||
return index1.CompareTo(index2);
|
||||
});
|
||||
(afflictionIconContainer as GUILayoutGroup).NeedsToRecalculate = true;
|
||||
|
||||
GUI.DrawString(spriteBatch,
|
||||
alignment == Alignment.Left ? highlightedIconPos + offset : highlightedIconPos - offset,
|
||||
nameTooltip,
|
||||
Color.White * 0.8f, Color.Black * 0.5f);
|
||||
Rectangle hiddenAfflictionHoverArea = showHiddenAfflictionsButton.Rect;
|
||||
foreach (GUIComponent child in hiddenAfflictionIconContainer.Children)
|
||||
{
|
||||
hiddenAfflictionHoverArea = Rectangle.Union(hiddenAfflictionHoverArea, child.Rect);
|
||||
}
|
||||
|
||||
afflictionIconContainer.Visible = true;
|
||||
hiddenAfflictionIconContainer.Visible =
|
||||
showHiddenAfflictionsButton.Rect.Contains(PlayerInput.MousePosition) ||
|
||||
(hiddenAfflictionIconContainer.Visible && hiddenAfflictionHoverArea.Contains(PlayerInput.MousePosition));
|
||||
showHiddenAfflictionsButton.Visible = hiddenAfflictionIconContainer.CountChildren > 0;
|
||||
showHiddenAfflictionsButton.IgnoreLayoutGroups = !showHiddenAfflictionsButton.Visible;
|
||||
showHiddenAfflictionsButton.Text = $"+{hiddenAfflictionIconContainer.CountChildren}";
|
||||
|
||||
if (Vitality > 0.0f)
|
||||
{
|
||||
float currHealth = healthBar.BarSize;
|
||||
@@ -1126,6 +1198,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
afflictionIconContainer.Visible = hiddenAfflictionIconContainer.Visible = false;
|
||||
if (Vitality > 0.0f)
|
||||
{
|
||||
float currHealth = healthWindowHealthBar.BarSize;
|
||||
@@ -1150,18 +1223,20 @@ namespace Barotrauma
|
||||
|
||||
public static Color GetAfflictionIconColor(AfflictionPrefab prefab, float afflictionStrength)
|
||||
{
|
||||
//use sqrt to make the color change rapidly when strength is low
|
||||
//(low strength is where seeing the severity of the affliction makes more difference - at high strengths the character is already unconscious or dead)
|
||||
float colorT = MathF.Sqrt(afflictionStrength / prefab.MaxStrength);
|
||||
// No specific colors, use generic
|
||||
if (prefab.IconColors == null)
|
||||
{
|
||||
if (prefab.IsBuff)
|
||||
{
|
||||
return ToolBox.GradientLerp(afflictionStrength / prefab.MaxStrength, GUIStyle.BuffColorLow, GUIStyle.BuffColorMedium, GUIStyle.BuffColorHigh);
|
||||
return ToolBox.GradientLerp(colorT, GUIStyle.BuffColorLow, GUIStyle.BuffColorMedium, GUIStyle.BuffColorHigh);
|
||||
}
|
||||
|
||||
return ToolBox.GradientLerp(afflictionStrength / prefab.MaxStrength, GUIStyle.DebuffColorLow, GUIStyle.DebuffColorMedium, GUIStyle.DebuffColorHigh);
|
||||
return ToolBox.GradientLerp(colorT, GUIStyle.DebuffColorLow, GUIStyle.DebuffColorMedium, GUIStyle.DebuffColorHigh);
|
||||
}
|
||||
|
||||
return ToolBox.GradientLerp(afflictionStrength / prefab.MaxStrength, prefab.IconColors);
|
||||
return ToolBox.GradientLerp(colorT, prefab.IconColors);
|
||||
}
|
||||
|
||||
public static Color GetAfflictionIconColor(Affliction affliction) => GetAfflictionIconColor(affliction.Prefab, affliction);
|
||||
@@ -1172,7 +1247,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (selectedLimb == null)
|
||||
{
|
||||
afflictionIconContainer.Content.ClearChildren();
|
||||
afflictionIconList.Content.ClearChildren();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1282,7 @@ namespace Barotrauma
|
||||
|
||||
private void CreateAfflictionInfos(IEnumerable<Affliction> afflictions)
|
||||
{
|
||||
afflictionIconContainer.ClearChildren();
|
||||
afflictionIconList.ClearChildren();
|
||||
displayedAfflictions.Clear();
|
||||
|
||||
Affliction mostSevereAffliction = SortAfflictionsBySeverity(afflictions, excludeBuffs: false).FirstOrDefault();
|
||||
@@ -1217,7 +1292,7 @@ namespace Barotrauma
|
||||
{
|
||||
displayedAfflictions.Add((affliction, affliction.Strength));
|
||||
|
||||
var frame = new GUIButton(new RectTransform(new Vector2(1.0f, 0.25f), afflictionIconContainer.Content.RectTransform), style: "ListBoxElement")
|
||||
var frame = new GUIButton(new RectTransform(new Vector2(1.0f, 0.25f), afflictionIconList.Content.RectTransform), style: "ListBoxElement")
|
||||
{
|
||||
UserData = affliction,
|
||||
OnClicked = SelectAffliction
|
||||
@@ -1275,7 +1350,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
buttonToSelect?.OnClicked(buttonToSelect, buttonToSelect.UserData);
|
||||
afflictionIconContainer.RecalculateChildren();
|
||||
afflictionIconList.RecalculateChildren();
|
||||
}
|
||||
|
||||
private void CreateRecommendedTreatments()
|
||||
@@ -1386,7 +1461,7 @@ namespace Barotrauma
|
||||
|
||||
recommendedTreatmentContainer.RecalculateChildren();
|
||||
|
||||
afflictionIconContainer.Content.RectTransform.SortChildren((r1, r2) =>
|
||||
afflictionIconList.Content.RectTransform.SortChildren((r1, r2) =>
|
||||
{
|
||||
var first = r1.GUIComponent.UserData as Affliction;
|
||||
var second = r2.GUIComponent.UserData as Affliction;
|
||||
@@ -1437,7 +1512,10 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
var description = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), parent.RectTransform),
|
||||
affliction.Prefab.Description, textAlignment: Alignment.TopLeft, wrap: true)
|
||||
affliction.Prefab.GetDescription(
|
||||
affliction.Strength,
|
||||
Character == Character.Controlled ? AfflictionPrefab.Description.TargetType.Self : AfflictionPrefab.Description.TargetType.OtherCharacter),
|
||||
textAlignment: Alignment.TopLeft, wrap: true)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
@@ -1449,8 +1527,7 @@ namespace Barotrauma
|
||||
|
||||
Point nameDims = new Point(afflictionName.Rect.Width, (int)(GUIStyle.LargeFont.Size * 1.5f));
|
||||
|
||||
afflictionStrength.Text = strengthTexts[
|
||||
MathHelper.Clamp((int)Math.Floor((affliction.Strength / affliction.Prefab.MaxStrength) * strengthTexts.Length), 0, strengthTexts.Length - 1)];
|
||||
afflictionStrength.Text = affliction.GetStrengthText();
|
||||
|
||||
Vector2 strengthDims = GUIStyle.SubHeadingFont.MeasureString(afflictionStrength.Text);
|
||||
|
||||
@@ -1482,10 +1559,9 @@ namespace Barotrauma
|
||||
private bool SelectAffliction(GUIButton button, object userData)
|
||||
{
|
||||
bool selected = button.Selected;
|
||||
foreach (var child in afflictionIconContainer.Content.Children)
|
||||
foreach (var child in afflictionIconList.Content.Children)
|
||||
{
|
||||
GUIButton btn = child.GetChild<GUIButton>();
|
||||
if (btn != null)
|
||||
if (child is GUIButton btn)
|
||||
{
|
||||
btn.Selected = btn == button && !selected;
|
||||
}
|
||||
@@ -1516,7 +1592,7 @@ namespace Barotrauma
|
||||
afflictionEffectColor = GUIStyle.Green;
|
||||
}
|
||||
|
||||
var child = afflictionIconContainer.Content.FindChild(affliction);
|
||||
var child = afflictionIconList.Content.FindChild(affliction);
|
||||
|
||||
var afflictionStrengthPredictionBar = child.GetChild<GUILayoutGroup>().GetChildByUserData("afflictionstrengthprediction") as GUIProgressBar;
|
||||
afflictionStrengthPredictionBar.BarSize = 0.0f;
|
||||
@@ -1581,8 +1657,7 @@ namespace Barotrauma
|
||||
|
||||
var strengthText = labelContainer.GetChildByUserData("strength") as GUITextBlock;
|
||||
|
||||
strengthText.Text = strengthTexts[
|
||||
MathHelper.Clamp((int)Math.Floor((affliction.Strength / affliction.Prefab.MaxStrength) * strengthTexts.Length), 0, strengthTexts.Length - 1)];
|
||||
strengthText.Text = affliction.GetStrengthText();
|
||||
|
||||
strengthText.TextColor = Color.Lerp(GUIStyle.Orange, GUIStyle.Red,
|
||||
affliction.Strength / affliction.Prefab.MaxStrength);
|
||||
@@ -1836,14 +1911,14 @@ namespace Barotrauma
|
||||
i++;
|
||||
}
|
||||
|
||||
if (selectedLimbIndex > -1 && afflictionIconContainer.Content.CountChildren > 0)
|
||||
if (selectedLimbIndex > -1 && afflictionIconList.Content.CountChildren > 0)
|
||||
{
|
||||
LimbHealth limbHealth = limbHealths[selectedLimbIndex];
|
||||
if (limbHealth?.IndicatorSprite != null)
|
||||
{
|
||||
Rectangle selectedLimbArea = GetLimbHighlightArea(limbHealth, drawArea);
|
||||
GUI.DrawLine(spriteBatch,
|
||||
new Vector2(afflictionIconContainer.Rect.X, afflictionIconContainer.Rect.Y),
|
||||
new Vector2(afflictionIconList.Rect.X, afflictionIconList.Rect.Y),
|
||||
selectedLimbArea.Center.ToVector2(),
|
||||
Color.LightGray * 0.5f, width: 4);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user