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:
@@ -47,11 +47,13 @@ namespace Content.Client.Markings
|
|||||||
private List<MarkingCategories> _markingCategories = Enum.GetValues<MarkingCategories>().ToList();
|
private List<MarkingCategories> _markingCategories = Enum.GetValues<MarkingCategories>().ToList();
|
||||||
|
|
||||||
private string _currentSpecies = SpeciesManager.DefaultSpecies;
|
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;
|
_currentMarkings = newMarkings;
|
||||||
_currentSpecies = species;
|
_currentSpecies = species;
|
||||||
|
CurrentSkinColor = skinColor;
|
||||||
|
|
||||||
// Should marking limits be dependent on species prototypes,
|
// Should marking limits be dependent on species prototypes,
|
||||||
// or should it be dependent on the entity the
|
// or should it be dependent on the entity the
|
||||||
@@ -72,6 +74,8 @@ namespace Content.Client.Markings
|
|||||||
PopulateUsed();
|
PopulateUsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetSkinColor(Color color) => CurrentSkinColor = color;
|
||||||
|
|
||||||
public MarkingPicker()
|
public MarkingPicker()
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
@@ -349,9 +353,9 @@ namespace Content.Client.Markings
|
|||||||
);
|
);
|
||||||
colorSelector.Color = currentColor;
|
colorSelector.Color = currentColor;
|
||||||
_currentMarkingColors.Add(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;
|
_currentMarkingColors[colorIndex] = colorSelector.Color;
|
||||||
|
|
||||||
@@ -394,7 +398,13 @@ namespace Content.Client.Markings
|
|||||||
|
|
||||||
UpdatePoints();
|
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);
|
CMarkingsUnused.Remove(_selectedUnusedMarking);
|
||||||
var item = new ItemList.Item(CMarkingsUsed)
|
var item = new ItemList.Item(CMarkingsUsed)
|
||||||
|
|||||||
@@ -555,6 +555,7 @@ namespace Content.Client.Preferences.UI
|
|||||||
|
|
||||||
var color = Color.FromHsv(new Vector4(hue / 360, sat / 100, val / 100, 1.0f));
|
var color = Color.FromHsv(new Vector4(hue / 360, sat / 100, val / 100, 1.0f));
|
||||||
|
|
||||||
|
CMarkings.CurrentSkinColor = color;
|
||||||
Profile = Profile.WithCharacterAppearance(Profile.Appearance.WithSkinColor(color));
|
Profile = Profile.WithCharacterAppearance(Profile.Appearance.WithSkinColor(color));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -567,6 +568,8 @@ namespace Content.Client.Preferences.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
var color = new Color(_rgbSkinColorSelector.Color.R, _rgbSkinColorSelector.Color.G, _rgbSkinColorSelector.Color.B);
|
var color = new Color(_rgbSkinColorSelector.Color.R, _rgbSkinColorSelector.Color.G, _rgbSkinColorSelector.Color.B);
|
||||||
|
|
||||||
|
CMarkings.CurrentSkinColor = color;
|
||||||
Profile = Profile.WithCharacterAppearance(Profile.Appearance.WithSkinColor(color));
|
Profile = Profile.WithCharacterAppearance(Profile.Appearance.WithSkinColor(color));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -584,6 +587,7 @@ namespace Content.Client.Preferences.UI
|
|||||||
newColor.Y = .1f;
|
newColor.Y = .1f;
|
||||||
color = Color.FromHsv(newColor);
|
color = Color.FromHsv(newColor);
|
||||||
|
|
||||||
|
CMarkings.CurrentSkinColor = color;
|
||||||
Profile = Profile.WithCharacterAppearance(Profile.Appearance.WithSkinColor(color));
|
Profile = Profile.WithCharacterAppearance(Profile.Appearance.WithSkinColor(color));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -834,7 +838,7 @@ namespace Content.Client.Preferences.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMarkings.SetData(Profile.Appearance.Markings, Profile.Species);
|
CMarkings.SetData(Profile.Appearance.Markings, Profile.Species, Profile.Appearance.SkinColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSpecies()
|
private void UpdateSpecies()
|
||||||
@@ -945,7 +949,7 @@ namespace Content.Client.Preferences.UI
|
|||||||
UpdateAntagPreferences();
|
UpdateAntagPreferences();
|
||||||
UpdateMarkings();
|
UpdateMarkings();
|
||||||
|
|
||||||
_needUpdatePreview = true;
|
NeedsDummyRebuild = true;
|
||||||
|
|
||||||
_preferenceUnavailableButton.SelectId((int) Profile.PreferenceUnavailable);
|
_preferenceUnavailableButton.SelectId((int) Profile.PreferenceUnavailable);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using Content.Shared.CharacterAppearance;
|
using Content.Shared.CharacterAppearance;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||||
|
|
||||||
namespace Content.Shared.Markings
|
namespace Content.Shared.Markings
|
||||||
{
|
{
|
||||||
@@ -32,7 +34,7 @@ namespace Content.Shared.Markings
|
|||||||
[DataField("required", required: true)]
|
[DataField("required", required: true)]
|
||||||
public bool Required = false;
|
public bool Required = false;
|
||||||
// Default markings for this layer.
|
// Default markings for this layer.
|
||||||
[DataField("defaultMarkings")]
|
[DataField("defaultMarkings", customTypeSerializer:typeof(PrototypeIdListSerializer<MarkingPrototype>))]
|
||||||
public List<string> DefaultMarkings = new();
|
public List<string> DefaultMarkings = new();
|
||||||
|
|
||||||
public static Dictionary<MarkingCategories, MarkingPoints> CloneMarkingPointDictionary(Dictionary<MarkingCategories, MarkingPoints> self)
|
public static Dictionary<MarkingCategories, MarkingPoints> CloneMarkingPointDictionary(Dictionary<MarkingCategories, MarkingPoints> self)
|
||||||
|
|||||||
Reference in New Issue
Block a user