Markings tweaks (#8394)

* fixes issue with indexing into colors on multi-sprite markings

* should rebuild the dummy upon character profile switch in client

* markings, when selected, should now default to the current character's skin color

* whoops, missed one

* adds a type serializer into marking points

* that has to be a list serializer, oops
This commit is contained in:
Flipp Syder
2022-05-23 18:55:43 -07:00
committed by GitHub
parent 5c44abc3f2
commit 2b45894879
3 changed files with 23 additions and 7 deletions

View File

@@ -47,11 +47,13 @@ namespace Content.Client.Markings
private List<MarkingCategories> _markingCategories = Enum.GetValues<MarkingCategories>().ToList();
private string _currentSpecies = SpeciesManager.DefaultSpecies;
public Color CurrentSkinColor = Color.White;
public void SetData(MarkingsSet newMarkings, string species)
public void SetData(MarkingsSet newMarkings, string species, Color skinColor)
{
_currentMarkings = newMarkings;
_currentSpecies = species;
CurrentSkinColor = skinColor;
// Should marking limits be dependent on species prototypes,
// or should it be dependent on the entity the
@@ -72,6 +74,8 @@ namespace Content.Client.Markings
PopulateUsed();
}
public void SetSkinColor(Color color) => CurrentSkinColor = color;
public MarkingPicker()
{
RobustXamlLoader.Load(this);
@@ -349,9 +353,9 @@ namespace Content.Client.Markings
);
colorSelector.Color = currentColor;
_currentMarkingColors.Add(currentColor);
int colorIndex = _currentMarkingColors.IndexOf(currentColor);
var colorIndex = _currentMarkingColors.Count - 1;
Action<Color> colorChanged = delegate(Color color)
Action<Color> colorChanged = _ =>
{
_currentMarkingColors[colorIndex] = colorSelector.Color;
@@ -394,7 +398,13 @@ namespace Content.Client.Markings
UpdatePoints();
_currentMarkings.AddBack(marking.AsMarking());
var markingObject = marking.AsMarking();
for (var i = 0; i < markingObject.MarkingColors.Count; i++)
{
markingObject.SetColor(i, CurrentSkinColor);
}
_currentMarkings.AddBack(markingObject);
CMarkingsUnused.Remove(_selectedUnusedMarking);
var item = new ItemList.Item(CMarkingsUsed)