Пример #1
0
            private static void LoadFacePresetPrefix(ChaFileControl __instance, ref HeadPresetInfo __state)
            {
                __state = null;
                int headID = __instance.custom.face.headId;

                if (headID >= BaseSlotID)
                {
                    ChaListControl chaListCtrl = Singleton <Character> .Instance.chaListCtrl;
                    ListInfoBase   listInfo    = chaListCtrl.GetListInfo(__instance.parameter.sex == 0 ? ChaListDefine.CategoryNo.mo_head : ChaListDefine.CategoryNo.fo_head, __instance.custom.face.headId);
                    string         preset      = listInfo.GetInfo(ChaListDefine.KeyType.Preset);

                    var resolveinfo = TryGetResolutionInfo(__instance.parameter.sex == 0 ? ChaListDefine.CategoryNo.mo_head : ChaListDefine.CategoryNo.fo_head, __instance.custom.face.headId);
                    if (resolveinfo == null)
                    {
                        return;
                    }

                    var headPresetInfo = TryGetHeadPresetInfo(resolveinfo.Slot, resolveinfo.GUID, preset);
                    __state = headPresetInfo;
                }
                else
                {
                    ChaListControl chaListCtrl = Singleton <Character> .Instance.chaListCtrl;
                    ListInfoBase   listInfo    = chaListCtrl.GetListInfo(__instance.parameter.sex == 0 ? ChaListDefine.CategoryNo.mo_head : ChaListDefine.CategoryNo.fo_head, __instance.custom.face.headId);
                    string         preset      = listInfo.GetInfo(ChaListDefine.KeyType.Preset);

                    var headPresetInfo = TryGetHeadPresetInfo(headID, null, preset);
                    __state = headPresetInfo;
                }
            }
Пример #2
0
            internal static void LoadFacePresetPostfix(ChaFileControl __instance, ref HeadPresetInfo __state)
            {
                if (__state == null)
                {
                    return;
                }

                List <ResolveInfo> faceResolveInfos   = new List <ResolveInfo>();
                List <ResolveInfo> makeupResolveInfos = new List <ResolveInfo>();
                Dictionary <CategoryProperty, StructValue <int> > structref = __instance.parameter.sex == 0 ? StructReference.ChaFileFacePropertiesMale : StructReference.ChaFileFacePropertiesFemale;

                foreach (var property in structref)
                {
                    if (__state.FaceData[property.Key.Property] == null)
                    {
                        continue;
                    }
                    var resolveinfo = TryGetResolutionInfo(property.Value.GetMethod(__instance.custom.face), $"{property.Key.Prefix}.{property.Key.Property}", property.Key.Category, __state.FaceData[property.Key.Property]);
                    if (resolveinfo == null)
                    {
                        ShowGUIDError(__state.FaceData[property.Key.Property]);
                    }
                    else
                    {
                        faceResolveInfos.Add(resolveinfo);
                    }
                }

                foreach (var property in StructReference.ChaFileMakeupProperties)
                {
                    if (__state.MakeupData[property.Key.Property] == null)
                    {
                        continue;
                    }
                    var resolveinfo = TryGetResolutionInfo(property.Value.GetMethod(__instance.custom.face.makeup), $"{property.Key.Prefix}.{property.Key.Property}", property.Key.Category, __state.MakeupData[property.Key.Property]);
                    if (resolveinfo == null)
                    {
                        ShowGUIDError(__state.MakeupData[property.Key.Property]);
                    }
                    else
                    {
                        makeupResolveInfos.Add(resolveinfo);
                    }
                }

                ResolveStructure(structref, __instance.custom.face, faceResolveInfos);
                ResolveStructure(StructReference.ChaFileMakeupProperties, __instance.custom.face.makeup, makeupResolveInfos);
            }