- add: database for genitals

This commit is contained in:
2024-02-16 21:21:19 +03:00
parent 52628d0393
commit c3e8e64fb8
14 changed files with 3907 additions and 14 deletions

View File

@@ -65,6 +65,14 @@ public sealed partial class GenitalController : Control
};
}
public void SetColor(Color? color)
{
if (color is null)
CheckBox.Pressed = true;
else
Color.Color = color.Value;
}
private void OnColorChanged(Color obj)
{
if(!CheckBox.Pressed)

View File

@@ -21,17 +21,22 @@ public sealed partial class HumanoidProfileEditor
_genitals.Clear();
GenitalBoxView.ClearChilds();
Logger.Debug(Profile.Appearance.Genitals.Count + "<<");
var genitalsList = Profile.Appearance.Genitals.ToList();
foreach (var prototype in _prototypeManager.EnumeratePrototypes<GenitalsGroupPrototype>())
{
var controller = new GenitalController();
var selected = 0;
foreach (var genital in Profile.Appearance.Genitals.Where(genital => prototype.Prototypes.Contains(genital.GenitalId)))
foreach (var genital in genitalsList)
{
selected = prototype.Prototypes.IndexOf(genital.GenitalId);
if (!prototype.Prototypes.Contains(genital.GenitalId))
continue;
selected = prototype.Prototypes.IndexOf(genital.GenitalId) + 1;
controller.SetColor(genital.Color);
}
var controller = new GenitalController();
controller.GenitalsCollectionPrototype = prototype;
controller.InChange += ControllerOnInChange;
controller.SelectedId = selected;