Unstable 0.1300.0.10

This commit is contained in:
Markus Isberg
2021-04-16 15:51:16 +03:00
parent f48dfb5862
commit 245b48c3a3
29 changed files with 289 additions and 84 deletions
@@ -215,8 +215,10 @@ namespace Barotrauma
public Inventory Inventory;
public readonly Item Item;
public readonly bool IsSubSlot;
public string Tooltip;
public List<RichTextData> TooltipRichTextData;
public string Tooltip { get; private set; }
public List<RichTextData> TooltipRichTextData { get; private set;}
public int tooltipDisplayedCondition;
public SlotReference(Inventory parentInventory, VisualSlot slot, int slotIndex, bool isSubSlot, Inventory subInventory = null)
{
@@ -227,13 +229,26 @@ namespace Barotrauma
IsSubSlot = isSubSlot;
Item = ParentInventory.GetItemAt(slotIndex);
IEnumerable<Item> itemsInSlot = null;
if (parentInventory != null && Item != null)
{
itemsInSlot = parentInventory.GetItemsAt(slotIndex);
}
RefreshTooltip();
}
TooltipRichTextData = RichTextData.GetRichTextData(GetTooltip(Item, itemsInSlot), out Tooltip);
public bool TooltipNeedsRefresh()
{
if (Item == null) { return false; }
return (int)Item.ConditionPercentage != tooltipDisplayedCondition;
}
public void RefreshTooltip()
{
if (Item == null) { return; }
IEnumerable<Item> itemsInSlot = null;
if (ParentInventory != null && Item != null)
{
itemsInSlot = ParentInventory.GetItemsAt(SlotIndex);
}
TooltipRichTextData = RichTextData.GetRichTextData(GetTooltip(Item, itemsInSlot), out string newTooltip);
Tooltip = newTooltip;
tooltipDisplayedCondition = (int)Item.ConditionPercentage;
}
private string GetTooltip(Item item, IEnumerable<Item> itemsInSlot)
@@ -1370,6 +1385,10 @@ namespace Barotrauma
{
Rectangle slotRect = selectedSlot.Slot.Rect;
slotRect.Location += selectedSlot.Slot.DrawOffset.ToPoint();
if (selectedSlot.TooltipNeedsRefresh())
{
selectedSlot.RefreshTooltip();
}
DrawToolTip(spriteBatch, selectedSlot.Tooltip, slotRect, selectedSlot.TooltipRichTextData);
}
}
@@ -3288,9 +3288,12 @@ namespace Barotrauma.Networking
if (respawnManager != null)
{
string respawnText = string.Empty;
float textScale = 1.0f;
Color textColor = Color.White;
bool canChooseRespawn = GameMain.GameSession.GameMode is CampaignMode && Character.Controlled == null && Level.Loaded?.Type != LevelData.LevelType.Outpost;
bool canChooseRespawn =
GameMain.GameSession.GameMode is CampaignMode &&
Character.Controlled == null &&
Level.Loaded?.Type != LevelData.LevelType.Outpost &&
(characterInfo == null || HasSpawned);
if (respawnManager.CurrentState == RespawnManager.State.Waiting &&
respawnManager.RespawnCountdownStarted)
{