TBody.cs 105 KB

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