Example #1
0
            static bool Prefix(GameObject clothRoot, bool showHat, string[] ___nudeAppearUnits, string[] ___equipAppearUnits, AppearData ___appearData, string ___tattooPath, ActorEquip __instance)
            {
                List <AppearUnit> list         = new List <AppearUnit>();
                AppearUnit        tattooTarget = null;

                for (int i = 0; i < 5; i++)
                {
                    if (___nudeAppearUnits.Length > i && ___nudeAppearUnits[i] != null)
                    {
                        AppearUnit appearUnit = null;
                        if (i < ___equipAppearUnits.Length && !string.IsNullOrEmpty(___equipAppearUnits[i]) && ((showHat && Singleton <OptionsMgr> .Self.ShowHat) || i != 1))
                        {
                            AppearUnit appearUnit2 = Singleton <ResMgr> .Instance.LoadSyncByType <AppearUnit>(AssetType.Appear, ___equipAppearUnits[i]);

                            if (appearUnit2 != null)
                            {
                                appearUnit = appearUnit2;
                                if (___equipAppearUnits[i].Contains("Linda_Pants018"))
                                {
                                    //appearUnit.Smr.material.SetTexture("_MainTex", customTextures["Linda_Pants018"]);
                                }
                            }
                        }
                        else
                        {
                            appearUnit = Singleton <ResMgr> .Instance.LoadSyncByType <AppearUnit>(AssetType.Appear, ___nudeAppearUnits[i]);
                        }
                        if (appearUnit != null)
                        {
                            list.Add(appearUnit);
                            if (i == 0)
                            {
                                tattooTarget = appearUnit;
                            }
                        }
                    }
                }
                if (clothRoot == null)
                {
                    clothRoot = __instance.ClothRoot;
                }
                AppearTarget.Instance.SetRoot(clothRoot);
                AppearTarget.Instance.BuildMesh(list, ___appearData, tattooTarget, ___tattooPath);

                MethodInfo dynMethod = __instance.GetType().GetMethod("ApplyDyboneConfigs", BindingFlags.NonPublic | BindingFlags.Instance);

                dynMethod.Invoke(__instance, new object[] { AppearTarget.Instance.BoneDic });

                return(false);
            }
Example #2
0
            static bool Prefix(ref SkinnedMeshRenderer __result, ref ActorEquip __instance, string[] ___nudeAppearUnits,
                               string[] ___equipAppearUnits, ref AppearData ___appearData, ref string ___tattooPath,
                               GameObject clothRoot = null, bool showHat = true)
            {
                List <AppearUnit> list         = new List <AppearUnit>();
                AppearUnit        tattooTarget = null;

                for (int i = 0; i < 5; i++)
                {
                    if (___nudeAppearUnits.Length > i && ___nudeAppearUnits[i] != null)
                    {
                        AppearUnit appearUnit = null;
                        if (i < ___equipAppearUnits.Length && !string.IsNullOrEmpty(___equipAppearUnits[i]) &&
                            ((showHat && Singleton <OptionsMgr> .Self.ShowHat) || i != 1))
                        {
                            AppearUnit appearUnit2 =
                                Singleton <ResMgr> .Instance.LoadSyncByType <AppearUnit>(AssetType.Appear,
                                                                                         ___equipAppearUnits[i]);

                            if (appearUnit2 != null)
                            {
                                Dbgl("ActorEquip path: " + ___equipAppearUnits[i]);
                                foreach (string key in customClothes.Keys)
                                {
                                    if (___equipAppearUnits[i].EndsWith(key))
                                    {
                                        appearUnit2.Smr.material.SetTexture("_MainTex", customClothes[key]);
                                    }
                                }

                                appearUnit = appearUnit2;
                            }
                        }
                        else
                        {
                            appearUnit =
                                Singleton <ResMgr> .Instance.LoadSyncByType <AppearUnit>(AssetType.Appear,
                                                                                         ___nudeAppearUnits[i]);
                        }

                        if (appearUnit != null)
                        {
                            list.Add(appearUnit);
                            if (i == 0)
                            {
                                tattooTarget = appearUnit;
                            }
                        }
                    }
                }

                if (clothRoot == null)
                {
                    clothRoot = __instance.ClothRoot;
                }

                AppearTarget.Instance.SetRoot(clothRoot);
                SkinnedMeshRenderer result =
                    AppearTarget.Instance.BuildMesh(list, ___appearData, tattooTarget, ___tattooPath);

                MethodInfo dynMethod = __instance.GetType()
                                       .GetMethod("ApplyDyboneConfigs", BindingFlags.NonPublic | BindingFlags.Instance);

                dynMethod.Invoke(__instance, new object[] { AppearTarget.Instance.BoneDic });

                __result = result;
                return(false);
            }