Merge remote-tracking branch 'upstream/master' into develop
This commit is contained in:
@@ -246,6 +246,57 @@ namespace Barotrauma
|
||||
{
|
||||
get { return new Vector2(Rect.Center.X, Rect.Center.Y); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clamps the component's rect position to the specified area. Does not resize the component.
|
||||
/// </summary>
|
||||
/// <param name="clampArea">Area to contain the Rect of this component to</param>
|
||||
public void ClampToArea(Rectangle clampArea)
|
||||
{
|
||||
Rectangle componentRect = Rect;
|
||||
|
||||
int x = componentRect.X;
|
||||
int y = componentRect.Y;
|
||||
|
||||
// Adjust the X position
|
||||
if (componentRect.Width <= clampArea.Width)
|
||||
{
|
||||
if (componentRect.Left < clampArea.Left)
|
||||
{
|
||||
x = clampArea.Left;
|
||||
}
|
||||
else if (componentRect.Right > clampArea.Right)
|
||||
{
|
||||
x = clampArea.Right - componentRect.Width;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Component is wider than clamp area, osition it to overlap as much as possible
|
||||
x = clampArea.Left - (componentRect.Width - clampArea.Width) / 2;
|
||||
}
|
||||
|
||||
// Adjust the Y position
|
||||
if (componentRect.Height <= clampArea.Height)
|
||||
{
|
||||
if (componentRect.Top < clampArea.Top)
|
||||
{
|
||||
y = clampArea.Top;
|
||||
}
|
||||
else if (componentRect.Bottom > clampArea.Bottom)
|
||||
{
|
||||
y = clampArea.Bottom - componentRect.Height;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Component is taller than clamp area, osition it to overlap as much as possible
|
||||
y = clampArea.Top - (componentRect.Height - clampArea.Height) / 2;
|
||||
}
|
||||
|
||||
Point moveAmount = new Point(x - componentRect.X, y - componentRect.Y);
|
||||
RectTransform.ScreenSpaceOffset += moveAmount;
|
||||
}
|
||||
|
||||
protected Rectangle ClampRect(Rectangle r)
|
||||
{
|
||||
|
||||
@@ -1562,7 +1562,7 @@ namespace Barotrauma
|
||||
bool locationHasDealOnItem = isSellingRelatedList ?
|
||||
ActiveStore.RequestedGoods.Contains(pi.ItemPrefab) : ActiveStore.DailySpecials.Contains(pi.ItemPrefab);
|
||||
GUITextBlock nameBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), nameAndQuantityGroup.RectTransform),
|
||||
pi.ItemPrefab.Name, font: GUIStyle.SubHeadingFont, textAlignment: Alignment.BottomLeft)
|
||||
RichString.Rich(pi.ItemPrefab.Name), font: GUIStyle.SubHeadingFont, textAlignment: Alignment.BottomLeft)
|
||||
{
|
||||
CanBeFocused = false,
|
||||
Shadow = locationHasDealOnItem,
|
||||
|
||||
@@ -902,7 +902,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return teamIDs.IndexOf(client.TeamID);
|
||||
}
|
||||
|
||||
private void CreateWalletCrewFrame(Character character, GUILayoutGroup paddedFrame)
|
||||
@@ -1694,6 +1694,7 @@ namespace Barotrauma
|
||||
textContent,
|
||||
mission.Difficulty ?? 0,
|
||||
mission.Prefab.Icon, mission.Prefab.IconColor,
|
||||
mission.GetDifficultyToolTipText(),
|
||||
out GUIImage missionIcon);
|
||||
if (missionIcon != null)
|
||||
{
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
ImmutableHashSet<TalentPrefab?> talentsOutsideTree = info.GetUnlockedTalentsOutsideTree().Select(static e => TalentPrefab.TalentPrefabs.Find(c => c.Identifier == e)).ToImmutableHashSet();
|
||||
if (talentsOutsideTree.Any())
|
||||
if (talentsOutsideTree.Any(static t => t != null && !t.IsHiddenExtraTalent))
|
||||
{
|
||||
//spacing
|
||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.01f), nameLayout.RectTransform), style: null);
|
||||
@@ -324,6 +324,7 @@ namespace Barotrauma
|
||||
foreach (var extraTalent in talentsOutsideTree)
|
||||
{
|
||||
if (extraTalent is null) { continue; }
|
||||
if (extraTalent.IsHiddenExtraTalent) { continue; }
|
||||
GUIImage talentImg = new GUIImage(new RectTransform(Vector2.One, extraTalentList.Content.RectTransform, scaleBasis: ScaleBasis.BothHeight), sprite: extraTalent.Icon, scaleToFit: true)
|
||||
{
|
||||
ToolTip = RichString.Rich($"‖color:{Color.White.ToStringHex()}‖{extraTalent.DisplayName}‖color:end‖" + "\n\n" + ToolBox.ExtendColorToPercentageSigns(extraTalent.Description.Value)),
|
||||
@@ -440,7 +441,12 @@ namespace Barotrauma
|
||||
|
||||
private void CreateTalentResetPopup(GUIComponent parent)
|
||||
{
|
||||
bool hasResetTalentsBefore = character?.Info.TalentResetCount > 0;
|
||||
int talentResetCount = 0;
|
||||
if (character?.Info != null)
|
||||
{
|
||||
talentResetCount = Math.Min(character.Info.TalentResetCount, character.Info.GetCurrentLevel());
|
||||
}
|
||||
bool hasResetTalentsBefore = talentResetCount > 0;
|
||||
var bgBlocker = new GUIFrame(new RectTransform(Vector2.One, parent.RectTransform, anchor: Anchor.Center), style: "GUIBackgroundBlocker")
|
||||
{
|
||||
IgnoreLayoutGroups = true
|
||||
@@ -455,7 +461,8 @@ namespace Barotrauma
|
||||
|
||||
if (hasResetTalentsBefore)
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.25f), popupLayout.RectTransform), TextManager.Get("talentresetpromptwarning"), wrap: true)
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.25f), popupLayout.RectTransform),
|
||||
TextManager.GetWithVariable("talentresetpromptwarning", "[count]", talentResetCount.ToString()), wrap: true)
|
||||
{
|
||||
TextColor = GUIStyle.Red
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user