using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using UnityEngine; public class TBody : MonoBehaviour { public bool isLoadedBody { get { return this.m_bIsLoadedBody; } } public AudioSourceMgr AudioMan { get { return (!(this.m_AudioParent != null)) ? null : this.m_AudioParent.m_AudioMan; } } public void SetVoicePitch(int value) { if (this.AudioMan != null) { this.AudioMan.Pitch = SoundMgr.ConvertToAudioSourcePitch(value); } } public Transform SmBody { get { if (!this.m_SMbody) { if (!this.boMAN) { this.m_SMbody = CMT.SearchObjName(this.m_trBones, "_SM_body001", false); } else { this.m_SMbody = CMT.SearchObjName(this.m_trBones, "_SM_mbody", false); } } return this.m_SMbody; } } public jiggleBone jbMuneL { get; private set; } public jiggleBone jbMuneR { get; private set; } public float BoneHitHeightY { get { return this.m_trFloorPlane.position.y; } set { if (this.m_trFloorPlane != null) { this.m_trFloorPlane.position = new Vector3(0f, value, 0f); } this.m_BoneHitY = value; } } public void Init(Maid maid_, bool boMAN_ = false) { this.maid = maid_; this.boMAN = boMAN_; this.boMaid = !this.boMAN; this.m_strSlotName = new string[TBody.m_strDefSlotName.Length]; TBody.m_strDefSlotName.CopyTo(this.m_strSlotName, 0); if (this.boMAN) { for (int i = 0; i < this.m_strSlotName.Length; i++) { this.m_strSlotName[i] = this.m_strSlotName[i].Replace("Bip01", "ManBip"); } } TBody.hashSlotName = new Hashtable(); this.bonemorph = new BoneMorph_(); this.bonemorph.Init(); this.goSlot = new List(); int num = 0; while (!(this.m_strSlotName[num] == "end")) { int num2 = num / TBody.strSlotNameItemCnt; TBody.hashSlotName[this.m_strSlotName[num]] = num2; TBody.hashSlotName[this.m_strSlotName[num].ToLower()] = num2; TBody.hashSlotName[this.m_strSlotName[num].ToUpper()] = num2; TBodySkin item = new TBodySkin(this, this.m_strSlotName[num], (TBody.SlotID)num2, boMAN_); this.goSlot.Add(item); num += TBody.strSlotNameItemCnt; } this.m_bForceReloadAnime = false; } public void UnInit() { if (this.bonemorph != null) { this.bonemorph.Uninit(); } this.m_bIsLoadedBody = false; int num = this.goSlot.Count - 1; while (0 <= num) { this.goSlot[num].DeleteObj(); num--; } UnityEngine.Object.DestroyImmediate(this.m_Bones); this.m_Bones = null; this.m_trBones = null; this.m_dicTrans.Clear(); UnityEngine.Object.DestroyImmediate(this.m_Bones2); this.m_Bones2 = null; this.m_trBones2 = null; foreach (KeyValuePair keyValuePair in this.m_dicLaySlot) { keyValuePair.Value.Remove(); } this.m_dicLaySlot.Clear(); if (this.m_hitFloorPlane != null) { UnityEngine.Object.DestroyImmediate(this.m_hitFloorPlane.gameObject); this.m_hitFloorPlane = null; } } private void OnDetattchVoice(AudioSourceParent f_asp) { Debug.Log(this.maid.name + " Voice回収"); this.m_AudioParent = null; } private void OnDestroy() { if (this.m_hitFloorPlane != null) { UnityEngine.Object.DestroyImmediate(this.m_hitFloorPlane.gameObject); this.m_hitFloorPlane = null; } } public int GetSlotNo(string slotname) { NDebug.Assert(this.IsSlotNo(slotname), "GetSlotNo not found [" + slotname + "] "); return (int)TBody.hashSlotName[slotname]; } public bool IsSlotNo(string slotname) { return TBody.hashSlotName.ContainsKey(slotname); } public TBodySkin GetSlot(int f_nSlotNo) { return this.goSlot[f_nSlotNo]; } public TBodySkin GetSlot(string slotname) { return this.GetSlot(this.GetSlotNo(slotname)); } public Transform GetBone(string f_strBoneName) { return CMT.SearchObjName(this.m_trBones, f_strBoneName, true); } public void LoadBody_R(string f_strModelFileName, Maid f_maid) { if (this.m_bIsLoadedBody) { this.UnInit(); } this.m_bIsLoadedBody = true; GameObject goOffset = f_maid.m_goOffset; GameObject gameObject; if (!GameMain.Instance.CharacterMgr.TryGetCacheObject(f_strModelFileName, out gameObject)) { byte[] bs = null; try { using (AFileBase afileBase = GameUty.FileOpen(f_strModelFileName, null)) { NDebug.Assert(afileBase.IsValid(), "Bodyファイルが開けませんでした。" + f_strModelFileName); bs = afileBase.ReadAll(); } } catch (Exception ex) { Debug.LogError(string.Concat(new string[] { "ProcScriptBin/SetMaidItemTemp メニューファイルが読み込めませんでした。 : ", f_strModelFileName, " : ", ex.Message, " : StackTrace :\n", ex.StackTrace })); } GameObject gameObject2 = ImportCM.LoadOnlyBone_R(bs); GameMain.Instance.CharacterMgr.AddCacheObject(f_strModelFileName, gameObject2); gameObject = gameObject2; } if (this.m_Bones != null) { Debug.LogError("ボーン二重 " + this.m_Bones.name); } this.m_Bones = UnityEngine.Object.Instantiate(gameObject); this.m_Bones.name = gameObject.name; this.m_trBones = this.m_Bones.transform; CMT.SearchAndAddObj(this.m_trBones, this.m_dicTrans); this.m_Animation = this.m_Bones.GetComponent(); if (this.m_Bones2 != null) { Debug.LogError("ボーン二重 " + this.m_Bones2.name); } this.m_Bones2 = UnityEngine.Object.Instantiate(this.m_Bones); this.m_Bones2.name = this.m_Bones.name + " MR"; this.m_trBones2 = this.m_Bones2.transform; this.m_trBones.SetParent(goOffset.transform, false); this.m_trBones2.SetParent(goOffset.transform, false); this.HeadEulerAngle = Vector3.zero; this.HeadEulerAngleG = Vector3.zero; string text = "Bip01"; if (this.boMAN) { text = "ManBip"; } this.trBip = CMT.SearchObjName(this.m_trBones, text, true); this.trsHead = CMT.SearchObjName(this.m_trBones, text + " Head", true); this.trsNeck = CMT.SearchObjName(this.m_trBones, text + " Neck", true); if (!f_maid.boMAN) { if (this.m_AudioParent != null) { UnityEngine.Object.DestroyImmediate(this.m_AudioParent); } this.m_AudioParent = this.trsNeck.gameObject.AddComponent(); this.m_AudioParent.AttachVoice(this.trsNeck, new AudioSourceParent.dgOnDettach(this.OnDetattchVoice)); this.SetVoicePitch(this.maid.VoicePitch); Debug.Log(this.maid.name + " Voice割り当て"); } this.quaDefHead = this.trsHead.localRotation; this.quaDefNeck = this.trsNeck.localRotation; this.UpperArmR = CMT.SearchObjName(this.m_trBones, text + " R UpperArm", true); this.UpperArmL = CMT.SearchObjName(this.m_trBones, text + " L UpperArm", true); this.ForearmR = CMT.SearchObjName(this.m_trBones, text + " R Forearm", true); this.ForearmL = CMT.SearchObjName(this.m_trBones, text + " L Forearm", true); this.HandL = CMT.SearchObjName(this.m_trBones, text + " L Hand", true); this.HandL_NubY = new GameObject("L Hand nub1").transform; this.HandL_NubY.transform.parent = this.HandL; this.HandL_NubY.transform.localPosition = new Vector3(0f, 0.01f, 0f); this.HandL_NubY.transform.localRotation = Quaternion.identity; this.HandR = CMT.SearchObjName(this.m_trBones, text + " R Hand", true); this.HandR_NubY = new GameObject("R Hand nub1").transform; this.HandR_NubY.transform.parent = this.HandR; this.HandR_NubY.transform.localPosition = new Vector3(0f, 0.01f, 0f); this.HandR_NubY.transform.localRotation = Quaternion.identity; this.ClavicleL = CMT.SearchObjName(this.m_trBones, text + " L Clavicle", true); this.ClavicleR = CMT.SearchObjName(this.m_trBones, text + " R Clavicle", true); if (this.UpperArmR == null) { Debug.LogError("UpperArmR null"); } if (this.UpperArmL == null) { Debug.LogError("UpperArmL null"); } if (this.ForearmR == null) { Debug.LogError("ForearmR null"); } if (this.ForearmL == null) { Debug.LogError("ForearmL null"); } if (this.HandR == null) { Debug.LogError("HandR null"); } if (this.HandL == null) { Debug.LogError("HandL null"); } this.IKHandL.SetKinematicTgt(this.HandL, 3); this.IKHandL.IkCmoInit(this); if (!this.StrIKDataPair.ContainsKey("左手")) { this.StrIKDataPair.Add("左手", this.IKHandL); } this.IKHandR.SetKinematicTgt(this.HandR, 3); this.IKHandR.IkCmoInit(this); if (!this.StrIKDataPair.ContainsKey("右手")) { this.StrIKDataPair.Add("右手", this.IKHandR); } this.CenterBone = CMT.SearchObjName(this.m_trBones, "center", true); this.ToeR = CMT.SearchObjName(this.m_trBones, text + " R Toe2Nub", true); this.ToeL = CMT.SearchObjName(this.m_trBones, text + " L Toe2Nub", true); this.Pelvis = CMT.SearchObjName(this.m_trBones, text + " Pelvis", true); this.FootStep = CMT.SearchObjName(this.m_trBones, text + " Footsteps", true); this.Spine = CMT.SearchObjName(this.m_trBones, text + " Spine", true); this.Spine0a = CMT.SearchObjName(this.m_trBones, text + " Spine0a", true); this.Spine1a = CMT.SearchObjName(this.m_trBones, text + " Spine1a", true); if (this.boMAN) { this.trManChinko = CMT.SearchObjName(this.m_trBones, "chinkoCenter", true); this.vecChinkoOffset = this.trManChinko.transform.localPosition; } this.Uppertwist_L = CMT.SearchObjName(this.m_trBones, "Uppertwist_L", true); this.Uppertwist1_L = CMT.SearchObjName(this.m_trBones, "Uppertwist1_L", true); this.Kata_L = CMT.SearchObjName(this.m_trBones, "Kata_L", true); if (this.Kata_L != null) { this.quaKata_L = this.Kata_L.localRotation; } this.Uppertwist_R = CMT.SearchObjName(this.m_trBones, "Uppertwist_R", true); this.Uppertwist1_R = CMT.SearchObjName(this.m_trBones, "Uppertwist1_R", true); this.Kata_R = CMT.SearchObjName(this.m_trBones, "Kata_R", true); if (this.Kata_R != null) { this.quaKata_R = this.Kata_R.localRotation; } this.Foretwist1_L = CMT.SearchObjName(this.m_trBones, "Foretwist1_L", true); this.Foretwist_L = CMT.SearchObjName(this.m_trBones, "Foretwist_L", true); this.Foretwist1_L_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist1_L", true); this.Foretwist_L_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist_L", true); this.Foretwist1_R = CMT.SearchObjName(this.m_trBones, "Foretwist1_R", true); this.Foretwist_R = CMT.SearchObjName(this.m_trBones, "Foretwist_R", true); this.Foretwist1_R_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist1_R", true); this.Foretwist_R_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist_R", true); this.momoniku_L = CMT.SearchObjName(this.m_trBones, "momoniku_L", true); this.momoniku_R = CMT.SearchObjName(this.m_trBones, "momoniku_R", true); this.Calf_L = CMT.SearchObjName(this.m_trBones, text + " L Calf", true); this.Calf_R = CMT.SearchObjName(this.m_trBones, text + " R Calf", true); this.momoniku_L_MR = CMT.SearchObjName(this.m_trBones2, "momoniku_L", true); this.momoniku_R_MR = CMT.SearchObjName(this.m_trBones2, "momoniku_R", true); this.Thigh_R = CMT.SearchObjName(this.m_trBones, text + " R Thigh", true); this.Thigh_L = CMT.SearchObjName(this.m_trBones, text + " L Thigh", true); this.Thigh_R_MR = CMT.SearchObjName(this.m_trBones2, text + " R Thigh", true); this.Thigh_L_MR = CMT.SearchObjName(this.m_trBones2, text + " L Thigh", true); if (this.Thigh_L != null) { this.quaThigh_L = this.Thigh_L.localRotation; } if (this.Thigh_R != null) { this.quaThigh_R = this.Thigh_R.localRotation; } this.HandL_MR = CMT.SearchObjName(this.m_trBones2, text + " L Hand", true); if (this.HandL_MR != null) { this.HandL_NubY_MR = new GameObject("L Hand nub1").transform; this.HandL_NubY_MR.transform.parent = this.HandL_MR; this.HandL_NubY_MR.transform.localPosition = new Vector3(0f, 0.01f, 0f); this.HandL_NubY_MR.transform.localRotation = Quaternion.identity; } this.HandR_MR = CMT.SearchObjName(this.m_trBones2, text + " R Hand", true); if (this.HandR_MR != null) { this.HandR_NubY_MR = new GameObject("R Hand nub1").transform; this.HandR_NubY_MR.transform.parent = this.HandR_MR; this.HandR_NubY_MR.transform.localPosition = new Vector3(0f, 0.01f, 0f); this.HandR_NubY_MR.transform.localRotation = Quaternion.identity; } this.momotwist_L = CMT.SearchObjName(this.m_trBones, "momotwist_L", true); this.momotwist2_L = CMT.SearchObjName(this.m_trBones, "momotwist2_L", true); this.momotwist_R = CMT.SearchObjName(this.m_trBones, "momotwist_R", true); this.momotwist2_R = CMT.SearchObjName(this.m_trBones, "momotwist2_R", true); if (this.momotwist_L != null) { this.q_momotwist_L = this.momotwist_L.localRotation; } if (this.momotwist2_L != null) { this.q_momotwist2_L = this.momotwist2_L.localRotation; } if (this.momotwist_R != null) { this.q_momotwist_R = this.momotwist_R.localRotation; } if (this.momotwist2_R != null) { this.q_momotwist2_R = this.momotwist2_R.localRotation; } this.Hip_L_nub = CMT.SearchObjName(this.m_trBones, "Hip_L_nub", true); this.Hip_R_nub = CMT.SearchObjName(this.m_trBones, "Hip_R_nub", true); this.Hip_L = CMT.SearchObjName(this.m_trBones, "Hip_L", true); this.Hip_R = CMT.SearchObjName(this.m_trBones, "Hip_R", true); this.Hip_L_MR = CMT.SearchObjName(this.m_trBones2, "Hip_L", true); this.Hip_R_MR = CMT.SearchObjName(this.m_trBones2, "Hip_R", true); if (this.boMAN) { return; } this.jbMuneL = CMT.SearchObjName(this.m_trBones, "Mune_L", true).gameObject.AddComponent(); this.jbMuneR = CMT.SearchObjName(this.m_trBones, "Mune_R", true).gameObject.AddComponent(); if (GameMain.Instance.VRMode) { OvrMgr ovrMgr = GameMain.Instance.OvrMgr; if (ovrMgr != null) { OvrMgr.OvrObject.Controller left_controller = ovrMgr.ovr_obj.left_controller; if (left_controller != null && left_controller.controller != null && left_controller.controller.HandEnable) { this.m_trHandHitL = left_controller.hand_trans_hit; } OvrMgr.OvrObject.Controller right_controller = ovrMgr.ovr_obj.right_controller; if (right_controller != null && (right_controller.controller != null & right_controller.controller.HandEnable)) { this.m_trHandHitR = right_controller.hand_trans_hit; } this.m_trHandLeapHitL = ovrMgr.m_trLeapHandL; this.m_trHandLeapHitR = ovrMgr.m_trLeapHandR; } this.m_trsMuneL = CMT.SearchObjName(this.m_trBones, "Mune_L", true); this.m_trsMuneLsub = CMT.SearchObjName(this.m_trBones, "Mune_L_sub", true); GameObject gameObject3 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereParent")) as GameObject; GameObject gameObject4 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereChild")) as GameObject; gameObject4.GetComponent().connectedBody = gameObject3.GetComponent(); this.m_trHitParentL = gameObject3.transform; this.m_trHitChildL = gameObject4.transform; this.m_trHitParentL.parent = this.m_trsMuneL; this.m_trHitChildL.parent = this.m_trsMuneL; this.m_trHitParentL.localPosition = this.m_trsMuneLsub.localPosition; this.m_trHitChildL.localPosition = this.m_trsMuneLsub.localPosition; this.m_HitChildColliderL = gameObject4.GetComponent(); this.m_trsMuneR = CMT.SearchObjName(this.m_trBones, "Mune_R", true); this.m_trsMuneRsub = CMT.SearchObjName(this.m_trBones, "Mune_R_sub", true); GameObject gameObject5 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereParent")) as GameObject; GameObject gameObject6 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereChild")) as GameObject; gameObject6.GetComponent().connectedBody = gameObject5.GetComponent(); this.m_trHitParentR = gameObject5.transform; this.m_trHitChildR = gameObject6.transform; this.m_trHitParentR.parent = this.m_trsMuneR; this.m_trHitChildR.parent = this.m_trsMuneR; this.m_trHitParentR.localPosition = this.m_trsMuneRsub.localPosition; this.m_trHitChildR.localPosition = this.m_trsMuneRsub.localPosition; this.m_HitChildColliderR = gameObject6.GetComponent(); } Transform transform = (!this.m_trsMuneLsub) ? CMT.SearchObjName(this.m_trBones, "Mune_L_sub", true) : this.m_trsMuneLsub; Transform transform2 = (!this.m_trsMuneRsub) ? CMT.SearchObjName(this.m_trBones, "Mune_R_sub", true) : this.m_trsMuneRsub; this.IKMuneL.CreateAttachPointObj("_IK_nippleL", transform, this, "body", "乳首左"); this.IKMuneR.CreateAttachPointObj("_IK_nippleR", transform2, this, "body", "乳首右"); this.IKMuneL.SetKinematicTgt(transform, 2); this.IKMuneR.SetKinematicTgt(transform2, 2); if (!this.StrIKDataPair.ContainsKey("左胸")) { this.StrIKDataPair.Add("左胸", this.IKMuneL); } if (!this.StrIKDataPair.ContainsKey("右胸")) { this.StrIKDataPair.Add("右胸", this.IKMuneR); } for (int i = 0; i < this.goSlot.Count; i++) { int rot = 270; if (this.m_strSlotName[i * TBody.strSlotNameItemCnt + 1] == "_ROOT_") { rot = 90; } this.goSlot[i].LoadHitcheckData(this.m_trBones, this.m_strSlotName[i * TBody.strSlotNameItemCnt + 2], rot, this.m_strSlotName[i * TBody.strSlotNameItemCnt]); } this.goSlot[0].m_strModelFileName = f_strModelFileName; if (this.boMAN) { this.SetManHide(this.m_bManMeshHide); } if (this.m_hitFloorPlane == null) { GameObject gameObject7 = new GameObject("FloorPlane-Maid[" + this.maid.ActiveSlotNo + "]"); gameObject7.transform.SetParent(GameMain.Instance.BgMgr.Parent.transform, false); gameObject7.transform.position = new Vector3(0f, this.m_BoneHitY, 0f); this.m_hitFloorPlane = gameObject7.AddComponent(); this.m_trFloorPlane = gameObject7.transform; } } public void AddItem(MPN mpn, string slotname, string filename, string AttachSlot, string AttachName, bool f_bTemp) { int num = (int)TBody.hashSlotName[slotname]; string bonename = this.m_strSlotName[num * TBody.strSlotNameItemCnt + 1]; int layer = 10; TBodySkin tbodySkin = this.goSlot[num]; tbodySkin.Load(mpn, this.m_trBones2, this.m_trBones, this.m_dicTrans, bonename, filename, slotname, AttachSlot, layer, f_bTemp); tbodySkin.SyojiType = 0; tbodySkin.m_strModelFileName = filename; tbodySkin.RID = Path.GetFileName(filename).ToLower().GetHashCode(); tbodySkin.AttachName = null; tbodySkin.AttachSlotIdx = 0; if (AttachSlot == "ボーンにアタッチ") { tbodySkin.trsBoneAttach = CMT.SearchObjName(this.m_trBones, AttachName, true); } else if (AttachSlot != string.Empty) { if (!TBody.hashSlotName.ContainsKey(AttachSlot)) { return; } int attachSlotIdx = (int)TBody.hashSlotName[AttachSlot]; tbodySkin.AttachName = AttachName; tbodySkin.AttachSlotIdx = attachSlotIdx; } if (slotname == "head") { this.Face = tbodySkin; if (!this.boMAN) { this.trsEyeL = CMT.SearchObjName(this.Face.obj_tr, "Eye_L", false); this.trsEyeR = CMT.SearchObjName(this.Face.obj_tr, "Eye_R", false); this.quaDefEyeL = this.trsEyeL.localRotation; this.quaDefEyeR = this.trsEyeR.localRotation; this.EyeEulerAngle = Vector3.zero; } } if (slotname == "body" && !this.boMAN) { this.quaUppertwist_L = CMT.SearchObjName(tbodySkin.obj_tr, "Uppertwist_L", false).localRotation; this.quaUpperArmL = CMT.SearchObjName(tbodySkin.obj_tr, "Bip01 L UpperArm", false).localRotation; this.quaUppertwist_R = CMT.SearchObjName(tbodySkin.obj_tr, "Uppertwist_R", false).localRotation; this.quaUpperArmR = CMT.SearchObjName(tbodySkin.obj_tr, "Bip01 R UpperArm", false).localRotation; } this.bonemorph.Init(); this.bonemorph.InitBoneMorphEdit(tbodySkin.obj_tr, mpn, (TBody.SlotID)num); this.bonemorph.AddRoot(this.m_trBones); this.bonemorph.Blend(); if (this.boMAN) { this.SetManHide(this.m_bManMeshHide); } } private Transform SearchItemTarget(string f_strSlotName, string f_strObjTarget) { Transform result = null; try { int index = (int)TBody.hashSlotName[f_strSlotName]; Transform obj_tr = this.goSlot[index].obj_tr; result = obj_tr.Find(f_strObjTarget); } catch (Exception ex) { Debug.LogError("SearchItemTarget 不正\n" + ex.Message); } return result; } public void SetSlotOffsetPos(string f_strSlotName, string f_strObjTarget, Vector3 f_vPos) { Transform transform = this.SearchItemTarget(f_strSlotName, f_strObjTarget); if (transform != null) { transform.localPosition = f_vPos; } } public void SetSlotOffsetRot(string f_strSlotName, string f_strObjTarget, Vector3 f_vRot) { Transform transform = this.SearchItemTarget(f_strSlotName, f_strObjTarget); if (transform != null) { transform.localRotation = Quaternion.Euler(f_vRot); } } public void MuneYureL(float onL) { if (this.jbMuneL != null) { this.jbMuneL.BlendValueON = onL; } } public float GetMuneYureL() { return (!(this.jbMuneL != null)) ? 0f : this.jbMuneL.BlendValueON; } public void MuneYureR(float onR) { if (this.jbMuneR != null) { this.jbMuneR.BlendValueON = onR; } } public float GetMuneYureR() { return (!(this.jbMuneR != null)) ? 0f : this.jbMuneR.BlendValueON; } public void SetBoneHitHeightY(float f_fY) { this.BoneHitHeightY = f_fY; } public void VertexMorph_FromProcItem(string tag, float f) { tag = tag.ToLower(); if (!this.boMaid) { if (tag != "hara") { return; } tag = "karadal"; } if (this.goSlot[0].morph == null) { return; } if (this.boMaid) { if (tag == "munel") { this.jbMuneL.BlendValue = f; this.jbMuneR.BlendValue = f; this.goSlot[3].bonehair.bodyhit.ScaleMune("MUNE", f * 0.3f + 0.8f); this.goSlot[3].m_BonehairBodyhitScaleBackup["MUNE"] = f * 0.3f + 0.8f; this.goSlot[4].bonehair.bodyhit.ScaleMune("MUNE", f * 0.3f + 0.8f); this.goSlot[4].m_BonehairBodyhitScaleBackup["MUNE"] = f * 0.3f + 0.8f; if (GameMain.Instance.VRMode && this.m_HitChildColliderR != null && this.m_HitChildColliderL != null) { float num = this.jbMuneL.BlendValue / 1.3f; SphereCollider hitChildColliderR = this.m_HitChildColliderR; Vector3 center = new Vector3(0f, 0f, this.m_fHitCenterZMin + (this.m_fHitCenterZMax - this.m_fHitCenterZMin) * num); this.m_HitChildColliderL.center = center; hitChildColliderR.center = center; SphereCollider hitChildColliderR2 = this.m_HitChildColliderR; float radius = this.m_fHitRadiusMin + (this.m_fHitRadiusMax - this.m_fHitRadiusMin) * num; this.m_HitChildColliderL.radius = radius; hitChildColliderR2.radius = radius; } } if (tag == "hara") { this.goSlot[7].bonehair.bodyhit.ScaleMune("HARA", f); this.goSlot[7].m_BonehairBodyhitScaleBackup["HARA"] = f; } } if (tag == "regfat" || tag == "regmeet") { float blendValues = this.goSlot[0].morph.GetBlendValues((int)this.goSlot[0].morph.hash["regfat"]); float blendValues2 = this.goSlot[0].morph.GetBlendValues((int)this.goSlot[0].morph.hash["regmeet"]); float num2 = (blendValues + blendValues2) * 0.5f; if (num2 < 0.5f) { num2 = num2 * 0.1f + 0.95f; } else { num2 = num2 * 0.4f + 0.8f; } this.goSlot[7].bonehair.bodyhit.ScaleMune("MOMO", num2); this.goSlot[7].m_BonehairBodyhitScaleBackup["MOMO"] = num2; } try { if (this.goSlot[0].morph.hash.ContainsKey(tag)) { int f_nIdx = (int)this.goSlot[0].morph.hash[tag]; this.goSlot[0].morph.SetBlendValues(f_nIdx, f); this.goSlot[0].morph.FixBlendValues(); } } catch { NDebug.Assert(false, "Null MorphTarget=" + tag); } for (int i = 1; i < this.goSlot.Count; i++) { TMorph morph = this.goSlot[i].morph; if (morph != null) { if (morph.Contains(tag)) { int f_nIdx2 = (int)morph.hash[tag]; morph.SetBlendValues(f_nIdx2, f); morph.FixBlendValues(); } } } this.m_MorphBlendValues[tag] = f; } public void BoneMorph_FromProcItem(string tag, float f) { if (!this.boMaid) { return; } bool flag = false; if (tag == "sintyou") { flag = true; this.bonemorph.SCALE_Sintyou = f; } if (tag == "koshi") { flag = true; this.bonemorph.SCALE_Koshi = f; } if (tag == "kata") { flag = true; this.bonemorph.SCALE_Kata = f; } if (tag == "west") { flag = true; this.bonemorph.SCALE_West = f; } if (tag == "DouPer") { flag = true; this.bonemorph.SCALE_DouPer = f; } if (tag == "koshi" || tag == "west") { float num = (this.bonemorph.SCALE_Koshi + this.bonemorph.SCALE_West) * 0.5f; this.goSlot[7].bonehair.bodyhit.ScaleMune("KOSHI_SVAL", f); if (num < 1f) { num = num * 0.1f + 0.95f; } else { num = num * 0.8f + 0.4f; } this.goSlot[7].bonehair.bodyhit.ScaleMune("KOSHI_SCL", num); } if (tag == "KubiScl") { flag = true; this.bonemorph.SCALE_Kubi = f; } if (tag == "UdeScl") { flag = true; this.bonemorph.SCALE_Ude = f; } if (tag == "EyeSclX") { flag = true; this.bonemorph.SCALE_EyeX = f; } if (tag == "EyeSclY") { flag = true; this.bonemorph.SCALE_EyeY = f; } if (tag == "EyePosX") { flag = true; this.bonemorph.Postion_EyeX = f; } if (tag == "EyePosY") { flag = true; this.bonemorph.Postion_EyeY = f; } if (tag == "EyeBallPosX") { flag = true; this.bonemorph.EyeBallPosX = f; } if (tag == "EyeBallPosY") { flag = true; this.bonemorph.EyeBallPosY = f; } if (tag == "EyeBallSclX") { flag = true; this.bonemorph.EyeBallSclX = f; } if (tag == "EyeBallSclY") { flag = true; this.bonemorph.EyeBallSclY = f; } if (tag == "HeadX") { flag = true; this.bonemorph.SCALE_HeadX = f; } if (tag == "HeadY") { flag = true; this.bonemorph.SCALE_HeadY = f; } if (tag == "MayuY") { this.bonemorph.POS_MayuY = f; } if (tag == "EyeClose") { this.goSlot[1].morph.m_fEyeCloseRate = f; } if (tag == "FaceShape") { this.goSlot[1].morph.m_fFaceShapeRate = f; } if (tag == "MuneUpDown") { this.jbMuneL.MuneUpDown = (f - 0.5f) * 60f; this.jbMuneR.MuneUpDown = (f - 0.5f) * 60f; this.jbMuneL.BlendValue2 = f - 0.5f; this.jbMuneR.BlendValue2 = -(f - 0.5f); this.jbMuneL.MuneUpDown_f = Mathf.Abs(f - 0.5f) * 2f; this.jbMuneR.MuneUpDown_f = Mathf.Abs(f - 0.5f) * 2f; flag = true; } if (tag == "MuneYori") { this.jbMuneL.MuneYori = (f - 0.5f) * 25f; this.jbMuneR.MuneYori = (f - 0.5f) * 25f; this.jbMuneL.MuneYori_f = Mathf.Abs(f - 0.5f) * 2f; this.jbMuneR.MuneYori_f = Mathf.Abs(f - 0.5f) * 2f; flag = true; } if (tag == "MuneYawaraka") { jiggleBone jbMuneR = this.jbMuneR; this.jbMuneL.m_fMuneYawaraka = f; jbMuneR.m_fMuneYawaraka = f; flag = true; } if (!flag) { } this.bonemorph.Blend(); } public void SetVisibleNodeSlot(string slotname, bool boSetFlag, string name) { if (!this.boMaid) { return; } if (!TBody.hashSlotName.ContainsKey(slotname)) { NDebug.Assert("SetVisibleNodeSlot: not found slot name " + slotname, false); return; } int index = (int)TBody.hashSlotName[slotname]; this.goSlot[index].SetVisibleFlag(boSetFlag, name, this.goSlot[0].obj_tr, false); } public void SetVisibleNodeSlotParts(string slotname, string target, bool boSetFlag, string name) { if (!this.boMaid) { return; } if (!TBody.hashSlotName.ContainsKey(slotname)) { NDebug.Assert("SetVisibleNodeSlot: not found slot name " + slotname, false); return; } int index = (int)TBody.hashSlotName[slotname]; this.goSlot[index].SetVisibleFlagParts(boSetFlag, target, name, this.goSlot[0].obj_tr, false); } public void AddMask(string slotname, string maskslot) { if (!TBody.hashSlotName.ContainsKey(slotname) || !TBody.hashSlotName.ContainsKey(maskslot)) { return; } int index = (int)TBody.hashSlotName[slotname]; int item = (int)TBody.hashSlotName[maskslot]; this.goSlot[index].listMaskSlot.Add(item); } public void DelItem(MPN mpn, string slotname) { if (!TBody.hashSlotName.ContainsKey(slotname)) { return; } this.MulTexRemove(slotname); int num = (int)TBody.hashSlotName[slotname]; this.goSlot[num].DeleteObj(); this.goSlot[num].RID = 0; this.goSlot[num].boVisible = false; this.goSlot[num].SyojiType = 0; this.bonemorph.Init(); this.bonemorph.DelBoneMorphEdit(mpn, (TBody.SlotID)num); this.bonemorph.AddRoot(this.m_trBones); this.bonemorph.Blend(); this.goSlot[num].m_ParentMPN = MPN.null_mpn; this.SetVisibleNodeSlot(slotname, true, "_ALL_"); } public void ChangeCol(string name, int matno, string prop_name, Color col) { int index = (int)TBody.hashSlotName[name]; GameObject obj = this.goSlot[index].obj; if (obj == null) { return; } List list = new List(3); obj.transform.GetComponentsInChildren(true, list); for (int i = 0; i < list.Count; i++) { Renderer renderer = list[i]; if (renderer != null && renderer.material != null && matno < renderer.materials.Length) { renderer.materials[matno].SetColor(prop_name, col); } } } public void ChangeTex(string slotname, int matno, string prop_name, string filename, Dictionary dicModTexData, MaidParts.PARTS_COLOR f_ePartsColorId = MaidParts.PARTS_COLOR.NONE) { if (!this.boMaid) { return; } if (TBody.NoAlphaIdxSet == null) { TBody.NoAlphaIdxSet = new HashSet(); TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairF"]); TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairR"]); TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairS"]); TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairT"]); TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairAho"]); TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["body"]); TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["head"]); } Texture texture = null; NDebug.Assert(TBody.hashSlotName.ContainsKey(slotname), "テクスチャ変更:スロット名がみつかりません。:" + slotname); int num = (int)TBody.hashSlotName[slotname]; TBodySkin tbodySkin = this.goSlot[num]; GameObject obj = tbodySkin.obj; if (obj == null) { return; } if (filename.IndexOf("*") != -1) { filename = filename.Replace("*", Path.GetFileNameWithoutExtension(tbodySkin.m_strModelFileName)); } TextureResource textureResource = null; if (dicModTexData != null) { filename = filename.ToLower(); if (!dicModTexData.ContainsKey(filename)) { Debug.LogError("MOD:テクスチャの変更:" + filename + "は見つかりませんでした。"); return; } textureResource = new TextureResource(2, 2, TextureFormat.ARGB32, null, dicModTexData[filename]); } else { textureResource = ImportCM.LoadTexture(GameUty.FileSystem, filename, false); } List list = new List(3); obj.transform.GetComponentsInChildren(true, list); for (int i = 0; i < list.Count; i++) { Renderer renderer = list[i]; if (!(renderer == null) && !(renderer.material == null)) { if (matno < renderer.materials.Length) { try { Material material = renderer.materials[matno]; material.SetTexture(prop_name, null); tbodySkin.TextureCache.RemoveTexture(matno, prop_name); } catch (Exception ex) { NDebug.Assert("テクスチャの変更に失敗しました。以前のテクスチャを破棄できませんでした。" + ex.Message, false); goto IL_4AE; } this.MulTexRemove(slotname, matno, prop_name, -1); if (texture == null) { Texture2D texture2D = textureResource.CreateTexture2D(); texture2D.name = filename; bool flag = true; if (TBody.NoAlphaIdxSet.Contains(num) && (prop_name == "_MainTex" || prop_name == "_OutlineTex" || prop_name == "_ShadowTex" || prop_name == "_ToonRamp")) { flag = false; if (slotname == "head") { if (matno != 5) { flag = true; } } else if (slotname == "body" && matno != 0) { flag = true; } } bool flag2 = !RenderTextureCache.CheckSupportsRenderTextureFormat(RenderTextureFormat.R8); if (flag || flag2 || MaidParts.PARTS_COLOR.NONE >= f_ePartsColorId || f_ePartsColorId >= MaidParts.PARTS_COLOR.MAX) { texture = texture2D; } else { byte[] tex_byte = textureResource.data; Action CreateR8Tex = delegate(Texture2D src_tex2d, RenderTexture dest_render_tex) { RenderTexture active = RenderTexture.active; Material systemMaterial = GameUty.GetSystemMaterial(GameUty.SystemMaterial.TexTo8bitTex); Graphics.Blit(src_tex2d, dest_render_tex, systemMaterial); RenderTexture.active = active; }; Action value = delegate(RenderTexture recreate_tex) { byte[] tex_byte = tex_byte; string filename2 = filename; Texture2D texture2D2 = new Texture2D(2, 2, TextureFormat.RGBA32, false); texture2D2.LoadImage(tex_byte); CreateR8Tex(texture2D2, recreate_tex); recreate_tex.name = filename2; UnityEngine.Object.Destroy(texture2D2); }; KeyValuePair> recreate_func = new KeyValuePair>(0, value); RenderTexture texture2 = InfinityColorTextureCache.render_cache.GetTexture(texture2D.width, texture2D.height, RenderTextureFormat.R8, recreate_func); texture2.name = filename; CreateR8Tex(texture2D, texture2); UnityEngine.Object.Destroy(texture2D); texture = texture2; } } tbodySkin.TextureCache.AddTexture(matno, prop_name, texture, f_ePartsColorId); texture = tbodySkin.TextureCache.GetModifiedTexture(matno, prop_name); Material material2 = renderer.materials[matno]; material2.SetTexture(prop_name, texture); } else { NDebug.Assert(string.Concat(new object[] { "マテリアル番号指定が ", renderer.name, "のマテリアル数を超えています。", slotname, " / ", matno }), false); } } IL_4AE:; } } private Material GetMaterial(string f_strSlotname, int f_nMatNo) { NDebug.Assert(TBody.hashSlotName.ContainsKey(f_strSlotname), "スロット名がみつかりません。:" + f_strSlotname); int index = (int)TBody.hashSlotName[f_strSlotname]; TBodySkin tbodySkin = this.goSlot[index]; GameObject obj = tbodySkin.obj; if (obj == null) { return null; } foreach (Transform transform in obj.transform.GetComponentsInChildren(true)) { Renderer component = transform.GetComponent(); if (component != null && component.material != null) { if (f_nMatNo < component.materials.Length) { return component.materials[f_nMatNo]; } NDebug.Assert(string.Concat(new object[] { "マテリアル番号指定が ", component.name, " のマテリアル数を超えています。", f_strSlotname, " / ", f_nMatNo }), false); } } return null; } public void MulTexSet(string f_strSlotname, int f_nMatNo, string f_strPropName, int f_nLayerNo, string f_strFileName, GameUty.SystemMaterial f_eBlendMode, bool f_bAdd = false, int f_nX = 0, int f_nY = 0, float f_fRot = 0f, float f_nScale = 0f, bool f_bNoTransform = false, SubProp f_SubProp = null, float f_fAlpha = 1f, int f_nTargetBodyTexSize = 1024) { if (!this.boMaid) { return; } if (f_nLayerNo < 0) { NDebug.Assert("レイヤー番号は0以上を使ってください。", false); } TBody.TexLay.Mat mat; if (!this.m_dicLaySlot.TryGetValue(f_strSlotname, out mat)) { mat = new TBody.TexLay.Mat(); this.m_dicLaySlot.Add(f_strSlotname, mat); } TBody.TexLay.Prop prop; if (!mat.dicPropInMat.TryGetValue(f_nMatNo, out prop)) { prop = new TBody.TexLay.Prop(); mat.dicPropInMat.Add(f_nMatNo, prop); } TBody.TexLay.Lay lay; if (!prop.dicLayInProp.TryGetValue(f_strPropName, out lay)) { Material material = this.GetMaterial(f_strSlotname, f_nMatNo); Texture texture = material.GetTexture(f_strPropName); if (texture == null) { NDebug.Assert("テクスチャが設定されていませんでした。", false); } lay = new TBody.TexLay.Lay(texture); material.SetTexture(f_strPropName, lay.rtBase); prop.dicLayInProp.Add(f_strPropName, lay); } TBody.TexLay.OrderTex orderTex = lay.listLayer.Find((TBody.TexLay.OrderTex x) => x.nLayerNo == f_nLayerNo); if (orderTex == null) { orderTex = new TBody.TexLay.OrderTex(); orderTex.nLayerNo = f_nLayerNo; lay.listLayer.Add(orderTex); } else { UnityEngine.Object.Destroy(orderTex.tex); orderTex.tex = null; } Texture2D texture2D; if (f_strFileName.Contains("res:")) { string text = "Texture/" + f_strFileName.Replace("res:", string.Empty); UnityEngine.Object @object = Resources.Load(text); if (@object == null) { NDebug.Assert("Resourcesからテクスチャ" + text + "はみつかりません。", false); } texture2D = (UnityEngine.Object.Instantiate(@object) as Texture2D); texture2D.name = text; } else { texture2D = ImportCM.CreateTexture(f_strFileName); texture2D.name = f_strFileName; } orderTex.mode = f_eBlendMode; if (f_bAdd) { TBody.TexLay.LaySet laySet = new TBody.TexLay.LaySet(); laySet.tex = texture2D; laySet.bNoTransfrom = f_bNoTransform; laySet.nX = f_nX; laySet.nY = f_nY; laySet.fRot = f_fRot; laySet.fScale = f_nScale; laySet.nTargetBodyTexSize = f_nTargetBodyTexSize; laySet.fAlpha = f_fAlpha; laySet.sprop = f_SubProp; if (laySet.sprop != null) { laySet.sprop.strSlotName = f_strSlotname; } orderTex.listLaySet.Add(laySet); } else { orderTex.RemoveLaySet(); orderTex.tex = texture2D; } } public void MulTexProc() { foreach (KeyValuePair keyValuePair in this.m_dicLaySlot) { this.MulTexProc(keyValuePair.Key); } } public void MulTexProc(string slotname) { RenderTexture active = RenderTexture.active; TBody.TexLay.Mat mat; if (this.m_dicLaySlot.TryGetValue(slotname, out mat)) { foreach (KeyValuePair keyValuePair in mat.dicPropInMat) { foreach (KeyValuePair keyValuePair2 in keyValuePair.Value.dicLayInProp) { if (keyValuePair2.Value.rtBase == null) { Debug.LogWarning("MulTexProc rtBase is null."); } if (!keyValuePair2.Value.rtBase.IsCreated()) { Debug.LogWarning("MulTexProc rtBase is lost."); } Graphics.Blit(keyValuePair2.Value.texBack, keyValuePair2.Value.rtBase); List listLayer = keyValuePair2.Value.listLayer; keyValuePair2.Value.Sort(); for (int i = 0; i < listLayer.Count; i++) { TBody.TexLay.OrderTex orderTex = listLayer[i]; Material systemMaterial = GameUty.GetSystemMaterial(orderTex.mode); if (keyValuePair2.Value.rtBase == null) { Debug.LogWarning("texture layer base is not existed."); } else if (orderTex.listLaySet.Count == 0) { systemMaterial.SetFloat("_Alpha", 1f); Graphics.Blit(orderTex.tex, keyValuePair2.Value.rtBase, systemMaterial); } else { RenderTexture active2 = RenderTexture.active; RenderTexture.active = keyValuePair2.Value.rtBase; for (int j = 0; j < orderTex.listLaySet.Count; j++) { TBody.TexLay.LaySet laySet = orderTex.listLaySet[j]; if (laySet.bNoTransfrom) { if (laySet.sprop != null) { systemMaterial.SetFloat("_Alpha", laySet.sprop.fTexMulAlpha); } else { systemMaterial.SetFloat("_Alpha", laySet.fAlpha); } RenderTexture active3 = RenderTexture.active; Graphics.Blit(laySet.tex, keyValuePair2.Value.rtBase, systemMaterial); RenderTexture.active = active3; } else if (keyValuePair2.Value.rtBase.width == laySet.nTargetBodyTexSize) { Vector3 s = new Vector3(laySet.fScale, laySet.fScale, 1f); Vector3 pos = new Vector3((float)laySet.nX, (float)laySet.nY, 0f); Quaternion q = Quaternion.Euler(new Vector3(0f, 0f, laySet.fRot)); GL.PushMatrix(); GL.LoadPixelMatrix(0f, (float)keyValuePair2.Value.rtBase.width, (float)keyValuePair2.Value.rtBase.height, 0f); GL.MultMatrix(Matrix4x4.TRS(pos, q, s)); Graphics.DrawTexture(new Rect((float)(-(float)(laySet.tex.width / 2)), (float)(-(float)(laySet.tex.height / 2)), (float)laySet.tex.width, (float)laySet.tex.height), laySet.tex); GL.PopMatrix(); } else { float num = (float)(keyValuePair2.Value.rtBase.width / laySet.nTargetBodyTexSize); Vector3 s2 = new Vector3(laySet.fScale * num, laySet.fScale * num, 1f); Vector3 pos2 = new Vector3((float)laySet.nX * num, (float)laySet.nY * num, 0f); Quaternion q2 = Quaternion.Euler(new Vector3(0f, 0f, laySet.fRot)); GL.PushMatrix(); GL.LoadPixelMatrix(0f, (float)keyValuePair2.Value.rtBase.width, (float)keyValuePair2.Value.rtBase.height, 0f); GL.MultMatrix(Matrix4x4.TRS(pos2, q2, s2)); Graphics.DrawTexture(new Rect((float)(-(float)(laySet.tex.width / 2)), (float)(-(float)(laySet.tex.height / 2)), (float)laySet.tex.width, (float)laySet.tex.height), laySet.tex); GL.PopMatrix(); } } RenderTexture.active = active2; } } } } } RenderTexture.active = active; } public void MulTexRemove(string f_strSlotname) { TBody.TexLay.Mat mat; if (this.m_dicLaySlot.TryGetValue(f_strSlotname, out mat)) { mat.Remove(); } this.m_dicLaySlot.Remove(f_strSlotname); } public void MulTexRemove(string f_strSlotname, int f_nMatNo, string f_strPropName, int f_nLayNo = -1) { TBody.TexLay.Mat mat; if (this.m_dicLaySlot.TryGetValue(f_strSlotname, out mat)) { TBody.TexLay.Prop prop; if (mat.dicPropInMat.TryGetValue(f_nMatNo, out prop)) { TBody.TexLay.Lay lay; if (prop.dicLayInProp.TryGetValue(f_strPropName, out lay)) { lay.Remove(f_nLayNo); if (lay.listLayer.Count == 0) { prop.dicLayInProp.Remove(f_strPropName); } } if (prop.dicLayInProp.Count == 0) { mat.dicPropInMat.Remove(f_nMatNo); } } if (mat.dicPropInMat.Count == 0) { this.m_dicLaySlot.Remove(f_strSlotname); } } } public void UpdateInfinityColor(MaidParts.PARTS_COLOR f_eColorType) { bool flag = false; for (int i = 0; i < this.goSlot.Count; i++) { TBodySkin tbodySkin = this.goSlot[i]; if (tbodySkin.TextureCache.UpdateColor(f_eColorType)) { flag = true; } } if (flag) { this.MulTexProc(); } } public void ChangeShader(string f_strSlotName, int f_nMatNo, string f_strShaderFileName) { if (!TBody.hashSlotName.ContainsKey(f_strSlotName)) { NDebug.Assert("シェーダー変更:スロット名がみつかりません。:" + f_strSlotName, false); } int index = (int)TBody.hashSlotName[f_strSlotName]; this.goSlot[index].ChangeShader(f_nMatNo, f_strShaderFileName); } public void RestoreShader(string f_strSlotName) { int index = (int)TBody.hashSlotName[f_strSlotName]; this.goSlot[index].RestoreShader(); } public void ChangeMaterial(string f_strSlotName, int f_nMatNo, string f_strFileName) { if (!TBody.hashSlotName.ContainsKey(f_strSlotName)) { NDebug.Assert("マテリアル変更:スロット名がみつかりません。:" + f_strSlotName, false); } int index = (int)TBody.hashSlotName[f_strSlotName]; TBodySkin tbodySkin = this.goSlot[index]; GameObject obj = tbodySkin.obj; if (obj == null) { return; } foreach (Transform transform in obj.transform.GetComponentsInChildren(true)) { Renderer component = transform.GetComponent(); if (component != null && component.material != null && f_nMatNo < component.materials.Length) { ImportCM.LoadMaterial(f_strFileName, tbodySkin, component.materials[f_nMatNo]); } } } public void SetMaterialProperty(string f_strSrcMpnName, string f_strDestSlotName, int f_nMatNo, string f_strPropName, string f_strTypeName, string f_strValue, bool f_bEditSave = false) { if (!TBody.hashSlotName.ContainsKey(f_strDestSlotName)) { NDebug.Assert("マテリアルプロパティ変更:スロット名がみつかりません。:" + f_strDestSlotName, false); } MPN f_SrcMpn = (MPN)Enum.Parse(typeof(MPN), f_strSrcMpnName, true); int index = (int)TBody.hashSlotName[f_strDestSlotName]; TBodySkin tbodySkin = this.goSlot[index]; tbodySkin.SetMaterialProperty(f_SrcMpn, f_nMatNo, f_strPropName, f_strTypeName, f_strValue, f_bEditSave); } public string GetMaterialProperty(string f_strDestSlotName, int f_nMatNo, string f_strPropName, string f_strType = "AUTO") { if (!TBody.hashSlotName.ContainsKey(f_strDestSlotName)) { NDebug.Assert("マテリアルプロパティ変更:スロット名がみつかりません。:" + f_strDestSlotName, false); } int index = (int)TBody.hashSlotName[f_strDestSlotName]; TBodySkin tbodySkin = this.goSlot[index]; return tbodySkin.GetMaterialProperty(f_nMatNo, f_strPropName, f_strType); } public void SetMaskMode(TBody.MaskMode f_eMode) { this.m_eMaskMode = f_eMode; for (int i = 0; i < this.goSlot.Count; i++) { this.m_hFoceHide[(TBody.SlotID)i] = true; } if (this.m_eMaskMode == TBody.MaskMode.Nude) { this.m_hFoceHide[TBody.SlotID.stkg] = false; } if (this.m_eMaskMode == TBody.MaskMode.Nude || this.m_eMaskMode == TBody.MaskMode.Underwear) { this.m_hFoceHide[TBody.SlotID.mizugi] = false; this.m_hFoceHide[TBody.SlotID.onepiece] = false; } if (this.m_eMaskMode == TBody.MaskMode.Nude || this.m_eMaskMode == TBody.MaskMode.Underwear || this.m_eMaskMode == TBody.MaskMode.Swim) { this.m_hFoceHide[TBody.SlotID.wear] = false; this.m_hFoceHide[TBody.SlotID.skirt] = false; this.m_hFoceHide[TBody.SlotID.shoes] = false; this.m_hFoceHide[TBody.SlotID.headset] = false; this.m_hFoceHide[TBody.SlotID.glove] = false; this.m_hFoceHide[TBody.SlotID.accKubi] = false; this.m_hFoceHide[TBody.SlotID.accKubiwa] = false; } if (this.m_eMaskMode == TBody.MaskMode.Nude || this.m_eMaskMode == TBody.MaskMode.Swim) { this.m_hFoceHide[TBody.SlotID.bra] = false; this.m_hFoceHide[TBody.SlotID.panz] = false; } this.FixMaskFlag(); this.FixVisibleFlag(false); } public void SetManHide(bool hide) { if (!this.boMAN) { return; } SkinnedMeshRenderer[] componentsInChildren = base.GetComponentsInChildren(); foreach (SkinnedMeshRenderer skinnedMeshRenderer in componentsInChildren) { bool flag = false; foreach (Material material in skinnedMeshRenderer.materials) { if (material.shader.name.ToLower().Contains("cm3d2/man")) { flag = true; break; } } if (flag) { skinnedMeshRenderer.enabled = !hide; } } this.m_bManMeshHide = hide; } public bool IsManHide() { return this.boMAN && this.m_bManMeshHide; } public void SetMask(TBody.SlotID f_eSlot, bool f_bVisible) { if (f_eSlot <= TBody.SlotID.eye) { return; } this.m_hFoceHide[f_eSlot] = f_bVisible; this.FixMaskFlag(); this.FixVisibleFlag(false); } public bool GetMask(TBody.SlotID f_eSlot) { return !this.m_hFoceHide.ContainsKey(f_eSlot) || (bool)this.m_hFoceHide[f_eSlot]; } public bool GetSlotVisible(TBody.SlotID f_eSlot) { return this.GetSlotLoaded(f_eSlot) && this.goSlot[(int)f_eSlot].boVisible; } public bool GetSlotLoaded(TBody.SlotID f_eSlot) { return this.goSlot[(int)f_eSlot].obj != null; } public void FixMaskFlag() { if (!this.boMaid) { return; } for (int i = 0; i < this.goSlot.Count; i++) { this.goSlot[i].boVisible = true; } for (int j = 0; j < this.goSlot.Count; j++) { if (!this.GetMask((TBody.SlotID)j)) { this.goSlot[j].boVisible = false; } if (this.goSlot[j].boVisible) { foreach (int index in this.goSlot[j].listMaskSlot) { this.goSlot[index].boVisible = false; } } } this.boVisible_NIP = this.goSlot[(int)TBody.hashSlotName["accNipR"]].boVisible; this.boVisible_HESO = this.goSlot[(int)TBody.hashSlotName["accHeso"]].boVisible; this.boVisible_XXX = this.goSlot[(int)TBody.hashSlotName["accXXX"]].boVisible; this.boVisible_BRA = this.goSlot[(int)TBody.hashSlotName["bra"]].boVisible; this.boVisible_PANZU = this.goSlot[(int)TBody.hashSlotName["panz"]].boVisible; this.boVisible_SKIRT = (this.goSlot[(int)TBody.hashSlotName["skirt"]].RID != 0 & this.goSlot[(int)TBody.hashSlotName["skirt"]].boVisible); this.boVisible_WEAR = (this.goSlot[(int)TBody.hashSlotName["wear"]].RID != 0 & this.goSlot[(int)TBody.hashSlotName["wear"]].boVisible); this.boMizugi_panz = this.goSlot[(int)TBody.hashSlotName["panz"]].boMizugi; this.slotno_accXXX = (int)TBody.hashSlotName["accXXX"]; } public void FixVisibleFlag(bool f_bNonPartsLook = false) { if (!this.boMaid) { return; } if (this.goSlot[0].morph == null) { return; } for (int i = 0; i < this.goSlot.Count; i++) { TBodySkin tbodySkin = this.goSlot[i]; if (tbodySkin.morph != null) { tbodySkin.morph.ClearAllVisibleFlag(true); } } if (!f_bNonPartsLook) { for (int j = 0; j < this.goSlot.Count; j++) { if (this.goSlot[j].boVisible && !(this.goSlot[j].obj == null)) { for (int k = 0; k < this.goSlot[0].morph.BoneNames.Count; k++) { string key = this.goSlot[0].morph.BoneNames[k]; bool flag = true; if (this.goSlot[j].m_dicDelNodeBody.ContainsKey(key)) { flag = this.goSlot[j].m_dicDelNodeBody[key]; } if (!flag) { this.goSlot[0].morph.SetVisibleFlag1(k, false); } } TBodySkin tbodySkin2 = this.goSlot[j]; if (tbodySkin2.m_dicDelNodeParts != null) { for (int l = 1; l < this.goSlot.Count; l++) { TBodySkin tbodySkin3 = this.goSlot[l]; if (tbodySkin3.morph != null) { for (int m = 0; m < tbodySkin3.morph.BoneNames.Count; m++) { string key2 = tbodySkin3.morph.BoneNames[m]; bool flag2 = true; Dictionary dictionary; bool flag3; if (tbodySkin2.m_dicDelNodeParts.TryGetValue(tbodySkin3.Category, out dictionary) && dictionary.TryGetValue(key2, out flag3)) { flag2 = flag3; } if (!flag2) { tbodySkin3.morph.SetVisibleFlag1(m, false); } } } } } } } } for (int n = 0; n < this.goSlot.Count; n++) { TBodySkin tbodySkin4 = this.goSlot[n]; if (tbodySkin4.morph != null) { tbodySkin4.morph.FixVisibleFlag(); } } } public int GetSlotUserParam(string slotname, string tag) { return 0; } public void SetChinkoVisible(bool f_bVisible) { Vector3 localScale = (!f_bVisible) ? Vector3.zero : Vector3.one; for (int i = 0; i < this.goSlot.Count; i++) { GameObject obj = this.goSlot[i].obj; if (obj != null) { Transform transform = CMT.SearchObjName(obj.transform, "chinkoCenter", false); if (transform != null) { transform.localScale = localScale; } } } } public bool GetChinkoVisible() { for (int i = 0; i < this.goSlot.Count; i++) { GameObject obj = this.goSlot[i].obj; if (obj != null) { Transform transform = CMT.SearchObjName(obj.transform, "chinkoCenter", false); if (transform != null && transform.localScale == Vector3.zero) { return false; } } } return true; } public string GetPartsParam(string f_strTag) { for (int i = 0; i < this.goSlot.Count; i++) { string param = this.goSlot[i].GetParam(f_strTag); if (!string.IsNullOrEmpty(param)) { return param; } } return string.Empty; } private string GetAnimeTag(string filename = "") { return filename.ToLower(); } public void StopAnime(string filename = "") { if (this.m_Bones == null) { Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name); } Animation animation = this.m_Animation; if (filename == string.Empty || filename == "ALL") { animation.Stop(); IEnumerator enumerator = animation.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; AnimationState animationState = (AnimationState)obj; AnimationClip clip = animation.GetClip(animationState.name); int num = animationState.name.IndexOf(" - Queued Clone"); if (num <= 0) { animation.RemoveClip(animationState.name); } UnityEngine.Object.Destroy(clip); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } else { string animeTag = this.GetAnimeTag(filename); animation.Stop(animeTag); } } public void StopAnimeLayer(int layerno) { if (this.m_Bones == null) { Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name); } if (layerno < 2) { Debug.LogError("モーションレイヤーの停止は2以上を指定して下さい。"); } Animation animation = this.m_Animation; IEnumerator enumerator = animation.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; AnimationState animationState = (AnimationState)obj; if (animation.IsPlaying(animationState.name) && animationState.layer == layerno) { animation.Stop(animationState.name); } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } public void SetAnimeTime(int layerno, float time) { if (this.m_Bones == null) { Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name); } Animation animation = this.m_Animation; IEnumerator enumerator = animation.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; AnimationState animationState = (AnimationState)obj; if (animation.IsPlaying(animationState.name) && animationState.layer == layerno) { animationState.time = time; } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } public void SetAnimeSpeed(int layerno, float speed) { if (this.m_Bones == null) { Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name); } Animation animation = this.m_Animation; IEnumerator enumerator = animation.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; AnimationState animationState = (AnimationState)obj; if (animation.IsPlaying(animationState.name) && animationState.layer == layerno) { animationState.speed = speed; } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } public float GetAnimeTime() { if (this.m_Bones == null) { Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name); } Animation animation = this.m_Animation; IEnumerator enumerator = animation.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; AnimationState animationState = (AnimationState)obj; if (animation.IsPlaying(animationState.name)) { return animationState.time; } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } return 0f; } public string CrossFade(string filename, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float fade = 0.5f, float weight = 1f) { if (this.m_Bones == null) { NDebug.Assert("まだ読み込まれる前のBodyにモーションを指定しようとしました。" + base.gameObject.name, false); } string animeTag = this.GetAnimeTag(filename); AnimationState animationState = this.LoadAnime(animeTag, fileSystem, filename, additive, loop); if (animationState == null) { return string.Empty; } Animation animation = this.m_Animation; if (boAddQue) { if (weight != 1f) { animation.PlayQueued(animeTag, QueueMode.CompleteOthers); animation[animeTag].weight = weight; } else { animation.CrossFadeQueued(animeTag, fade, QueueMode.CompleteOthers); } } else { if (animationState.layer == 0) { this.anist = animationState; } if (weight != 1f) { animation.Play(animeTag); animation[animeTag].weight = weight; } else { animation.CrossFade(animeTag, fade); } } return animeTag; } public string CrossFade(string tag, byte[] byte_data, bool additive = false, bool loop = false, bool boAddQue = false, float fade = 0.5f, float weight = 1f) { if (this.m_Bones == null) { NDebug.Assert("まだ読み込まれる前のBodyにモーションを指定しようとしました。" + base.gameObject.name, false); } AnimationState animationState = this.LoadAnime(tag, byte_data, additive, loop); Animation animation = this.m_Animation; if (boAddQue) { if (weight != 1f) { animation.PlayQueued(tag, QueueMode.CompleteOthers); animation[tag].weight = weight; } else { animation.CrossFadeQueued(tag, fade, QueueMode.CompleteOthers); } } else { if (animationState.layer == 0) { this.anist = animationState; } if (weight != 1f) { animation.Play(tag); animation[tag].weight = weight; } else { animation.CrossFade(tag, fade); } } return tag; } public string CrossFadeAbsolute(string filename, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float fade = 0.5f, float weight = 1f) { if (this.m_Bones == null) { NDebug.Assert("まだ読み込まれる前のBodyにモーションを指定しようとしました。" + base.gameObject.name, false); } string text = this.GetAnimeTag(filename); if (boAddQue) { AnimationClip clip = this.m_Animation.GetClip(text); if (clip != null) { text += "_2"; } } AnimationState animationState = this.LoadAnime(text, fileSystem, filename, additive, loop); if (animationState == null) { return string.Empty; } Animation animation = this.m_Animation; if (boAddQue) { if (weight != 1f) { animation.PlayQueued(text, QueueMode.CompleteOthers); animation[text].weight = weight; } else { animation.CrossFadeQueued(text, fade, QueueMode.CompleteOthers); } } else { if (animationState.layer == 0) { this.anist = animationState; } if (weight != 1f) { animation.Play(text); animation[text].weight = weight; } else { animation.CrossFade(text, fade); } } return text; } public Animation GetAnimation() { if (this.m_Bones == null) { Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name); } return this.m_Animation; } public void CacheLoadAnime(AFileSystemBase fileSystem, string filename, bool load_mune_l, bool load_mune_r) { string animeTag = this.GetAnimeTag(filename); Animation animation = this.m_Animation; AnimationClip animationClip = animation.GetClip(animeTag); byte b = 0; byte b2 = 0; bool flag = this.m_AnimCache.TryGetValue(animeTag, out b); b2 |= ((!load_mune_l) ? 0 : 1); b2 |= ((!load_mune_r) ? 0 : 2); if (animationClip == null || !flag || b != b2 || this.m_bForceReloadAnime) { animationClip = ImportCM.LoadAniClipNative(fileSystem, filename, (b2 & 1) != 0, (b2 & 2) != 0, false); if (animationClip == null) { return; } animation.AddClip(animationClip, animeTag); if (animeTag.Contains("_l_")) { for (int i = 2; i <= 8; i++) { if (animeTag.Contains("_l_" + i.ToString() + "_")) { animation[animeTag].layer = i; break; } } } this.m_AnimCache[animeTag] = b2; } } public AnimationState LoadAnime(string tag, AFileSystemBase fileSystem, string filename, bool additive, bool loop) { if (this.m_Bones == null) { Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name); } Animation animation = this.m_Animation; AnimationClip animationClip = animation.GetClip(tag); byte b = 0; byte b2 = 0; bool flag = this.m_AnimCache.TryGetValue(tag, out b); b2 |= ((!(this.jbMuneL != null) || this.jbMuneL.BlendValueON != 0f) ? 0 : 1); b2 |= ((!(this.jbMuneR != null) || this.jbMuneR.BlendValueON != 0f) ? 0 : 2); if (animationClip == null || !flag || b != b2 || this.m_bForceReloadAnime) { animationClip = ImportCM.LoadAniClipNative(fileSystem, filename, (b2 & 1) != 0, (b2 & 2) != 0, false); if (animationClip == null) { return null; } animation.AddClip(animationClip, tag); if (tag.Contains("_l_")) { for (int i = 2; i <= 8; i++) { if (tag.Contains("_l_" + i.ToString() + "_")) { animation[tag].layer = i; break; } } } this.m_AnimCache[tag] = b2; } this.LastAnimeFN = filename; AnimationState animationState = animation[tag]; if (additive) { animationState.blendMode = AnimationBlendMode.Additive; } else { animationState.blendMode = AnimationBlendMode.Blend; } if (loop) { animationState.wrapMode = WrapMode.Loop; } else { animationState.wrapMode = WrapMode.Once; } animationState.speed = 1f; animationState.time = 0f; animationState.weight = 0f; animationState.enabled = false; return animationState; } public AnimationState LoadAnime(string tag, byte[] byte_data, bool additive, bool loop) { if (this.m_Bones == null) { Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name); } Animation animation = this.m_Animation; AnimationClip clip = animation.GetClip(tag); clip = ImportCM.LoadAniClipNative(byte_data, true, true, false); animation.AddClip(clip, tag); if (tag.Contains("_l_")) { for (int i = 2; i <= 8; i++) { if (tag.Contains("_l_" + i.ToString() + "_")) { animation[tag].layer = i; break; } } } this.LastAnimeFN = tag; AnimationState animationState = animation[tag]; if (additive) { animationState.blendMode = AnimationBlendMode.Additive; } else { animationState.blendMode = AnimationBlendMode.Blend; } if (loop) { animationState.wrapMode = WrapMode.Loop; } else { animationState.wrapMode = WrapMode.Once; } animationState.speed = 1f; animationState.time = 0f; animationState.weight = 0f; animationState.enabled = false; return animationState; } public void ItemAnimationLoad(TBody.SlotID f_slot, string f_strAnimName) { this.goSlot[(int)f_slot].AnimationLoad(f_strAnimName); } public void ItemAnimationPlay(TBody.SlotID f_slot, string f_strAnimName, bool f_bLoop) { this.goSlot[(int)f_slot].AnimationPlay(f_strAnimName, f_bLoop); } public void ItemAnimationStop(TBody.SlotID f_slot) { this.goSlot[(int)f_slot].AnimationStop(); } public void MaterialAnimatorAdd(TBody.SlotID f_slot, int f_nMateNo) { this.goSlot[(int)f_slot].MaterialAnimatorAdd(f_nMateNo); } public List GetSlotListFromMPN(MPN f_mpn) { List list = new List(); for (int i = 0; i < this.goSlot.Count; i++) { TBodySkin tbodySkin = this.goSlot[i]; if (tbodySkin.m_ParentMPN == f_mpn) { list.Add(tbodySkin); } } return list; } public List> GetAttachPointListFromMPN(MPN f_mpn) { List> list = new List>(); for (int i = 0; i < this.goSlot.Count; i++) { TBodySkin tbodySkin = this.goSlot[i]; if (tbodySkin.m_ParentMPN == f_mpn) { if (!string.IsNullOrEmpty(tbodySkin.AttachName)) { if (tbodySkin.AttachVisible) { list.Add(new KeyValuePair((TBody.SlotID)tbodySkin.AttachSlotIdx, tbodySkin.AttachName)); } } else { list.Add(new KeyValuePair(tbodySkin.SlotId, string.Empty)); } } } return list; } public void SetAttachPoint(string slotname, string apname, Vector3 v, Quaternion q, bool f_bTemp) { if (!TBody.hashSlotName.ContainsKey(slotname)) { Debug.LogError("アタッチポイントがありません。" + slotname + " の " + apname); return; } int index = (int)TBody.hashSlotName[slotname]; this.goSlot[index].morph.SetAttachPoint(apname, v, q, f_bTemp); } public void SetAttachPointLocal(TBody.SlotID slotid, string apname, Vector3 vPosLocal, Quaternion qRotlocal, Vector3 vScaleRate) { if (string.IsNullOrEmpty(apname)) { this.goSlot[(int)slotid].SetAttachObjPointLocal(vPosLocal, qRotlocal, vScaleRate); } } public void GetAttachPointLocal(TBody.SlotID slotid, string apname, out Vector3 vPosLocal, out Quaternion qRotLocal, out Vector3 vScaleRate) { if (!string.IsNullOrEmpty(apname)) { vPosLocal = Vector3.zero; qRotLocal = Quaternion.identity; vScaleRate = Vector3.zero; } else { this.goSlot[(int)slotid].GetAttachObjPointLocal(out vPosLocal, out qRotLocal, out vScaleRate); } } public void CopyAttachPoint(TBody.SlotID slotid, string apname) { if (!string.IsNullOrEmpty(apname)) { if (this.goSlot[(int)slotid].morph != null) { this.goSlot[(int)slotid].morph.CopyAttachObjPoint(apname); } } else { this.goSlot[(int)slotid].CopyAttachObjPoint(); } } public void PasteAttachPoint(TBody.SlotID slotid, string apname) { if (!string.IsNullOrEmpty(apname)) { if (this.goSlot[(int)slotid].morph != null) { this.goSlot[(int)slotid].morph.PastAttachObjPoint(apname); } } else { this.goSlot[(int)slotid].PastAttachObjPoint(); } } public void SetAttachPointWorld(TBody.SlotID slotid, string apname, Vector3 vPosWorld, Quaternion qRotWorld, Vector3 vScaleRate) { if (!string.IsNullOrEmpty(apname)) { if (this.goSlot[(int)slotid].morph != null) { this.goSlot[(int)slotid].morph.SetAttachPointWorld(apname, vPosWorld, qRotWorld, vScaleRate); } } else { this.goSlot[(int)slotid].SetAttachCenterPointWorld(vPosWorld, qRotWorld, vScaleRate); } } public void GetAttachPointWorld(TBody.SlotID slotid, string apname, out Vector3 vPosWorld, out Quaternion qRotWorld, out Vector3 vScaleRate) { vPosWorld = (vScaleRate = Vector3.zero); qRotWorld = Quaternion.identity; if (!string.IsNullOrEmpty(apname)) { if (this.goSlot[(int)slotid].morph != null) { this.goSlot[(int)slotid].morph.GetAttachPoint(apname, out vPosWorld, out qRotWorld, out vScaleRate, false); } } else { this.goSlot[(int)slotid].GetAttachCenterPointWorld(out vPosWorld, out qRotWorld, out vScaleRate); } } public void ResetAttachPoint(TBody.SlotID slotid, string apname = null) { if (!string.IsNullOrEmpty(apname)) { if (this.goSlot[(int)slotid].morph != null) { this.goSlot[(int)slotid].morph.ResetAttachPoint(apname); } } else { this.goSlot[(int)slotid].ResetAttachCenterPoint(); } } public void SetEnableAttachPointEdit(bool f_bEnable, TBody.SlotID slotid, string apname = null) { if (!string.IsNullOrEmpty(apname)) { if (this.goSlot[(int)slotid].morph != null) { this.goSlot[(int)slotid].morph.SetEnableAttachPointEdit(f_bEnable, apname); } } else { this.goSlot[(int)slotid].EnablePartsPosEdit = f_bEnable; } } public bool GetEnableAttachPointEdit(TBody.SlotID slotid, string apname = null) { if (!string.IsNullOrEmpty(apname)) { return this.goSlot[(int)slotid].morph != null && this.goSlot[(int)slotid].morph.GetEnableAttachPointEdit(apname); } return this.goSlot[(int)slotid].EnablePartsPosEdit; } public void SetHairLengthDataList(string f_strSlotName, string f_strGroupName, string f_strBoneSearchType, string f_strBoneName, Vector3 f_vScaleMin, Vector3 f_vScaleMax) { if (!TBody.hashSlotName.ContainsKey(f_strSlotName)) { Debug.LogError("髪ボーン長さグループがありません。" + f_strSlotName + " の " + f_strGroupName); return; } int index = (int)TBody.hashSlotName[f_strSlotName]; this.goSlot[index].m_HairLengthCtrl.SearchAndAddHairLengthTarget(f_strGroupName, f_strBoneSearchType, f_strBoneName, f_vScaleMin, f_vScaleMax); } public Dictionary GetHairLengthListFromMPN(MPN f_mpn) { for (int i = 0; i < this.goSlot.Count; i++) { TBodySkin tbodySkin = this.goSlot[i]; if (tbodySkin.m_ParentMPN == f_mpn && tbodySkin.m_HairLengthCtrl.IsHairLengthEditable) { return tbodySkin.m_HairLengthCtrl.HairLengthGroupList; } } return null; } public void HairLengthBlend() { for (int i = 0; i < this.goSlot.Count; i++) { TBodySkin.HairLengthCtrl hairLengthCtrl = this.goSlot[i].m_HairLengthCtrl; if (hairLengthCtrl != null) { hairLengthCtrl.HairLenghtBlend(); } } } public void ItemScaleReset() { for (int i = 0; i < this.goSlot.Count; i++) { this.goSlot[i].ItemScaleReset(); } } public void ProcCosAnime() { if (!this.CosAnimeMode) { return; } if (this.anist != null) { if (this.MotionBlenFadeVal < 1f) { this.MotionBlenFadeVal += Time.deltaTime * this.CosAnimePlusT; if (this.MotionBlenFadeVal >= 1f) { if (this.oldAnimeTag != null) { this.m_Animation.Stop(this.oldAnimeTag); this.oldAnimeTag = null; } this.MotionBlenFadeVal = 1f; this.anist.weight = 1f; this.anist.layer = 0; } else { this.anist.weight = UTY.COSS2(UTY.COSS(Mathf.Pow(this.MotionBlenFadeVal, 0.5f)), 2f); } } } } public void WarpInit() { this.jbMuneL.boWarpInit = true; this.jbMuneR.boWarpInit = true; for (int i = 0; i < this.goSlot.Count; i++) { TBodySkin tbodySkin = this.goSlot[i]; if (tbodySkin.bonehair3 != null) { tbodySkin.bonehair3.WarpInit(); } } } public void OnEnable() { this.OnChangeScreenSizeOrAA(); this.ManColorUpdate(); } private void Update() { for (int i = 0; i < this.goSlot.Count; i++) { this.goSlot[i].TextureCache.Update(); } bool flag = false; foreach (KeyValuePair keyValuePair in this.m_dicLaySlot) { flag |= keyValuePair.Value.Reset(); } if (flag) { Debug.Log("MulTexReset"); this.MulTexProc(); } if (!this.isLoadedBody) { return; } if (!this.boMAN) { this.posCalfCenter = (this.Calf_R.position + this.Calf_L.position) * 0.5f; Vector3 vector = this.CenterBone.position + this.CenterBone.forward * 100f; if ((this.CenterPosOld - vector).sqrMagnitude > 0.25f && !OvrIK.IsModeVRIK) { this.WarpInit(); } this.jbMuneL.boBRA = !this.boVisible_NIP; this.jbMuneR.boBRA = !this.boVisible_NIP; this.CenterPosOld = vector; if (GameMain.Instance.VRMode) { this.m_trHandHitR = (this.m_trHandHitL = null); OvrMgr ovrMgr = GameMain.Instance.OvrMgr; if (ovrMgr != null) { OvrMgr.OvrObject.Controller left_controller = ovrMgr.ovr_obj.left_controller; if (left_controller != null && left_controller.controller != null && left_controller.controller.HandEnable) { this.m_trHandHitL = left_controller.hand_trans_hit; } OvrMgr.OvrObject.Controller right_controller = ovrMgr.ovr_obj.right_controller; if (right_controller != null && right_controller.controller != null && right_controller.controller.HandEnable) { this.m_trHandHitR = right_controller.hand_trans_hit; } } if (this.m_trHandHitL != null || this.m_trHandHitR != null || this.m_trHandLeapHitL != null || this.m_trHandLeapHitR != null) { foreach (TBodySkin tbodySkin in this.goSlot) { if (this.m_trHandHitL != null) { this.m_bNoHandL = false; foreach (THitSphere thitSphere in tbodySkin.bonehair.bodyhit.m_listHandHitL) { thitSphere.vs = thitSphere.t.InverseTransformPoint(this.m_trHandHitL.position); } } else if (!this.m_bNoHandL) { foreach (THitSphere thitSphere2 in tbodySkin.bonehair.bodyhit.m_listHandHitL) { thitSphere2.vs.y = -99999f; } this.m_bNoHandL = true; } if (this.m_trHandLeapHitL != null) { if (tbodySkin.bonehair.bodyhit.m_HandHitLeapL != null) { tbodySkin.bonehair.bodyhit.m_HandHitLeapL.vs = tbodySkin.bonehair.bodyhit.m_HandHitLeapL.t.InverseTransformPoint(this.m_trHandLeapHitL.position); } } else if (tbodySkin.bonehair.bodyhit.m_HandHitLeapL != null) { tbodySkin.bonehair.bodyhit.m_HandHitLeapL.vs.y = -10000f; } if (this.m_trHandHitR != null) { this.m_bNoHandR = false; foreach (THitSphere thitSphere3 in tbodySkin.bonehair.bodyhit.m_listHandHitR) { thitSphere3.vs = thitSphere3.t.transform.InverseTransformPoint(this.m_trHandHitR.position); } } else if (!this.m_bNoHandR) { foreach (THitSphere thitSphere4 in tbodySkin.bonehair.bodyhit.m_listHandHitR) { thitSphere4.vs.y = -99999f; } this.m_bNoHandR = true; } if (this.m_trHandLeapHitR != null) { if (tbodySkin.bonehair.bodyhit.m_HandHitLeapR != null) { tbodySkin.bonehair.bodyhit.m_HandHitLeapR.vs = tbodySkin.bonehair.bodyhit.m_HandHitLeapR.t.InverseTransformPoint(this.m_trHandLeapHitR.position); } } else if (tbodySkin.bonehair.bodyhit.m_HandHitLeapR != null) { tbodySkin.bonehair.bodyhit.m_HandHitLeapR.vs.y = -10000f; } } } float num = this.m_fHitLimitDistanceMin + (this.m_fHitLimitDistanceMax - this.m_fHitLimitDistanceMin) * (this.jbMuneL.BlendValue / 1.3f); if (this.m_trsMuneLsub != null && this.m_trHitChildL != null) { Vector3 vector2 = this.m_trsMuneL.InverseTransformPoint(this.m_trHitChildL.position); if ((vector2 - this.m_trHitParentL.localPosition).magnitude < num) { this.m_trsMuneLsub.localPosition = vector2; } else { this.m_trsMuneLsub.localPosition = this.m_trHitParentL.localPosition + (vector2 - this.m_trHitParentL.localPosition).normalized * num; this.m_trHitChildL.position = this.m_trsMuneLsub.position; } } if (this.m_trsMuneRsub != null && this.m_trHitChildR != null) { Vector3 vector3 = this.m_trsMuneR.InverseTransformPoint(this.m_trHitChildR.position); if ((vector3 - this.m_trHitParentR.localPosition).magnitude < num) { this.m_trsMuneRsub.localPosition = vector3; } else { this.m_trsMuneRsub.localPosition = this.m_trHitParentR.localPosition + (vector3 - this.m_trHitParentR.localPosition).normalized * num; this.m_trHitChildR.position = this.m_trsMuneRsub.position; } } } } } private void LateUpdate() { if (!this.isLoadedBody) { return; } this.MoveHeadAndEye(); this.IKHandL.IKExec(this.goSlot); this.IKHandR.IKExec(this.goSlot); this.MoveMomoniku(); this.AutoTwist(); if (!this.boMAN) { this.IKMuneL.SyncAttachPoint(); this.IKMuneR.SyncAttachPoint(); this.jbMuneL.LateUpdateSelf(); this.jbMuneR.LateUpdateSelf(); this.IKMuneL.IKExec(this.goSlot); this.IKMuneR.IKExec(this.goSlot); } if (this.boMAN && this.trManChinko != null) { this.trManChinko.localPosition = this.vecChinkoOffset; } for (int i = 0; i < this.goSlot.Count; i++) { if (this.goSlot[i].obj != null) { this.goSlot[i].CopyTrans(); } } if (!this.boMAN) { this.JumpDis = Mathf.Max((this.Calf_L_pos_old - this.Calf_L.position).magnitude, (this.Calf_R_pos_old - this.Calf_R.position).magnitude); this.JumpDis = Mathf.Max(this.JumpDis, (this.Thigh_L_pos_old - this.Thigh_L.position).magnitude); this.JumpDis = Mathf.Max(this.JumpDis, (this.Thigh_R_pos_old - this.Thigh_R.position).magnitude); this.JumpDis = Mathf.Clamp01(this.JumpDis * 20f); this.JumpDis = (this.JumpDis + this.JumpDis_old) * 0.5f; this.JumpDis_old = this.JumpDis; } for (int j = 0; j < this.goSlot.Count; j++) { this.goSlot[j].Update(); } if (!this.boMAN) { this.Calf_L_pos_old = this.Calf_L.position; this.Calf_R_pos_old = this.Calf_R.position; this.Thigh_L_pos_old = this.Thigh_L.position; this.Thigh_R_pos_old = this.Thigh_R.position; } } public float DegPer(float r, float per) { if (r <= 180f) { return r * per; } return (r - 360f) * per; } private float AxisAngleOnAxisPlane(Vector3 fromDirection, Vector3 toDirection, Vector3 axis) { fromDirection.Normalize(); axis.Normalize(); Vector3 rhs = toDirection - axis * Vector3.Dot(axis, toDirection); rhs.Normalize(); return Mathf.Acos(Vector3.Dot(fromDirection, rhs)) * ((Vector3.Dot(Vector3.Cross(axis, fromDirection), rhs) >= 0f) ? 57.29578f : -57.29578f); } public void AutoTwist() { if (this.boAutoTwistShoulderL && this.Uppertwist_L != null) { Quaternion localRotation = this.UpperArmL.localRotation; float x = (Quaternion.Inverse(this.quaUpperArmL) * localRotation).eulerAngles.x; this.Uppertwist_L.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(x, this.fDegPer), 0f, 0f); this.Uppertwist1_L.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(x, this.fDegPer1), 0f, 0f); this.Kata_L.localRotation = this.quaKata_L; this.Kata_L.rotation = Quaternion.Slerp(this.Kata_L.rotation, this.UpperArmL.rotation, this.fRota); } if (this.boAutoTwistShoulderR && this.Uppertwist_R != null) { Quaternion localRotation2 = this.UpperArmR.localRotation; float x2 = (Quaternion.Inverse(this.quaUpperArmR) * localRotation2).eulerAngles.x; this.Uppertwist_R.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(x2, this.fDegPer), 0f, 0f); this.Uppertwist1_R.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(x2, 0.2f), 0f, 0f); this.Kata_R.localRotation = this.quaKata_R; this.Kata_R.rotation = Quaternion.Slerp(this.Kata_R.rotation, this.Uppertwist_R.rotation, 0.5f); } if (this.boAutoTwistWristL && this.Foretwist_L != null) { Vector3 fromDirection = this.HandL_MR.localRotation * Vector3.up; fromDirection.Normalize(); Vector3 toDirection = this.HandL.localRotation * Vector3.up; toDirection.Normalize(); this.m_fAngleHandL = this.AxisAngleOnAxisPlane(fromDirection, toDirection, new Vector3(1f, 0f, 0f)) * -1f; this.Foretwist_L.localRotation = Quaternion.AngleAxis(this.m_fAngleHandL, this.Foretwist_L_MR.localRotation * Vector3.left) * this.Foretwist_L_MR.localRotation; this.Foretwist1_L.localRotation = Quaternion.AngleAxis(this.m_fAngleHandL * 0.5f, this.Foretwist1_L_MR.localRotation * Vector3.left) * this.Foretwist1_L_MR.localRotation; } if (this.boAutoTwistWristR && this.Foretwist_R != null) { Vector3 fromDirection2 = this.HandR_MR.localRotation * Vector3.up; fromDirection2.Normalize(); Vector3 toDirection2 = this.HandR.localRotation * Vector3.up; toDirection2.Normalize(); float num = this.AxisAngleOnAxisPlane(fromDirection2, toDirection2, new Vector3(1f, 0f, 0f)) * -1f; this.Foretwist_R.localRotation = Quaternion.AngleAxis(num, this.Foretwist_R_MR.localRotation * Vector3.left) * this.Foretwist_R_MR.localRotation; this.Foretwist1_R.localRotation = Quaternion.AngleAxis(num * 0.5f, this.Foretwist1_R_MR.localRotation * Vector3.left) * this.Foretwist1_R_MR.localRotation; } if (this.boAutoTwistThighL && this.momotwist_L != null) { Quaternion quaternion = this.Thigh_L.localRotation; quaternion = Quaternion.Inverse(this.quaThigh_L) * quaternion; Vector3 vector = quaternion * Vector3.forward; float num2 = quaternion.eulerAngles.x; if (vector.z < 0f) { num2 = 180f - num2; } this.momotwist_L.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(num2, this.fDegPer), 0f, 0f) * this.q_momotwist_L; this.momotwist2_L.localRotation = Quaternion.Euler(0.0174532924f * this.DegPer(num2, 0.7f), 0f, 0f) * this.q_momotwist2_L; } if (this.boAutoTwistThighR & this.momotwist_R != null) { Quaternion quaternion2 = this.Thigh_R.localRotation; quaternion2 = Quaternion.Inverse(this.quaThigh_R) * quaternion2; Vector3 vector2 = quaternion2 * Vector3.forward; float num3 = quaternion2.eulerAngles.x; if (vector2.z < 0f) { num3 = 180f - num3; } this.momotwist_R.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(num3, this.fDegPer), 0f, 0f) * this.q_momotwist_R; this.momotwist2_R.localRotation = Quaternion.Euler(0.0174532924f * this.DegPer(num3, 0.7f), 0f, 0f) * this.q_momotwist2_R; } } public void MoveMomoniku() { if (!TBody.boMoveMomoniku || this.momoniku_L == null || this.momoniku_R == null) { return; } float num = Mathf.Clamp(Vector3.Dot(Vector3.up, this.Thigh_L.up), 0f, 0.8f); float num2 = Mathf.Clamp(Vector3.Dot(Vector3.up, this.Thigh_R.up), 0f, 0.8f); this.momoniku_L.localRotation = this.momoniku_L_MR.localRotation; this.momoniku_R.localRotation = this.momoniku_R_MR.localRotation; this.momoniku_L.Rotate(0f, 0f, num * 10f); this.momoniku_R.Rotate(0f, 0f, -num2 * 10f); this.Hip_L.localRotation = Quaternion.Slerp(this.Hip_L_MR.localRotation, this.Thigh_L.localRotation, 0.67f); this.Hip_R.localRotation = Quaternion.Slerp(this.Hip_R_MR.localRotation, this.Thigh_R.localRotation, 0.67f); } public void MoveHeadAndEye() { if (this.trsHead == null) { return; } if (GameMain.Instance.VRMode && GameMain.Instance.OvrMgr == null) { return; } CameraMain mainCamera = GameMain.Instance.MainCamera; if (mainCamera == null) { return; } Vector3 a; if (this.trsLookTarget == null) { a = this.trsHead.TransformPoint(this.offsetLookTarget); if (this.boEyeSorashi) { Vector3 vector = a - this.trsHead.position; Vector3 vector2; if (GameMain.Instance.VRMode) { vector2 = GameMain.Instance.OvrMgr.EyeAnchor.position; } else { vector2 = mainCamera.transform.position - this.trsHead.position; } float num = Vector3.Dot(vector.normalized, vector2.normalized); if (this.EyeSorashiCnt > 0) { this.EyeSorashiCnt++; if (this.EyeSorashiCnt > 200) { this.EyeSorashiCnt = 0; } } if (num > 0.9f && this.EyeSorashiCnt == 0) { if (this.EyeSorashiTgl) { this.offsetLookTarget = new Vector3(-0.5f, 1f, -0.7f); } else { this.offsetLookTarget = new Vector3(-0.6f, 1f, 0.6f); } this.EyeSorashiTgl = !this.EyeSorashiTgl; this.EyeSorashiCnt = 1; } } } else { a = this.trsLookTarget.position; } if (this.boLockHeadAndEye) { return; } if (this.boHeadToCam) { this.HeadToCamPer += Time.deltaTime * this.HeadToCamFadeSpeed; } else { this.HeadToCamPer -= Time.deltaTime * this.HeadToCamFadeSpeed; } this.HeadToCamPer = Mathf.Clamp01(this.HeadToCamPer); this.boChkEye = false; Vector3 vector3 = a - this.trsNeck.position; vector3 = Quaternion.Inverse(this.trsNeck.rotation) * vector3; Quaternion quaternion = default(Quaternion); quaternion.SetFromToRotation(Vector3.up, vector3); Vector3 eulerAngles = quaternion.eulerAngles; if (eulerAngles.x >= 180f) { eulerAngles.x -= 360f; } if (eulerAngles.z >= 180f) { eulerAngles.z -= 360f; } if (this.boHeadToCamInMode) { if (-80f >= eulerAngles.x || eulerAngles.x >= 80f || -50f >= eulerAngles.z || eulerAngles.z >= 60f) { this.boHeadToCamInMode = false; } } else if (-60f < eulerAngles.x && eulerAngles.x < 60f && -40f < eulerAngles.z && eulerAngles.z < 50f) { this.boHeadToCamInMode = true; } if (this.boHeadToCamInMode) { this.boChkEye = true; float num2 = 0.3f; if (eulerAngles.x > this.HeadEulerAngle.x + 10f) { this.HeadEulerAngleG.x = this.HeadEulerAngleG.x + num2; } else if (eulerAngles.x < this.HeadEulerAngle.x - 10f) { this.HeadEulerAngleG.x = this.HeadEulerAngleG.x - num2; } else { this.HeadEulerAngleG.x = this.HeadEulerAngleG.x * 0.95f; } if (eulerAngles.z > this.HeadEulerAngle.z + 10f) { this.HeadEulerAngleG.z = this.HeadEulerAngleG.z + num2; } else if (eulerAngles.z < this.HeadEulerAngle.z - 10f) { this.HeadEulerAngleG.z = this.HeadEulerAngleG.z - num2; } else { this.HeadEulerAngleG.z = this.HeadEulerAngleG.z * 0.95f; } } else { float num3 = 0.1f; if (0f > this.HeadEulerAngle.x + 10f) { this.HeadEulerAngleG.x = this.HeadEulerAngleG.x + num3; } if (0f < this.HeadEulerAngle.x - 10f) { this.HeadEulerAngleG.x = this.HeadEulerAngleG.x - num3; } if (0f > this.HeadEulerAngle.z + 10f) { this.HeadEulerAngleG.z = this.HeadEulerAngleG.z + num3; } if (0f < this.HeadEulerAngle.z - 10f) { this.HeadEulerAngleG.z = this.HeadEulerAngleG.z - num3; } } this.HeadEulerAngleG *= 0.95f; this.HeadEulerAngle += this.HeadEulerAngleG; Quaternion b = this.quaDefHead * Quaternion.Euler(this.HeadEulerAngle.x * 0.4f, 0f, this.HeadEulerAngle.z * 0.4f); this.trsHead.localRotation = Quaternion.Slerp(this.trsHead.localRotation, b, UTY.COSS(this.HeadToCamPer)); if (!this.boMAN && this.trsEyeL != null && this.trsEyeR != null) { Vector3 vector4 = a - this.trsHead.position; vector4 = Quaternion.Inverse(this.trsHead.rotation) * vector4; Quaternion lhs = default(Quaternion); lhs.SetFromToRotation(Vector3.up, vector4); Vector3 eulerAngles2 = lhs.eulerAngles; if (eulerAngles2.x >= 180f) { eulerAngles2.x -= 360f; } if (eulerAngles2.z >= 180f) { eulerAngles2.z -= 360f; } Vector3 view = Vector3.Normalize(a - this.trsEyeL.position); lhs.SetLookRotation(view, Vector3.up); lhs *= Quaternion.Euler(0f, 90f, 0f); if (this.boEyeToCam && this.boChkEye) { float num4 = 0.5f; if (this.boEyeSorashi) { num4 = 0.05f; } this.EyeEulerAngle = this.EyeEulerAngle * (1f - num4) + eulerAngles2 * num4; } else { this.EyeEulerAngle *= 0.95f; } this.trsEyeL.localRotation = this.quaDefEyeL * Quaternion.Euler(0f, -this.EyeEulerAngle.x * 0.2f, -this.EyeEulerAngle.z * 0.1f); this.trsEyeR.localRotation = this.quaDefEyeR * Quaternion.Euler(0f, this.EyeEulerAngle.x * 0.2f, this.EyeEulerAngle.z * 0.1f); } } public void OnChangeScreenSizeOrAA() { if (this.goSlot != null) { for (int i = 0; i < this.goSlot.Count; i++) { this.goSlot[i].OnChangeScreenSizeOrAA(); } } base.StartCoroutine(this.CoReseize()); } private IEnumerator CoReseize() { yield return null; yield break; } public void ManColorUpdate() { if (this.boMAN) { for (int i = 0; i < this.goSlot.Count; i++) { TBodySkin tbodySkin = this.goSlot[i]; if (tbodySkin != null) { tbodySkin.ManColorUpdate(); } } } } private bool m_bIsLoadedBody; private AudioSourceParent m_AudioParent; public GameObject m_Bones; public Transform m_trBones; public GameObject m_Bones2; public Transform m_trBones2; public Transform trBip; public Dictionary m_dicTrans = new Dictionary(); public Animation m_Animation; private Dictionary m_AnimCache = new Dictionary(); public bool m_bForceReloadAnime; private bool boMaid = true; public bool boMAN; public IKMgrData IKHandL = new IKMgrData(); public IKMgrData IKHandR = new IKMgrData(); public IKMgrData IKMuneL = new IKMgrData(); public IKMgrData IKMuneR = new IKMgrData(); public Dictionary StrIKDataPair = new Dictionary(); private Transform m_SMbody; public Transform trsHead; public Transform trsNeck; public Quaternion quaDefHead; public Quaternion quaDefNeck; private Vector3 HeadEulerAngle; private Vector3 HeadEulerAngleG; public Transform Uppertwist_L; public Transform Uppertwist1_L; public Transform Kata_L; public Transform ClavicleL; public Transform Uppertwist_R; public Transform Uppertwist1_R; public Transform Kata_R; public Transform ClavicleR; public Quaternion quaKata_L; public Quaternion quaKata_R; public Quaternion quaUppertwist_L; public Quaternion quaUpperArmL; public Quaternion quaUppertwist_R; public Quaternion quaUpperArmR; private Transform momoniku_L; private Transform momoniku_R; private Transform momoniku_L_MR; private Transform momoniku_R_MR; public Transform Calf_L; public Transform Calf_R; public Transform Thigh_L; public Transform Thigh_R; public Transform Thigh_L_MR; public Transform Thigh_R_MR; public Transform Hip_R_nub; public Transform Hip_R; public Transform Hip_L_nub; public Transform Hip_L; private Quaternion quaThigh_L; private Quaternion quaThigh_R; private Transform Hip_L_MR; private Transform Hip_R_MR; public Vector3 m_vecDebug_Hand; public float m_fAngleHandL; private Transform HandL_NubY; private Transform HandR_NubY; private Transform HandL_NubY_MR; private Transform HandR_NubY_MR; public Transform UpperArmR; public Transform UpperArmL; private Transform ForearmR; private Transform ForearmL; private Transform HandR; private Transform HandL; private Transform HandR_MR; private Transform HandL_MR; private Transform Foretwist1_L; private Transform Foretwist_L; private Transform Foretwist1_L_MR; private Transform Foretwist_L_MR; private Transform Foretwist1_R; private Transform Foretwist_R; private Transform Foretwist1_R_MR; private Transform Foretwist_R_MR; private Transform momotwist_L; private Transform momotwist2_L; private Transform momotwist_R; private Transform momotwist2_R; private Quaternion q_momotwist_L; private Quaternion q_momotwist2_L; private Quaternion q_momotwist_R; private Quaternion q_momotwist2_R; public Transform ToeR; public Transform ToeL; public Transform CenterBone; public Transform Pelvis; public Transform FootStep; public Transform Spine; public Transform Spine0a; public Transform Spine1a; public Transform trManChinko; public Vector3 vecChinkoOffset = default(Vector3); public GameObject goMoza; public GameObject goMozaANL; public List goSlot; private float m_BoneHitY; public DynamicBonePlaneCollider m_hitFloorPlane; public Transform m_trFloorPlane; public TBody.ModeHirR Mode_HairR; public bool boMizugi_panz; public bool boVisible_NIP; public bool boVisible_HESO; public bool boVisible_XXX; public bool boVisible_BRA; public bool boVisible_PANZU; public bool boVisible_SKIRT; public bool boVisible_WEAR; public bool boLockHeadAndEye; public bool boEyeToCam = true; public bool boChkEye; public bool boHeadToCam = true; public float HeadToCamPer; public bool boHeadToCamInMode; public float HeadToCamFadeSpeed = 1f; public Transform trsLookTarget; public Vector3 offsetLookTarget = new Vector3(0f, 1f, 0f); public bool boEyeSorashi; public int EyeSorashiCnt; public bool EyeSorashiTgl; private AnimationState anist; private float MotionBlenFadeVal = 1f; private float CosAnimePlusT = 1f; private string oldAnimeTag; public bool CosAnimeMode; public int slotno_accXXX; public Vector3 CenterPosOld = Vector3.zero; public Vector3 Calf_L_pos_old; public Vector3 Calf_R_pos_old; public Vector3 Thigh_L_pos_old; public Vector3 Thigh_R_pos_old; public Vector3 posCalfCenter; public float JumpDis; public float JumpDis_old; public static readonly string[] m_strDefSlotName = new string[] { "body", "_ROOT_", "IK", "head", "Bip01 Head", "Jyouhanshin", "eye", "Bip01 Head", "Jyouhanshin", "hairF", "Bip01 Head", "Jyouhanshin", "hairR", "Bip01 Head", "Jyouhanshin", "hairS", "Bip01 Head", "Jyouhanshin", "hairT", "Bip01 Head", "Jyouhanshin", "wear", "_ROOT_", "Uwagi", "skirt", "_ROOT_", "Kahanshin", "onepiece", "_ROOT_", "Kahanshin", "mizugi", "_ROOT_", "Kahanshin", "panz", "_ROOT_", "Kahanshin", "bra", "_ROOT_", "Jyouhanshin", "stkg", "_ROOT_", "Kahanshin", "shoes", "_ROOT_", "Kahanshin", "headset", "Bip01 Head", "Jyouhanshin", "glove", "_ROOT_", "Uwagi", "accHead", "Bip01 Head", "Jyouhanshin", "hairAho", "Bip01 Head", "Jyouhanshin", "accHana", "_ROOT_", "Jyouhanshin", "accHa", "Bip01 Head", "Jyouhanshin", "accKami_1_", "Bip01 Head", "Jyouhanshin", "accMiMiR", "Bip01 Head", "Jyouhanshin", "accKamiSubR", "Bip01 Head", "Jyouhanshin", "accNipR", "_ROOT_", "Uwagi", "HandItemR", "_IK_handR", "Uwagi", "accKubi", "Bip01 Spine1a", "Jyouhanshin", "accKubiwa", "Bip01 Neck", "Jyouhanshin", "accHeso", "Bip01 Head", "Jyouhanshin", "accUde", "_ROOT_", "Uwagi", "accAshi", "_ROOT_", "Uwagi", "accSenaka", "_ROOT_", "Uwagi", "accShippo", "Bip01 Spine", "Uwagi", "accAnl", "_ROOT_", "Uwagi", "accVag", "_ROOT_", "Uwagi", "kubiwa", "_ROOT_", "Uwagi", "megane", "Bip01 Head", "Jyouhanshin", "accXXX", "_ROOT_", "Uwagi", "chinko", "Bip01 Pelvis", "Uwagi", "chikubi", "_ROOT_", "Jyouhanshin", "accHat", "Bip01 Head", "Jyouhanshin", "kousoku_upper", "_ROOT_", "Uwagi", "kousoku_lower", "_ROOT_", "Kahanshin", "seieki_naka", "_ROOT_", "Uwagi", "seieki_hara", "_ROOT_", "Uwagi", "seieki_face", "_ROOT_", "Uwagi", "seieki_mune", "_ROOT_", "Uwagi", "seieki_hip", "_ROOT_", "Uwagi", "seieki_ude", "_ROOT_", "Uwagi", "seieki_ashi", "_ROOT_", "Uwagi", "accNipL", "_ROOT_", "Uwagi", "accMiMiL", "Bip01 Head", "Jyouhanshin", "accKamiSubL", "Bip01 Head", "Jyouhanshin", "accKami_2_", "Bip01 Head", "Jyouhanshin", "accKami_3_", "Bip01 Head", "Jyouhanshin", "HandItemL", "_IK_handL", "Uwagi", "underhair", "_ROOT_", "Kahanshin", "moza", "_ROOT_", "Kahanshin", "end" }; private string[] m_strSlotName; private static int strSlotNameItemCnt = 3; public static Hashtable hashSlotName; private static HashSet NoAlphaIdxSet = null; public TBodySkin Face; public BoneMorph_ bonemorph; public Transform trsEyeL; public Transform trsEyeR; public Quaternion quaDefEyeL; public Quaternion quaDefEyeR; private Vector3 EyeEulerAngle; public float ManAlpha = 1f; public string LastAnimeFN; public Maid maid; public static bool boMoveMomoniku = true; public bool boAutoTwistShoulderL = true; public bool boAutoTwistShoulderR = true; public bool boAutoTwistWristL = true; public bool boAutoTwistWristR = true; public bool boAutoTwistThighL = true; public bool boAutoTwistThighR = true; public Dictionary m_MorphBlendValues = new Dictionary(); public Transform m_trHandHitL; public Transform m_trHandHitR; public Transform m_trHandLeapHitL; public Transform m_trHandLeapHitR; public float m_fHitLimitDistanceMin = 0.01f; public float m_fHitLimitDistanceMax = 0.04f; public float m_fHitCenterZMin = -0.3f; public float m_fHitCenterZMax; public float m_fHitRadiusMin = 0.1f; public float m_fHitRadiusMax = 0.32f; public bool m_bNewPhyscs = true; public bool m_bNewSkirtPhyscs = true; private Transform m_trsMuneL; private Transform m_trsMuneR; private Transform m_trsMuneLsub; private Transform m_trsMuneRsub; private Transform m_trHitParentL; private Transform m_trHitParentR; private Transform m_trHitChildL; private Transform m_trHitChildR; private SphereCollider m_HitChildColliderL; private SphereCollider m_HitChildColliderR; private bool m_bManMeshHide; private Dictionary m_dicLaySlot = new Dictionary(); private TBody.MaskMode m_eMaskMode; private Hashtable m_hFoceHide = new Hashtable(); private bool m_bNoHandL; private bool m_bNoHandR; public float fDegPer = 31.1f; public float fDegPer1 = 0.2f; public float fRota = 0.5f; public class IKCMO { public void Init(Transform hip, Transform knee, Transform ankle, TBody b) { this.body = b; this.defLEN1 = (hip.position - knee.position).magnitude; this.defLEN2 = (ankle.position - knee.position).magnitude; this.knee_old = knee.position; this.defHipQ = hip.localRotation; this.defKneeQ = knee.localRotation; this.vechand = Vector3.zero; } public void Porc(Transform hip, Transform knee, Transform ankle, Vector3 tgt, Vector3 vechand_offset) { tgt += this.vechand; if ((knee.position - this.knee_old).sqrMagnitude > 1f) { this.knee_old = knee.position; } this.knee_old = this.knee_old * 0.5f + knee.position * 0.5f; Vector3 normalized = (this.knee_old - tgt).normalized; this.knee_old = tgt + normalized * this.defLEN2; Vector3 normalized2 = (this.knee_old - hip.position).normalized; this.knee_old = hip.position + normalized2 * this.defLEN1; if (!this.body.boMAN) { Vector3 zero = Vector3.zero; bool flag = this.body.goSlot[0].bonehair.bodyhit.SphereMove_hair(ref this.knee_old, ref zero, Vector3.zero); if (flag) { Debug.DrawLine(this.body.Spine0a.position, this.knee_old, Color.white); } } default(Quaternion).SetLookRotation(normalized2); hip.localRotation = this.defHipQ; hip.transform.rotation = Quaternion.FromToRotation(knee.transform.position - hip.transform.position, this.knee_old - hip.transform.position) * hip.transform.rotation; knee.localRotation = this.defKneeQ; knee.transform.rotation = Quaternion.FromToRotation(ankle.transform.position - knee.transform.position, tgt - knee.transform.position) * knee.transform.rotation; Debug.DrawLine(hip.position, this.knee_old, Color.yellow); Debug.DrawLine(ankle.position, this.knee_old, Color.yellow); this.vechand = ankle.rotation * vechand_offset; } private TBody body; private float defLEN1; private float defLEN2; private Vector3 knee_old; private Quaternion defHipQ; private Quaternion defKneeQ; private Vector3 vechand; } public enum ModeHirR { Normal, NoFront } public enum SlotID { body, head, eye, hairF, hairR, hairS, hairT, wear, skirt, onepiece, mizugi, panz, bra, stkg, shoes, headset, glove, accHead, hairAho, accHana, accHa, accKami_1_, accMiMiR, accKamiSubR, accNipR, HandItemR, accKubi, accKubiwa, accHeso, accUde, accAshi, accSenaka, accShippo, accAnl, accVag, kubiwa, megane, accXXX, chinko, chikubi, accHat, kousoku_upper, kousoku_lower, seieki_naka, seieki_hara, seieki_face, seieki_mune, seieki_hip, seieki_ude, seieki_ashi, accNipL, accMiMiL, accKamiSubL, accKami_2_, accKami_3_, HandItemL, underhair, moza, end } public class TexLay { public class LaySet { public void Remove() { UnityEngine.Object.Destroy(this.tex); this.tex = null; } public int nLayerNo; public bool bNoTransfrom; public int nX; public int nY; public float fRot; public float fScale; public int nTargetBodyTexSize; public Texture tex; public GameUty.SystemMaterial mode; public float fAlpha = 1f; public SubProp sprop; } public class OrderTex { public void SortLaySet() { this.listLaySet.Sort(delegate(TBody.TexLay.LaySet x, TBody.TexLay.LaySet y) { if (x.nLayerNo < y.nLayerNo) { return -1; } if (x.nLayerNo > y.nLayerNo) { return 1; } return 0; }); } public void Remove() { UnityEngine.Object.Destroy(this.tex); this.tex = null; this.RemoveLaySet(); } public void RemoveLaySet() { for (int i = 0; i < this.listLaySet.Count; i++) { this.listLaySet[i].Remove(); } this.listLaySet.Clear(); } public int nLayerNo; public Texture2D texBack; public Texture2D tex; public GameUty.SystemMaterial mode; public List listLaySet = new List(); } public class Lay { public Lay(Texture f_texBack) { this.rtBase = new RenderTexture(f_texBack.width, f_texBack.height, 0); this.texBack = f_texBack; this.rtBase.name = "rt:src:" + f_texBack.name; RenderTexture active = RenderTexture.active; Graphics.Blit(this.texBack, this.rtBase); RenderTexture.active = active; } public void Sort() { this.listLayer.Sort(delegate(TBody.TexLay.OrderTex x, TBody.TexLay.OrderTex y) { if (x.nLayerNo < y.nLayerNo) { return -1; } if (x.nLayerNo > y.nLayerNo) { return 1; } return 0; }); } public void Remove(int f_nLayNo = -1) { if (f_nLayNo == -1) { for (int i = 0; i < this.listLayer.Count; i++) { this.listLayer[i].Remove(); } this.listLayer.Clear(); } else { TBody.TexLay.OrderTex[] array = (from ot in this.listLayer where ot.nLayerNo == f_nLayNo select ot).ToArray(); for (int j = 0; j < array.Length; j++) { if (this.listLayer[j].nLayerNo == f_nLayNo) { this.listLayer[j].Remove(); } } this.listLayer.RemoveAll((TBody.TexLay.OrderTex ot) => ot.nLayerNo == f_nLayNo); } if (this.listLayer.Count == 0 && this.rtBase != null) { UnityEngine.Object.DestroyImmediate(this.rtBase); this.rtBase = null; } } public bool Reset() { bool result = false; if (!this.rtBase.IsCreated()) { Debug.Log("画面リサイズによる、テクスチャレイヤーRTの再生成"); this.rtBase.Create(); RenderTexture active = RenderTexture.active; Graphics.Blit(this.texBack, this.rtBase); RenderTexture.active = active; result = true; } return result; } public Texture texBack; public RenderTexture rtBase; public List listLayer = new List(); public bool bDel; } public class Prop { public void Remove() { foreach (KeyValuePair keyValuePair in this.dicLayInProp) { keyValuePair.Value.Remove(-1); } this.dicLayInProp.Clear(); } public bool Reset() { bool flag = false; foreach (KeyValuePair keyValuePair in this.dicLayInProp) { flag |= keyValuePair.Value.Reset(); } return flag; } public Dictionary dicLayInProp = new Dictionary(); } public class Mat { public void Remove() { foreach (KeyValuePair keyValuePair in this.dicPropInMat) { keyValuePair.Value.Remove(); } this.dicPropInMat.Clear(); } public bool Reset() { bool flag = false; foreach (KeyValuePair keyValuePair in this.dicPropInMat) { flag |= keyValuePair.Value.Reset(); } return flag; } public Dictionary dicPropInMat = new Dictionary(); } } public enum MaskMode { None, Underwear, Swim, Nude } }