예제 #1
0
            static void Postfix(AppearTarget __instance, ref SkinnedMeshRenderer __result)
            {
                if (!enabled || !settings.EnablePlayerModelling)
                {
                    return;
                }

                List <string> bones = new List <string>();

                for (int j = 0; j < __result.bones.Length; j++)
                {
                    if (__result.bones[j].name == "Bip001 Spine2")
                    {
                        //Dbgl(__result.bones[j].name + " " + __result.bones[j].position);
                    }
                }
                //Dbgl(string.Join("\r\n", bones.ToArray()));
            }
예제 #2
0
            static void Prefix(AppearTarget __instance, AppearData appearData, ref List <AppearUnit> units)
            {
                Dbgl($"Building player mesh");

                if (!enabled || !settings.EnablePlayerModelling)
                {
                    return;
                }

                for (int i = 0; i < units.Count; i++)
                {
                    //Dbgl(units[i].name + " " + units[i].Part + " "+ (units[i].Smr != null && units[i].Smr.rootBone != null? units[i].Smr.rootBone.position+"" : ""));
                    bool isFemale = units[i].name.StartsWith("AppearUnit_Linda");

                    if (units[i].Part == AppearPartEnum.Body && settings.playerClothes > 0)
                    {
                        if (!playerAppearUnits.ContainsKey(units[i].name))
                        {
                            playerAppearUnits.Add(units[i].name, GameObject.Instantiate <AppearUnit>(units[i]));
                        }
                        units[i]     = playerAppearUnits[units[i].name];
                        units[i].Smr = Singleton <ResMgr> .Instance.LoadSyncByType <NpcAppearUnit>(AssetType.NpcAppear, playerClothesNames[settings.playerClothes]).smrs[0];

                        for (int j = 0; j < units[i].Smr.bones.Length; j++)
                        {
                            if (units[i].Smr.bones[j].name == "Bip001 Spine1")
                            {
                                if (isFemale)
                                {
                                    Transform bone = Transform.Instantiate(units[i].Smr.bones[j], units[i].Smr.bones[j].parent, false);
                                    units[i].Smr.bones[j]      = bone;
                                    units[i].Smr.bones[j].name = "Bip001 Spine2";
                                }
                            }
                        }
                    }
                    if (units[i].Part == AppearPartEnum.Foot && settings.playerClothes > 0)
                    {
                        if (settings.playerHair > 0)
                        {
                            //units[i] = GameObject.Instantiate<AppearUnit>(units[i], units[i].);
                            units[i].Smr = null;
                        }
                    }
                    else if (units[i].Part == AppearPartEnum.Head && units[i].Smr != null && units[i].Smr.bones != null)
                    {
                        if (isFemale)
                        {
                            units[i].Smr.rootBone.position = new Vector3(0, 1.13f + settings.playerHeadOffset, 0);
                        }
                        else
                        {
                            units[i].Smr.rootBone.position = new Vector3(0, 1f + settings.playerHeadOffset, 0);
                        }
                    }
                    else if (units[i].Part == AppearPartEnum.Hair && units[i].Smr != null && units[i].Smr.bones != null)
                    {
                        if (settings.playerHair > 0)
                        {
                            if (!playerAppearUnits.ContainsKey(units[i].name))
                            {
                                playerAppearUnits.Add(units[i].name, GameObject.Instantiate <AppearUnit>(units[i]));
                            }
                            units[i]     = playerAppearUnits[units[i].name];
                            units[i].Smr = Singleton <ResMgr> .Instance.LoadSyncByType <NpcAppearUnit>(AssetType.NpcAppear, playerHairNames[settings.playerHair]).smrs[0];
                        }
                        if (isFemale)
                        {
                            units[i].Smr.rootBone.position = new Vector3(0, 1.35f + settings.playerHeadOffset + settings.playerHairOffset, 0);
                        }
                        else
                        {
                            units[i].Smr.rootBone.position = new Vector3(0, 1.40f + settings.playerHeadOffset + settings.playerHairOffset, 0);
                        }
                    }
                }
            }