TBody.cs 102 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using UnityEngine;
  7. public class TBody : MonoBehaviour
  8. {
  9. public bool isLoadedBody
  10. {
  11. get
  12. {
  13. return this.m_bIsLoadedBody;
  14. }
  15. }
  16. public AudioSourceMgr AudioMan
  17. {
  18. get
  19. {
  20. return (!(this.m_AudioParent != null)) ? null : this.m_AudioParent.m_AudioMan;
  21. }
  22. }
  23. public void SetVoicePitch(int value)
  24. {
  25. if (this.AudioMan != null)
  26. {
  27. this.AudioMan.Pitch = SoundMgr.ConvertToAudioSourcePitch(value);
  28. }
  29. }
  30. public Transform SmBody
  31. {
  32. get
  33. {
  34. if (!this.m_SMbody)
  35. {
  36. if (!this.boMAN)
  37. {
  38. this.m_SMbody = CMT.SearchObjName(this.m_trBones, "_SM_body001", false);
  39. }
  40. else
  41. {
  42. this.m_SMbody = CMT.SearchObjName(this.m_trBones, "_SM_mbody", false);
  43. }
  44. }
  45. return this.m_SMbody;
  46. }
  47. }
  48. public jiggleBone jbMuneL { get; private set; }
  49. public jiggleBone jbMuneR { get; private set; }
  50. public float BoneHitHeightY
  51. {
  52. get
  53. {
  54. return this.m_trFloorPlane.position.y;
  55. }
  56. set
  57. {
  58. if (this.m_trFloorPlane != null)
  59. {
  60. this.m_trFloorPlane.position = new Vector3(0f, value, 0f);
  61. }
  62. this.m_BoneHitY = value;
  63. }
  64. }
  65. public void Init(Maid maid_, bool boMAN_ = false)
  66. {
  67. this.maid = maid_;
  68. this.boMAN = boMAN_;
  69. this.boMaid = !this.boMAN;
  70. this.m_strSlotName = new string[TBody.m_strDefSlotName.Length];
  71. TBody.m_strDefSlotName.CopyTo(this.m_strSlotName, 0);
  72. if (this.boMAN)
  73. {
  74. for (int i = 0; i < this.m_strSlotName.Length; i++)
  75. {
  76. this.m_strSlotName[i] = this.m_strSlotName[i].Replace("Bip01", "ManBip");
  77. }
  78. }
  79. TBody.hashSlotName = new Hashtable();
  80. this.bonemorph = new BoneMorph_();
  81. this.bonemorph.Init();
  82. this.goSlot = new List<TBodySkin>();
  83. int num = 0;
  84. while (!(this.m_strSlotName[num] == "end"))
  85. {
  86. int num2 = num / TBody.strSlotNameItemCnt;
  87. TBody.hashSlotName[this.m_strSlotName[num]] = num2;
  88. TBody.hashSlotName[this.m_strSlotName[num].ToLower()] = num2;
  89. TBody.hashSlotName[this.m_strSlotName[num].ToUpper()] = num2;
  90. TBodySkin item = new TBodySkin(this, this.m_strSlotName[num], (TBody.SlotID)num2, boMAN_);
  91. this.goSlot.Add(item);
  92. num += TBody.strSlotNameItemCnt;
  93. }
  94. this.m_bForceReloadAnime = false;
  95. }
  96. public void UnInit()
  97. {
  98. if (this.bonemorph != null)
  99. {
  100. this.bonemorph.Uninit();
  101. }
  102. this.m_bIsLoadedBody = false;
  103. int num = this.goSlot.Count - 1;
  104. while (0 <= num)
  105. {
  106. this.goSlot[num].DeleteObj();
  107. num--;
  108. }
  109. UnityEngine.Object.DestroyImmediate(this.m_Bones);
  110. this.m_Bones = null;
  111. this.m_trBones = null;
  112. this.m_dicTrans.Clear();
  113. UnityEngine.Object.DestroyImmediate(this.m_Bones2);
  114. this.m_Bones2 = null;
  115. this.m_trBones2 = null;
  116. foreach (KeyValuePair<string, TBody.TexLay.Mat> keyValuePair in this.m_dicLaySlot)
  117. {
  118. keyValuePair.Value.Remove();
  119. }
  120. this.m_dicLaySlot.Clear();
  121. if (this.m_hitFloorPlane != null)
  122. {
  123. UnityEngine.Object.DestroyImmediate(this.m_hitFloorPlane.gameObject);
  124. this.m_hitFloorPlane = null;
  125. }
  126. }
  127. private void OnDetattchVoice(AudioSourceParent f_asp)
  128. {
  129. Debug.Log(this.maid.name + " Voice回収");
  130. this.m_AudioParent = null;
  131. }
  132. private void OnDestroy()
  133. {
  134. if (this.m_hitFloorPlane != null)
  135. {
  136. UnityEngine.Object.DestroyImmediate(this.m_hitFloorPlane.gameObject);
  137. this.m_hitFloorPlane = null;
  138. }
  139. }
  140. public int GetSlotNo(string slotname)
  141. {
  142. NDebug.Assert(this.IsSlotNo(slotname), "GetSlotNo not found [" + slotname + "] ");
  143. return (int)TBody.hashSlotName[slotname];
  144. }
  145. public bool IsSlotNo(string slotname)
  146. {
  147. return TBody.hashSlotName.ContainsKey(slotname);
  148. }
  149. public TBodySkin GetSlot(int f_nSlotNo)
  150. {
  151. return this.goSlot[f_nSlotNo];
  152. }
  153. public TBodySkin GetSlot(string slotname)
  154. {
  155. return this.GetSlot(this.GetSlotNo(slotname));
  156. }
  157. public Transform GetBone(string f_strBoneName)
  158. {
  159. return CMT.SearchObjName(this.m_trBones, f_strBoneName, true);
  160. }
  161. public void LoadBody_R(string f_strModelFileName, Maid f_maid)
  162. {
  163. if (this.m_bIsLoadedBody)
  164. {
  165. this.UnInit();
  166. }
  167. this.m_bIsLoadedBody = true;
  168. GameObject goOffset = f_maid.m_goOffset;
  169. GameObject gameObject;
  170. if (!GameMain.Instance.CharacterMgr.TryGetCacheObject(f_strModelFileName, out gameObject))
  171. {
  172. byte[] bs = null;
  173. try
  174. {
  175. using (AFileBase afileBase = GameUty.FileOpen(f_strModelFileName, null))
  176. {
  177. NDebug.Assert(afileBase.IsValid(), "Bodyファイルが開けませんでした。" + f_strModelFileName);
  178. bs = afileBase.ReadAll();
  179. }
  180. }
  181. catch (Exception ex)
  182. {
  183. Debug.LogError(string.Concat(new string[]
  184. {
  185. "ProcScriptBin/SetMaidItemTemp メニューファイルが読み込めませんでした。 : ",
  186. f_strModelFileName,
  187. " : ",
  188. ex.Message,
  189. " : StackTrace :\n",
  190. ex.StackTrace
  191. }));
  192. }
  193. GameObject gameObject2 = ImportCM.LoadOnlyBone_R(bs);
  194. GameMain.Instance.CharacterMgr.AddCacheObject(f_strModelFileName, gameObject2);
  195. gameObject = gameObject2;
  196. }
  197. if (this.m_Bones != null)
  198. {
  199. Debug.LogError("ボーン二重 " + this.m_Bones.name);
  200. }
  201. this.m_Bones = UnityEngine.Object.Instantiate<GameObject>(gameObject);
  202. this.m_Bones.name = gameObject.name;
  203. this.m_trBones = this.m_Bones.transform;
  204. CMT.SearchAndAddObj(this.m_trBones, this.m_dicTrans);
  205. this.m_Animation = this.m_Bones.GetComponent<Animation>();
  206. if (this.m_Bones2 != null)
  207. {
  208. Debug.LogError("ボーン二重 " + this.m_Bones2.name);
  209. }
  210. this.m_Bones2 = UnityEngine.Object.Instantiate<GameObject>(this.m_Bones);
  211. this.m_Bones2.name = this.m_Bones.name + " MR";
  212. this.m_trBones2 = this.m_Bones2.transform;
  213. this.m_trBones.SetParent(goOffset.transform, false);
  214. this.m_trBones2.SetParent(goOffset.transform, false);
  215. this.HeadEulerAngle = Vector3.zero;
  216. this.HeadEulerAngleG = Vector3.zero;
  217. string text = "Bip01";
  218. if (this.boMAN)
  219. {
  220. text = "ManBip";
  221. }
  222. this.trBip = CMT.SearchObjName(this.m_trBones, text, true);
  223. this.trsHead = CMT.SearchObjName(this.m_trBones, text + " Head", true);
  224. this.trsNeck = CMT.SearchObjName(this.m_trBones, text + " Neck", true);
  225. if (!f_maid.boMAN)
  226. {
  227. if (this.m_AudioParent != null)
  228. {
  229. UnityEngine.Object.DestroyImmediate(this.m_AudioParent);
  230. }
  231. this.m_AudioParent = this.trsNeck.gameObject.AddComponent<AudioSourceParent>();
  232. this.m_AudioParent.AttachVoice(this.trsNeck, new AudioSourceParent.dgOnDettach(this.OnDetattchVoice));
  233. this.SetVoicePitch(this.maid.VoicePitch);
  234. Debug.Log(this.maid.name + " Voice割り当て");
  235. }
  236. this.quaDefHead = this.trsHead.localRotation;
  237. this.quaDefNeck = this.trsNeck.localRotation;
  238. this.UpperArmR = CMT.SearchObjName(this.m_trBones, text + " R UpperArm", true);
  239. this.UpperArmL = CMT.SearchObjName(this.m_trBones, text + " L UpperArm", true);
  240. this.ForearmR = CMT.SearchObjName(this.m_trBones, text + " R Forearm", true);
  241. this.ForearmL = CMT.SearchObjName(this.m_trBones, text + " L Forearm", true);
  242. this.HandL = CMT.SearchObjName(this.m_trBones, text + " L Hand", true);
  243. this.HandL_NubY = new GameObject("L Hand nub1").transform;
  244. this.HandL_NubY.transform.parent = this.HandL;
  245. this.HandL_NubY.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  246. this.HandL_NubY.transform.localRotation = Quaternion.identity;
  247. this.HandR = CMT.SearchObjName(this.m_trBones, text + " R Hand", true);
  248. this.HandR_NubY = new GameObject("R Hand nub1").transform;
  249. this.HandR_NubY.transform.parent = this.HandR;
  250. this.HandR_NubY.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  251. this.HandR_NubY.transform.localRotation = Quaternion.identity;
  252. this.ClavicleL = CMT.SearchObjName(this.m_trBones, text + " L Clavicle", true);
  253. this.ClavicleR = CMT.SearchObjName(this.m_trBones, text + " R Clavicle", true);
  254. if (this.UpperArmR == null)
  255. {
  256. Debug.LogError("UpperArmR null");
  257. }
  258. if (this.UpperArmL == null)
  259. {
  260. Debug.LogError("UpperArmL null");
  261. }
  262. if (this.ForearmR == null)
  263. {
  264. Debug.LogError("ForearmR null");
  265. }
  266. if (this.ForearmL == null)
  267. {
  268. Debug.LogError("ForearmL null");
  269. }
  270. if (this.HandR == null)
  271. {
  272. Debug.LogError("HandR null");
  273. }
  274. if (this.HandL == null)
  275. {
  276. Debug.LogError("HandL null");
  277. }
  278. this.IKHandL.SetKinematicTgt(this.HandL, 3);
  279. this.IKHandL.IkCmoInit(this);
  280. if (!this.StrIKDataPair.ContainsKey("左手"))
  281. {
  282. this.StrIKDataPair.Add("左手", this.IKHandL);
  283. }
  284. this.IKHandR.SetKinematicTgt(this.HandR, 3);
  285. this.IKHandR.IkCmoInit(this);
  286. if (!this.StrIKDataPair.ContainsKey("右手"))
  287. {
  288. this.StrIKDataPair.Add("右手", this.IKHandR);
  289. }
  290. this.CenterBone = CMT.SearchObjName(this.m_trBones, "center", true);
  291. this.ToeR = CMT.SearchObjName(this.m_trBones, text + " R Toe2Nub", true);
  292. this.ToeL = CMT.SearchObjName(this.m_trBones, text + " L Toe2Nub", true);
  293. this.Pelvis = CMT.SearchObjName(this.m_trBones, text + " Pelvis", true);
  294. this.FootStep = CMT.SearchObjName(this.m_trBones, text + " Footsteps", true);
  295. this.Spine = CMT.SearchObjName(this.m_trBones, text + " Spine", true);
  296. this.Spine0a = CMT.SearchObjName(this.m_trBones, text + " Spine0a", true);
  297. this.Spine1a = CMT.SearchObjName(this.m_trBones, text + " Spine1a", true);
  298. if (this.boMAN)
  299. {
  300. this.trManChinko = CMT.SearchObjName(this.m_trBones, "chinkoCenter", true);
  301. this.vecChinkoOffset = this.trManChinko.transform.localPosition;
  302. }
  303. this.Uppertwist_L = CMT.SearchObjName(this.m_trBones, "Uppertwist_L", true);
  304. this.Uppertwist1_L = CMT.SearchObjName(this.m_trBones, "Uppertwist1_L", true);
  305. this.Kata_L = CMT.SearchObjName(this.m_trBones, "Kata_L", true);
  306. if (this.Kata_L != null)
  307. {
  308. this.quaKata_L = this.Kata_L.localRotation;
  309. }
  310. this.Uppertwist_R = CMT.SearchObjName(this.m_trBones, "Uppertwist_R", true);
  311. this.Uppertwist1_R = CMT.SearchObjName(this.m_trBones, "Uppertwist1_R", true);
  312. this.Kata_R = CMT.SearchObjName(this.m_trBones, "Kata_R", true);
  313. if (this.Kata_R != null)
  314. {
  315. this.quaKata_R = this.Kata_R.localRotation;
  316. }
  317. this.Foretwist1_L = CMT.SearchObjName(this.m_trBones, "Foretwist1_L", true);
  318. this.Foretwist_L = CMT.SearchObjName(this.m_trBones, "Foretwist_L", true);
  319. this.Foretwist1_L_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist1_L", true);
  320. this.Foretwist_L_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist_L", true);
  321. this.Foretwist1_R = CMT.SearchObjName(this.m_trBones, "Foretwist1_R", true);
  322. this.Foretwist_R = CMT.SearchObjName(this.m_trBones, "Foretwist_R", true);
  323. this.Foretwist1_R_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist1_R", true);
  324. this.Foretwist_R_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist_R", true);
  325. this.momoniku_L = CMT.SearchObjName(this.m_trBones, "momoniku_L", true);
  326. this.momoniku_R = CMT.SearchObjName(this.m_trBones, "momoniku_R", true);
  327. this.Calf_L = CMT.SearchObjName(this.m_trBones, text + " L Calf", true);
  328. this.Calf_R = CMT.SearchObjName(this.m_trBones, text + " R Calf", true);
  329. this.momoniku_L_MR = CMT.SearchObjName(this.m_trBones2, "momoniku_L", true);
  330. this.momoniku_R_MR = CMT.SearchObjName(this.m_trBones2, "momoniku_R", true);
  331. this.Thigh_R = CMT.SearchObjName(this.m_trBones, text + " R Thigh", true);
  332. this.Thigh_L = CMT.SearchObjName(this.m_trBones, text + " L Thigh", true);
  333. this.Thigh_R_MR = CMT.SearchObjName(this.m_trBones2, text + " R Thigh", true);
  334. this.Thigh_L_MR = CMT.SearchObjName(this.m_trBones2, text + " L Thigh", true);
  335. if (this.Thigh_L != null)
  336. {
  337. this.quaThigh_L = this.Thigh_L.localRotation;
  338. }
  339. if (this.Thigh_R != null)
  340. {
  341. this.quaThigh_R = this.Thigh_R.localRotation;
  342. }
  343. this.HandL_MR = CMT.SearchObjName(this.m_trBones2, text + " L Hand", true);
  344. if (this.HandL_MR != null)
  345. {
  346. this.HandL_NubY_MR = new GameObject("L Hand nub1").transform;
  347. this.HandL_NubY_MR.transform.parent = this.HandL_MR;
  348. this.HandL_NubY_MR.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  349. this.HandL_NubY_MR.transform.localRotation = Quaternion.identity;
  350. }
  351. this.HandR_MR = CMT.SearchObjName(this.m_trBones2, text + " R Hand", true);
  352. if (this.HandR_MR != null)
  353. {
  354. this.HandR_NubY_MR = new GameObject("R Hand nub1").transform;
  355. this.HandR_NubY_MR.transform.parent = this.HandR_MR;
  356. this.HandR_NubY_MR.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  357. this.HandR_NubY_MR.transform.localRotation = Quaternion.identity;
  358. }
  359. this.momotwist_L = CMT.SearchObjName(this.m_trBones, "momotwist_L", true);
  360. this.momotwist2_L = CMT.SearchObjName(this.m_trBones, "momotwist2_L", true);
  361. this.momotwist_R = CMT.SearchObjName(this.m_trBones, "momotwist_R", true);
  362. this.momotwist2_R = CMT.SearchObjName(this.m_trBones, "momotwist2_R", true);
  363. if (this.momotwist_L != null)
  364. {
  365. this.q_momotwist_L = this.momotwist_L.localRotation;
  366. }
  367. if (this.momotwist2_L != null)
  368. {
  369. this.q_momotwist2_L = this.momotwist2_L.localRotation;
  370. }
  371. if (this.momotwist_R != null)
  372. {
  373. this.q_momotwist_R = this.momotwist_R.localRotation;
  374. }
  375. if (this.momotwist2_R != null)
  376. {
  377. this.q_momotwist2_R = this.momotwist2_R.localRotation;
  378. }
  379. this.Hip_L_nub = CMT.SearchObjName(this.m_trBones, "Hip_L_nub", true);
  380. this.Hip_R_nub = CMT.SearchObjName(this.m_trBones, "Hip_R_nub", true);
  381. this.Hip_L = CMT.SearchObjName(this.m_trBones, "Hip_L", true);
  382. this.Hip_R = CMT.SearchObjName(this.m_trBones, "Hip_R", true);
  383. this.Hip_L_MR = CMT.SearchObjName(this.m_trBones2, "Hip_L", true);
  384. this.Hip_R_MR = CMT.SearchObjName(this.m_trBones2, "Hip_R", true);
  385. if (this.boMAN)
  386. {
  387. return;
  388. }
  389. this.jbMuneL = CMT.SearchObjName(this.m_trBones, "Mune_L", true).gameObject.AddComponent<jiggleBone>();
  390. this.jbMuneR = CMT.SearchObjName(this.m_trBones, "Mune_R", true).gameObject.AddComponent<jiggleBone>();
  391. if (GameMain.Instance.VRMode)
  392. {
  393. OvrMgr ovrMgr = GameMain.Instance.OvrMgr;
  394. if (ovrMgr != null)
  395. {
  396. OvrMgr.OvrObject.Controller left_controller = ovrMgr.ovr_obj.left_controller;
  397. if (left_controller != null && left_controller.controller != null && left_controller.controller.HandEnable)
  398. {
  399. this.m_trHandHitL = left_controller.hand_trans_hit;
  400. }
  401. OvrMgr.OvrObject.Controller right_controller = ovrMgr.ovr_obj.right_controller;
  402. if (right_controller != null && (right_controller.controller != null & right_controller.controller.HandEnable))
  403. {
  404. this.m_trHandHitR = right_controller.hand_trans_hit;
  405. }
  406. this.m_trHandLeapHitL = ovrMgr.m_trLeapHandL;
  407. this.m_trHandLeapHitR = ovrMgr.m_trLeapHandR;
  408. }
  409. this.m_trsMuneL = CMT.SearchObjName(this.m_trBones, "Mune_L", true);
  410. this.m_trsMuneLsub = CMT.SearchObjName(this.m_trBones, "Mune_L_sub", true);
  411. GameObject gameObject3 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereParent")) as GameObject;
  412. GameObject gameObject4 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereChild")) as GameObject;
  413. gameObject4.GetComponent<SpringJoint>().connectedBody = gameObject3.GetComponent<Rigidbody>();
  414. this.m_trHitParentL = gameObject3.transform;
  415. this.m_trHitChildL = gameObject4.transform;
  416. this.m_trHitParentL.parent = this.m_trsMuneL;
  417. this.m_trHitChildL.parent = this.m_trsMuneL;
  418. this.m_trHitParentL.localPosition = this.m_trsMuneLsub.localPosition;
  419. this.m_trHitChildL.localPosition = this.m_trsMuneLsub.localPosition;
  420. this.m_HitChildColliderL = gameObject4.GetComponent<SphereCollider>();
  421. this.m_trsMuneR = CMT.SearchObjName(this.m_trBones, "Mune_R", true);
  422. this.m_trsMuneRsub = CMT.SearchObjName(this.m_trBones, "Mune_R_sub", true);
  423. GameObject gameObject5 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereParent")) as GameObject;
  424. GameObject gameObject6 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereChild")) as GameObject;
  425. gameObject6.GetComponent<SpringJoint>().connectedBody = gameObject5.GetComponent<Rigidbody>();
  426. this.m_trHitParentR = gameObject5.transform;
  427. this.m_trHitChildR = gameObject6.transform;
  428. this.m_trHitParentR.parent = this.m_trsMuneR;
  429. this.m_trHitChildR.parent = this.m_trsMuneR;
  430. this.m_trHitParentR.localPosition = this.m_trsMuneRsub.localPosition;
  431. this.m_trHitChildR.localPosition = this.m_trsMuneRsub.localPosition;
  432. this.m_HitChildColliderR = gameObject6.GetComponent<SphereCollider>();
  433. }
  434. Transform transform = (!this.m_trsMuneLsub) ? CMT.SearchObjName(this.m_trBones, "Mune_L_sub", true) : this.m_trsMuneLsub;
  435. Transform transform2 = (!this.m_trsMuneRsub) ? CMT.SearchObjName(this.m_trBones, "Mune_R_sub", true) : this.m_trsMuneRsub;
  436. this.IKMuneL.CreateAttachPointObj("_IK_nippleL", transform, this, "body", "乳首左");
  437. this.IKMuneR.CreateAttachPointObj("_IK_nippleR", transform2, this, "body", "乳首右");
  438. this.IKMuneL.SetKinematicTgt(transform, 2);
  439. this.IKMuneR.SetKinematicTgt(transform2, 2);
  440. if (!this.StrIKDataPair.ContainsKey("左胸"))
  441. {
  442. this.StrIKDataPair.Add("左胸", this.IKMuneL);
  443. }
  444. if (!this.StrIKDataPair.ContainsKey("右胸"))
  445. {
  446. this.StrIKDataPair.Add("右胸", this.IKMuneR);
  447. }
  448. for (int i = 0; i < this.goSlot.Count; i++)
  449. {
  450. int rot = 270;
  451. if (this.m_strSlotName[i * TBody.strSlotNameItemCnt + 1] == "_ROOT_")
  452. {
  453. rot = 90;
  454. }
  455. this.goSlot[i].LoadHitcheckData(this.m_trBones, this.m_strSlotName[i * TBody.strSlotNameItemCnt + 2], rot, this.m_strSlotName[i * TBody.strSlotNameItemCnt]);
  456. }
  457. this.goSlot[0].m_strModelFileName = f_strModelFileName;
  458. if (this.boMAN)
  459. {
  460. this.SetManHide(this.m_bManMeshHide);
  461. }
  462. if (this.m_hitFloorPlane == null)
  463. {
  464. GameObject gameObject7 = new GameObject("FloorPlane-Maid[" + this.maid.ActiveSlotNo + "]");
  465. gameObject7.transform.SetParent(GameMain.Instance.BgMgr.Parent.transform, false);
  466. gameObject7.transform.position = new Vector3(0f, this.m_BoneHitY, 0f);
  467. this.m_hitFloorPlane = gameObject7.AddComponent<DynamicBonePlaneCollider>();
  468. this.m_trFloorPlane = gameObject7.transform;
  469. }
  470. }
  471. public void AddItem(MPN mpn, string slotname, string filename, string AttachSlot, string AttachName, bool f_bTemp)
  472. {
  473. int num = (int)TBody.hashSlotName[slotname];
  474. string bonename = this.m_strSlotName[num * TBody.strSlotNameItemCnt + 1];
  475. int layer = 10;
  476. TBodySkin tbodySkin = this.goSlot[num];
  477. tbodySkin.Load(mpn, this.m_trBones2, this.m_trBones, this.m_dicTrans, bonename, filename, slotname, AttachSlot, layer, f_bTemp);
  478. tbodySkin.SyojiType = 0;
  479. tbodySkin.m_strModelFileName = filename;
  480. tbodySkin.RID = Path.GetFileName(filename).ToLower().GetHashCode();
  481. tbodySkin.AttachName = null;
  482. tbodySkin.AttachSlotIdx = 0;
  483. if (AttachSlot == "ボーンにアタッチ")
  484. {
  485. tbodySkin.trsBoneAttach = CMT.SearchObjName(this.m_trBones, AttachName, true);
  486. }
  487. else if (AttachSlot != string.Empty)
  488. {
  489. if (!TBody.hashSlotName.ContainsKey(AttachSlot))
  490. {
  491. return;
  492. }
  493. int attachSlotIdx = (int)TBody.hashSlotName[AttachSlot];
  494. tbodySkin.AttachName = AttachName;
  495. tbodySkin.AttachSlotIdx = attachSlotIdx;
  496. }
  497. if (slotname == "head")
  498. {
  499. this.Face = tbodySkin;
  500. if (!this.boMAN)
  501. {
  502. this.trsEyeL = CMT.SearchObjName(this.Face.obj_tr, "Eye_L", false);
  503. this.trsEyeR = CMT.SearchObjName(this.Face.obj_tr, "Eye_R", false);
  504. this.quaDefEyeL = this.trsEyeL.localRotation;
  505. this.quaDefEyeR = this.trsEyeR.localRotation;
  506. this.EyeEulerAngle = Vector3.zero;
  507. }
  508. }
  509. if (slotname == "body" && !this.boMAN)
  510. {
  511. this.quaUppertwist_L = CMT.SearchObjName(tbodySkin.obj_tr, "Uppertwist_L", false).localRotation;
  512. this.quaUpperArmL = CMT.SearchObjName(tbodySkin.obj_tr, "Bip01 L UpperArm", false).localRotation;
  513. this.quaUppertwist_R = CMT.SearchObjName(tbodySkin.obj_tr, "Uppertwist_R", false).localRotation;
  514. this.quaUpperArmR = CMT.SearchObjName(tbodySkin.obj_tr, "Bip01 R UpperArm", false).localRotation;
  515. }
  516. this.bonemorph.Init();
  517. this.bonemorph.InitBoneMorphEdit(tbodySkin.obj_tr, mpn, (TBody.SlotID)num);
  518. this.bonemorph.AddRoot(this.m_trBones);
  519. this.bonemorph.Blend();
  520. if (this.boMAN)
  521. {
  522. this.SetManHide(this.m_bManMeshHide);
  523. }
  524. }
  525. private Transform SearchItemTarget(string f_strSlotName, string f_strObjTarget)
  526. {
  527. Transform result = null;
  528. try
  529. {
  530. int index = (int)TBody.hashSlotName[f_strSlotName];
  531. Transform obj_tr = this.goSlot[index].obj_tr;
  532. result = obj_tr.Find(f_strObjTarget);
  533. }
  534. catch (Exception ex)
  535. {
  536. Debug.LogError("SearchItemTarget 不正\n" + ex.Message);
  537. }
  538. return result;
  539. }
  540. public void SetSlotOffsetPos(string f_strSlotName, string f_strObjTarget, Vector3 f_vPos)
  541. {
  542. Transform transform = this.SearchItemTarget(f_strSlotName, f_strObjTarget);
  543. if (transform != null)
  544. {
  545. transform.localPosition = f_vPos;
  546. }
  547. }
  548. public void SetSlotOffsetRot(string f_strSlotName, string f_strObjTarget, Vector3 f_vRot)
  549. {
  550. Transform transform = this.SearchItemTarget(f_strSlotName, f_strObjTarget);
  551. if (transform != null)
  552. {
  553. transform.localRotation = Quaternion.Euler(f_vRot);
  554. }
  555. }
  556. public void MuneYureL(float onL)
  557. {
  558. if (this.jbMuneL != null)
  559. {
  560. this.jbMuneL.BlendValueON = onL;
  561. }
  562. }
  563. public float GetMuneYureL()
  564. {
  565. return (!(this.jbMuneL != null)) ? 0f : this.jbMuneL.BlendValueON;
  566. }
  567. public void MuneYureR(float onR)
  568. {
  569. if (this.jbMuneR != null)
  570. {
  571. this.jbMuneR.BlendValueON = onR;
  572. }
  573. }
  574. public float GetMuneYureR()
  575. {
  576. return (!(this.jbMuneR != null)) ? 0f : this.jbMuneR.BlendValueON;
  577. }
  578. public void SetBoneHitHeightY(float f_fY)
  579. {
  580. this.BoneHitHeightY = f_fY;
  581. }
  582. public void VertexMorph_FromProcItem(string tag, float f)
  583. {
  584. tag = tag.ToLower();
  585. if (!this.boMaid)
  586. {
  587. if (tag != "hara")
  588. {
  589. return;
  590. }
  591. tag = "karadal";
  592. }
  593. if (this.goSlot[0].morph == null)
  594. {
  595. return;
  596. }
  597. if (this.boMaid)
  598. {
  599. if (tag == "munel")
  600. {
  601. this.jbMuneL.BlendValue = f;
  602. this.jbMuneR.BlendValue = f;
  603. this.goSlot[3].bonehair.bodyhit.ScaleMune("MUNE", f * 0.3f + 0.8f);
  604. this.goSlot[3].m_BonehairBodyhitScaleBackup["MUNE"] = f * 0.3f + 0.8f;
  605. this.goSlot[4].bonehair.bodyhit.ScaleMune("MUNE", f * 0.3f + 0.8f);
  606. this.goSlot[4].m_BonehairBodyhitScaleBackup["MUNE"] = f * 0.3f + 0.8f;
  607. if (GameMain.Instance.VRMode && this.m_HitChildColliderR != null && this.m_HitChildColliderL != null)
  608. {
  609. float num = this.jbMuneL.BlendValue / 1.3f;
  610. SphereCollider hitChildColliderR = this.m_HitChildColliderR;
  611. Vector3 center = new Vector3(0f, 0f, this.m_fHitCenterZMin + (this.m_fHitCenterZMax - this.m_fHitCenterZMin) * num);
  612. this.m_HitChildColliderL.center = center;
  613. hitChildColliderR.center = center;
  614. SphereCollider hitChildColliderR2 = this.m_HitChildColliderR;
  615. float radius = this.m_fHitRadiusMin + (this.m_fHitRadiusMax - this.m_fHitRadiusMin) * num;
  616. this.m_HitChildColliderL.radius = radius;
  617. hitChildColliderR2.radius = radius;
  618. }
  619. }
  620. if (tag == "hara")
  621. {
  622. this.goSlot[7].bonehair.bodyhit.ScaleMune("HARA", f);
  623. this.goSlot[7].m_BonehairBodyhitScaleBackup["HARA"] = f;
  624. }
  625. }
  626. if (tag == "regfat" || tag == "regmeet")
  627. {
  628. float blendValues = this.goSlot[0].morph.GetBlendValues((int)this.goSlot[0].morph.hash["regfat"]);
  629. float blendValues2 = this.goSlot[0].morph.GetBlendValues((int)this.goSlot[0].morph.hash["regmeet"]);
  630. float num2 = (blendValues + blendValues2) * 0.5f;
  631. if (num2 < 0.5f)
  632. {
  633. num2 = num2 * 0.1f + 0.95f;
  634. }
  635. else
  636. {
  637. num2 = num2 * 0.4f + 0.8f;
  638. }
  639. this.goSlot[7].bonehair.bodyhit.ScaleMune("MOMO", num2);
  640. this.goSlot[7].m_BonehairBodyhitScaleBackup["MOMO"] = num2;
  641. }
  642. try
  643. {
  644. if (this.goSlot[0].morph.hash.ContainsKey(tag))
  645. {
  646. int f_nIdx = (int)this.goSlot[0].morph.hash[tag];
  647. this.goSlot[0].morph.SetBlendValues(f_nIdx, f);
  648. this.goSlot[0].morph.FixBlendValues();
  649. }
  650. }
  651. catch
  652. {
  653. NDebug.Assert(false, "Null MorphTarget=" + tag);
  654. }
  655. for (int i = 1; i < this.goSlot.Count; i++)
  656. {
  657. TMorph morph = this.goSlot[i].morph;
  658. if (morph != null)
  659. {
  660. if (morph.Contains(tag))
  661. {
  662. int f_nIdx2 = (int)morph.hash[tag];
  663. morph.SetBlendValues(f_nIdx2, f);
  664. morph.FixBlendValues();
  665. }
  666. }
  667. }
  668. this.m_MorphBlendValues[tag] = f;
  669. }
  670. public void BoneMorph_FromProcItem(string tag, float f)
  671. {
  672. if (!this.boMaid)
  673. {
  674. return;
  675. }
  676. bool flag = false;
  677. if (tag == "sintyou")
  678. {
  679. flag = true;
  680. this.bonemorph.SCALE_Sintyou = f;
  681. }
  682. if (tag == "koshi")
  683. {
  684. flag = true;
  685. this.bonemorph.SCALE_Koshi = f;
  686. }
  687. if (tag == "kata")
  688. {
  689. flag = true;
  690. this.bonemorph.SCALE_Kata = f;
  691. }
  692. if (tag == "west")
  693. {
  694. flag = true;
  695. this.bonemorph.SCALE_West = f;
  696. }
  697. if (tag == "DouPer")
  698. {
  699. flag = true;
  700. this.bonemorph.SCALE_DouPer = f;
  701. }
  702. if (tag == "koshi" || tag == "west")
  703. {
  704. float num = (this.bonemorph.SCALE_Koshi + this.bonemorph.SCALE_West) * 0.5f;
  705. this.goSlot[7].bonehair.bodyhit.ScaleMune("KOSHI_SVAL", f);
  706. if (num < 1f)
  707. {
  708. num = num * 0.1f + 0.95f;
  709. }
  710. else
  711. {
  712. num = num * 0.8f + 0.4f;
  713. }
  714. this.goSlot[7].bonehair.bodyhit.ScaleMune("KOSHI_SCL", num);
  715. }
  716. if (tag == "KubiScl")
  717. {
  718. flag = true;
  719. this.bonemorph.SCALE_Kubi = f;
  720. }
  721. if (tag == "UdeScl")
  722. {
  723. flag = true;
  724. this.bonemorph.SCALE_Ude = f;
  725. }
  726. if (tag == "EyeSclX")
  727. {
  728. flag = true;
  729. this.bonemorph.SCALE_EyeX = f;
  730. }
  731. if (tag == "EyeSclY")
  732. {
  733. flag = true;
  734. this.bonemorph.SCALE_EyeY = f;
  735. }
  736. if (tag == "EyePosX")
  737. {
  738. flag = true;
  739. this.bonemorph.Postion_EyeX = f;
  740. }
  741. if (tag == "EyePosY")
  742. {
  743. flag = true;
  744. this.bonemorph.Postion_EyeY = f;
  745. }
  746. if (tag == "EyeBallPosX")
  747. {
  748. flag = true;
  749. this.bonemorph.EyeBallPosX = f;
  750. }
  751. if (tag == "EyeBallPosY")
  752. {
  753. flag = true;
  754. this.bonemorph.EyeBallPosY = f;
  755. }
  756. if (tag == "EyeBallSclX")
  757. {
  758. flag = true;
  759. this.bonemorph.EyeBallSclX = f;
  760. }
  761. if (tag == "EyeBallSclY")
  762. {
  763. flag = true;
  764. this.bonemorph.EyeBallSclY = f;
  765. }
  766. if (tag == "HeadX")
  767. {
  768. flag = true;
  769. this.bonemorph.SCALE_HeadX = f;
  770. }
  771. if (tag == "HeadY")
  772. {
  773. flag = true;
  774. this.bonemorph.SCALE_HeadY = f;
  775. }
  776. if (tag == "MayuY")
  777. {
  778. this.bonemorph.POS_MayuY = f;
  779. }
  780. if (tag == "EyeClose")
  781. {
  782. this.goSlot[1].morph.m_fEyeCloseRate = f;
  783. }
  784. if (tag == "FaceShape")
  785. {
  786. this.goSlot[1].morph.m_fFaceShapeRate = f;
  787. }
  788. if (tag == "MuneUpDown")
  789. {
  790. this.jbMuneL.MuneUpDown = (f - 0.5f) * 60f;
  791. this.jbMuneR.MuneUpDown = (f - 0.5f) * 60f;
  792. this.jbMuneL.BlendValue2 = f - 0.5f;
  793. this.jbMuneR.BlendValue2 = -(f - 0.5f);
  794. this.jbMuneL.MuneUpDown_f = Mathf.Abs(f - 0.5f) * 2f;
  795. this.jbMuneR.MuneUpDown_f = Mathf.Abs(f - 0.5f) * 2f;
  796. flag = true;
  797. }
  798. if (tag == "MuneYori")
  799. {
  800. this.jbMuneL.MuneYori = (f - 0.5f) * 25f;
  801. this.jbMuneR.MuneYori = (f - 0.5f) * 25f;
  802. this.jbMuneL.MuneYori_f = Mathf.Abs(f - 0.5f) * 2f;
  803. this.jbMuneR.MuneYori_f = Mathf.Abs(f - 0.5f) * 2f;
  804. flag = true;
  805. }
  806. if (tag == "MuneYawaraka")
  807. {
  808. jiggleBone jbMuneR = this.jbMuneR;
  809. this.jbMuneL.m_fMuneYawaraka = f;
  810. jbMuneR.m_fMuneYawaraka = f;
  811. flag = true;
  812. }
  813. if (!flag)
  814. {
  815. }
  816. this.bonemorph.Blend();
  817. }
  818. public void SetVisibleNodeSlot(string slotname, bool boSetFlag, string name)
  819. {
  820. if (!this.boMaid)
  821. {
  822. return;
  823. }
  824. if (!TBody.hashSlotName.ContainsKey(slotname))
  825. {
  826. NDebug.Assert("SetVisibleNodeSlot: not found slot name " + slotname, false);
  827. return;
  828. }
  829. int index = (int)TBody.hashSlotName[slotname];
  830. this.goSlot[index].SetVisibleFlag(boSetFlag, name, this.goSlot[0].obj_tr, false);
  831. }
  832. public void SetVisibleNodeSlotParts(string slotname, string target, bool boSetFlag, string name)
  833. {
  834. if (!this.boMaid)
  835. {
  836. return;
  837. }
  838. if (!TBody.hashSlotName.ContainsKey(slotname))
  839. {
  840. NDebug.Assert("SetVisibleNodeSlot: not found slot name " + slotname, false);
  841. return;
  842. }
  843. int index = (int)TBody.hashSlotName[slotname];
  844. this.goSlot[index].SetVisibleFlagParts(boSetFlag, target, name, this.goSlot[0].obj_tr, false);
  845. }
  846. public void AddMask(string slotname, string maskslot)
  847. {
  848. if (!TBody.hashSlotName.ContainsKey(slotname) || !TBody.hashSlotName.ContainsKey(maskslot))
  849. {
  850. return;
  851. }
  852. int index = (int)TBody.hashSlotName[slotname];
  853. int item = (int)TBody.hashSlotName[maskslot];
  854. this.goSlot[index].listMaskSlot.Add(item);
  855. }
  856. public void DelItem(MPN mpn, string slotname)
  857. {
  858. if (!TBody.hashSlotName.ContainsKey(slotname))
  859. {
  860. return;
  861. }
  862. this.MulTexRemove(slotname);
  863. int num = (int)TBody.hashSlotName[slotname];
  864. this.goSlot[num].DeleteObj();
  865. this.goSlot[num].RID = 0;
  866. this.goSlot[num].boVisible = false;
  867. this.goSlot[num].SyojiType = 0;
  868. this.bonemorph.Init();
  869. this.bonemorph.DelBoneMorphEdit(mpn, (TBody.SlotID)num);
  870. this.bonemorph.AddRoot(this.m_trBones);
  871. this.bonemorph.Blend();
  872. this.goSlot[num].m_ParentMPN = MPN.null_mpn;
  873. this.SetVisibleNodeSlot(slotname, true, "_ALL_");
  874. }
  875. public void ChangeCol(string name, int matno, string prop_name, Color col)
  876. {
  877. int index = (int)TBody.hashSlotName[name];
  878. GameObject obj = this.goSlot[index].obj;
  879. if (obj == null)
  880. {
  881. return;
  882. }
  883. List<Renderer> list = new List<Renderer>(3);
  884. obj.transform.GetComponentsInChildren<Renderer>(true, list);
  885. for (int i = 0; i < list.Count; i++)
  886. {
  887. Renderer renderer = list[i];
  888. if (renderer != null && renderer.material != null && matno < renderer.materials.Length)
  889. {
  890. renderer.materials[matno].SetColor(prop_name, col);
  891. }
  892. }
  893. }
  894. public void ChangeTex(string slotname, int matno, string prop_name, string filename, Dictionary<string, byte[]> dicModTexData, MaidParts.PARTS_COLOR f_ePartsColorId = MaidParts.PARTS_COLOR.NONE)
  895. {
  896. if (!this.boMaid)
  897. {
  898. return;
  899. }
  900. if (TBody.NoAlphaIdxSet == null)
  901. {
  902. TBody.NoAlphaIdxSet = new HashSet<int>();
  903. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairF"]);
  904. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairR"]);
  905. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairS"]);
  906. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairT"]);
  907. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairAho"]);
  908. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["body"]);
  909. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["head"]);
  910. }
  911. Texture texture = null;
  912. NDebug.Assert(TBody.hashSlotName.ContainsKey(slotname), "テクスチャ変更:スロット名がみつかりません。:" + slotname);
  913. int num = (int)TBody.hashSlotName[slotname];
  914. TBodySkin tbodySkin = this.goSlot[num];
  915. GameObject obj = tbodySkin.obj;
  916. if (obj == null)
  917. {
  918. return;
  919. }
  920. if (filename.IndexOf("*") != -1)
  921. {
  922. filename = filename.Replace("*", Path.GetFileNameWithoutExtension(tbodySkin.m_strModelFileName));
  923. }
  924. TextureResource textureResource = null;
  925. if (dicModTexData != null)
  926. {
  927. filename = filename.ToLower();
  928. if (!dicModTexData.ContainsKey(filename))
  929. {
  930. Debug.LogError("MOD:テクスチャの変更:" + filename + "は見つかりませんでした。");
  931. return;
  932. }
  933. textureResource = new TextureResource(2, 2, TextureFormat.ARGB32, null, dicModTexData[filename]);
  934. }
  935. else
  936. {
  937. textureResource = ImportCM.LoadTexture(GameUty.FileSystem, filename, false);
  938. }
  939. List<Renderer> list = new List<Renderer>(3);
  940. obj.transform.GetComponentsInChildren<Renderer>(true, list);
  941. for (int i = 0; i < list.Count; i++)
  942. {
  943. Renderer renderer = list[i];
  944. if (!(renderer == null) && !(renderer.material == null))
  945. {
  946. if (matno < renderer.materials.Length)
  947. {
  948. try
  949. {
  950. Material material = renderer.materials[matno];
  951. material.SetTexture(prop_name, null);
  952. tbodySkin.TextureCache.RemoveTexture(matno, prop_name);
  953. }
  954. catch (Exception ex)
  955. {
  956. NDebug.Assert("テクスチャの変更に失敗しました。以前のテクスチャを破棄できませんでした。" + ex.Message, false);
  957. goto IL_4AE;
  958. }
  959. this.MulTexRemove(slotname, matno, prop_name, -1);
  960. if (texture == null)
  961. {
  962. Texture2D texture2D = textureResource.CreateTexture2D();
  963. texture2D.name = filename;
  964. bool flag = true;
  965. if (TBody.NoAlphaIdxSet.Contains(num) && (prop_name == "_MainTex" || prop_name == "_OutlineTex" || prop_name == "_ShadowTex" || prop_name == "_ToonRamp"))
  966. {
  967. flag = false;
  968. if (slotname == "head")
  969. {
  970. if (matno != 5)
  971. {
  972. flag = true;
  973. }
  974. }
  975. else if (slotname == "body" && matno != 0)
  976. {
  977. flag = true;
  978. }
  979. }
  980. bool flag2 = !RenderTextureCache.CheckSupportsRenderTextureFormat(RenderTextureFormat.R8);
  981. if (flag || flag2 || MaidParts.PARTS_COLOR.NONE >= f_ePartsColorId || f_ePartsColorId >= MaidParts.PARTS_COLOR.MAX)
  982. {
  983. texture = texture2D;
  984. }
  985. else
  986. {
  987. byte[] tex_byte = textureResource.data;
  988. Action<Texture2D, RenderTexture> CreateR8Tex = delegate(Texture2D src_tex2d, RenderTexture dest_render_tex)
  989. {
  990. RenderTexture active = RenderTexture.active;
  991. Material systemMaterial = GameUty.GetSystemMaterial(GameUty.SystemMaterial.TexTo8bitTex);
  992. Graphics.Blit(src_tex2d, dest_render_tex, systemMaterial);
  993. RenderTexture.active = active;
  994. };
  995. Action<RenderTexture> value = delegate(RenderTexture recreate_tex)
  996. {
  997. byte[] tex_byte = tex_byte;
  998. string filename2 = filename;
  999. Texture2D texture2D2 = new Texture2D(2, 2, TextureFormat.RGBA32, false);
  1000. texture2D2.LoadImage(tex_byte);
  1001. CreateR8Tex(texture2D2, recreate_tex);
  1002. recreate_tex.name = filename2;
  1003. UnityEngine.Object.Destroy(texture2D2);
  1004. };
  1005. KeyValuePair<int, Action<RenderTexture>> recreate_func = new KeyValuePair<int, Action<RenderTexture>>(0, value);
  1006. RenderTexture texture2 = InfinityColorTextureCache.render_cache.GetTexture(texture2D.width, texture2D.height, RenderTextureFormat.R8, recreate_func);
  1007. texture2.name = filename;
  1008. CreateR8Tex(texture2D, texture2);
  1009. UnityEngine.Object.Destroy(texture2D);
  1010. texture = texture2;
  1011. }
  1012. }
  1013. tbodySkin.TextureCache.AddTexture(matno, prop_name, texture, f_ePartsColorId);
  1014. texture = tbodySkin.TextureCache.GetModifiedTexture(matno, prop_name);
  1015. Material material2 = renderer.materials[matno];
  1016. material2.SetTexture(prop_name, texture);
  1017. }
  1018. else
  1019. {
  1020. NDebug.Assert(string.Concat(new object[]
  1021. {
  1022. "マテリアル番号指定が ",
  1023. renderer.name,
  1024. "のマテリアル数を超えています。",
  1025. slotname,
  1026. " / ",
  1027. matno
  1028. }), false);
  1029. }
  1030. }
  1031. IL_4AE:;
  1032. }
  1033. }
  1034. private Material GetMaterial(string f_strSlotname, int f_nMatNo)
  1035. {
  1036. NDebug.Assert(TBody.hashSlotName.ContainsKey(f_strSlotname), "スロット名がみつかりません。:" + f_strSlotname);
  1037. int index = (int)TBody.hashSlotName[f_strSlotname];
  1038. TBodySkin tbodySkin = this.goSlot[index];
  1039. GameObject obj = tbodySkin.obj;
  1040. if (obj == null)
  1041. {
  1042. return null;
  1043. }
  1044. foreach (Transform transform in obj.transform.GetComponentsInChildren<Transform>(true))
  1045. {
  1046. Renderer component = transform.GetComponent<Renderer>();
  1047. if (component != null && component.material != null)
  1048. {
  1049. if (f_nMatNo < component.materials.Length)
  1050. {
  1051. return component.materials[f_nMatNo];
  1052. }
  1053. NDebug.Assert(string.Concat(new object[]
  1054. {
  1055. "マテリアル番号指定が ",
  1056. component.name,
  1057. " のマテリアル数を超えています。",
  1058. f_strSlotname,
  1059. " / ",
  1060. f_nMatNo
  1061. }), false);
  1062. }
  1063. }
  1064. return null;
  1065. }
  1066. 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)
  1067. {
  1068. if (!this.boMaid)
  1069. {
  1070. return;
  1071. }
  1072. if (f_nLayerNo < 0)
  1073. {
  1074. NDebug.Assert("レイヤー番号は0以上を使ってください。", false);
  1075. }
  1076. TBody.TexLay.Mat mat;
  1077. if (!this.m_dicLaySlot.TryGetValue(f_strSlotname, out mat))
  1078. {
  1079. mat = new TBody.TexLay.Mat();
  1080. this.m_dicLaySlot.Add(f_strSlotname, mat);
  1081. }
  1082. TBody.TexLay.Prop prop;
  1083. if (!mat.dicPropInMat.TryGetValue(f_nMatNo, out prop))
  1084. {
  1085. prop = new TBody.TexLay.Prop();
  1086. mat.dicPropInMat.Add(f_nMatNo, prop);
  1087. }
  1088. TBody.TexLay.Lay lay;
  1089. if (!prop.dicLayInProp.TryGetValue(f_strPropName, out lay))
  1090. {
  1091. Material material = this.GetMaterial(f_strSlotname, f_nMatNo);
  1092. Texture texture = material.GetTexture(f_strPropName);
  1093. if (texture == null)
  1094. {
  1095. NDebug.Assert("テクスチャが設定されていませんでした。", false);
  1096. }
  1097. lay = new TBody.TexLay.Lay(texture);
  1098. material.SetTexture(f_strPropName, lay.rtBase);
  1099. prop.dicLayInProp.Add(f_strPropName, lay);
  1100. }
  1101. TBody.TexLay.OrderTex orderTex = lay.listLayer.Find((TBody.TexLay.OrderTex x) => x.nLayerNo == f_nLayerNo);
  1102. if (orderTex == null)
  1103. {
  1104. orderTex = new TBody.TexLay.OrderTex();
  1105. orderTex.nLayerNo = f_nLayerNo;
  1106. lay.listLayer.Add(orderTex);
  1107. }
  1108. else
  1109. {
  1110. UnityEngine.Object.Destroy(orderTex.tex);
  1111. orderTex.tex = null;
  1112. }
  1113. Texture2D texture2D;
  1114. if (f_strFileName.Contains("res:"))
  1115. {
  1116. string text = "Texture/" + f_strFileName.Replace("res:", string.Empty);
  1117. UnityEngine.Object @object = Resources.Load(text);
  1118. if (@object == null)
  1119. {
  1120. NDebug.Assert("Resourcesからテクスチャ" + text + "はみつかりません。", false);
  1121. }
  1122. texture2D = (UnityEngine.Object.Instantiate(@object) as Texture2D);
  1123. texture2D.name = text;
  1124. }
  1125. else
  1126. {
  1127. texture2D = ImportCM.CreateTexture(f_strFileName);
  1128. texture2D.name = f_strFileName;
  1129. }
  1130. orderTex.mode = f_eBlendMode;
  1131. if (f_bAdd)
  1132. {
  1133. TBody.TexLay.LaySet laySet = new TBody.TexLay.LaySet();
  1134. laySet.tex = texture2D;
  1135. laySet.bNoTransfrom = f_bNoTransform;
  1136. laySet.nX = f_nX;
  1137. laySet.nY = f_nY;
  1138. laySet.fRot = f_fRot;
  1139. laySet.fScale = f_nScale;
  1140. laySet.nTargetBodyTexSize = f_nTargetBodyTexSize;
  1141. laySet.fAlpha = f_fAlpha;
  1142. laySet.sprop = f_SubProp;
  1143. if (laySet.sprop != null)
  1144. {
  1145. laySet.sprop.strSlotName = f_strSlotname;
  1146. }
  1147. orderTex.listLaySet.Add(laySet);
  1148. }
  1149. else
  1150. {
  1151. orderTex.RemoveLaySet();
  1152. orderTex.tex = texture2D;
  1153. }
  1154. }
  1155. public void MulTexProc()
  1156. {
  1157. foreach (KeyValuePair<string, TBody.TexLay.Mat> keyValuePair in this.m_dicLaySlot)
  1158. {
  1159. this.MulTexProc(keyValuePair.Key);
  1160. }
  1161. }
  1162. public void MulTexProc(string slotname)
  1163. {
  1164. RenderTexture active = RenderTexture.active;
  1165. TBody.TexLay.Mat mat;
  1166. if (this.m_dicLaySlot.TryGetValue(slotname, out mat))
  1167. {
  1168. foreach (KeyValuePair<int, TBody.TexLay.Prop> keyValuePair in mat.dicPropInMat)
  1169. {
  1170. foreach (KeyValuePair<string, TBody.TexLay.Lay> keyValuePair2 in keyValuePair.Value.dicLayInProp)
  1171. {
  1172. if (keyValuePair2.Value.rtBase == null)
  1173. {
  1174. Debug.LogWarning("MulTexProc rtBase is null.");
  1175. }
  1176. if (!keyValuePair2.Value.rtBase.IsCreated())
  1177. {
  1178. Debug.LogWarning("MulTexProc rtBase is lost.");
  1179. }
  1180. Graphics.Blit(keyValuePair2.Value.texBack, keyValuePair2.Value.rtBase);
  1181. List<TBody.TexLay.OrderTex> listLayer = keyValuePair2.Value.listLayer;
  1182. keyValuePair2.Value.Sort();
  1183. for (int i = 0; i < listLayer.Count; i++)
  1184. {
  1185. TBody.TexLay.OrderTex orderTex = listLayer[i];
  1186. Material systemMaterial = GameUty.GetSystemMaterial(orderTex.mode);
  1187. if (keyValuePair2.Value.rtBase == null)
  1188. {
  1189. Debug.LogWarning("texture layer base is not existed.");
  1190. }
  1191. else if (orderTex.listLaySet.Count == 0)
  1192. {
  1193. systemMaterial.SetFloat("_Alpha", 1f);
  1194. Graphics.Blit(orderTex.tex, keyValuePair2.Value.rtBase, systemMaterial);
  1195. }
  1196. else
  1197. {
  1198. RenderTexture active2 = RenderTexture.active;
  1199. RenderTexture.active = keyValuePair2.Value.rtBase;
  1200. for (int j = 0; j < orderTex.listLaySet.Count; j++)
  1201. {
  1202. TBody.TexLay.LaySet laySet = orderTex.listLaySet[j];
  1203. if (laySet.bNoTransfrom)
  1204. {
  1205. if (laySet.sprop != null)
  1206. {
  1207. systemMaterial.SetFloat("_Alpha", laySet.sprop.fTexMulAlpha);
  1208. }
  1209. else
  1210. {
  1211. systemMaterial.SetFloat("_Alpha", laySet.fAlpha);
  1212. }
  1213. RenderTexture active3 = RenderTexture.active;
  1214. Graphics.Blit(laySet.tex, keyValuePair2.Value.rtBase, systemMaterial);
  1215. RenderTexture.active = active3;
  1216. }
  1217. else if (keyValuePair2.Value.rtBase.width == laySet.nTargetBodyTexSize)
  1218. {
  1219. Vector3 s = new Vector3(laySet.fScale, laySet.fScale, 1f);
  1220. Vector3 pos = new Vector3((float)laySet.nX, (float)laySet.nY, 0f);
  1221. Quaternion q = Quaternion.Euler(new Vector3(0f, 0f, laySet.fRot));
  1222. GL.PushMatrix();
  1223. GL.LoadPixelMatrix(0f, (float)keyValuePair2.Value.rtBase.width, (float)keyValuePair2.Value.rtBase.height, 0f);
  1224. GL.MultMatrix(Matrix4x4.TRS(pos, q, s));
  1225. 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);
  1226. GL.PopMatrix();
  1227. }
  1228. else
  1229. {
  1230. float num = (float)(keyValuePair2.Value.rtBase.width / laySet.nTargetBodyTexSize);
  1231. Vector3 s2 = new Vector3(laySet.fScale * num, laySet.fScale * num, 1f);
  1232. Vector3 pos2 = new Vector3((float)laySet.nX * num, (float)laySet.nY * num, 0f);
  1233. Quaternion q2 = Quaternion.Euler(new Vector3(0f, 0f, laySet.fRot));
  1234. GL.PushMatrix();
  1235. GL.LoadPixelMatrix(0f, (float)keyValuePair2.Value.rtBase.width, (float)keyValuePair2.Value.rtBase.height, 0f);
  1236. GL.MultMatrix(Matrix4x4.TRS(pos2, q2, s2));
  1237. 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);
  1238. GL.PopMatrix();
  1239. }
  1240. }
  1241. RenderTexture.active = active2;
  1242. }
  1243. }
  1244. }
  1245. }
  1246. }
  1247. RenderTexture.active = active;
  1248. }
  1249. public void MulTexRemove(string f_strSlotname)
  1250. {
  1251. TBody.TexLay.Mat mat;
  1252. if (this.m_dicLaySlot.TryGetValue(f_strSlotname, out mat))
  1253. {
  1254. mat.Remove();
  1255. }
  1256. this.m_dicLaySlot.Remove(f_strSlotname);
  1257. }
  1258. public void MulTexRemove(string f_strSlotname, int f_nMatNo, string f_strPropName, int f_nLayNo = -1)
  1259. {
  1260. TBody.TexLay.Mat mat;
  1261. if (this.m_dicLaySlot.TryGetValue(f_strSlotname, out mat))
  1262. {
  1263. TBody.TexLay.Prop prop;
  1264. if (mat.dicPropInMat.TryGetValue(f_nMatNo, out prop))
  1265. {
  1266. TBody.TexLay.Lay lay;
  1267. if (prop.dicLayInProp.TryGetValue(f_strPropName, out lay))
  1268. {
  1269. lay.Remove(f_nLayNo);
  1270. if (lay.listLayer.Count == 0)
  1271. {
  1272. prop.dicLayInProp.Remove(f_strPropName);
  1273. }
  1274. }
  1275. if (prop.dicLayInProp.Count == 0)
  1276. {
  1277. mat.dicPropInMat.Remove(f_nMatNo);
  1278. }
  1279. }
  1280. if (mat.dicPropInMat.Count == 0)
  1281. {
  1282. this.m_dicLaySlot.Remove(f_strSlotname);
  1283. }
  1284. }
  1285. }
  1286. public void UpdateInfinityColor(MaidParts.PARTS_COLOR f_eColorType)
  1287. {
  1288. bool flag = false;
  1289. for (int i = 0; i < this.goSlot.Count; i++)
  1290. {
  1291. TBodySkin tbodySkin = this.goSlot[i];
  1292. if (tbodySkin.TextureCache.UpdateColor(f_eColorType))
  1293. {
  1294. flag = true;
  1295. }
  1296. }
  1297. if (flag)
  1298. {
  1299. this.MulTexProc();
  1300. }
  1301. }
  1302. public void ChangeShader(string f_strSlotName, int f_nMatNo, string f_strShaderFileName)
  1303. {
  1304. if (!TBody.hashSlotName.ContainsKey(f_strSlotName))
  1305. {
  1306. NDebug.Assert("シェーダー変更:スロット名がみつかりません。:" + f_strSlotName, false);
  1307. }
  1308. int index = (int)TBody.hashSlotName[f_strSlotName];
  1309. this.goSlot[index].ChangeShader(f_nMatNo, f_strShaderFileName);
  1310. }
  1311. public void RestoreShader(string f_strSlotName)
  1312. {
  1313. int index = (int)TBody.hashSlotName[f_strSlotName];
  1314. this.goSlot[index].RestoreShader();
  1315. }
  1316. public void ChangeMaterial(string f_strSlotName, int f_nMatNo, string f_strFileName)
  1317. {
  1318. if (!TBody.hashSlotName.ContainsKey(f_strSlotName))
  1319. {
  1320. NDebug.Assert("マテリアル変更:スロット名がみつかりません。:" + f_strSlotName, false);
  1321. }
  1322. int index = (int)TBody.hashSlotName[f_strSlotName];
  1323. TBodySkin tbodySkin = this.goSlot[index];
  1324. GameObject obj = tbodySkin.obj;
  1325. if (obj == null)
  1326. {
  1327. return;
  1328. }
  1329. foreach (Transform transform in obj.transform.GetComponentsInChildren<Transform>(true))
  1330. {
  1331. Renderer component = transform.GetComponent<Renderer>();
  1332. if (component != null && component.material != null && f_nMatNo < component.materials.Length)
  1333. {
  1334. ImportCM.LoadMaterial(f_strFileName, tbodySkin, component.materials[f_nMatNo]);
  1335. }
  1336. }
  1337. }
  1338. 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)
  1339. {
  1340. if (!TBody.hashSlotName.ContainsKey(f_strDestSlotName))
  1341. {
  1342. NDebug.Assert("マテリアルプロパティ変更:スロット名がみつかりません。:" + f_strDestSlotName, false);
  1343. }
  1344. MPN f_SrcMpn = (MPN)Enum.Parse(typeof(MPN), f_strSrcMpnName, true);
  1345. int index = (int)TBody.hashSlotName[f_strDestSlotName];
  1346. TBodySkin tbodySkin = this.goSlot[index];
  1347. tbodySkin.SetMaterialProperty(f_SrcMpn, f_nMatNo, f_strPropName, f_strTypeName, f_strValue, f_bEditSave);
  1348. }
  1349. public string GetMaterialProperty(string f_strDestSlotName, int f_nMatNo, string f_strPropName, string f_strType = "AUTO")
  1350. {
  1351. if (!TBody.hashSlotName.ContainsKey(f_strDestSlotName))
  1352. {
  1353. NDebug.Assert("マテリアルプロパティ変更:スロット名がみつかりません。:" + f_strDestSlotName, false);
  1354. }
  1355. int index = (int)TBody.hashSlotName[f_strDestSlotName];
  1356. TBodySkin tbodySkin = this.goSlot[index];
  1357. return tbodySkin.GetMaterialProperty(f_nMatNo, f_strPropName, f_strType);
  1358. }
  1359. public void SetMaskMode(TBody.MaskMode f_eMode)
  1360. {
  1361. this.m_eMaskMode = f_eMode;
  1362. for (int i = 0; i < this.goSlot.Count; i++)
  1363. {
  1364. this.m_hFoceHide[(TBody.SlotID)i] = true;
  1365. }
  1366. if (this.m_eMaskMode == TBody.MaskMode.Nude)
  1367. {
  1368. this.m_hFoceHide[TBody.SlotID.stkg] = false;
  1369. }
  1370. if (this.m_eMaskMode == TBody.MaskMode.Nude || this.m_eMaskMode == TBody.MaskMode.Underwear)
  1371. {
  1372. this.m_hFoceHide[TBody.SlotID.mizugi] = false;
  1373. this.m_hFoceHide[TBody.SlotID.onepiece] = false;
  1374. }
  1375. if (this.m_eMaskMode == TBody.MaskMode.Nude || this.m_eMaskMode == TBody.MaskMode.Underwear || this.m_eMaskMode == TBody.MaskMode.Swim)
  1376. {
  1377. this.m_hFoceHide[TBody.SlotID.wear] = false;
  1378. this.m_hFoceHide[TBody.SlotID.skirt] = false;
  1379. this.m_hFoceHide[TBody.SlotID.shoes] = false;
  1380. this.m_hFoceHide[TBody.SlotID.headset] = false;
  1381. this.m_hFoceHide[TBody.SlotID.glove] = false;
  1382. this.m_hFoceHide[TBody.SlotID.accKubi] = false;
  1383. this.m_hFoceHide[TBody.SlotID.accKubiwa] = false;
  1384. }
  1385. if (this.m_eMaskMode == TBody.MaskMode.Nude || this.m_eMaskMode == TBody.MaskMode.Swim)
  1386. {
  1387. this.m_hFoceHide[TBody.SlotID.bra] = false;
  1388. this.m_hFoceHide[TBody.SlotID.panz] = false;
  1389. }
  1390. this.FixMaskFlag();
  1391. this.FixVisibleFlag(false);
  1392. }
  1393. public void SetManHide(bool hide)
  1394. {
  1395. if (!this.boMAN)
  1396. {
  1397. return;
  1398. }
  1399. SkinnedMeshRenderer[] componentsInChildren = base.GetComponentsInChildren<SkinnedMeshRenderer>();
  1400. foreach (SkinnedMeshRenderer skinnedMeshRenderer in componentsInChildren)
  1401. {
  1402. bool flag = false;
  1403. foreach (Material material in skinnedMeshRenderer.materials)
  1404. {
  1405. if (material.shader.name.ToLower().Contains("cm3d2/man"))
  1406. {
  1407. flag = true;
  1408. break;
  1409. }
  1410. }
  1411. if (flag)
  1412. {
  1413. skinnedMeshRenderer.enabled = !hide;
  1414. }
  1415. }
  1416. this.m_bManMeshHide = hide;
  1417. }
  1418. public bool IsManHide()
  1419. {
  1420. return this.boMAN && this.m_bManMeshHide;
  1421. }
  1422. public void SetMask(TBody.SlotID f_eSlot, bool f_bVisible)
  1423. {
  1424. if (f_eSlot <= TBody.SlotID.eye)
  1425. {
  1426. return;
  1427. }
  1428. this.m_hFoceHide[f_eSlot] = f_bVisible;
  1429. this.FixMaskFlag();
  1430. this.FixVisibleFlag(false);
  1431. }
  1432. public bool GetMask(TBody.SlotID f_eSlot)
  1433. {
  1434. return !this.m_hFoceHide.ContainsKey(f_eSlot) || (bool)this.m_hFoceHide[f_eSlot];
  1435. }
  1436. public bool GetSlotVisible(TBody.SlotID f_eSlot)
  1437. {
  1438. return this.GetSlotLoaded(f_eSlot) && this.goSlot[(int)f_eSlot].boVisible;
  1439. }
  1440. public bool GetSlotLoaded(TBody.SlotID f_eSlot)
  1441. {
  1442. return this.goSlot[(int)f_eSlot].obj != null;
  1443. }
  1444. public void FixMaskFlag()
  1445. {
  1446. if (!this.boMaid)
  1447. {
  1448. return;
  1449. }
  1450. for (int i = 0; i < this.goSlot.Count; i++)
  1451. {
  1452. this.goSlot[i].boVisible = true;
  1453. }
  1454. for (int j = 0; j < this.goSlot.Count; j++)
  1455. {
  1456. if (!this.GetMask((TBody.SlotID)j))
  1457. {
  1458. this.goSlot[j].boVisible = false;
  1459. }
  1460. if (this.goSlot[j].boVisible)
  1461. {
  1462. foreach (int index in this.goSlot[j].listMaskSlot)
  1463. {
  1464. this.goSlot[index].boVisible = false;
  1465. }
  1466. }
  1467. }
  1468. this.boVisible_NIP = this.goSlot[(int)TBody.hashSlotName["accNipR"]].boVisible;
  1469. this.boVisible_HESO = this.goSlot[(int)TBody.hashSlotName["accHeso"]].boVisible;
  1470. this.boVisible_XXX = this.goSlot[(int)TBody.hashSlotName["accXXX"]].boVisible;
  1471. this.boVisible_BRA = this.goSlot[(int)TBody.hashSlotName["bra"]].boVisible;
  1472. this.boVisible_PANZU = this.goSlot[(int)TBody.hashSlotName["panz"]].boVisible;
  1473. this.boVisible_SKIRT = (this.goSlot[(int)TBody.hashSlotName["skirt"]].RID != 0 & this.goSlot[(int)TBody.hashSlotName["skirt"]].boVisible);
  1474. this.boVisible_WEAR = (this.goSlot[(int)TBody.hashSlotName["wear"]].RID != 0 & this.goSlot[(int)TBody.hashSlotName["wear"]].boVisible);
  1475. this.boMizugi_panz = this.goSlot[(int)TBody.hashSlotName["panz"]].boMizugi;
  1476. this.slotno_accXXX = (int)TBody.hashSlotName["accXXX"];
  1477. }
  1478. public void FixVisibleFlag(bool f_bNonPartsLook = false)
  1479. {
  1480. if (!this.boMaid)
  1481. {
  1482. return;
  1483. }
  1484. if (this.goSlot[0].morph == null)
  1485. {
  1486. return;
  1487. }
  1488. for (int i = 0; i < this.goSlot.Count; i++)
  1489. {
  1490. TBodySkin tbodySkin = this.goSlot[i];
  1491. if (tbodySkin.morph != null)
  1492. {
  1493. tbodySkin.morph.ClearAllVisibleFlag(true);
  1494. }
  1495. }
  1496. if (!f_bNonPartsLook)
  1497. {
  1498. for (int j = 0; j < this.goSlot.Count; j++)
  1499. {
  1500. if (this.goSlot[j].boVisible && !(this.goSlot[j].obj == null))
  1501. {
  1502. for (int k = 0; k < this.goSlot[0].morph.BoneNames.Count; k++)
  1503. {
  1504. string key = this.goSlot[0].morph.BoneNames[k];
  1505. bool flag = true;
  1506. if (this.goSlot[j].m_dicDelNodeBody.ContainsKey(key))
  1507. {
  1508. flag = this.goSlot[j].m_dicDelNodeBody[key];
  1509. }
  1510. if (!flag)
  1511. {
  1512. this.goSlot[0].morph.SetVisibleFlag1(k, false);
  1513. }
  1514. }
  1515. TBodySkin tbodySkin2 = this.goSlot[j];
  1516. if (tbodySkin2.m_dicDelNodeParts != null)
  1517. {
  1518. for (int l = 1; l < this.goSlot.Count; l++)
  1519. {
  1520. TBodySkin tbodySkin3 = this.goSlot[l];
  1521. if (tbodySkin3.morph != null)
  1522. {
  1523. for (int m = 0; m < tbodySkin3.morph.BoneNames.Count; m++)
  1524. {
  1525. string key2 = tbodySkin3.morph.BoneNames[m];
  1526. bool flag2 = true;
  1527. Dictionary<string, bool> dictionary;
  1528. bool flag3;
  1529. if (tbodySkin2.m_dicDelNodeParts.TryGetValue(tbodySkin3.Category, out dictionary) && dictionary.TryGetValue(key2, out flag3))
  1530. {
  1531. flag2 = flag3;
  1532. }
  1533. if (!flag2)
  1534. {
  1535. tbodySkin3.morph.SetVisibleFlag1(m, false);
  1536. }
  1537. }
  1538. }
  1539. }
  1540. }
  1541. }
  1542. }
  1543. }
  1544. for (int n = 0; n < this.goSlot.Count; n++)
  1545. {
  1546. TBodySkin tbodySkin4 = this.goSlot[n];
  1547. if (tbodySkin4.morph != null)
  1548. {
  1549. tbodySkin4.morph.FixVisibleFlag();
  1550. }
  1551. }
  1552. }
  1553. public int GetSlotUserParam(string slotname, string tag)
  1554. {
  1555. return 0;
  1556. }
  1557. public void SetChinkoVisible(bool f_bVisible)
  1558. {
  1559. Vector3 localScale = (!f_bVisible) ? Vector3.zero : Vector3.one;
  1560. for (int i = 0; i < this.goSlot.Count; i++)
  1561. {
  1562. GameObject obj = this.goSlot[i].obj;
  1563. if (obj != null)
  1564. {
  1565. Transform transform = CMT.SearchObjName(obj.transform, "chinkoCenter", false);
  1566. if (transform != null)
  1567. {
  1568. transform.localScale = localScale;
  1569. }
  1570. }
  1571. }
  1572. }
  1573. public bool GetChinkoVisible()
  1574. {
  1575. for (int i = 0; i < this.goSlot.Count; i++)
  1576. {
  1577. GameObject obj = this.goSlot[i].obj;
  1578. if (obj != null)
  1579. {
  1580. Transform transform = CMT.SearchObjName(obj.transform, "chinkoCenter", false);
  1581. if (transform != null && transform.localScale == Vector3.zero)
  1582. {
  1583. return false;
  1584. }
  1585. }
  1586. }
  1587. return true;
  1588. }
  1589. public string GetPartsParam(string f_strTag)
  1590. {
  1591. for (int i = 0; i < this.goSlot.Count; i++)
  1592. {
  1593. string param = this.goSlot[i].GetParam(f_strTag);
  1594. if (!string.IsNullOrEmpty(param))
  1595. {
  1596. return param;
  1597. }
  1598. }
  1599. return string.Empty;
  1600. }
  1601. private string GetAnimeTag(string filename = "")
  1602. {
  1603. return filename.ToLower();
  1604. }
  1605. public void StopAnime(string filename = "")
  1606. {
  1607. if (this.m_Bones == null)
  1608. {
  1609. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  1610. }
  1611. Animation animation = this.m_Animation;
  1612. if (filename == string.Empty || filename == "ALL")
  1613. {
  1614. animation.Stop();
  1615. IEnumerator enumerator = animation.GetEnumerator();
  1616. try
  1617. {
  1618. while (enumerator.MoveNext())
  1619. {
  1620. object obj = enumerator.Current;
  1621. AnimationState animationState = (AnimationState)obj;
  1622. AnimationClip clip = animation.GetClip(animationState.name);
  1623. int num = animationState.name.IndexOf(" - Queued Clone");
  1624. if (num <= 0)
  1625. {
  1626. animation.RemoveClip(animationState.name);
  1627. }
  1628. UnityEngine.Object.Destroy(clip);
  1629. }
  1630. }
  1631. finally
  1632. {
  1633. IDisposable disposable;
  1634. if ((disposable = (enumerator as IDisposable)) != null)
  1635. {
  1636. disposable.Dispose();
  1637. }
  1638. }
  1639. }
  1640. else
  1641. {
  1642. string animeTag = this.GetAnimeTag(filename);
  1643. animation.Stop(animeTag);
  1644. }
  1645. }
  1646. public void StopAnimeLayer(int layerno)
  1647. {
  1648. if (this.m_Bones == null)
  1649. {
  1650. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  1651. }
  1652. if (layerno < 2)
  1653. {
  1654. Debug.LogError("モーションレイヤーの停止は2以上を指定して下さい。");
  1655. }
  1656. Animation animation = this.m_Animation;
  1657. IEnumerator enumerator = animation.GetEnumerator();
  1658. try
  1659. {
  1660. while (enumerator.MoveNext())
  1661. {
  1662. object obj = enumerator.Current;
  1663. AnimationState animationState = (AnimationState)obj;
  1664. if (animation.IsPlaying(animationState.name) && animationState.layer == layerno)
  1665. {
  1666. animation.Stop(animationState.name);
  1667. }
  1668. }
  1669. }
  1670. finally
  1671. {
  1672. IDisposable disposable;
  1673. if ((disposable = (enumerator as IDisposable)) != null)
  1674. {
  1675. disposable.Dispose();
  1676. }
  1677. }
  1678. }
  1679. public void SetAnimeTime(int layerno, float time)
  1680. {
  1681. if (this.m_Bones == null)
  1682. {
  1683. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  1684. }
  1685. Animation animation = this.m_Animation;
  1686. IEnumerator enumerator = animation.GetEnumerator();
  1687. try
  1688. {
  1689. while (enumerator.MoveNext())
  1690. {
  1691. object obj = enumerator.Current;
  1692. AnimationState animationState = (AnimationState)obj;
  1693. if (animation.IsPlaying(animationState.name) && animationState.layer == layerno)
  1694. {
  1695. animationState.time = time;
  1696. }
  1697. }
  1698. }
  1699. finally
  1700. {
  1701. IDisposable disposable;
  1702. if ((disposable = (enumerator as IDisposable)) != null)
  1703. {
  1704. disposable.Dispose();
  1705. }
  1706. }
  1707. }
  1708. public void SetAnimeSpeed(int layerno, float speed)
  1709. {
  1710. if (this.m_Bones == null)
  1711. {
  1712. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  1713. }
  1714. Animation animation = this.m_Animation;
  1715. IEnumerator enumerator = animation.GetEnumerator();
  1716. try
  1717. {
  1718. while (enumerator.MoveNext())
  1719. {
  1720. object obj = enumerator.Current;
  1721. AnimationState animationState = (AnimationState)obj;
  1722. if (animation.IsPlaying(animationState.name) && animationState.layer == layerno)
  1723. {
  1724. animationState.speed = speed;
  1725. }
  1726. }
  1727. }
  1728. finally
  1729. {
  1730. IDisposable disposable;
  1731. if ((disposable = (enumerator as IDisposable)) != null)
  1732. {
  1733. disposable.Dispose();
  1734. }
  1735. }
  1736. }
  1737. public float GetAnimeTime()
  1738. {
  1739. if (this.m_Bones == null)
  1740. {
  1741. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  1742. }
  1743. Animation animation = this.m_Animation;
  1744. IEnumerator enumerator = animation.GetEnumerator();
  1745. try
  1746. {
  1747. while (enumerator.MoveNext())
  1748. {
  1749. object obj = enumerator.Current;
  1750. AnimationState animationState = (AnimationState)obj;
  1751. if (animation.IsPlaying(animationState.name))
  1752. {
  1753. return animationState.time;
  1754. }
  1755. }
  1756. }
  1757. finally
  1758. {
  1759. IDisposable disposable;
  1760. if ((disposable = (enumerator as IDisposable)) != null)
  1761. {
  1762. disposable.Dispose();
  1763. }
  1764. }
  1765. return 0f;
  1766. }
  1767. public string CrossFade(string filename, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float fade = 0.5f, float weight = 1f)
  1768. {
  1769. if (this.m_Bones == null)
  1770. {
  1771. NDebug.Assert("まだ読み込まれる前のBodyにモーションを指定しようとしました。" + base.gameObject.name, false);
  1772. }
  1773. string animeTag = this.GetAnimeTag(filename);
  1774. AnimationState animationState = this.LoadAnime(animeTag, fileSystem, filename, additive, loop);
  1775. if (animationState == null)
  1776. {
  1777. return string.Empty;
  1778. }
  1779. Animation animation = this.m_Animation;
  1780. if (boAddQue)
  1781. {
  1782. if (weight != 1f)
  1783. {
  1784. animation.PlayQueued(animeTag, QueueMode.CompleteOthers);
  1785. animation[animeTag].weight = weight;
  1786. }
  1787. else
  1788. {
  1789. animation.CrossFadeQueued(animeTag, fade, QueueMode.CompleteOthers);
  1790. }
  1791. }
  1792. else
  1793. {
  1794. if (animationState.layer == 0)
  1795. {
  1796. this.anist = animationState;
  1797. }
  1798. if (weight != 1f)
  1799. {
  1800. animation.Play(animeTag);
  1801. animation[animeTag].weight = weight;
  1802. }
  1803. else
  1804. {
  1805. animation.CrossFade(animeTag, fade);
  1806. }
  1807. }
  1808. return animeTag;
  1809. }
  1810. public string CrossFade(string tag, byte[] byte_data, bool additive = false, bool loop = false, bool boAddQue = false, float fade = 0.5f, float weight = 1f)
  1811. {
  1812. if (this.m_Bones == null)
  1813. {
  1814. NDebug.Assert("まだ読み込まれる前のBodyにモーションを指定しようとしました。" + base.gameObject.name, false);
  1815. }
  1816. AnimationState animationState = this.LoadAnime(tag, byte_data, additive, loop);
  1817. Animation animation = this.m_Animation;
  1818. if (boAddQue)
  1819. {
  1820. if (weight != 1f)
  1821. {
  1822. animation.PlayQueued(tag, QueueMode.CompleteOthers);
  1823. animation[tag].weight = weight;
  1824. }
  1825. else
  1826. {
  1827. animation.CrossFadeQueued(tag, fade, QueueMode.CompleteOthers);
  1828. }
  1829. }
  1830. else
  1831. {
  1832. if (animationState.layer == 0)
  1833. {
  1834. this.anist = animationState;
  1835. }
  1836. if (weight != 1f)
  1837. {
  1838. animation.Play(tag);
  1839. animation[tag].weight = weight;
  1840. }
  1841. else
  1842. {
  1843. animation.CrossFade(tag, fade);
  1844. }
  1845. }
  1846. return tag;
  1847. }
  1848. public string CrossFadeAbsolute(string filename, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float fade = 0.5f, float weight = 1f)
  1849. {
  1850. if (this.m_Bones == null)
  1851. {
  1852. NDebug.Assert("まだ読み込まれる前のBodyにモーションを指定しようとしました。" + base.gameObject.name, false);
  1853. }
  1854. string text = this.GetAnimeTag(filename);
  1855. if (boAddQue)
  1856. {
  1857. AnimationClip clip = this.m_Animation.GetClip(text);
  1858. if (clip != null)
  1859. {
  1860. text += "_2";
  1861. }
  1862. }
  1863. AnimationState animationState = this.LoadAnime(text, fileSystem, filename, additive, loop);
  1864. if (animationState == null)
  1865. {
  1866. return string.Empty;
  1867. }
  1868. Animation animation = this.m_Animation;
  1869. if (boAddQue)
  1870. {
  1871. if (weight != 1f)
  1872. {
  1873. animation.PlayQueued(text, QueueMode.CompleteOthers);
  1874. animation[text].weight = weight;
  1875. }
  1876. else
  1877. {
  1878. animation.CrossFadeQueued(text, fade, QueueMode.CompleteOthers);
  1879. }
  1880. }
  1881. else
  1882. {
  1883. if (animationState.layer == 0)
  1884. {
  1885. this.anist = animationState;
  1886. }
  1887. if (weight != 1f)
  1888. {
  1889. animation.Play(text);
  1890. animation[text].weight = weight;
  1891. }
  1892. else
  1893. {
  1894. animation.CrossFade(text, fade);
  1895. }
  1896. }
  1897. return text;
  1898. }
  1899. public Animation GetAnimation()
  1900. {
  1901. if (this.m_Bones == null)
  1902. {
  1903. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  1904. }
  1905. return this.m_Animation;
  1906. }
  1907. public void CacheLoadAnime(AFileSystemBase fileSystem, string filename, bool load_mune_l, bool load_mune_r)
  1908. {
  1909. string animeTag = this.GetAnimeTag(filename);
  1910. Animation animation = this.m_Animation;
  1911. AnimationClip animationClip = animation.GetClip(animeTag);
  1912. byte b = 0;
  1913. byte b2 = 0;
  1914. bool flag = this.m_AnimCache.TryGetValue(animeTag, out b);
  1915. b2 |= ((!load_mune_l) ? 0 : 1);
  1916. b2 |= ((!load_mune_r) ? 0 : 2);
  1917. if (animationClip == null || !flag || b != b2 || this.m_bForceReloadAnime)
  1918. {
  1919. animationClip = ImportCM.LoadAniClipNative(fileSystem, filename, (b2 & 1) != 0, (b2 & 2) != 0, false);
  1920. if (animationClip == null)
  1921. {
  1922. return;
  1923. }
  1924. animation.AddClip(animationClip, animeTag);
  1925. if (animeTag.Contains("_l_"))
  1926. {
  1927. for (int i = 2; i <= 8; i++)
  1928. {
  1929. if (animeTag.Contains("_l_" + i.ToString() + "_"))
  1930. {
  1931. animation[animeTag].layer = i;
  1932. break;
  1933. }
  1934. }
  1935. }
  1936. this.m_AnimCache[animeTag] = b2;
  1937. }
  1938. }
  1939. public AnimationState LoadAnime(string tag, AFileSystemBase fileSystem, string filename, bool additive, bool loop)
  1940. {
  1941. if (this.m_Bones == null)
  1942. {
  1943. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  1944. }
  1945. Animation animation = this.m_Animation;
  1946. AnimationClip animationClip = animation.GetClip(tag);
  1947. byte b = 0;
  1948. byte b2 = 0;
  1949. bool flag = this.m_AnimCache.TryGetValue(tag, out b);
  1950. b2 |= ((!(this.jbMuneL != null) || this.jbMuneL.BlendValueON != 0f) ? 0 : 1);
  1951. b2 |= ((!(this.jbMuneR != null) || this.jbMuneR.BlendValueON != 0f) ? 0 : 2);
  1952. if (animationClip == null || !flag || b != b2 || this.m_bForceReloadAnime)
  1953. {
  1954. animationClip = ImportCM.LoadAniClipNative(fileSystem, filename, (b2 & 1) != 0, (b2 & 2) != 0, false);
  1955. if (animationClip == null)
  1956. {
  1957. return null;
  1958. }
  1959. animation.AddClip(animationClip, tag);
  1960. if (tag.Contains("_l_"))
  1961. {
  1962. for (int i = 2; i <= 8; i++)
  1963. {
  1964. if (tag.Contains("_l_" + i.ToString() + "_"))
  1965. {
  1966. animation[tag].layer = i;
  1967. break;
  1968. }
  1969. }
  1970. }
  1971. this.m_AnimCache[tag] = b2;
  1972. }
  1973. this.LastAnimeFN = filename;
  1974. AnimationState animationState = animation[tag];
  1975. if (additive)
  1976. {
  1977. animationState.blendMode = AnimationBlendMode.Additive;
  1978. }
  1979. else
  1980. {
  1981. animationState.blendMode = AnimationBlendMode.Blend;
  1982. }
  1983. if (loop)
  1984. {
  1985. animationState.wrapMode = WrapMode.Loop;
  1986. }
  1987. else
  1988. {
  1989. animationState.wrapMode = WrapMode.Once;
  1990. }
  1991. animationState.speed = 1f;
  1992. animationState.time = 0f;
  1993. animationState.weight = 0f;
  1994. animationState.enabled = false;
  1995. return animationState;
  1996. }
  1997. public AnimationState LoadAnime(string tag, byte[] byte_data, bool additive, bool loop)
  1998. {
  1999. if (this.m_Bones == null)
  2000. {
  2001. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  2002. }
  2003. Animation animation = this.m_Animation;
  2004. AnimationClip clip = animation.GetClip(tag);
  2005. clip = ImportCM.LoadAniClipNative(byte_data, true, true, false);
  2006. animation.AddClip(clip, tag);
  2007. if (tag.Contains("_l_"))
  2008. {
  2009. for (int i = 2; i <= 8; i++)
  2010. {
  2011. if (tag.Contains("_l_" + i.ToString() + "_"))
  2012. {
  2013. animation[tag].layer = i;
  2014. break;
  2015. }
  2016. }
  2017. }
  2018. this.LastAnimeFN = tag;
  2019. AnimationState animationState = animation[tag];
  2020. if (additive)
  2021. {
  2022. animationState.blendMode = AnimationBlendMode.Additive;
  2023. }
  2024. else
  2025. {
  2026. animationState.blendMode = AnimationBlendMode.Blend;
  2027. }
  2028. if (loop)
  2029. {
  2030. animationState.wrapMode = WrapMode.Loop;
  2031. }
  2032. else
  2033. {
  2034. animationState.wrapMode = WrapMode.Once;
  2035. }
  2036. animationState.speed = 1f;
  2037. animationState.time = 0f;
  2038. animationState.weight = 0f;
  2039. animationState.enabled = false;
  2040. return animationState;
  2041. }
  2042. public void ItemAnimationLoad(TBody.SlotID f_slot, string f_strAnimName)
  2043. {
  2044. this.goSlot[(int)f_slot].AnimationLoad(f_strAnimName);
  2045. }
  2046. public void ItemAnimationPlay(TBody.SlotID f_slot, string f_strAnimName, bool f_bLoop)
  2047. {
  2048. this.goSlot[(int)f_slot].AnimationPlay(f_strAnimName, f_bLoop);
  2049. }
  2050. public void ItemAnimationStop(TBody.SlotID f_slot)
  2051. {
  2052. this.goSlot[(int)f_slot].AnimationStop();
  2053. }
  2054. public void MaterialAnimatorAdd(TBody.SlotID f_slot, int f_nMateNo)
  2055. {
  2056. this.goSlot[(int)f_slot].MaterialAnimatorAdd(f_nMateNo);
  2057. }
  2058. public List<TBodySkin> GetSlotListFromMPN(MPN f_mpn)
  2059. {
  2060. List<TBodySkin> list = new List<TBodySkin>();
  2061. for (int i = 0; i < this.goSlot.Count; i++)
  2062. {
  2063. TBodySkin tbodySkin = this.goSlot[i];
  2064. if (tbodySkin.m_ParentMPN == f_mpn)
  2065. {
  2066. list.Add(tbodySkin);
  2067. }
  2068. }
  2069. return list;
  2070. }
  2071. public List<KeyValuePair<TBody.SlotID, string>> GetAttachPointListFromMPN(MPN f_mpn)
  2072. {
  2073. List<KeyValuePair<TBody.SlotID, string>> list = new List<KeyValuePair<TBody.SlotID, string>>();
  2074. for (int i = 0; i < this.goSlot.Count; i++)
  2075. {
  2076. TBodySkin tbodySkin = this.goSlot[i];
  2077. if (tbodySkin.m_ParentMPN == f_mpn)
  2078. {
  2079. if (!string.IsNullOrEmpty(tbodySkin.AttachName))
  2080. {
  2081. if (tbodySkin.AttachVisible)
  2082. {
  2083. list.Add(new KeyValuePair<TBody.SlotID, string>((TBody.SlotID)tbodySkin.AttachSlotIdx, tbodySkin.AttachName));
  2084. }
  2085. }
  2086. else
  2087. {
  2088. list.Add(new KeyValuePair<TBody.SlotID, string>(tbodySkin.SlotId, string.Empty));
  2089. }
  2090. }
  2091. }
  2092. return list;
  2093. }
  2094. public void SetAttachPoint(string slotname, string apname, Vector3 v, Quaternion q, bool f_bTemp)
  2095. {
  2096. if (!TBody.hashSlotName.ContainsKey(slotname))
  2097. {
  2098. Debug.LogError("アタッチポイントがありません。" + slotname + " の " + apname);
  2099. return;
  2100. }
  2101. int index = (int)TBody.hashSlotName[slotname];
  2102. this.goSlot[index].morph.SetAttachPoint(apname, v, q, f_bTemp);
  2103. }
  2104. public void SetAttachPointLocal(TBody.SlotID slotid, string apname, Vector3 vPosLocal, Quaternion qRotlocal, Vector3 vScaleRate)
  2105. {
  2106. if (string.IsNullOrEmpty(apname))
  2107. {
  2108. this.goSlot[(int)slotid].SetAttachObjPointLocal(vPosLocal, qRotlocal, vScaleRate);
  2109. }
  2110. }
  2111. public void GetAttachPointLocal(TBody.SlotID slotid, string apname, out Vector3 vPosLocal, out Quaternion qRotLocal, out Vector3 vScaleRate)
  2112. {
  2113. if (!string.IsNullOrEmpty(apname))
  2114. {
  2115. vPosLocal = Vector3.zero;
  2116. qRotLocal = Quaternion.identity;
  2117. vScaleRate = Vector3.zero;
  2118. }
  2119. else
  2120. {
  2121. this.goSlot[(int)slotid].GetAttachObjPointLocal(out vPosLocal, out qRotLocal, out vScaleRate);
  2122. }
  2123. }
  2124. public void CopyAttachPoint(TBody.SlotID slotid, string apname)
  2125. {
  2126. if (!string.IsNullOrEmpty(apname))
  2127. {
  2128. if (this.goSlot[(int)slotid].morph != null)
  2129. {
  2130. this.goSlot[(int)slotid].morph.CopyAttachObjPoint(apname);
  2131. }
  2132. }
  2133. else
  2134. {
  2135. this.goSlot[(int)slotid].CopyAttachObjPoint();
  2136. }
  2137. }
  2138. public void PasteAttachPoint(TBody.SlotID slotid, string apname)
  2139. {
  2140. if (!string.IsNullOrEmpty(apname))
  2141. {
  2142. if (this.goSlot[(int)slotid].morph != null)
  2143. {
  2144. this.goSlot[(int)slotid].morph.PastAttachObjPoint(apname);
  2145. }
  2146. }
  2147. else
  2148. {
  2149. this.goSlot[(int)slotid].PastAttachObjPoint();
  2150. }
  2151. }
  2152. public void SetAttachPointWorld(TBody.SlotID slotid, string apname, Vector3 vPosWorld, Quaternion qRotWorld, Vector3 vScaleRate)
  2153. {
  2154. if (!string.IsNullOrEmpty(apname))
  2155. {
  2156. if (this.goSlot[(int)slotid].morph != null)
  2157. {
  2158. this.goSlot[(int)slotid].morph.SetAttachPointWorld(apname, vPosWorld, qRotWorld, vScaleRate);
  2159. }
  2160. }
  2161. else
  2162. {
  2163. this.goSlot[(int)slotid].SetAttachCenterPointWorld(vPosWorld, qRotWorld, vScaleRate);
  2164. }
  2165. }
  2166. public void GetAttachPointWorld(TBody.SlotID slotid, string apname, out Vector3 vPosWorld, out Quaternion qRotWorld, out Vector3 vScaleRate)
  2167. {
  2168. vPosWorld = (vScaleRate = Vector3.zero);
  2169. qRotWorld = Quaternion.identity;
  2170. if (!string.IsNullOrEmpty(apname))
  2171. {
  2172. if (this.goSlot[(int)slotid].morph != null)
  2173. {
  2174. this.goSlot[(int)slotid].morph.GetAttachPoint(apname, out vPosWorld, out qRotWorld, out vScaleRate, false);
  2175. }
  2176. }
  2177. else
  2178. {
  2179. this.goSlot[(int)slotid].GetAttachCenterPointWorld(out vPosWorld, out qRotWorld, out vScaleRate);
  2180. }
  2181. }
  2182. public void ResetAttachPoint(TBody.SlotID slotid, string apname = null)
  2183. {
  2184. if (!string.IsNullOrEmpty(apname))
  2185. {
  2186. if (this.goSlot[(int)slotid].morph != null)
  2187. {
  2188. this.goSlot[(int)slotid].morph.ResetAttachPoint(apname);
  2189. }
  2190. }
  2191. else
  2192. {
  2193. this.goSlot[(int)slotid].ResetAttachCenterPoint();
  2194. }
  2195. }
  2196. public void SetEnableAttachPointEdit(bool f_bEnable, TBody.SlotID slotid, string apname = null)
  2197. {
  2198. if (!string.IsNullOrEmpty(apname))
  2199. {
  2200. if (this.goSlot[(int)slotid].morph != null)
  2201. {
  2202. this.goSlot[(int)slotid].morph.SetEnableAttachPointEdit(f_bEnable, apname);
  2203. }
  2204. }
  2205. else
  2206. {
  2207. this.goSlot[(int)slotid].EnablePartsPosEdit = f_bEnable;
  2208. }
  2209. }
  2210. public bool GetEnableAttachPointEdit(TBody.SlotID slotid, string apname = null)
  2211. {
  2212. if (!string.IsNullOrEmpty(apname))
  2213. {
  2214. return this.goSlot[(int)slotid].morph != null && this.goSlot[(int)slotid].morph.GetEnableAttachPointEdit(apname);
  2215. }
  2216. return this.goSlot[(int)slotid].EnablePartsPosEdit;
  2217. }
  2218. public void SetHairLengthDataList(string f_strSlotName, string f_strGroupName, string f_strBoneSearchType, string f_strBoneName, Vector3 f_vScaleMin, Vector3 f_vScaleMax)
  2219. {
  2220. if (!TBody.hashSlotName.ContainsKey(f_strSlotName))
  2221. {
  2222. Debug.LogError("髪ボーン長さグループがありません。" + f_strSlotName + " の " + f_strGroupName);
  2223. return;
  2224. }
  2225. int index = (int)TBody.hashSlotName[f_strSlotName];
  2226. this.goSlot[index].m_HairLengthCtrl.SearchAndAddHairLengthTarget(f_strGroupName, f_strBoneSearchType, f_strBoneName, f_vScaleMin, f_vScaleMax);
  2227. }
  2228. public Dictionary<string, TBodySkin.HairLengthCtrl.HairLength> GetHairLengthListFromMPN(MPN f_mpn)
  2229. {
  2230. for (int i = 0; i < this.goSlot.Count; i++)
  2231. {
  2232. TBodySkin tbodySkin = this.goSlot[i];
  2233. if (tbodySkin.m_ParentMPN == f_mpn && tbodySkin.m_HairLengthCtrl.IsHairLengthEditable)
  2234. {
  2235. return tbodySkin.m_HairLengthCtrl.HairLengthGroupList;
  2236. }
  2237. }
  2238. return null;
  2239. }
  2240. public void HairLengthBlend()
  2241. {
  2242. for (int i = 0; i < this.goSlot.Count; i++)
  2243. {
  2244. TBodySkin.HairLengthCtrl hairLengthCtrl = this.goSlot[i].m_HairLengthCtrl;
  2245. if (hairLengthCtrl != null)
  2246. {
  2247. hairLengthCtrl.HairLenghtBlend();
  2248. }
  2249. }
  2250. }
  2251. public void ItemScaleReset()
  2252. {
  2253. for (int i = 0; i < this.goSlot.Count; i++)
  2254. {
  2255. this.goSlot[i].ItemScaleReset();
  2256. }
  2257. }
  2258. public void ProcCosAnime()
  2259. {
  2260. if (!this.CosAnimeMode)
  2261. {
  2262. return;
  2263. }
  2264. if (this.anist != null)
  2265. {
  2266. if (this.MotionBlenFadeVal < 1f)
  2267. {
  2268. this.MotionBlenFadeVal += Time.deltaTime * this.CosAnimePlusT;
  2269. if (this.MotionBlenFadeVal >= 1f)
  2270. {
  2271. if (this.oldAnimeTag != null)
  2272. {
  2273. this.m_Animation.Stop(this.oldAnimeTag);
  2274. this.oldAnimeTag = null;
  2275. }
  2276. this.MotionBlenFadeVal = 1f;
  2277. this.anist.weight = 1f;
  2278. this.anist.layer = 0;
  2279. }
  2280. else
  2281. {
  2282. this.anist.weight = UTY.COSS2(UTY.COSS(Mathf.Pow(this.MotionBlenFadeVal, 0.5f)), 2f);
  2283. }
  2284. }
  2285. }
  2286. }
  2287. public void WarpInit()
  2288. {
  2289. this.jbMuneL.boWarpInit = true;
  2290. this.jbMuneR.boWarpInit = true;
  2291. for (int i = 0; i < this.goSlot.Count; i++)
  2292. {
  2293. TBodySkin tbodySkin = this.goSlot[i];
  2294. if (tbodySkin.bonehair3 != null)
  2295. {
  2296. tbodySkin.bonehair3.WarpInit();
  2297. }
  2298. }
  2299. }
  2300. public void OnEnable()
  2301. {
  2302. this.OnChangeScreenSizeOrAA();
  2303. this.ManColorUpdate();
  2304. }
  2305. private void Update()
  2306. {
  2307. for (int i = 0; i < this.goSlot.Count; i++)
  2308. {
  2309. this.goSlot[i].TextureCache.Update();
  2310. }
  2311. bool flag = false;
  2312. foreach (KeyValuePair<string, TBody.TexLay.Mat> keyValuePair in this.m_dicLaySlot)
  2313. {
  2314. flag |= keyValuePair.Value.Reset();
  2315. }
  2316. if (flag)
  2317. {
  2318. Debug.Log("MulTexReset");
  2319. this.MulTexProc();
  2320. }
  2321. if (!this.isLoadedBody)
  2322. {
  2323. return;
  2324. }
  2325. if (!this.boMAN)
  2326. {
  2327. this.posCalfCenter = (this.Calf_R.position + this.Calf_L.position) * 0.5f;
  2328. Vector3 vector = this.CenterBone.position + this.CenterBone.forward * 100f;
  2329. if ((this.CenterPosOld - vector).sqrMagnitude > 0.25f && !OvrIK.IsModeVRIK)
  2330. {
  2331. this.WarpInit();
  2332. }
  2333. this.jbMuneL.boBRA = !this.boVisible_NIP;
  2334. this.jbMuneR.boBRA = !this.boVisible_NIP;
  2335. this.CenterPosOld = vector;
  2336. if (GameMain.Instance.VRMode)
  2337. {
  2338. this.m_trHandHitR = (this.m_trHandHitL = null);
  2339. OvrMgr ovrMgr = GameMain.Instance.OvrMgr;
  2340. if (ovrMgr != null)
  2341. {
  2342. OvrMgr.OvrObject.Controller left_controller = ovrMgr.ovr_obj.left_controller;
  2343. if (left_controller != null && left_controller.controller != null && left_controller.controller.HandEnable)
  2344. {
  2345. this.m_trHandHitL = left_controller.hand_trans_hit;
  2346. }
  2347. OvrMgr.OvrObject.Controller right_controller = ovrMgr.ovr_obj.right_controller;
  2348. if (right_controller != null && right_controller.controller != null && right_controller.controller.HandEnable)
  2349. {
  2350. this.m_trHandHitR = right_controller.hand_trans_hit;
  2351. }
  2352. }
  2353. if (this.m_trHandHitL != null || this.m_trHandHitR != null || this.m_trHandLeapHitL != null || this.m_trHandLeapHitR != null)
  2354. {
  2355. foreach (TBodySkin tbodySkin in this.goSlot)
  2356. {
  2357. if (this.m_trHandHitL != null)
  2358. {
  2359. this.m_bNoHandL = false;
  2360. foreach (THitSphere thitSphere in tbodySkin.bonehair.bodyhit.m_listHandHitL)
  2361. {
  2362. thitSphere.vs = thitSphere.t.InverseTransformPoint(this.m_trHandHitL.position);
  2363. }
  2364. }
  2365. else if (!this.m_bNoHandL)
  2366. {
  2367. foreach (THitSphere thitSphere2 in tbodySkin.bonehair.bodyhit.m_listHandHitL)
  2368. {
  2369. thitSphere2.vs.y = -99999f;
  2370. }
  2371. this.m_bNoHandL = true;
  2372. }
  2373. if (this.m_trHandLeapHitL != null)
  2374. {
  2375. if (tbodySkin.bonehair.bodyhit.m_HandHitLeapL != null)
  2376. {
  2377. tbodySkin.bonehair.bodyhit.m_HandHitLeapL.vs = tbodySkin.bonehair.bodyhit.m_HandHitLeapL.t.InverseTransformPoint(this.m_trHandLeapHitL.position);
  2378. }
  2379. }
  2380. else if (tbodySkin.bonehair.bodyhit.m_HandHitLeapL != null)
  2381. {
  2382. tbodySkin.bonehair.bodyhit.m_HandHitLeapL.vs.y = -10000f;
  2383. }
  2384. if (this.m_trHandHitR != null)
  2385. {
  2386. this.m_bNoHandR = false;
  2387. foreach (THitSphere thitSphere3 in tbodySkin.bonehair.bodyhit.m_listHandHitR)
  2388. {
  2389. thitSphere3.vs = thitSphere3.t.transform.InverseTransformPoint(this.m_trHandHitR.position);
  2390. }
  2391. }
  2392. else if (!this.m_bNoHandR)
  2393. {
  2394. foreach (THitSphere thitSphere4 in tbodySkin.bonehair.bodyhit.m_listHandHitR)
  2395. {
  2396. thitSphere4.vs.y = -99999f;
  2397. }
  2398. this.m_bNoHandR = true;
  2399. }
  2400. if (this.m_trHandLeapHitR != null)
  2401. {
  2402. if (tbodySkin.bonehair.bodyhit.m_HandHitLeapR != null)
  2403. {
  2404. tbodySkin.bonehair.bodyhit.m_HandHitLeapR.vs = tbodySkin.bonehair.bodyhit.m_HandHitLeapR.t.InverseTransformPoint(this.m_trHandLeapHitR.position);
  2405. }
  2406. }
  2407. else if (tbodySkin.bonehair.bodyhit.m_HandHitLeapR != null)
  2408. {
  2409. tbodySkin.bonehair.bodyhit.m_HandHitLeapR.vs.y = -10000f;
  2410. }
  2411. }
  2412. }
  2413. float num = this.m_fHitLimitDistanceMin + (this.m_fHitLimitDistanceMax - this.m_fHitLimitDistanceMin) * (this.jbMuneL.BlendValue / 1.3f);
  2414. if (this.m_trsMuneLsub != null && this.m_trHitChildL != null)
  2415. {
  2416. Vector3 vector2 = this.m_trsMuneL.InverseTransformPoint(this.m_trHitChildL.position);
  2417. if ((vector2 - this.m_trHitParentL.localPosition).magnitude < num)
  2418. {
  2419. this.m_trsMuneLsub.localPosition = vector2;
  2420. }
  2421. else
  2422. {
  2423. this.m_trsMuneLsub.localPosition = this.m_trHitParentL.localPosition + (vector2 - this.m_trHitParentL.localPosition).normalized * num;
  2424. this.m_trHitChildL.position = this.m_trsMuneLsub.position;
  2425. }
  2426. }
  2427. if (this.m_trsMuneRsub != null && this.m_trHitChildR != null)
  2428. {
  2429. Vector3 vector3 = this.m_trsMuneR.InverseTransformPoint(this.m_trHitChildR.position);
  2430. if ((vector3 - this.m_trHitParentR.localPosition).magnitude < num)
  2431. {
  2432. this.m_trsMuneRsub.localPosition = vector3;
  2433. }
  2434. else
  2435. {
  2436. this.m_trsMuneRsub.localPosition = this.m_trHitParentR.localPosition + (vector3 - this.m_trHitParentR.localPosition).normalized * num;
  2437. this.m_trHitChildR.position = this.m_trsMuneRsub.position;
  2438. }
  2439. }
  2440. }
  2441. }
  2442. }
  2443. private void LateUpdate()
  2444. {
  2445. if (!this.isLoadedBody)
  2446. {
  2447. return;
  2448. }
  2449. this.MoveHeadAndEye();
  2450. this.IKHandL.IKExec(this.goSlot);
  2451. this.IKHandR.IKExec(this.goSlot);
  2452. this.MoveMomoniku();
  2453. this.AutoTwist();
  2454. if (!this.boMAN)
  2455. {
  2456. this.IKMuneL.SyncAttachPoint();
  2457. this.IKMuneR.SyncAttachPoint();
  2458. this.jbMuneL.LateUpdateSelf();
  2459. this.jbMuneR.LateUpdateSelf();
  2460. this.IKMuneL.IKExec(this.goSlot);
  2461. this.IKMuneR.IKExec(this.goSlot);
  2462. }
  2463. if (this.boMAN && this.trManChinko != null)
  2464. {
  2465. this.trManChinko.localPosition = this.vecChinkoOffset;
  2466. }
  2467. for (int i = 0; i < this.goSlot.Count; i++)
  2468. {
  2469. if (this.goSlot[i].obj != null)
  2470. {
  2471. this.goSlot[i].CopyTrans();
  2472. }
  2473. }
  2474. if (!this.boMAN)
  2475. {
  2476. this.JumpDis = Mathf.Max((this.Calf_L_pos_old - this.Calf_L.position).magnitude, (this.Calf_R_pos_old - this.Calf_R.position).magnitude);
  2477. this.JumpDis = Mathf.Max(this.JumpDis, (this.Thigh_L_pos_old - this.Thigh_L.position).magnitude);
  2478. this.JumpDis = Mathf.Max(this.JumpDis, (this.Thigh_R_pos_old - this.Thigh_R.position).magnitude);
  2479. this.JumpDis = Mathf.Clamp01(this.JumpDis * 20f);
  2480. this.JumpDis = (this.JumpDis + this.JumpDis_old) * 0.5f;
  2481. this.JumpDis_old = this.JumpDis;
  2482. }
  2483. for (int j = 0; j < this.goSlot.Count; j++)
  2484. {
  2485. this.goSlot[j].Update();
  2486. }
  2487. if (!this.boMAN)
  2488. {
  2489. this.Calf_L_pos_old = this.Calf_L.position;
  2490. this.Calf_R_pos_old = this.Calf_R.position;
  2491. this.Thigh_L_pos_old = this.Thigh_L.position;
  2492. this.Thigh_R_pos_old = this.Thigh_R.position;
  2493. }
  2494. }
  2495. public float DegPer(float r, float per)
  2496. {
  2497. if (r <= 180f)
  2498. {
  2499. return r * per;
  2500. }
  2501. return (r - 360f) * per;
  2502. }
  2503. private float AxisAngleOnAxisPlane(Vector3 fromDirection, Vector3 toDirection, Vector3 axis)
  2504. {
  2505. fromDirection.Normalize();
  2506. axis.Normalize();
  2507. Vector3 rhs = toDirection - axis * Vector3.Dot(axis, toDirection);
  2508. rhs.Normalize();
  2509. return Mathf.Acos(Vector3.Dot(fromDirection, rhs)) * ((Vector3.Dot(Vector3.Cross(axis, fromDirection), rhs) >= 0f) ? 57.29578f : -57.29578f);
  2510. }
  2511. public void AutoTwist()
  2512. {
  2513. if (this.boAutoTwistShoulderL && this.Uppertwist_L != null)
  2514. {
  2515. Quaternion localRotation = this.UpperArmL.localRotation;
  2516. float x = (Quaternion.Inverse(this.quaUpperArmL) * localRotation).eulerAngles.x;
  2517. this.Uppertwist_L.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(x, this.fDegPer), 0f, 0f);
  2518. this.Uppertwist1_L.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(x, this.fDegPer1), 0f, 0f);
  2519. this.Kata_L.localRotation = this.quaKata_L;
  2520. this.Kata_L.rotation = Quaternion.Slerp(this.Kata_L.rotation, this.UpperArmL.rotation, this.fRota);
  2521. }
  2522. if (this.boAutoTwistShoulderR && this.Uppertwist_R != null)
  2523. {
  2524. Quaternion localRotation2 = this.UpperArmR.localRotation;
  2525. float x2 = (Quaternion.Inverse(this.quaUpperArmR) * localRotation2).eulerAngles.x;
  2526. this.Uppertwist_R.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(x2, this.fDegPer), 0f, 0f);
  2527. this.Uppertwist1_R.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(x2, 0.2f), 0f, 0f);
  2528. this.Kata_R.localRotation = this.quaKata_R;
  2529. this.Kata_R.rotation = Quaternion.Slerp(this.Kata_R.rotation, this.Uppertwist_R.rotation, 0.5f);
  2530. }
  2531. if (this.boAutoTwistWristL && this.Foretwist_L != null)
  2532. {
  2533. Vector3 fromDirection = this.HandL_MR.localRotation * Vector3.up;
  2534. fromDirection.Normalize();
  2535. Vector3 toDirection = this.HandL.localRotation * Vector3.up;
  2536. toDirection.Normalize();
  2537. this.m_fAngleHandL = this.AxisAngleOnAxisPlane(fromDirection, toDirection, new Vector3(1f, 0f, 0f)) * -1f;
  2538. this.Foretwist_L.localRotation = Quaternion.AngleAxis(this.m_fAngleHandL, this.Foretwist_L_MR.localRotation * Vector3.left) * this.Foretwist_L_MR.localRotation;
  2539. this.Foretwist1_L.localRotation = Quaternion.AngleAxis(this.m_fAngleHandL * 0.5f, this.Foretwist1_L_MR.localRotation * Vector3.left) * this.Foretwist1_L_MR.localRotation;
  2540. }
  2541. if (this.boAutoTwistWristR && this.Foretwist_R != null)
  2542. {
  2543. Vector3 fromDirection2 = this.HandR_MR.localRotation * Vector3.up;
  2544. fromDirection2.Normalize();
  2545. Vector3 toDirection2 = this.HandR.localRotation * Vector3.up;
  2546. toDirection2.Normalize();
  2547. float num = this.AxisAngleOnAxisPlane(fromDirection2, toDirection2, new Vector3(1f, 0f, 0f)) * -1f;
  2548. this.Foretwist_R.localRotation = Quaternion.AngleAxis(num, this.Foretwist_R_MR.localRotation * Vector3.left) * this.Foretwist_R_MR.localRotation;
  2549. this.Foretwist1_R.localRotation = Quaternion.AngleAxis(num * 0.5f, this.Foretwist1_R_MR.localRotation * Vector3.left) * this.Foretwist1_R_MR.localRotation;
  2550. }
  2551. if (this.boAutoTwistThighL && this.momotwist_L != null)
  2552. {
  2553. Quaternion quaternion = this.Thigh_L.localRotation;
  2554. quaternion = Quaternion.Inverse(this.quaThigh_L) * quaternion;
  2555. Vector3 vector = quaternion * Vector3.forward;
  2556. float num2 = quaternion.eulerAngles.x;
  2557. if (vector.z < 0f)
  2558. {
  2559. num2 = 180f - num2;
  2560. }
  2561. this.momotwist_L.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(num2, this.fDegPer), 0f, 0f) * this.q_momotwist_L;
  2562. this.momotwist2_L.localRotation = Quaternion.Euler(0.0174532924f * this.DegPer(num2, 0.7f), 0f, 0f) * this.q_momotwist2_L;
  2563. }
  2564. if (this.boAutoTwistThighR & this.momotwist_R != null)
  2565. {
  2566. Quaternion quaternion2 = this.Thigh_R.localRotation;
  2567. quaternion2 = Quaternion.Inverse(this.quaThigh_R) * quaternion2;
  2568. Vector3 vector2 = quaternion2 * Vector3.forward;
  2569. float num3 = quaternion2.eulerAngles.x;
  2570. if (vector2.z < 0f)
  2571. {
  2572. num3 = 180f - num3;
  2573. }
  2574. this.momotwist_R.localRotation = Quaternion.Euler(-0.0174532924f * this.DegPer(num3, this.fDegPer), 0f, 0f) * this.q_momotwist_R;
  2575. this.momotwist2_R.localRotation = Quaternion.Euler(0.0174532924f * this.DegPer(num3, 0.7f), 0f, 0f) * this.q_momotwist2_R;
  2576. }
  2577. }
  2578. public void MoveMomoniku()
  2579. {
  2580. if (!TBody.boMoveMomoniku || this.momoniku_L == null || this.momoniku_R == null)
  2581. {
  2582. return;
  2583. }
  2584. float num = Mathf.Clamp(Vector3.Dot(Vector3.up, this.Thigh_L.up), 0f, 0.8f);
  2585. float num2 = Mathf.Clamp(Vector3.Dot(Vector3.up, this.Thigh_R.up), 0f, 0.8f);
  2586. this.momoniku_L.localRotation = this.momoniku_L_MR.localRotation;
  2587. this.momoniku_R.localRotation = this.momoniku_R_MR.localRotation;
  2588. this.momoniku_L.Rotate(0f, 0f, num * 10f);
  2589. this.momoniku_R.Rotate(0f, 0f, -num2 * 10f);
  2590. this.Hip_L.localRotation = Quaternion.Slerp(this.Hip_L_MR.localRotation, this.Thigh_L.localRotation, 0.67f);
  2591. this.Hip_R.localRotation = Quaternion.Slerp(this.Hip_R_MR.localRotation, this.Thigh_R.localRotation, 0.67f);
  2592. }
  2593. public void MoveHeadAndEye()
  2594. {
  2595. if (this.trsHead == null)
  2596. {
  2597. return;
  2598. }
  2599. if (GameMain.Instance.VRMode && GameMain.Instance.OvrMgr == null)
  2600. {
  2601. return;
  2602. }
  2603. CameraMain mainCamera = GameMain.Instance.MainCamera;
  2604. if (mainCamera == null)
  2605. {
  2606. return;
  2607. }
  2608. Vector3 a;
  2609. if (this.trsLookTarget == null)
  2610. {
  2611. a = this.trsHead.TransformPoint(this.offsetLookTarget);
  2612. if (this.boEyeSorashi)
  2613. {
  2614. Vector3 vector = a - this.trsHead.position;
  2615. Vector3 vector2;
  2616. if (GameMain.Instance.VRMode)
  2617. {
  2618. vector2 = GameMain.Instance.OvrMgr.EyeAnchor.position;
  2619. }
  2620. else
  2621. {
  2622. vector2 = mainCamera.transform.position - this.trsHead.position;
  2623. }
  2624. float num = Vector3.Dot(vector.normalized, vector2.normalized);
  2625. if (this.EyeSorashiCnt > 0)
  2626. {
  2627. this.EyeSorashiCnt++;
  2628. if (this.EyeSorashiCnt > 200)
  2629. {
  2630. this.EyeSorashiCnt = 0;
  2631. }
  2632. }
  2633. if (num > 0.9f && this.EyeSorashiCnt == 0)
  2634. {
  2635. if (this.EyeSorashiTgl)
  2636. {
  2637. this.offsetLookTarget = new Vector3(-0.5f, 1f, -0.7f);
  2638. }
  2639. else
  2640. {
  2641. this.offsetLookTarget = new Vector3(-0.6f, 1f, 0.6f);
  2642. }
  2643. this.EyeSorashiTgl = !this.EyeSorashiTgl;
  2644. this.EyeSorashiCnt = 1;
  2645. }
  2646. }
  2647. }
  2648. else
  2649. {
  2650. a = this.trsLookTarget.position;
  2651. }
  2652. if (this.boLockHeadAndEye)
  2653. {
  2654. return;
  2655. }
  2656. if (this.boHeadToCam)
  2657. {
  2658. this.HeadToCamPer += Time.deltaTime * this.HeadToCamFadeSpeed;
  2659. }
  2660. else
  2661. {
  2662. this.HeadToCamPer -= Time.deltaTime * this.HeadToCamFadeSpeed;
  2663. }
  2664. this.HeadToCamPer = Mathf.Clamp01(this.HeadToCamPer);
  2665. this.boChkEye = false;
  2666. Vector3 vector3 = a - this.trsNeck.position;
  2667. vector3 = Quaternion.Inverse(this.trsNeck.rotation) * vector3;
  2668. Quaternion quaternion = default(Quaternion);
  2669. quaternion.SetFromToRotation(Vector3.up, vector3);
  2670. Vector3 eulerAngles = quaternion.eulerAngles;
  2671. if (eulerAngles.x >= 180f)
  2672. {
  2673. eulerAngles.x -= 360f;
  2674. }
  2675. if (eulerAngles.z >= 180f)
  2676. {
  2677. eulerAngles.z -= 360f;
  2678. }
  2679. if (this.boHeadToCamInMode)
  2680. {
  2681. if (-80f >= eulerAngles.x || eulerAngles.x >= 80f || -50f >= eulerAngles.z || eulerAngles.z >= 60f)
  2682. {
  2683. this.boHeadToCamInMode = false;
  2684. }
  2685. }
  2686. else if (-60f < eulerAngles.x && eulerAngles.x < 60f && -40f < eulerAngles.z && eulerAngles.z < 50f)
  2687. {
  2688. this.boHeadToCamInMode = true;
  2689. }
  2690. if (this.boHeadToCamInMode)
  2691. {
  2692. this.boChkEye = true;
  2693. float num2 = 0.3f;
  2694. if (eulerAngles.x > this.HeadEulerAngle.x + 10f)
  2695. {
  2696. this.HeadEulerAngleG.x = this.HeadEulerAngleG.x + num2;
  2697. }
  2698. else if (eulerAngles.x < this.HeadEulerAngle.x - 10f)
  2699. {
  2700. this.HeadEulerAngleG.x = this.HeadEulerAngleG.x - num2;
  2701. }
  2702. else
  2703. {
  2704. this.HeadEulerAngleG.x = this.HeadEulerAngleG.x * 0.95f;
  2705. }
  2706. if (eulerAngles.z > this.HeadEulerAngle.z + 10f)
  2707. {
  2708. this.HeadEulerAngleG.z = this.HeadEulerAngleG.z + num2;
  2709. }
  2710. else if (eulerAngles.z < this.HeadEulerAngle.z - 10f)
  2711. {
  2712. this.HeadEulerAngleG.z = this.HeadEulerAngleG.z - num2;
  2713. }
  2714. else
  2715. {
  2716. this.HeadEulerAngleG.z = this.HeadEulerAngleG.z * 0.95f;
  2717. }
  2718. }
  2719. else
  2720. {
  2721. float num3 = 0.1f;
  2722. if (0f > this.HeadEulerAngle.x + 10f)
  2723. {
  2724. this.HeadEulerAngleG.x = this.HeadEulerAngleG.x + num3;
  2725. }
  2726. if (0f < this.HeadEulerAngle.x - 10f)
  2727. {
  2728. this.HeadEulerAngleG.x = this.HeadEulerAngleG.x - num3;
  2729. }
  2730. if (0f > this.HeadEulerAngle.z + 10f)
  2731. {
  2732. this.HeadEulerAngleG.z = this.HeadEulerAngleG.z + num3;
  2733. }
  2734. if (0f < this.HeadEulerAngle.z - 10f)
  2735. {
  2736. this.HeadEulerAngleG.z = this.HeadEulerAngleG.z - num3;
  2737. }
  2738. }
  2739. this.HeadEulerAngleG *= 0.95f;
  2740. this.HeadEulerAngle += this.HeadEulerAngleG;
  2741. Quaternion b = this.quaDefHead * Quaternion.Euler(this.HeadEulerAngle.x * 0.4f, 0f, this.HeadEulerAngle.z * 0.4f);
  2742. this.trsHead.localRotation = Quaternion.Slerp(this.trsHead.localRotation, b, UTY.COSS(this.HeadToCamPer));
  2743. if (!this.boMAN && this.trsEyeL != null && this.trsEyeR != null)
  2744. {
  2745. Vector3 vector4 = a - this.trsHead.position;
  2746. vector4 = Quaternion.Inverse(this.trsHead.rotation) * vector4;
  2747. Quaternion lhs = default(Quaternion);
  2748. lhs.SetFromToRotation(Vector3.up, vector4);
  2749. Vector3 eulerAngles2 = lhs.eulerAngles;
  2750. if (eulerAngles2.x >= 180f)
  2751. {
  2752. eulerAngles2.x -= 360f;
  2753. }
  2754. if (eulerAngles2.z >= 180f)
  2755. {
  2756. eulerAngles2.z -= 360f;
  2757. }
  2758. Vector3 view = Vector3.Normalize(a - this.trsEyeL.position);
  2759. lhs.SetLookRotation(view, Vector3.up);
  2760. lhs *= Quaternion.Euler(0f, 90f, 0f);
  2761. if (this.boEyeToCam && this.boChkEye)
  2762. {
  2763. float num4 = 0.5f;
  2764. if (this.boEyeSorashi)
  2765. {
  2766. num4 = 0.05f;
  2767. }
  2768. this.EyeEulerAngle = this.EyeEulerAngle * (1f - num4) + eulerAngles2 * num4;
  2769. }
  2770. else
  2771. {
  2772. this.EyeEulerAngle *= 0.95f;
  2773. }
  2774. this.trsEyeL.localRotation = this.quaDefEyeL * Quaternion.Euler(0f, -this.EyeEulerAngle.x * 0.2f, -this.EyeEulerAngle.z * 0.1f);
  2775. this.trsEyeR.localRotation = this.quaDefEyeR * Quaternion.Euler(0f, this.EyeEulerAngle.x * 0.2f, this.EyeEulerAngle.z * 0.1f);
  2776. }
  2777. }
  2778. public void OnChangeScreenSizeOrAA()
  2779. {
  2780. if (this.goSlot != null)
  2781. {
  2782. for (int i = 0; i < this.goSlot.Count; i++)
  2783. {
  2784. this.goSlot[i].OnChangeScreenSizeOrAA();
  2785. }
  2786. }
  2787. base.StartCoroutine(this.CoReseize());
  2788. }
  2789. private IEnumerator CoReseize()
  2790. {
  2791. yield return null;
  2792. yield break;
  2793. }
  2794. public void ManColorUpdate()
  2795. {
  2796. if (this.boMAN)
  2797. {
  2798. for (int i = 0; i < this.goSlot.Count; i++)
  2799. {
  2800. TBodySkin tbodySkin = this.goSlot[i];
  2801. if (tbodySkin != null)
  2802. {
  2803. tbodySkin.ManColorUpdate();
  2804. }
  2805. }
  2806. }
  2807. }
  2808. private bool m_bIsLoadedBody;
  2809. private AudioSourceParent m_AudioParent;
  2810. public GameObject m_Bones;
  2811. public Transform m_trBones;
  2812. public GameObject m_Bones2;
  2813. public Transform m_trBones2;
  2814. public Transform trBip;
  2815. public Dictionary<string, Transform> m_dicTrans = new Dictionary<string, Transform>();
  2816. public Animation m_Animation;
  2817. private Dictionary<string, byte> m_AnimCache = new Dictionary<string, byte>();
  2818. public bool m_bForceReloadAnime;
  2819. private bool boMaid = true;
  2820. public bool boMAN;
  2821. public IKMgrData IKHandL = new IKMgrData();
  2822. public IKMgrData IKHandR = new IKMgrData();
  2823. public IKMgrData IKMuneL = new IKMgrData();
  2824. public IKMgrData IKMuneR = new IKMgrData();
  2825. public Dictionary<string, IKMgrData> StrIKDataPair = new Dictionary<string, IKMgrData>();
  2826. private Transform m_SMbody;
  2827. public Transform trsHead;
  2828. public Transform trsNeck;
  2829. public Quaternion quaDefHead;
  2830. public Quaternion quaDefNeck;
  2831. private Vector3 HeadEulerAngle;
  2832. private Vector3 HeadEulerAngleG;
  2833. public Transform Uppertwist_L;
  2834. public Transform Uppertwist1_L;
  2835. public Transform Kata_L;
  2836. public Transform ClavicleL;
  2837. public Transform Uppertwist_R;
  2838. public Transform Uppertwist1_R;
  2839. public Transform Kata_R;
  2840. public Transform ClavicleR;
  2841. public Quaternion quaKata_L;
  2842. public Quaternion quaKata_R;
  2843. public Quaternion quaUppertwist_L;
  2844. public Quaternion quaUpperArmL;
  2845. public Quaternion quaUppertwist_R;
  2846. public Quaternion quaUpperArmR;
  2847. private Transform momoniku_L;
  2848. private Transform momoniku_R;
  2849. private Transform momoniku_L_MR;
  2850. private Transform momoniku_R_MR;
  2851. public Transform Calf_L;
  2852. public Transform Calf_R;
  2853. public Transform Thigh_L;
  2854. public Transform Thigh_R;
  2855. public Transform Thigh_L_MR;
  2856. public Transform Thigh_R_MR;
  2857. public Transform Hip_R_nub;
  2858. public Transform Hip_R;
  2859. public Transform Hip_L_nub;
  2860. public Transform Hip_L;
  2861. private Quaternion quaThigh_L;
  2862. private Quaternion quaThigh_R;
  2863. private Transform Hip_L_MR;
  2864. private Transform Hip_R_MR;
  2865. public Vector3 m_vecDebug_Hand;
  2866. public float m_fAngleHandL;
  2867. private Transform HandL_NubY;
  2868. private Transform HandR_NubY;
  2869. private Transform HandL_NubY_MR;
  2870. private Transform HandR_NubY_MR;
  2871. public Transform UpperArmR;
  2872. public Transform UpperArmL;
  2873. private Transform ForearmR;
  2874. private Transform ForearmL;
  2875. private Transform HandR;
  2876. private Transform HandL;
  2877. private Transform HandR_MR;
  2878. private Transform HandL_MR;
  2879. private Transform Foretwist1_L;
  2880. private Transform Foretwist_L;
  2881. private Transform Foretwist1_L_MR;
  2882. private Transform Foretwist_L_MR;
  2883. private Transform Foretwist1_R;
  2884. private Transform Foretwist_R;
  2885. private Transform Foretwist1_R_MR;
  2886. private Transform Foretwist_R_MR;
  2887. private Transform momotwist_L;
  2888. private Transform momotwist2_L;
  2889. private Transform momotwist_R;
  2890. private Transform momotwist2_R;
  2891. private Quaternion q_momotwist_L;
  2892. private Quaternion q_momotwist2_L;
  2893. private Quaternion q_momotwist_R;
  2894. private Quaternion q_momotwist2_R;
  2895. public Transform ToeR;
  2896. public Transform ToeL;
  2897. public Transform CenterBone;
  2898. public Transform Pelvis;
  2899. public Transform FootStep;
  2900. public Transform Spine;
  2901. public Transform Spine0a;
  2902. public Transform Spine1a;
  2903. public Transform trManChinko;
  2904. public Vector3 vecChinkoOffset = default(Vector3);
  2905. public GameObject goMoza;
  2906. public GameObject goMozaANL;
  2907. public List<TBodySkin> goSlot;
  2908. private float m_BoneHitY;
  2909. public DynamicBonePlaneCollider m_hitFloorPlane;
  2910. public Transform m_trFloorPlane;
  2911. public TBody.ModeHirR Mode_HairR;
  2912. public bool boMizugi_panz;
  2913. public bool boVisible_NIP;
  2914. public bool boVisible_HESO;
  2915. public bool boVisible_XXX;
  2916. public bool boVisible_BRA;
  2917. public bool boVisible_PANZU;
  2918. public bool boVisible_SKIRT;
  2919. public bool boVisible_WEAR;
  2920. public bool boLockHeadAndEye;
  2921. public bool boEyeToCam = true;
  2922. public bool boChkEye;
  2923. public bool boHeadToCam = true;
  2924. public float HeadToCamPer;
  2925. public bool boHeadToCamInMode;
  2926. public float HeadToCamFadeSpeed = 1f;
  2927. public Transform trsLookTarget;
  2928. public Vector3 offsetLookTarget = new Vector3(0f, 1f, 0f);
  2929. public bool boEyeSorashi;
  2930. public int EyeSorashiCnt;
  2931. public bool EyeSorashiTgl;
  2932. private AnimationState anist;
  2933. private float MotionBlenFadeVal = 1f;
  2934. private float CosAnimePlusT = 1f;
  2935. private string oldAnimeTag;
  2936. public bool CosAnimeMode;
  2937. public int slotno_accXXX;
  2938. public Vector3 CenterPosOld = Vector3.zero;
  2939. public Vector3 Calf_L_pos_old;
  2940. public Vector3 Calf_R_pos_old;
  2941. public Vector3 Thigh_L_pos_old;
  2942. public Vector3 Thigh_R_pos_old;
  2943. public Vector3 posCalfCenter;
  2944. public float JumpDis;
  2945. public float JumpDis_old;
  2946. public static readonly string[] m_strDefSlotName = new string[]
  2947. {
  2948. "body",
  2949. "_ROOT_",
  2950. "IK",
  2951. "head",
  2952. "Bip01 Head",
  2953. "Jyouhanshin",
  2954. "eye",
  2955. "Bip01 Head",
  2956. "Jyouhanshin",
  2957. "hairF",
  2958. "Bip01 Head",
  2959. "Jyouhanshin",
  2960. "hairR",
  2961. "Bip01 Head",
  2962. "Jyouhanshin",
  2963. "hairS",
  2964. "Bip01 Head",
  2965. "Jyouhanshin",
  2966. "hairT",
  2967. "Bip01 Head",
  2968. "Jyouhanshin",
  2969. "wear",
  2970. "_ROOT_",
  2971. "Uwagi",
  2972. "skirt",
  2973. "_ROOT_",
  2974. "Kahanshin",
  2975. "onepiece",
  2976. "_ROOT_",
  2977. "Kahanshin",
  2978. "mizugi",
  2979. "_ROOT_",
  2980. "Kahanshin",
  2981. "panz",
  2982. "_ROOT_",
  2983. "Kahanshin",
  2984. "bra",
  2985. "_ROOT_",
  2986. "Jyouhanshin",
  2987. "stkg",
  2988. "_ROOT_",
  2989. "Kahanshin",
  2990. "shoes",
  2991. "_ROOT_",
  2992. "Kahanshin",
  2993. "headset",
  2994. "Bip01 Head",
  2995. "Jyouhanshin",
  2996. "glove",
  2997. "_ROOT_",
  2998. "Uwagi",
  2999. "accHead",
  3000. "Bip01 Head",
  3001. "Jyouhanshin",
  3002. "hairAho",
  3003. "Bip01 Head",
  3004. "Jyouhanshin",
  3005. "accHana",
  3006. "_ROOT_",
  3007. "Jyouhanshin",
  3008. "accHa",
  3009. "Bip01 Head",
  3010. "Jyouhanshin",
  3011. "accKami_1_",
  3012. "Bip01 Head",
  3013. "Jyouhanshin",
  3014. "accMiMiR",
  3015. "Bip01 Head",
  3016. "Jyouhanshin",
  3017. "accKamiSubR",
  3018. "Bip01 Head",
  3019. "Jyouhanshin",
  3020. "accNipR",
  3021. "_ROOT_",
  3022. "Uwagi",
  3023. "HandItemR",
  3024. "_IK_handR",
  3025. "Uwagi",
  3026. "accKubi",
  3027. "Bip01 Spine1a",
  3028. "Jyouhanshin",
  3029. "accKubiwa",
  3030. "Bip01 Neck",
  3031. "Jyouhanshin",
  3032. "accHeso",
  3033. "Bip01 Head",
  3034. "Jyouhanshin",
  3035. "accUde",
  3036. "_ROOT_",
  3037. "Uwagi",
  3038. "accAshi",
  3039. "_ROOT_",
  3040. "Uwagi",
  3041. "accSenaka",
  3042. "_ROOT_",
  3043. "Uwagi",
  3044. "accShippo",
  3045. "Bip01 Spine",
  3046. "Uwagi",
  3047. "accAnl",
  3048. "_ROOT_",
  3049. "Uwagi",
  3050. "accVag",
  3051. "_ROOT_",
  3052. "Uwagi",
  3053. "kubiwa",
  3054. "_ROOT_",
  3055. "Uwagi",
  3056. "megane",
  3057. "Bip01 Head",
  3058. "Jyouhanshin",
  3059. "accXXX",
  3060. "_ROOT_",
  3061. "Uwagi",
  3062. "chinko",
  3063. "Bip01 Pelvis",
  3064. "Uwagi",
  3065. "chikubi",
  3066. "_ROOT_",
  3067. "Jyouhanshin",
  3068. "accHat",
  3069. "Bip01 Head",
  3070. "Jyouhanshin",
  3071. "kousoku_upper",
  3072. "_ROOT_",
  3073. "Uwagi",
  3074. "kousoku_lower",
  3075. "_ROOT_",
  3076. "Kahanshin",
  3077. "seieki_naka",
  3078. "_ROOT_",
  3079. "Uwagi",
  3080. "seieki_hara",
  3081. "_ROOT_",
  3082. "Uwagi",
  3083. "seieki_face",
  3084. "_ROOT_",
  3085. "Uwagi",
  3086. "seieki_mune",
  3087. "_ROOT_",
  3088. "Uwagi",
  3089. "seieki_hip",
  3090. "_ROOT_",
  3091. "Uwagi",
  3092. "seieki_ude",
  3093. "_ROOT_",
  3094. "Uwagi",
  3095. "seieki_ashi",
  3096. "_ROOT_",
  3097. "Uwagi",
  3098. "accNipL",
  3099. "_ROOT_",
  3100. "Uwagi",
  3101. "accMiMiL",
  3102. "Bip01 Head",
  3103. "Jyouhanshin",
  3104. "accKamiSubL",
  3105. "Bip01 Head",
  3106. "Jyouhanshin",
  3107. "accKami_2_",
  3108. "Bip01 Head",
  3109. "Jyouhanshin",
  3110. "accKami_3_",
  3111. "Bip01 Head",
  3112. "Jyouhanshin",
  3113. "HandItemL",
  3114. "_IK_handL",
  3115. "Uwagi",
  3116. "underhair",
  3117. "_ROOT_",
  3118. "Kahanshin",
  3119. "moza",
  3120. "_ROOT_",
  3121. "Kahanshin",
  3122. "end"
  3123. };
  3124. private string[] m_strSlotName;
  3125. private static int strSlotNameItemCnt = 3;
  3126. public static Hashtable hashSlotName;
  3127. private static HashSet<int> NoAlphaIdxSet = null;
  3128. public TBodySkin Face;
  3129. public BoneMorph_ bonemorph;
  3130. public Transform trsEyeL;
  3131. public Transform trsEyeR;
  3132. public Quaternion quaDefEyeL;
  3133. public Quaternion quaDefEyeR;
  3134. private Vector3 EyeEulerAngle;
  3135. public float ManAlpha = 1f;
  3136. public string LastAnimeFN;
  3137. public Maid maid;
  3138. public static bool boMoveMomoniku = true;
  3139. public bool boAutoTwistShoulderL = true;
  3140. public bool boAutoTwistShoulderR = true;
  3141. public bool boAutoTwistWristL = true;
  3142. public bool boAutoTwistWristR = true;
  3143. public bool boAutoTwistThighL = true;
  3144. public bool boAutoTwistThighR = true;
  3145. public Dictionary<string, float> m_MorphBlendValues = new Dictionary<string, float>();
  3146. public Transform m_trHandHitL;
  3147. public Transform m_trHandHitR;
  3148. public Transform m_trHandLeapHitL;
  3149. public Transform m_trHandLeapHitR;
  3150. public float m_fHitLimitDistanceMin = 0.01f;
  3151. public float m_fHitLimitDistanceMax = 0.04f;
  3152. public float m_fHitCenterZMin = -0.3f;
  3153. public float m_fHitCenterZMax;
  3154. public float m_fHitRadiusMin = 0.1f;
  3155. public float m_fHitRadiusMax = 0.32f;
  3156. public bool m_bNewPhyscs = true;
  3157. public bool m_bNewSkirtPhyscs = true;
  3158. private Transform m_trsMuneL;
  3159. private Transform m_trsMuneR;
  3160. private Transform m_trsMuneLsub;
  3161. private Transform m_trsMuneRsub;
  3162. private Transform m_trHitParentL;
  3163. private Transform m_trHitParentR;
  3164. private Transform m_trHitChildL;
  3165. private Transform m_trHitChildR;
  3166. private SphereCollider m_HitChildColliderL;
  3167. private SphereCollider m_HitChildColliderR;
  3168. private bool m_bManMeshHide;
  3169. private Dictionary<string, TBody.TexLay.Mat> m_dicLaySlot = new Dictionary<string, TBody.TexLay.Mat>();
  3170. private TBody.MaskMode m_eMaskMode;
  3171. private Hashtable m_hFoceHide = new Hashtable();
  3172. private bool m_bNoHandL;
  3173. private bool m_bNoHandR;
  3174. public float fDegPer = 31.1f;
  3175. public float fDegPer1 = 0.2f;
  3176. public float fRota = 0.5f;
  3177. public class IKCMO
  3178. {
  3179. public void Init(Transform hip, Transform knee, Transform ankle, TBody b)
  3180. {
  3181. this.body = b;
  3182. this.defLEN1 = (hip.position - knee.position).magnitude;
  3183. this.defLEN2 = (ankle.position - knee.position).magnitude;
  3184. this.knee_old = knee.position;
  3185. this.defHipQ = hip.localRotation;
  3186. this.defKneeQ = knee.localRotation;
  3187. this.vechand = Vector3.zero;
  3188. }
  3189. public void Porc(Transform hip, Transform knee, Transform ankle, Vector3 tgt, Vector3 vechand_offset)
  3190. {
  3191. tgt += this.vechand;
  3192. if ((knee.position - this.knee_old).sqrMagnitude > 1f)
  3193. {
  3194. this.knee_old = knee.position;
  3195. }
  3196. this.knee_old = this.knee_old * 0.5f + knee.position * 0.5f;
  3197. Vector3 normalized = (this.knee_old - tgt).normalized;
  3198. this.knee_old = tgt + normalized * this.defLEN2;
  3199. Vector3 normalized2 = (this.knee_old - hip.position).normalized;
  3200. this.knee_old = hip.position + normalized2 * this.defLEN1;
  3201. if (!this.body.boMAN)
  3202. {
  3203. Vector3 zero = Vector3.zero;
  3204. bool flag = this.body.goSlot[0].bonehair.bodyhit.SphereMove_hair(ref this.knee_old, ref zero, Vector3.zero);
  3205. if (flag)
  3206. {
  3207. Debug.DrawLine(this.body.Spine0a.position, this.knee_old, Color.white);
  3208. }
  3209. }
  3210. default(Quaternion).SetLookRotation(normalized2);
  3211. hip.localRotation = this.defHipQ;
  3212. hip.transform.rotation = Quaternion.FromToRotation(knee.transform.position - hip.transform.position, this.knee_old - hip.transform.position) * hip.transform.rotation;
  3213. knee.localRotation = this.defKneeQ;
  3214. knee.transform.rotation = Quaternion.FromToRotation(ankle.transform.position - knee.transform.position, tgt - knee.transform.position) * knee.transform.rotation;
  3215. Debug.DrawLine(hip.position, this.knee_old, Color.yellow);
  3216. Debug.DrawLine(ankle.position, this.knee_old, Color.yellow);
  3217. this.vechand = ankle.rotation * vechand_offset;
  3218. }
  3219. private TBody body;
  3220. private float defLEN1;
  3221. private float defLEN2;
  3222. private Vector3 knee_old;
  3223. private Quaternion defHipQ;
  3224. private Quaternion defKneeQ;
  3225. private Vector3 vechand;
  3226. }
  3227. public enum ModeHirR
  3228. {
  3229. Normal,
  3230. NoFront
  3231. }
  3232. public enum SlotID
  3233. {
  3234. body,
  3235. head,
  3236. eye,
  3237. hairF,
  3238. hairR,
  3239. hairS,
  3240. hairT,
  3241. wear,
  3242. skirt,
  3243. onepiece,
  3244. mizugi,
  3245. panz,
  3246. bra,
  3247. stkg,
  3248. shoes,
  3249. headset,
  3250. glove,
  3251. accHead,
  3252. hairAho,
  3253. accHana,
  3254. accHa,
  3255. accKami_1_,
  3256. accMiMiR,
  3257. accKamiSubR,
  3258. accNipR,
  3259. HandItemR,
  3260. accKubi,
  3261. accKubiwa,
  3262. accHeso,
  3263. accUde,
  3264. accAshi,
  3265. accSenaka,
  3266. accShippo,
  3267. accAnl,
  3268. accVag,
  3269. kubiwa,
  3270. megane,
  3271. accXXX,
  3272. chinko,
  3273. chikubi,
  3274. accHat,
  3275. kousoku_upper,
  3276. kousoku_lower,
  3277. seieki_naka,
  3278. seieki_hara,
  3279. seieki_face,
  3280. seieki_mune,
  3281. seieki_hip,
  3282. seieki_ude,
  3283. seieki_ashi,
  3284. accNipL,
  3285. accMiMiL,
  3286. accKamiSubL,
  3287. accKami_2_,
  3288. accKami_3_,
  3289. HandItemL,
  3290. underhair,
  3291. moza,
  3292. end
  3293. }
  3294. public class TexLay
  3295. {
  3296. public class LaySet
  3297. {
  3298. public void Remove()
  3299. {
  3300. UnityEngine.Object.Destroy(this.tex);
  3301. this.tex = null;
  3302. }
  3303. public int nLayerNo;
  3304. public bool bNoTransfrom;
  3305. public int nX;
  3306. public int nY;
  3307. public float fRot;
  3308. public float fScale;
  3309. public int nTargetBodyTexSize;
  3310. public Texture tex;
  3311. public GameUty.SystemMaterial mode;
  3312. public float fAlpha = 1f;
  3313. public SubProp sprop;
  3314. }
  3315. public class OrderTex
  3316. {
  3317. public void SortLaySet()
  3318. {
  3319. this.listLaySet.Sort(delegate(TBody.TexLay.LaySet x, TBody.TexLay.LaySet y)
  3320. {
  3321. if (x.nLayerNo < y.nLayerNo)
  3322. {
  3323. return -1;
  3324. }
  3325. if (x.nLayerNo > y.nLayerNo)
  3326. {
  3327. return 1;
  3328. }
  3329. return 0;
  3330. });
  3331. }
  3332. public void Remove()
  3333. {
  3334. UnityEngine.Object.Destroy(this.tex);
  3335. this.tex = null;
  3336. this.RemoveLaySet();
  3337. }
  3338. public void RemoveLaySet()
  3339. {
  3340. for (int i = 0; i < this.listLaySet.Count; i++)
  3341. {
  3342. this.listLaySet[i].Remove();
  3343. }
  3344. this.listLaySet.Clear();
  3345. }
  3346. public int nLayerNo;
  3347. public Texture2D texBack;
  3348. public Texture2D tex;
  3349. public GameUty.SystemMaterial mode;
  3350. public List<TBody.TexLay.LaySet> listLaySet = new List<TBody.TexLay.LaySet>();
  3351. }
  3352. public class Lay
  3353. {
  3354. public Lay(Texture f_texBack)
  3355. {
  3356. this.rtBase = new RenderTexture(f_texBack.width, f_texBack.height, 0);
  3357. this.texBack = f_texBack;
  3358. this.rtBase.name = "rt:src:" + f_texBack.name;
  3359. RenderTexture active = RenderTexture.active;
  3360. Graphics.Blit(this.texBack, this.rtBase);
  3361. RenderTexture.active = active;
  3362. }
  3363. public void Sort()
  3364. {
  3365. this.listLayer.Sort(delegate(TBody.TexLay.OrderTex x, TBody.TexLay.OrderTex y)
  3366. {
  3367. if (x.nLayerNo < y.nLayerNo)
  3368. {
  3369. return -1;
  3370. }
  3371. if (x.nLayerNo > y.nLayerNo)
  3372. {
  3373. return 1;
  3374. }
  3375. return 0;
  3376. });
  3377. }
  3378. public void Remove(int f_nLayNo = -1)
  3379. {
  3380. if (f_nLayNo == -1)
  3381. {
  3382. for (int i = 0; i < this.listLayer.Count; i++)
  3383. {
  3384. this.listLayer[i].Remove();
  3385. }
  3386. this.listLayer.Clear();
  3387. }
  3388. else
  3389. {
  3390. TBody.TexLay.OrderTex[] array = (from ot in this.listLayer
  3391. where ot.nLayerNo == f_nLayNo
  3392. select ot).ToArray<TBody.TexLay.OrderTex>();
  3393. for (int j = 0; j < array.Length; j++)
  3394. {
  3395. if (this.listLayer[j].nLayerNo == f_nLayNo)
  3396. {
  3397. this.listLayer[j].Remove();
  3398. }
  3399. }
  3400. this.listLayer.RemoveAll((TBody.TexLay.OrderTex ot) => ot.nLayerNo == f_nLayNo);
  3401. }
  3402. if (this.listLayer.Count == 0 && this.rtBase != null)
  3403. {
  3404. UnityEngine.Object.DestroyImmediate(this.rtBase);
  3405. this.rtBase = null;
  3406. }
  3407. }
  3408. public bool Reset()
  3409. {
  3410. bool result = false;
  3411. if (!this.rtBase.IsCreated())
  3412. {
  3413. Debug.Log("画面リサイズによる、テクスチャレイヤーRTの再生成");
  3414. this.rtBase.Create();
  3415. RenderTexture active = RenderTexture.active;
  3416. Graphics.Blit(this.texBack, this.rtBase);
  3417. RenderTexture.active = active;
  3418. result = true;
  3419. }
  3420. return result;
  3421. }
  3422. public Texture texBack;
  3423. public RenderTexture rtBase;
  3424. public List<TBody.TexLay.OrderTex> listLayer = new List<TBody.TexLay.OrderTex>();
  3425. public bool bDel;
  3426. }
  3427. public class Prop
  3428. {
  3429. public void Remove()
  3430. {
  3431. foreach (KeyValuePair<string, TBody.TexLay.Lay> keyValuePair in this.dicLayInProp)
  3432. {
  3433. keyValuePair.Value.Remove(-1);
  3434. }
  3435. this.dicLayInProp.Clear();
  3436. }
  3437. public bool Reset()
  3438. {
  3439. bool flag = false;
  3440. foreach (KeyValuePair<string, TBody.TexLay.Lay> keyValuePair in this.dicLayInProp)
  3441. {
  3442. flag |= keyValuePair.Value.Reset();
  3443. }
  3444. return flag;
  3445. }
  3446. public Dictionary<string, TBody.TexLay.Lay> dicLayInProp = new Dictionary<string, TBody.TexLay.Lay>();
  3447. }
  3448. public class Mat
  3449. {
  3450. public void Remove()
  3451. {
  3452. foreach (KeyValuePair<int, TBody.TexLay.Prop> keyValuePair in this.dicPropInMat)
  3453. {
  3454. keyValuePair.Value.Remove();
  3455. }
  3456. this.dicPropInMat.Clear();
  3457. }
  3458. public bool Reset()
  3459. {
  3460. bool flag = false;
  3461. foreach (KeyValuePair<int, TBody.TexLay.Prop> keyValuePair in this.dicPropInMat)
  3462. {
  3463. flag |= keyValuePair.Value.Reset();
  3464. }
  3465. return flag;
  3466. }
  3467. public Dictionary<int, TBody.TexLay.Prop> dicPropInMat = new Dictionary<int, TBody.TexLay.Prop>();
  3468. }
  3469. }
  3470. public enum MaskMode
  3471. {
  3472. None,
  3473. Underwear,
  3474. Swim,
  3475. Nude
  3476. }
  3477. }