Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Content.Client/_DEN/Lobby/UI/Traits/EntityTraitSelector.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,18 @@ private static string ConstructTooltipDescription(EntityTraitPrototype trait,
return tooltipString;
}

public void SetInvalid(bool invalid)
public void UpdateAppearance(bool invalid)
{
SelectorCheckbox.Label.FontColorOverride = invalid ? Color.Red : null;
if (_trait is null)
return;
var valid = SharedPlayerRequirementManager.CheckRequirements(GetContext(), _trait.Requirements);
SelectorCheckbox.Disabled = !valid && !Preference;
Color? fontColor = null;
if (invalid)
fontColor = Color.Red;
else if (!valid)
fontColor = Color.Gray;

SelectorCheckbox.Label.FontColorOverride = fontColor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void SetCategory(TraitCategoryPrototype category)

var tooManySelected = TotalCost > category.MaxTraitPoints;
foreach (var selector in _selectors)
selector.SetInvalid(tooManySelected);
selector.UpdateAppearance(tooManySelected);
}
else
CategoryMaxTraitLabel.Visible = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public static bool CheckRequirement(PlayerRequirementContext context, IPlayerReq

// Check the actual requirement, now.
if (!requirement.CheckRequirement(context))
return false;
return requirement.Inverted;

return true;
return !requirement.Inverted;
}

/// <summary>
Expand Down
Loading