(9619c01cd) Change the info text colors and cache the list.

This commit is contained in:
Joonas Rikkonen
2019-04-10 13:22:19 +03:00
parent d7c88e3055
commit 842b6a2e34
@@ -1608,23 +1608,22 @@ namespace Barotrauma
if (remove) { Spawner?.AddToRemoveQueue(this); } if (remove) { Spawner?.AddToRemoveQueue(this); }
} }
List<ColoredText> texts = new List<ColoredText>();
public List<ColoredText> GetHUDTexts(Character character) public List<ColoredText> GetHUDTexts(Character character)
{ {
List<ColoredText> texts = new List<ColoredText>(); texts.Clear();
foreach (ItemComponent ic in components) foreach (ItemComponent ic in components)
{ {
if (string.IsNullOrEmpty(ic.DisplayMsg)) continue; if (string.IsNullOrEmpty(ic.DisplayMsg)) continue;
if (!ic.CanBePicked && !ic.CanBeSelected) continue; if (!ic.CanBePicked && !ic.CanBeSelected) continue;
if (ic is Holdable holdable && !holdable.CanBeDeattached()) continue; if (ic is Holdable holdable && !holdable.CanBeDeattached()) continue;
Color color = Color.Red; Color color = Color.Gray;
bool hasRequiredSkillsAndItems = ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false); bool hasRequiredSkillsAndItems = ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false);
if (hasRequiredSkillsAndItems) if (hasRequiredSkillsAndItems)
{ {
color = Color.Orange; color = Color.Cyan;
} }
// TODO: Blue color if the item is selected
texts.Add(new ColoredText(ic.DisplayMsg, color, false)); texts.Add(new ColoredText(ic.DisplayMsg, color, false));
} }