Set Order for customize again.

This commit is contained in:
Ottermandias 2023-12-24 14:37:04 +01:00
parent 44a65f61fb
commit d81a6b7f6f
2 changed files with 15 additions and 14 deletions

View file

@ -248,19 +248,6 @@ public class CustomizeSet
public CharaMakeParams.MenuType Type(CustomizeIndex index) public CharaMakeParams.MenuType Type(CustomizeIndex index)
=> Types[(int)index]; => Types[(int)index];
internal static IReadOnlyDictionary<CharaMakeParams.MenuType, CustomizeIndex[]> ComputeOrder(CustomizeSet set)
{
var ret = Enum.GetValues<CustomizeIndex>().ToArray();
ret[(int)CustomizeIndex.TattooColor] = CustomizeIndex.EyeColorLeft;
ret[(int)CustomizeIndex.EyeColorLeft] = CustomizeIndex.EyeColorRight;
ret[(int)CustomizeIndex.EyeColorRight] = CustomizeIndex.TattooColor;
var dict = ret.Skip(2).Where(set.IsAvailable).GroupBy(set.Type).ToDictionary(k => k.Key, k => k.ToArray());
foreach (var type in Enum.GetValues<CharaMakeParams.MenuType>())
dict.TryAdd(type, Array.Empty<CustomizeIndex>());
return dict;
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public int Count(CustomizeIndex index) public int Count(CustomizeIndex index)
=> Count(index, CustomizeValue.Zero); => Count(index, CustomizeValue.Zero);

View file

@ -68,6 +68,7 @@ internal class CustomizeSetFactory(
SetFacialFeatures(set, row); SetFacialFeatures(set, row);
SetHairByFace(set); SetHairByFace(set);
SetNpcData(set, set.Clan, set.Gender); SetNpcData(set, set.Clan, set.Gender);
SetOrder(set);
} }
/// <summary> Given a customize set with filled data, find all customizations used by valid NPCs that are not regularly available. </summary> /// <summary> Given a customize set with filled data, find all customizations used by valid NPCs that are not regularly available. </summary>
@ -303,7 +304,7 @@ internal class CustomizeSetFactory(
} }
/// <summary> Get the manu types for all available options. </summary> /// <summary> Get the manu types for all available options. </summary>
private CharaMakeParams.MenuType[] GetMenuTypes(CharaMakeParams row) private static CharaMakeParams.MenuType[] GetMenuTypes(CharaMakeParams row)
{ {
// Set up the menu types for all customizations. // Set up the menu types for all customizations.
return Enum.GetValues<CustomizeIndex>().Select(c => return Enum.GetValues<CustomizeIndex>().Select(c =>
@ -394,6 +395,19 @@ internal class CustomizeSetFactory(
} }
} }
internal static void SetOrder(CustomizeSet set)
{
var ret = Enum.GetValues<CustomizeIndex>().ToArray();
ret[(int)CustomizeIndex.TattooColor] = CustomizeIndex.EyeColorLeft;
ret[(int)CustomizeIndex.EyeColorLeft] = CustomizeIndex.EyeColorRight;
ret[(int)CustomizeIndex.EyeColorRight] = CustomizeIndex.TattooColor;
var dict = ret.Skip(2).Where(set.IsAvailable).GroupBy(set.Type).ToDictionary(k => k.Key, k => k.ToArray());
foreach (var type in Enum.GetValues<CharaMakeParams.MenuType>())
dict.TryAdd(type, []);
set.Order = dict;
}
/// <summary> Set hairstyles per face for Hrothgar and make it simple for non-Hrothgar. </summary> /// <summary> Set hairstyles per face for Hrothgar and make it simple for non-Hrothgar. </summary>
private void SetHairByFace(CustomizeSet set) private void SetHairByFace(CustomizeSet set)
{ {