Unstable v0.9.707.0

This commit is contained in:
Juan Pablo Arce
2020-02-11 16:07:21 -03:00
parent 8324d20464
commit 2783125162
68 changed files with 1460 additions and 1219 deletions
@@ -11,7 +11,7 @@ using System.Xml.Linq;
namespace Barotrauma
{
partial class CharacterInventory : Inventory
{
{
public enum Layout
{
Default,
@@ -35,20 +35,13 @@ namespace Barotrauma
}
private static Dictionary<InvSlotType, Sprite> limbSlotIcons;
private static Sprite inventoryBackgroundSprite, inventoryExtendButton, inventoryExtendUpArrow, inventoryExtendDownArrow;
public Rectangle InventoryToggleArea;
public bool InventoryToggleContains = false;
private Vector2 inventoryExtendButtonOffset, inventoryArrowOffset;
private int inventoryOpeningOffset;
private Point prevResolution;
public const InvSlotType PersonalSlots = InvSlotType.Card | InvSlotType.Headset | InvSlotType.InnerClothes | InvSlotType.OuterClothes | InvSlotType.Head;
public Vector2[] SlotPositions;
private Vector2 bgScale;
private Point screenResolution;
public Vector2[] SlotPositions;
private Layout layout;
public Layout CurrentLayout
{
@@ -57,7 +50,7 @@ namespace Barotrauma
{
if (layout == value) return;
layout = value;
SetSlotPositions();
SetSlotPositions(layout);
}
}
public bool Hidden { get; set; }
@@ -66,8 +59,6 @@ namespace Barotrauma
private float hidePersonalSlotsState;
private GUIButton hideButton;
private Rectangle personalSlotArea;
private bool inventoryOpen = false;
private bool wasInventoryToggledAutomatically = false;
public bool HidePersonalSlots
{
@@ -112,16 +103,10 @@ namespace Barotrauma
limbSlotIcons.Add(InvSlotType.LeftHand, new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(634, 0, 128, 128)));
limbSlotIcons.Add(InvSlotType.RightHand, new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(762, 0, 128, 128)));
limbSlotIcons.Add(InvSlotType.OuterClothes, new Sprite("Content/UI/MainIconsAtlas.png", new Rectangle(256 + margin, 128 + margin, 128 - margin * 2, 128 - margin * 2)));
inventoryBackgroundSprite = new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(252, 317, 263, 197));
inventoryExtendButton = new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(533, 300, 96, 19));
inventoryExtendUpArrow = new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(640, 310, 10, 10));
inventoryExtendDownArrow = new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(668, 310, 10, 10));
}
SlotPositions = new Vector2[SlotTypes.Length];
CurrentLayout = Layout.Default;
SetSlotPositions();
SetSlotPositions(layout);
}
protected override ItemInventory GetActiveEquippedSubInventory(int slotIndex)
@@ -157,6 +142,8 @@ namespace Barotrauma
public override void CreateSlots()
{
if (slots == null) { slots = new InventorySlot[capacity]; }
float multiplier = !GUI.IsFourByThree() ? UIScale : UIScale * 0.925f;
for (int i = 0; i < capacity; i++)
{
@@ -166,7 +153,7 @@ namespace Barotrauma
Rectangle slotRect = new Rectangle(
(int)(SlotPositions[i].X),
(int)(SlotPositions[i].Y),
(int)(slotSprite.size.X * UIScale), (int)(slotSprite.size.Y * UIScale));
(int)(slotSprite.size.X * multiplier), (int)(slotSprite.size.Y * multiplier));
if (Items[i] != null)
{
@@ -208,54 +195,31 @@ namespace Barotrauma
}
}
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
CalculateBackgroundFrame();
}
protected override void CalculateBackgroundFrame()
{
Rectangle frame = Rectangle.Empty;
int firstSlotLocationY = 0;
int lastSlotLocationY = 0;
for (int i = 0; i < capacity; i++)
{
if (HideSlot(i)) continue;
if (PersonalSlots.HasFlag(SlotTypes[i])) continue;
if (IsHandSlot(SlotTypes[i])) continue;
if (frame == Rectangle.Empty)
{
firstSlotLocationY = slots[i].Rect.Location.Y;
frame = slots[i].Rect;
continue;
}
frame = Rectangle.Union(frame, slots[i].Rect);
lastSlotLocationY = slots[i].Rect.Location.Y;
}
frame.Inflate(25f * UIScale, 25f * UIScale);
if (layout == Layout.Default)
{
inventoryOpeningOffset = firstSlotLocationY - lastSlotLocationY;
bgScale = new Vector2((float)frame.Width / (float)inventoryBackgroundSprite.SourceRect.Width, (float)frame.Height / (float)inventoryBackgroundSprite.SourceRect.Height);
inventoryExtendButtonOffset = new Vector2(inventoryExtendButton.size.X * UIScale * 1.5f / 2f, inventoryExtendButton.size.Y * UIScale * 1.5f / 2f + UIScale * 6);
inventoryArrowOffset = new Vector2(inventoryExtendUpArrow.size.X * UIScale * 1.25f / 2f, inventoryExtendUpArrow.size.Y * UIScale * 1.25f / 2f);
InventoryToggleArea = new Rectangle(new Point(frame.Center.X, frame.Top) - inventoryExtendButtonOffset.ToPoint(), inventoryExtendButton.size.ToPoint() + new Point(0, (int)(UIScale * 6f)));
if (!inventoryOpen)
{
frame.Offset(0, inventoryOpeningOffset);
InventoryToggleArea.Offset(0, inventoryOpeningOffset);
}
}
frame.Inflate(10, 30);
frame.Location -= new Point(0, 25);
BackgroundFrame = frame;
}
protected override bool HideSlot(int i)
{
if (slots[i].Disabled) return true;
if (slots[i].Disabled || (hideEmptySlot[i] && Items[i] == null)) return true;
if (layout == Layout.Default)
{
@@ -268,23 +232,34 @@ namespace Barotrauma
return true;
}
//don't show the equip slot if the item is also in the default inventory
if (SlotTypes[i] != InvSlotType.Any && Items[i] != null)
{
for (int j = 0; j < capacity; j++)
{
if (SlotTypes[j] == InvSlotType.Any && Items[j] == Items[i]) return true;
}
}
return false;
}
protected override bool IsSlotHiddenDueToToggleState(int i)
private void SetSlotPositions(Layout layout)
{
return layout == Layout.Default && !inventoryOpen && slots[i].QuickUseKey == Keys.None && SlotTypes[i] == InvSlotType.Any;
}
int spacing;
private void SetSlotPositions()
{
Layout layout = CurrentLayout;
int spacing = (int)(10 * UIScale);
Point slotSize = (SlotSpriteSmall.size * UIScale).ToPoint();
bool isFourByThree = GUI.IsFourByThree();
if (isFourByThree)
{
spacing = (int)(5 * UIScale);
}
else
{
spacing = (int)(10 * UIScale);
}
Point slotSize = !isFourByThree ? (SlotSpriteSmall.size * UIScale).ToPoint() : (SlotSpriteSmall.size * UIScale * .925f).ToPoint();
int bottomOffset = slotSize.Y + spacing * 2 + ContainedIndicatorHeight;
prevResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
if (slots == null) { CreateSlots(); }
hideButton.Visible = false;
@@ -296,47 +271,27 @@ namespace Barotrauma
int personalSlotCount = SlotTypes.Count(s => PersonalSlots.HasFlag(s));
int normalSlotCount = SlotTypes.Count(s => !PersonalSlots.HasFlag(s));
int firstRowSlotCount = hotkeyCount > normalSlotCount ? normalSlotCount : hotkeyCount;
int startX = GameMain.GraphicsWidth / 2 - firstRowSlotCount * (slotSize.X + spacing) / 2;
int x = startX;
int equipmentX = GameMain.GraphicsWidth - slotSize.X * 2;
int buttonIndex = 0;
int startY = GameMain.GraphicsHeight - bottomOffset;
int y = startY;
int handIndex = 1;
int x = GameMain.GraphicsWidth / 2 - normalSlotCount * (slotSize.X + spacing) / 2;
int upperX = GameMain.GraphicsWidth - slotSize.X * 2;
//make sure the rightmost normal slot doesn't overlap with the personal slots
x -= Math.Max(x + firstRowSlotCount * (slotSize.X + spacing) - (equipmentX - 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++)
{
if (PersonalSlots.HasFlag(SlotTypes[i]))
{
SlotPositions[i] = new Vector2(equipmentX, startY);
equipmentX -= slotSize.X + spacing;
SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset);
upperX -= slotSize.X + spacing;
personalSlotArea = (hideButtonSlotIndex == -1) ?
new Rectangle(SlotPositions[i].ToPoint(), slotSize) :
Rectangle.Union(personalSlotArea, new Rectangle(SlotPositions[i].ToPoint(), slotSize));
hideButtonSlotIndex = i;
}
else if (IsHandSlot(SlotTypes[i]))
{
SlotPositions[i] = new Vector2(startX - (slotSize.X + spacing * 4) - (slotSize.X + spacing) * handIndex, startY);
handIndex--;
}
else
{
if (buttonIndex >= hotkeyCount)
{
y -= bottomOffset;
buttonIndex = 0;
x = startX;
}
buttonIndex++;
SlotPositions[i] = new Vector2(x, y);
SlotPositions[i] = new Vector2(x, GameMain.GraphicsHeight - bottomOffset);
x += slotSize.X + spacing;
}
}
@@ -354,6 +309,7 @@ namespace Barotrauma
break;
case Layout.Right:
{
int extraOffset = 0;
int x = HUDLayoutSettings.InventoryAreaLower.Right;
int personalSlotX = HUDLayoutSettings.InventoryAreaLower.Right - slotSize.X - spacing;
for (int i = 0; i < slots.Length; i++)
@@ -364,35 +320,24 @@ namespace Barotrauma
//upperX -= slotSize.X + spacing;
}
else
{
if (i < slots.Length - 5)
{
x -= slotSize.X + spacing;
}
{
x -= slotSize.X + spacing;
}
}
int lowerX = x;
int y = GameMain.GraphicsHeight - bottomOffset;
for (int i = 0; i < SlotPositions.Length; i++)
{
if (HideSlot(i)) continue;
if (PersonalSlots.HasFlag(SlotTypes[i]))
{
SlotPositions[i] = new Vector2(personalSlotX, y - bottomOffset);
SlotPositions[i] = new Vector2(personalSlotX, GameMain.GraphicsHeight - bottomOffset * 2 - extraOffset - spacing * 2);
personalSlotX -= slots[i].Rect.Width + spacing;
}
else
{
SlotPositions[i] = new Vector2(x, y);
SlotPositions[i] = new Vector2(x, GameMain.GraphicsHeight - bottomOffset - extraOffset);
x += slots[i].Rect.Width + spacing;
if (i == SlotPositions.Length - 6)
{
x = lowerX + (slots[i].Rect.Width + spacing) * 2;
y -= bottomOffset;
}
}
}
@@ -401,37 +346,28 @@ namespace Barotrauma
{
if (!HideSlot(i)) continue;
x -= slots[i].Rect.Width + spacing;
SlotPositions[i] = new Vector2(x, y);
SlotPositions[i] = new Vector2(x, GameMain.GraphicsHeight - bottomOffset - extraOffset);
}
}
break;
case Layout.Left:
{
int x = HUDLayoutSettings.InventoryAreaLower.Left;
int y = GameMain.GraphicsHeight - bottomOffset;
int x = HUDLayoutSettings.InventoryAreaLower.X;
int personalSlotX = x;
for (int i = 0; i < SlotPositions.Length; i++)
{
if (HideSlot(i)) continue;
if (PersonalSlots.HasFlag(SlotTypes[i]))
{
SlotPositions[i] = new Vector2(personalSlotX, y - bottomOffset);
SlotPositions[i] = new Vector2(personalSlotX, GameMain.GraphicsHeight - bottomOffset * 2 - spacing * 2);
personalSlotX += slots[i].Rect.Width + spacing;
}
else
{
SlotPositions[i] = new Vector2(x, y);
SlotPositions[i] = new Vector2(x, GameMain.GraphicsHeight - bottomOffset);
x += slots[i].Rect.Width + spacing;
if (i == SlotPositions.Length - 7)
{
x -= (slots[i].Rect.Width + spacing) * 6;
y -= bottomOffset;
}
}
}
for (int i = 0; i < SlotPositions.Length; i++)
{
if (!HideSlot(i)) continue;
@@ -483,11 +419,7 @@ namespace Barotrauma
{
HUDLayoutSettings.InventoryTopY = slots[0].EquipButtonRect.Y - (int)(15 * GUI.Scale);
}
}
private bool IsHandSlot(InvSlotType slotType)
{
return slotType == InvSlotType.LeftHand || slotType == InvSlotType.RightHand;
}
protected override void ControlInput(Camera cam)
@@ -500,32 +432,6 @@ namespace Barotrauma
}
}
public void ToggleInventory(bool automaticToggle = false)
{
if (Character.Controlled == null || !Character.Controlled.IsHuman || wasInventoryToggledAutomatically || inventoryOpen && automaticToggle) return;
inventoryOpen = !inventoryOpen;
if (inventoryOpen)
{
wasInventoryToggledAutomatically = automaticToggle;
BackgroundFrame.Offset(0, -inventoryOpeningOffset);
InventoryToggleArea.Offset(0, -inventoryOpeningOffset);
}
else
{
BackgroundFrame.Offset(0, inventoryOpeningOffset);
InventoryToggleArea.Offset(0, inventoryOpeningOffset);
}
}
private void HandleAutomaticInventoryState()
{
if (wasInventoryToggledAutomatically && inventoryOpen && Character.Controlled.SelectedConstruction == null && Character.Controlled.SelectedCharacter == null)
{
wasInventoryToggledAutomatically = false;
ToggleInventory();
}
}
public override void Update(float deltaTime, Camera cam, bool isSubInventory = false)
{
if (!AccessibleWhenAlive && !character.IsDead)
@@ -534,8 +440,6 @@ namespace Barotrauma
return;
}
HandleAutomaticInventoryState();
base.Update(deltaTime, cam);
bool hoverOnInventory = GUI.MouseOn == null &&
@@ -564,12 +468,6 @@ namespace Barotrauma
slots[i].DrawOffset = Vector2.Lerp(Vector2.Zero, new Vector2(personalSlotArea.Width, 0.0f), hidePersonalSlotsState);
}
}
InventoryToggleContains = InventoryToggleArea.Contains(PlayerInput.MousePosition);
if (InventoryToggleContains && PlayerInput.PrimaryMouseButtonClicked())
{
ToggleInventory();
}
}
if (hoverOnInventory) { HideTimer = 0.5f; }
@@ -726,10 +624,7 @@ namespace Barotrauma
private void HandleButtonEquipStates(Item item, InventorySlot slot, float deltaTime)
{
Rectangle modifiedRect = slot.EquipButtonRect;
modifiedRect.Width = slot.InteractRect.Width;
slot.EquipButtonState = modifiedRect.Contains(PlayerInput.MousePosition) ?
slot.EquipButtonState = slot.EquipButtonRect.Contains(PlayerInput.MousePosition) ?
GUIComponent.ComponentState.Hover : GUIComponent.ComponentState.None;
if (PlayerInput.LeftButtonHeld() && PlayerInput.RightButtonHeld())
{
@@ -803,8 +698,6 @@ namespace Barotrauma
continue;
}
if (num > hotkeyCount) break;
if (SlotTypes[i] == InvSlotType.Any)
{
slots[i].QuickUseKey = Keys.D0 + num % 10;
@@ -950,7 +843,7 @@ namespace Barotrauma
if (character.SelectedCharacter != null && character.SelectedCharacter.Inventory != null)
{
//player has selected the inventory of another character -> attempt to move the item there
success = character.SelectedCharacter.Inventory.TryPutItem(item, Character.Controlled, item.AllowedSlots, true, true);
success = character.SelectedCharacter.Inventory.TryPutItem(item, Character.Controlled, item.AllowedSlots, true);
}
break;
case QuickUseAction.PutToContainer:
@@ -966,7 +859,7 @@ namespace Barotrauma
character.SelectedBy.Inventory != null)
{
//item is in the inventory of another character -> attempt to get the item from there
success = character.SelectedBy.Inventory.TryPutItemWithAutoEquipCheck(item, Character.Controlled, item.AllowedSlots, true, true);
success = character.SelectedBy.Inventory.TryPutItemWithAutoEquipCheck(item, Character.Controlled, item.AllowedSlots, true);
}
break;
case QuickUseAction.TakeFromContainer:
@@ -985,7 +878,7 @@ namespace Barotrauma
// No subinventory found or placing unsuccessful -> attempt to put in the character's inventory
if (!success)
{
success = TryPutItemWithAutoEquipCheck(item, Character.Controlled, item.AllowedSlots, true, true);
success = TryPutItemWithAutoEquipCheck(item, Character.Controlled, item.AllowedSlots, true);
}
break;
case QuickUseAction.PutToEquippedItem:
@@ -1017,86 +910,128 @@ namespace Barotrauma
GUI.PlayUISound(success ? GUISoundType.PickItem : GUISoundType.PickItemFail);
}
public void DrawThis(SpriteBatch spriteBatch)
public void DrawOwn(SpriteBatch spriteBatch)
{
if (!AccessibleWhenAlive && !character.IsDead) { return; }
if (slots == null) { CreateSlots(); }
if (prevResolution.X != GameMain.GraphicsWidth || prevResolution.Y != GameMain.GraphicsHeight)
if (!AccessibleWhenAlive && !character.IsDead) return;
if (slots == null) CreateSlots();
if (GameMain.GraphicsWidth != screenResolution.X ||
GameMain.GraphicsHeight != screenResolution.Y ||
prevUIScale != UIScale ||
prevHUDScale != GUI.Scale)
{
SetSlotPositions();
SetSlotPositions(layout);
prevUIScale = UIScale;
prevHUDScale = GUI.Scale;
}
if (layout == Layout.Center)
{
CalculateBackgroundFrame();
GUI.DrawRectangle(spriteBatch, BackgroundFrame, Color.Black * 0.8f, true);
GUI.DrawString(spriteBatch,
new Vector2((int)(BackgroundFrame.Center.X - GUI.Font.MeasureString(character.Name).X / 2), (int)BackgroundFrame.Y + 5),
character.Name, Color.White * 0.9f);
}
for (int i = 0; i < capacity; i++)
{
if (HideSlot(i)) continue;
Rectangle interactRect = slots[i].InteractRect;
interactRect.Location += slots[i].DrawOffset.ToPoint();
//don't draw the item if it's being dragged out of the slot
bool drawItem = draggingItem == null || draggingItem != Items[i] || interactRect.Contains(PlayerInput.MousePosition);
DrawSlot(spriteBatch, this, slots[i], Items[i], i, drawItem, SlotTypes[i]);
}
if (hideButton != null && hideButton.Visible && !Locked)
{
hideButton.DrawManually(spriteBatch, alsoChildren: true);
}
if (layout == Layout.Default)
{
inventoryBackgroundSprite.Draw(spriteBatch, BackgroundFrame.Location.ToVector2(), Color.White, Vector2.Zero, rotate: 0, scale: bgScale);
Vector2 backgroundFrameCenter = new Vector2(BackgroundFrame.Center.X, BackgroundFrame.Top);
inventoryExtendButton.Draw(spriteBatch, backgroundFrameCenter - inventoryExtendButtonOffset, Color.White, scale: UIScale * 1.5f);
Vector2 arrowPosition = backgroundFrameCenter - inventoryArrowOffset;
if (inventoryOpen)
{
inventoryExtendDownArrow.Draw(spriteBatch, arrowPosition, Color.White, scale: UIScale * 1.25f);
}
else
{
inventoryExtendUpArrow.Draw(spriteBatch, arrowPosition, Color.White, scale: UIScale * 1.25f);
}
GUI.DrawString(spriteBatch, arrowPosition + new Vector2(UIScale * 25, -3 * UIScale), GameMain.Config.KeyBindText(InputType.ToggleInventory), Color.White, font: GUI.HotkeyFont);
}
InventorySlot highlightedQuickUseSlot = null;
for (int i = 0; i < capacity; i++)
{
if (HideSlot(i)) continue;
if (IsSlotHiddenDueToToggleState(i)) continue;
InventorySlot slot = slots[i];
Item item = Items[i];
InvSlotType slotType = SlotTypes[i];
Rectangle interactRect = slot.InteractRect;
interactRect.Location += slot.DrawOffset.ToPoint();
//don't draw the item if it's being dragged out of the slot
bool drawItem = draggingItem == null || draggingItem != item || interactRect.Contains(PlayerInput.MousePosition);
DrawSlot(spriteBatch, this, slot, item, i, drawItem, slotType);
if (item == null || (draggingItem == item && !slot.InteractRect.Contains(PlayerInput.MousePosition)) || !item.AllowedSlots.Any(a => a != InvSlotType.Any))
if (Items[i] == null ||
(draggingItem == Items[i] && !slots[i].InteractRect.Contains(PlayerInput.MousePosition)) ||
!Items[i].AllowedSlots.Any(a => a != InvSlotType.Any))
{
//draw limb icons on empty slots
if (limbSlotIcons.ContainsKey(slotType))
if (limbSlotIcons.ContainsKey(SlotTypes[i]))
{
var icon = limbSlotIcons[slotType];
icon.Draw(spriteBatch, slot.Rect.Center.ToVector2() + slot.DrawOffset, GUIColorSettings.EquipmentSlotIconColor, origin: icon.size / 2, scale: slot.Rect.Width / icon.size.X);
var icon = limbSlotIcons[SlotTypes[i]];
icon.Draw(spriteBatch, slots[i].Rect.Center.ToVector2() + slots[i].DrawOffset, GUIColorSettings.EquipmentSlotIconColor, origin: icon.size / 2, scale: slots[i].Rect.Width / icon.size.X);
}
continue;
}
if (draggingItem == Items[i] && !slots[i].IsHighlighted) continue;
//draw hand icons if the item is equipped in a hand slot
if (IsInLimbSlot(Items[i], InvSlotType.LeftHand))
{
var icon = limbSlotIcons[InvSlotType.LeftHand];
icon.Draw(spriteBatch, new Vector2(slots[i].Rect.X, slots[i].Rect.Bottom) + slots[i].DrawOffset, Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.35f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f);
}
if (IsInLimbSlot(Items[i], InvSlotType.RightHand))
{
var icon = limbSlotIcons[InvSlotType.RightHand];
icon.Draw(spriteBatch, new Vector2(slots[i].Rect.Right, slots[i].Rect.Bottom) + slots[i].DrawOffset, Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.65f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f);
}
// Draw always on hotkeys
if (slot.QuickUseKey != Keys.None)
{
DrawIndicatorAndHotkey(spriteBatch, slot, slot.EquipButtonState == GUIComponent.ComponentState.Hover);
}
GUIComponent.ComponentState state = slots[i].EquipButtonState;
if (state == GUIComponent.ComponentState.Hover)
{
highlightedQuickUseSlot = slots[i];
}
if (!Items[i].AllowedSlots.Any(a => a == InvSlotType.Any))
{
continue;
}
if (draggingItem == item && !slot.IsHighlighted) continue;
bool hover = slot.EquipButtonState == GUIComponent.ComponentState.Hover;
if (hover) highlightedQuickUseSlot = slot;
if (!item.AllowedSlots.Any(a => a == InvSlotType.Any)) continue;
DrawIndicatorAndHotkey(spriteBatch, slot, hover);
Color color = Color.White;
if (Locked)
{
color *= 0.5f;
}
if (character.HasEquippedItem(Items[i]))
{
switch (state)
{
case GUIComponent.ComponentState.None:
EquippedIndicator.Draw(spriteBatch, slots[i].EquipButtonRect.Center.ToVector2(), color, EquippedIndicator.Origin, 0, UIScale * IndicatorScaleAdjustment);
break;
case GUIComponent.ComponentState.Hover:
EquippedHoverIndicator.Draw(spriteBatch, slots[i].EquipButtonRect.Center.ToVector2(), color, EquippedIndicator.Origin, 0, UIScale * IndicatorScaleAdjustment);
break;
case GUIComponent.ComponentState.Pressed:
case GUIComponent.ComponentState.Selected:
case GUIComponent.ComponentState.HoverSelected:
EquippedClickedIndicator.Draw(spriteBatch, slots[i].EquipButtonRect.Center.ToVector2(), color, EquippedIndicator.Origin, 0, UIScale * IndicatorScaleAdjustment);
break;
}
}
else
{
switch (state)
{
case GUIComponent.ComponentState.None:
UnequippedIndicator.Draw(spriteBatch, slots[i].EquipButtonRect.Center.ToVector2(), color, EquippedIndicator.Origin, 0, UIScale * IndicatorScaleAdjustment);
break;
case GUIComponent.ComponentState.Hover:
UnequippedHoverIndicator.Draw(spriteBatch, slots[i].EquipButtonRect.Center.ToVector2(), color, EquippedIndicator.Origin, 0, UIScale * IndicatorScaleAdjustment);
break;
case GUIComponent.ComponentState.Pressed:
case GUIComponent.ComponentState.Selected:
case GUIComponent.ComponentState.HoverSelected:
UnequippedClickedIndicator.Draw(spriteBatch, slots[i].EquipButtonRect.Center.ToVector2(), color, EquippedIndicator.Origin, 0, UIScale * IndicatorScaleAdjustment);
break;
}
}
}
if (highlightedQuickUseSlot != null && !string.IsNullOrEmpty(highlightedQuickUseSlot.QuickUseButtonToolTip))
@@ -1104,30 +1039,5 @@ namespace Barotrauma
GUIComponent.DrawToolTip(spriteBatch, highlightedQuickUseSlot.QuickUseButtonToolTip, highlightedQuickUseSlot.EquipButtonRect);
}
}
private void DrawIndicatorAndHotkey(SpriteBatch spriteBatch, InventorySlot slot, bool hover)
{
Color indicatorColor = (hover) ? Color.White : Color.White * 0.8f;
/*if (character.HasEquippedItem(item))
{
indicatorColor = hover ? GUIColorSettings.InventorySlotEquippedColor : GUIColorSettings.InventorySlotEquippedColor * 0.8f;
}
else
{
indicatorColor = hover ? GUIColorSettings.InventorySlotColor : GUIColorSettings.InventorySlotColor * 0.8f;
}*/
if (Locked) indicatorColor *= 0.3f;
Rectangle equipRect = slot.EquipButtonRect;
EquipIndicator.Draw(spriteBatch, new Vector2(equipRect.Center.X, equipRect.Bottom), indicatorColor, EquipIndicator.Origin, 0, UIScale * 0.6f);
if (slot.QuickUseKey != Keys.None)
{
GUI.DrawString(spriteBatch, new Vector2(slot.Rect.Center.X - 2, slot.Rect.Top), slot.QuickUseKey.ToString().Substring(1, 1), Color.Black, font: GUI.HotkeyFont);
}
}
}
}