TBody.cs 105 KB

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