v0.13.0.11
This commit is contained in:
@@ -77,6 +77,12 @@ namespace Barotrauma
|
||||
return RectTransform.IsParentOf(component.RectTransform, recursive);
|
||||
}
|
||||
|
||||
public bool IsChildOf(GUIComponent component, bool recursive = true)
|
||||
{
|
||||
if (component == null) { return false; }
|
||||
return RectTransform.IsChildOf(component.RectTransform, recursive);
|
||||
}
|
||||
|
||||
public virtual void RemoveChild(GUIComponent child)
|
||||
{
|
||||
if (child == null) { return; }
|
||||
|
||||
@@ -640,6 +640,12 @@ namespace Barotrauma
|
||||
return children.Contains(rectT) || (recursive && children.Any(c => c.IsParentOf(rectT)));
|
||||
}
|
||||
|
||||
public bool IsChildOf(RectTransform rectT, bool recursive = true)
|
||||
{
|
||||
if (Parent == null) { return false; }
|
||||
return Parent == rectT || (recursive && Parent.IsChildOf(rectT));
|
||||
}
|
||||
|
||||
public void ClearChildren()
|
||||
{
|
||||
children.ForEachMod(c => c.Parent = null);
|
||||
|
||||
@@ -1290,7 +1290,8 @@ namespace Barotrauma
|
||||
|
||||
WasCommandInterfaceDisabledThisUpdate = false;
|
||||
|
||||
if (PlayerInput.KeyDown(InputType.Command) && (GUI.KeyboardDispatcher.Subscriber == null || GUI.KeyboardDispatcher.Subscriber == crewList) &&
|
||||
if (PlayerInput.KeyDown(InputType.Command) &&
|
||||
(GUI.KeyboardDispatcher.Subscriber == null || (GUI.KeyboardDispatcher.Subscriber is GUIComponent component && (component == crewList || component.IsChildOf(crewList)))) &&
|
||||
commandFrame == null && !clicklessSelectionActive && CanIssueOrders && !(GameMain.GameSession?.Campaign?.ShowCampaignUI ?? false))
|
||||
{
|
||||
if (PlayerInput.KeyDown(Keys.LeftShift) || PlayerInput.KeyDown(Keys.RightShift))
|
||||
|
||||
@@ -540,15 +540,16 @@ namespace Barotrauma.Items.Components
|
||||
if (ShowProjectileIndicator)
|
||||
{
|
||||
Point slotSize = (Inventory.SlotSpriteSmall.size * Inventory.UIScale).ToPoint();
|
||||
int spacing = 5;
|
||||
Point spacing = new Point(GUI.IntScale(5), GUI.IntScale(20));
|
||||
int slotsPerRow = Math.Min(availableAmmo.Count, 6);
|
||||
int totalWidth = slotSize.X * slotsPerRow + spacing * (slotsPerRow - 1);
|
||||
Point invSlotPos = new Point(GameMain.GraphicsWidth / 2 - totalWidth / 2, powerIndicator.Rect.Y - (int)(75 * GUI.Scale));
|
||||
int totalWidth = slotSize.X * slotsPerRow + spacing.X * (slotsPerRow - 1);
|
||||
int rows = (int)Math.Ceiling(availableAmmo.Count / (float)slotsPerRow);
|
||||
Point invSlotPos = new Point(GameMain.GraphicsWidth / 2 - totalWidth / 2, powerIndicator.Rect.Y - (slotSize.Y + spacing.Y) * rows);
|
||||
for (int i = 0; i < availableAmmo.Count; i++)
|
||||
{
|
||||
// TODO: Optimize? Creates multiple new objects per frame?
|
||||
Inventory.DrawSlot(spriteBatch, null,
|
||||
new VisualSlot(new Rectangle(invSlotPos + new Point((i % slotsPerRow) * (slotSize.X + spacing), (int)Math.Floor(i / (float)slotsPerRow) * (slotSize.Y + spacing)), slotSize)),
|
||||
new VisualSlot(new Rectangle(invSlotPos + new Point((i % slotsPerRow) * (slotSize.X + spacing.X), (int)Math.Floor(i / (float)slotsPerRow) * (slotSize.Y + spacing.Y)), slotSize)),
|
||||
availableAmmo[i], -1, true);
|
||||
}
|
||||
if (flashNoAmmo)
|
||||
|
||||
Reference in New Issue
Block a user