TBody.cs 154 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using kt;
  7. using kt.Physics;
  8. using kt.Utility;
  9. using MaidStatus;
  10. using UnityEngine;
  11. using UnityEngine.Audio;
  12. public class TBody : MonoBehaviour
  13. {
  14. public bool isLoadedBody
  15. {
  16. get
  17. {
  18. return this.m_bIsLoadedBody;
  19. }
  20. }
  21. public AudioSourceMgr AudioMan
  22. {
  23. get
  24. {
  25. return (!(this.m_AudioParent != null)) ? null : this.m_AudioParent.m_AudioMan;
  26. }
  27. }
  28. public void SetVoicePitch(int value)
  29. {
  30. if (this.AudioMan != null)
  31. {
  32. this.AudioMan.Pitch = SoundMgr.ConvertToAudioSourcePitch(value);
  33. }
  34. }
  35. public void SetVoiceGroup(VoiceGroup group)
  36. {
  37. if (this.AudioMan == null)
  38. {
  39. return;
  40. }
  41. AudioMixerMgr.Group group2 = AudioMixerMgr.Group.VoiceHeroine;
  42. AudioSourceMgr.Type soundType = AudioSourceMgr.Type.VoiceHeroine;
  43. if (group != VoiceGroup.Sub)
  44. {
  45. if (group != VoiceGroup.Extra)
  46. {
  47. if (group == VoiceGroup.Mob)
  48. {
  49. group2 = AudioMixerMgr.Group.VoiceMob;
  50. soundType = AudioSourceMgr.Type.VoiceMob;
  51. }
  52. }
  53. else
  54. {
  55. group2 = AudioMixerMgr.Group.VoiceExtra;
  56. soundType = AudioSourceMgr.Type.VoiceExtra;
  57. }
  58. }
  59. else
  60. {
  61. group2 = AudioMixerMgr.Group.VoiceSub;
  62. soundType = AudioSourceMgr.Type.VoiceSub;
  63. }
  64. SoundMgr soundMgr = GameMain.Instance.SoundMgr;
  65. AudioMixerGroup audioMixerGroup = soundMgr.mix_mgr[group2];
  66. AudioSource audiosource = this.maid.AudioMan.audiosource;
  67. if (audiosource.outputAudioMixerGroup != audioMixerGroup)
  68. {
  69. bool threeD = soundMgr.GetThreeD(this.maid.AudioMan.SoundType);
  70. soundMgr.SetThreeD(this.maid.AudioMan.SoundType, false);
  71. this.maid.AudioMan.ApplyThreeD();
  72. soundMgr.SetThreeD(this.maid.AudioMan.SoundType, threeD);
  73. this.maid.AudioMan.SoundType = soundType;
  74. audiosource.outputAudioMixerGroup = audioMixerGroup;
  75. this.maid.AudioMan.ApplyThreeD();
  76. }
  77. }
  78. public FullBodyIKMgr fullBodyIK
  79. {
  80. get
  81. {
  82. return this.FullBodyIK;
  83. }
  84. }
  85. public float motionBlendTime
  86. {
  87. get
  88. {
  89. return this.MotionBlendTime;
  90. }
  91. set
  92. {
  93. this.fullBodyIK.blendTime = value;
  94. this.MotionBlendTime = value;
  95. }
  96. }
  97. public Transform SmBody
  98. {
  99. get
  100. {
  101. if (!this.m_SMbody)
  102. {
  103. if (!this.boMAN)
  104. {
  105. this.m_SMbody = CMT.SearchObjName(this.m_trBones, "_SM_body001", false);
  106. }
  107. else
  108. {
  109. this.m_SMbody = CMT.SearchObjName(this.m_trBones, "_SM_mbody", false);
  110. }
  111. }
  112. return this.m_SMbody;
  113. }
  114. }
  115. public jiggleBone jbMuneL { get; private set; }
  116. public jiggleBone jbMuneR { get; private set; }
  117. public DynamicMuneBone dbMuneL { get; private set; }
  118. public DynamicMuneBone dbMuneR { get; private set; }
  119. public ChinkoCtrl chinkoCtrl { get; private set; }
  120. public float BoneHitHeightY
  121. {
  122. get
  123. {
  124. return this.m_trFloorPlane.position.y;
  125. }
  126. set
  127. {
  128. if (this.m_trFloorPlane != null)
  129. {
  130. this.m_trFloorPlane.position = new Vector3(0f, value, 0f);
  131. }
  132. this.m_BoneHitY = value;
  133. }
  134. }
  135. [HideInInspector]
  136. public bool isMotionScriptSet { get; private set; }
  137. public bool isMotionChange
  138. {
  139. get
  140. {
  141. return this.IsAnimationChange || this.IsMotionScriptChange;
  142. }
  143. }
  144. public bool IsCrcBody
  145. {
  146. get
  147. {
  148. return this.m_IsCrcBodyImported || 200 <= this.m_bodyVer;
  149. }
  150. }
  151. public bool IsHiheel
  152. {
  153. get
  154. {
  155. return this.goSlot[19].m_isHiheel && this.goSlot[19].boVisible;
  156. }
  157. }
  158. public PermTempAction<string, float> onBoneMorphApply
  159. {
  160. get
  161. {
  162. return this.OnBoneMorphApply;
  163. }
  164. }
  165. public PermTempAction<string, float> onVertexMorphApply
  166. {
  167. get
  168. {
  169. return this.OnVertexMorphApply;
  170. }
  171. }
  172. public LimbColliderMgr limbColliderMgr { get; private set; }
  173. public void Init(Maid maid_, bool boMAN_ = false)
  174. {
  175. this.maid = maid_;
  176. this.boMAN = boMAN_;
  177. this.boMaid = !this.boMAN;
  178. this.m_strSlotName = new string[TBody.m_strDefSlotName.Length];
  179. TBody.m_strDefSlotName.CopyTo(this.m_strSlotName, 0);
  180. this.m_strSlotNameCRC = new string[TBody.m_strDefSlotNameCRC.Length];
  181. TBody.m_strDefSlotNameCRC.CopyTo(this.m_strSlotNameCRC, 0);
  182. if (this.boMAN)
  183. {
  184. for (int k = 0; k < this.m_strSlotName.Length; k++)
  185. {
  186. this.m_strSlotName[k] = this.m_strSlotName[k].Replace("Bip01", "ManBip");
  187. }
  188. }
  189. TBody.hashSlotName = new Hashtable();
  190. this.bonemorph = new BoneMorph_();
  191. this.bonemorph.Init();
  192. this.goSlot = new TBody.Slot();
  193. int i = 0;
  194. while (!(this.m_strSlotName[i] == "end"))
  195. {
  196. int num = i / TBody.strSlotNameItemCnt;
  197. TBody.hashSlotName[this.m_strSlotName[i]] = num;
  198. TBody.hashSlotName[this.m_strSlotName[i].ToLower()] = num;
  199. TBody.hashSlotName[this.m_strSlotName[i].ToUpper()] = num;
  200. TBodySkin bodySkin = new TBodySkin(this, this.m_strSlotName[i], (TBody.SlotID)num, boMAN_, 0);
  201. this.goSlot.Add(bodySkin);
  202. if (Array.Find<string>(TBody.m_multiSlot, (string a) => string.Compare(a, this.m_strSlotName[i], true) == 0) != null)
  203. {
  204. for (int j = 1; j < TBody.SUB_SLOT_NO; j++)
  205. {
  206. TBodySkin bodySkin2 = new TBodySkin(this, this.m_strSlotName[i], (TBody.SlotID)num, boMAN_, j);
  207. this.goSlot.AddChild(this.goSlot.Count - 1, bodySkin2);
  208. }
  209. }
  210. i += TBody.strSlotNameItemCnt;
  211. }
  212. this.m_bForceReloadAnime = false;
  213. }
  214. public void UnInit()
  215. {
  216. if (this.bonemorph != null)
  217. {
  218. this.bonemorph.Uninit();
  219. }
  220. this.m_bIsLoadedBody = false;
  221. this.chinkoCtrl = null;
  222. this.goSlot.DeleteObjAll();
  223. UnityEngine.Object.DestroyImmediate(this.m_Bones);
  224. this.m_Bones = null;
  225. this.m_trBones = null;
  226. this.m_dicTrans.Clear();
  227. UnityEngine.Object.DestroyImmediate(this.m_Bones2);
  228. this.m_Bones2 = null;
  229. this.m_trBones2 = null;
  230. this.m_dicBones.Clear();
  231. this.m_dicBonesMR.Clear();
  232. foreach (KeyValuePair<string, TBody.TexLay.Mat> keyValuePair in this.m_dicLaySlot)
  233. {
  234. keyValuePair.Value.Remove();
  235. }
  236. this.m_dicLaySlot.Clear();
  237. if (this.m_hitFloorPlane != null)
  238. {
  239. UnityEngine.Object.Destroy(this.m_hitFloorPlane.gameObject);
  240. this.m_hitFloorPlane = null;
  241. this.m_trFloorPlane = null;
  242. }
  243. if (this.crcHitFloorPlane)
  244. {
  245. UnityEngine.Object.Destroy(this.crcHitFloorPlane.gameObject);
  246. this.crcHitFloorPlane = null;
  247. this.m_trFloorPlane = null;
  248. }
  249. if (this.FullBodyIK != null)
  250. {
  251. UnityEngine.Object.Destroy(this.FullBodyIK);
  252. this.FullBodyIK = null;
  253. }
  254. if (this.limbColliderMgr != null)
  255. {
  256. UnityEngine.Object.Destroy(this.limbColliderMgr);
  257. this.limbColliderMgr = null;
  258. }
  259. this.LastAnimeFN = string.Empty;
  260. this.IsAnimationChange = false;
  261. this.IsMotionScriptChange = false;
  262. this.LastMSName = string.Empty;
  263. this.LastMSLabelName = string.Empty;
  264. this.m_bodyVer = 0;
  265. this.m_IsCrcBodyImported = false;
  266. }
  267. private void OnDetattchVoice(AudioSourceParent f_asp)
  268. {
  269. Debug.Log(this.maid.name + " Voice回収");
  270. this.m_AudioParent = null;
  271. }
  272. private void OnDestroy()
  273. {
  274. if (this.m_hitFloorPlane != null)
  275. {
  276. UnityEngine.Object.Destroy(this.m_hitFloorPlane.gameObject);
  277. this.m_hitFloorPlane = null;
  278. this.m_trFloorPlane = null;
  279. }
  280. if (this.crcHitFloorPlane)
  281. {
  282. UnityEngine.Object.Destroy(this.crcHitFloorPlane.gameObject);
  283. this.crcHitFloorPlane = null;
  284. this.m_trFloorPlane = null;
  285. }
  286. }
  287. public int GetSlotNo(string slotname)
  288. {
  289. NDebug.Assert(this.IsSlotNo(slotname), "GetSlotNo not found [" + slotname + "] ");
  290. return (int)TBody.hashSlotName[slotname];
  291. }
  292. public bool IsSlotNo(string slotname)
  293. {
  294. return TBody.hashSlotName.ContainsKey(slotname);
  295. }
  296. public TBodySkin GetSlot(int f_nSlotNo)
  297. {
  298. return this.goSlot[f_nSlotNo];
  299. }
  300. public TBodySkin GetSlot(int f_nSlotNo, int subPropNo)
  301. {
  302. return this.goSlot[f_nSlotNo, subPropNo];
  303. }
  304. public TBodySkin GetSlot(string slotname)
  305. {
  306. return this.GetSlot(this.GetSlotNo(slotname));
  307. }
  308. public TBodySkin GetSlot(string slotname, int subPropNo)
  309. {
  310. return this.GetSlot(this.GetSlotNo(slotname), subPropNo);
  311. }
  312. public Transform GetBone(string f_strBoneName)
  313. {
  314. return CMT.SearchObjName(this.m_trBones, f_strBoneName, true);
  315. }
  316. public void LoadBody_R(string f_strModelFileName, Maid f_maid)
  317. {
  318. this.LoadBody_R(f_strModelFileName, f_maid, 100);
  319. }
  320. public void LoadBody_R(string f_strModelFileName, Maid f_maid, int bodyVer)
  321. {
  322. this.LoadBody_R(f_strModelFileName, f_maid, 100, false);
  323. }
  324. public void LoadBody_R(string f_strModelFileName, Maid f_maid, int bodyVer, bool crcImport)
  325. {
  326. if (this.m_bIsLoadedBody)
  327. {
  328. this.UnInit();
  329. }
  330. this.m_bodyVer = bodyVer;
  331. this.m_IsCrcBodyImported = crcImport;
  332. this.m_bIsLoadedBody = true;
  333. if (this.FullBodyIK == null)
  334. {
  335. this.FullBodyIK = base.gameObject.AddComponent<FullBodyIKMgr>();
  336. }
  337. if (this.limbColliderMgr == null)
  338. {
  339. this.limbColliderMgr = base.gameObject.AddComponent<LimbColliderMgr>();
  340. }
  341. if (this.IsCrcBody)
  342. {
  343. this.bonemorph = new TMorphBone();
  344. this.bonemorph.Init();
  345. }
  346. else
  347. {
  348. this.bonemorph = new BoneMorph_();
  349. this.bonemorph.Init();
  350. }
  351. GameObject goOffset = f_maid.m_goOffset;
  352. GameObject gameObject;
  353. if (!GameMain.Instance.CharacterMgr.TryGetCacheObject(f_strModelFileName, out gameObject))
  354. {
  355. byte[] bs = null;
  356. try
  357. {
  358. using (AFileBase afileBase = GameUty.FileOpen(f_strModelFileName, null))
  359. {
  360. NDebug.Assert(afileBase.IsValid(), "Bodyファイルが開けませんでした。" + f_strModelFileName);
  361. bs = afileBase.ReadAll();
  362. }
  363. }
  364. catch (Exception ex)
  365. {
  366. Debug.LogError(string.Concat(new string[]
  367. {
  368. "ProcScriptBin/SetMaidItemTemp メニューファイルが読み込めませんでした。 : ",
  369. f_strModelFileName,
  370. " : ",
  371. ex.Message,
  372. " : StackTrace :\n",
  373. ex.StackTrace
  374. }));
  375. }
  376. GameObject gameObject2 = ImportCM.LoadOnlyBone_R(bs);
  377. GameMain.Instance.CharacterMgr.AddCacheObject(f_strModelFileName, gameObject2);
  378. gameObject = gameObject2;
  379. }
  380. if (this.m_Bones != null)
  381. {
  382. Debug.LogError("ボーン二重 " + this.m_Bones.name);
  383. }
  384. this.m_Bones = UnityEngine.Object.Instantiate<GameObject>(gameObject);
  385. this.m_Bones.name = gameObject.name;
  386. this.m_trBones = this.m_Bones.transform;
  387. CMT.SearchAndAddObj(this.m_trBones, this.m_dicTrans);
  388. this.m_Animation = this.m_Bones.GetComponent<Animation>();
  389. if (this.m_Bones2 != null)
  390. {
  391. Debug.LogError("ボーン二重 " + this.m_Bones2.name);
  392. }
  393. this.m_Bones2 = UnityEngine.Object.Instantiate<GameObject>(this.m_Bones);
  394. this.m_Bones2.name = this.m_Bones.name + " MR";
  395. this.m_trBones2 = this.m_Bones2.transform;
  396. this.m_trBones.SetParent(goOffset.transform, false);
  397. this.m_trBones2.SetParent(goOffset.transform, false);
  398. this.HeadEulerAngle = Vector3.zero;
  399. this.HeadEulerAngleG = Vector3.zero;
  400. this.m_trAttachCache = new GameObject("_AC_AttachCache").transform;
  401. this.m_trAttachCache.SetParent(this.m_trBones, false);
  402. string text = "Bip01";
  403. if (!this.IsCrcBody)
  404. {
  405. if (this.FullBodyIK == null)
  406. {
  407. this.FullBodyIK = base.gameObject.AddComponent<FullBodyIKMgr>();
  408. }
  409. if (!this.IsCrcBody && this.boMAN)
  410. {
  411. text = "ManBip";
  412. }
  413. this.trBip = CMT.SearchObjName(this.m_trBones, text, true);
  414. this.trsHead = CMT.SearchObjName(this.m_trBones, text + " Head", true);
  415. this.trsNeck = CMT.SearchObjName(this.m_trBones, text + " Neck", true);
  416. if (!f_maid.boMAN)
  417. {
  418. if (this.m_AudioParent != null)
  419. {
  420. UnityEngine.Object.DestroyImmediate(this.m_AudioParent);
  421. }
  422. this.m_AudioParent = this.trsNeck.gameObject.AddComponent<AudioSourceParent>();
  423. this.m_AudioParent.AttachVoice(this.trsNeck, new AudioSourceParent.dgOnDettach(this.OnDetattchVoice));
  424. this.SetVoicePitch(this.maid.VoicePitch);
  425. this.SetVoiceGroup(this.maid.status.voiceGroup);
  426. Debug.Log(this.maid.name + " Voice割り当て");
  427. }
  428. this.quaDefHead = this.trsHead.localRotation;
  429. this.quaDefNeck = this.trsNeck.localRotation;
  430. this.UpperArmR = CMT.SearchObjName(this.m_trBones, text + " R UpperArm", true);
  431. this.UpperArmL = CMT.SearchObjName(this.m_trBones, text + " L UpperArm", true);
  432. this.ForearmR = CMT.SearchObjName(this.m_trBones, text + " R Forearm", true);
  433. this.ForearmL = CMT.SearchObjName(this.m_trBones, text + " L Forearm", true);
  434. this.HandL = CMT.SearchObjName(this.m_trBones, text + " L Hand", true);
  435. this.HandL_NubY = new GameObject("L Hand nub1").transform;
  436. this.HandL_NubY.transform.parent = this.HandL;
  437. this.HandL_NubY.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  438. this.HandL_NubY.transform.localRotation = Quaternion.identity;
  439. this.HandR = CMT.SearchObjName(this.m_trBones, text + " R Hand", true);
  440. this.HandR_NubY = new GameObject("R Hand nub1").transform;
  441. this.HandR_NubY.transform.parent = this.HandR;
  442. this.HandR_NubY.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  443. this.HandR_NubY.transform.localRotation = Quaternion.identity;
  444. this.ClavicleL = CMT.SearchObjName(this.m_trBones, text + " L Clavicle", true);
  445. this.ClavicleR = CMT.SearchObjName(this.m_trBones, text + " R Clavicle", true);
  446. if (this.UpperArmR == null)
  447. {
  448. Debug.LogError("UpperArmR null");
  449. }
  450. if (this.UpperArmL == null)
  451. {
  452. Debug.LogError("UpperArmL null");
  453. }
  454. if (this.ForearmR == null)
  455. {
  456. Debug.LogError("ForearmR null");
  457. }
  458. if (this.ForearmL == null)
  459. {
  460. Debug.LogError("ForearmL null");
  461. }
  462. if (this.HandR == null)
  463. {
  464. Debug.LogError("HandR null");
  465. }
  466. if (this.HandL == null)
  467. {
  468. Debug.LogError("HandL null");
  469. }
  470. this.CenterBone = CMT.SearchObjName(this.m_trBones, "center", true);
  471. this.ToeR = CMT.SearchObjName(this.m_trBones, text + " R Toe2Nub", true);
  472. this.ToeL = CMT.SearchObjName(this.m_trBones, text + " L Toe2Nub", true);
  473. this.Pelvis = CMT.SearchObjName(this.m_trBones, text + " Pelvis", true);
  474. this.FootStep = CMT.SearchObjName(this.m_trBones, text + " Footsteps", true);
  475. this.Spine = CMT.SearchObjName(this.m_trBones, text + " Spine", true);
  476. this.Spine0a = CMT.SearchObjName(this.m_trBones, text + " Spine0a", true);
  477. this.Spine1a = CMT.SearchObjName(this.m_trBones, text + " Spine1a", true);
  478. if (this.boMAN)
  479. {
  480. this.trManChinko = CMT.SearchObjName(this.m_trBones, "chinkoCenter", true);
  481. if (this.trManChinko != null)
  482. {
  483. this.vecChinkoOffset = this.trManChinko.transform.localPosition;
  484. this.chinkoCtrl = new ChinkoCtrl(this.trManChinko.transform);
  485. }
  486. }
  487. this.Uppertwist_L = CMT.SearchObjName(this.m_trBones, "Uppertwist_L", true);
  488. this.Uppertwist1_L = CMT.SearchObjName(this.m_trBones, "Uppertwist1_L", true);
  489. this.Kata_L = CMT.SearchObjName(this.m_trBones, "Kata_L", true);
  490. if (this.Kata_L != null)
  491. {
  492. this.quaKata_L = this.Kata_L.localRotation;
  493. }
  494. this.Uppertwist_R = CMT.SearchObjName(this.m_trBones, "Uppertwist_R", true);
  495. this.Uppertwist1_R = CMT.SearchObjName(this.m_trBones, "Uppertwist1_R", true);
  496. this.Kata_R = CMT.SearchObjName(this.m_trBones, "Kata_R", true);
  497. if (this.Kata_R != null)
  498. {
  499. this.quaKata_R = this.Kata_R.localRotation;
  500. }
  501. this.Foretwist1_L = CMT.SearchObjName(this.m_trBones, "Foretwist1_L", true);
  502. this.Foretwist_L = CMT.SearchObjName(this.m_trBones, "Foretwist_L", true);
  503. this.Foretwist1_L_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist1_L", true);
  504. this.Foretwist_L_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist_L", true);
  505. this.Foretwist1_R = CMT.SearchObjName(this.m_trBones, "Foretwist1_R", true);
  506. this.Foretwist_R = CMT.SearchObjName(this.m_trBones, "Foretwist_R", true);
  507. this.Foretwist1_R_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist1_R", true);
  508. this.Foretwist_R_MR = CMT.SearchObjName(this.m_trBones2, "Foretwist_R", true);
  509. this.momoniku_L = CMT.SearchObjName(this.m_trBones, "momoniku_L", true);
  510. this.momoniku_R = CMT.SearchObjName(this.m_trBones, "momoniku_R", true);
  511. this.Calf_L = CMT.SearchObjName(this.m_trBones, text + " L Calf", true);
  512. this.Calf_R = CMT.SearchObjName(this.m_trBones, text + " R Calf", true);
  513. this.momoniku_L_MR = CMT.SearchObjName(this.m_trBones2, "momoniku_L", true);
  514. this.momoniku_R_MR = CMT.SearchObjName(this.m_trBones2, "momoniku_R", true);
  515. this.Thigh_R = CMT.SearchObjName(this.m_trBones, text + " R Thigh", true);
  516. this.Thigh_L = CMT.SearchObjName(this.m_trBones, text + " L Thigh", true);
  517. this.Thigh_R_MR = CMT.SearchObjName(this.m_trBones2, text + " R Thigh", true);
  518. this.Thigh_L_MR = CMT.SearchObjName(this.m_trBones2, text + " L Thigh", true);
  519. if (this.Thigh_L != null)
  520. {
  521. this.quaThigh_L = this.Thigh_L.localRotation;
  522. }
  523. if (this.Thigh_R != null)
  524. {
  525. this.quaThigh_R = this.Thigh_R.localRotation;
  526. }
  527. this.HandL_MR = CMT.SearchObjName(this.m_trBones2, text + " L Hand", true);
  528. if (this.HandL_MR != null)
  529. {
  530. this.HandL_NubY_MR = new GameObject("L Hand nub1").transform;
  531. this.HandL_NubY_MR.transform.parent = this.HandL_MR;
  532. this.HandL_NubY_MR.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  533. this.HandL_NubY_MR.transform.localRotation = Quaternion.identity;
  534. }
  535. this.HandR_MR = CMT.SearchObjName(this.m_trBones2, text + " R Hand", true);
  536. if (this.HandR_MR != null)
  537. {
  538. this.HandR_NubY_MR = new GameObject("R Hand nub1").transform;
  539. this.HandR_NubY_MR.transform.parent = this.HandR_MR;
  540. this.HandR_NubY_MR.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  541. this.HandR_NubY_MR.transform.localRotation = Quaternion.identity;
  542. }
  543. this.momotwist_L = CMT.SearchObjName(this.m_trBones, "momotwist_L", true);
  544. this.momotwist2_L = CMT.SearchObjName(this.m_trBones, "momotwist2_L", true);
  545. this.momotwist_R = CMT.SearchObjName(this.m_trBones, "momotwist_R", true);
  546. this.momotwist2_R = CMT.SearchObjName(this.m_trBones, "momotwist2_R", true);
  547. if (this.momotwist_L != null)
  548. {
  549. this.q_momotwist_L = this.momotwist_L.localRotation;
  550. }
  551. if (this.momotwist2_L != null)
  552. {
  553. this.q_momotwist2_L = this.momotwist2_L.localRotation;
  554. }
  555. if (this.momotwist_R != null)
  556. {
  557. this.q_momotwist_R = this.momotwist_R.localRotation;
  558. }
  559. if (this.momotwist2_R != null)
  560. {
  561. this.q_momotwist2_R = this.momotwist2_R.localRotation;
  562. }
  563. this.Hip_L_nub = CMT.SearchObjName(this.m_trBones, "Hip_L_nub", true);
  564. this.Hip_R_nub = CMT.SearchObjName(this.m_trBones, "Hip_R_nub", true);
  565. this.Hip_L = CMT.SearchObjName(this.m_trBones, "Hip_L", true);
  566. this.Hip_R = CMT.SearchObjName(this.m_trBones, "Hip_R", true);
  567. this.Hip_L_MR = CMT.SearchObjName(this.m_trBones2, "Hip_L", true);
  568. this.Hip_R_MR = CMT.SearchObjName(this.m_trBones2, "Hip_R", true);
  569. this.FullBodyIK.Init();
  570. if (!this.IsCrcBody && this.boMAN)
  571. {
  572. return;
  573. }
  574. this.jbMuneL = CMT.SearchObjName(this.m_trBones, "Mune_L", true).gameObject.AddComponent<jiggleBone>();
  575. this.jbMuneL.Init(this);
  576. this.jbMuneR = CMT.SearchObjName(this.m_trBones, "Mune_R", true).gameObject.AddComponent<jiggleBone>();
  577. this.jbMuneR.Init(this);
  578. if (GameMain.Instance.VRMode)
  579. {
  580. OvrMgr ovrMgr = GameMain.Instance.OvrMgr;
  581. if (ovrMgr != null)
  582. {
  583. OvrMgr.OvrObject.Controller left_controller = ovrMgr.ovr_obj.left_controller;
  584. if (left_controller != null && left_controller.controller != null && left_controller.controller.HandEnable)
  585. {
  586. this.m_trHandHitL = left_controller.hand_trans_hit;
  587. }
  588. OvrMgr.OvrObject.Controller right_controller = ovrMgr.ovr_obj.right_controller;
  589. if (right_controller != null && (right_controller.controller != null & right_controller.controller.HandEnable))
  590. {
  591. this.m_trHandHitR = right_controller.hand_trans_hit;
  592. }
  593. this.m_trHandLeapHitL = ovrMgr.m_trLeapHandL;
  594. this.m_trHandLeapHitR = ovrMgr.m_trLeapHandR;
  595. }
  596. this.m_trsMuneL = CMT.SearchObjName(this.m_trBones, "Mune_L", true);
  597. this.m_trsMuneLsub = CMT.SearchObjName(this.m_trBones, "Mune_L_sub", true);
  598. GameObject gameObject3 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereParent")) as GameObject;
  599. GameObject gameObject4 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereChild")) as GameObject;
  600. gameObject4.GetComponent<SpringJoint>().connectedBody = gameObject3.GetComponent<Rigidbody>();
  601. this.m_trHitParentL = gameObject3.transform;
  602. this.m_trHitChildL = gameObject4.transform;
  603. this.m_trHitParentL.parent = this.m_trsMuneL;
  604. this.m_trHitChildL.parent = this.m_trsMuneL;
  605. this.m_trHitParentL.localPosition = this.m_trsMuneLsub.localPosition;
  606. this.m_trHitChildL.localPosition = this.m_trsMuneLsub.localPosition;
  607. this.m_HitChildColliderL = gameObject4.GetComponent<SphereCollider>();
  608. this.m_trsMuneR = CMT.SearchObjName(this.m_trBones, "Mune_R", true);
  609. this.m_trsMuneRsub = CMT.SearchObjName(this.m_trBones, "Mune_R_sub", true);
  610. GameObject gameObject5 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereParent")) as GameObject;
  611. GameObject gameObject6 = UnityEngine.Object.Instantiate(Resources.Load("OVR/SphereChild")) as GameObject;
  612. gameObject6.GetComponent<SpringJoint>().connectedBody = gameObject5.GetComponent<Rigidbody>();
  613. this.m_trHitParentR = gameObject5.transform;
  614. this.m_trHitChildR = gameObject6.transform;
  615. this.m_trHitParentR.parent = this.m_trsMuneR;
  616. this.m_trHitChildR.parent = this.m_trsMuneR;
  617. this.m_trHitParentR.localPosition = this.m_trsMuneRsub.localPosition;
  618. this.m_trHitChildR.localPosition = this.m_trsMuneRsub.localPosition;
  619. this.m_HitChildColliderR = gameObject6.GetComponent<SphereCollider>();
  620. }
  621. for (int i = 0; i < this.goSlot.Count; i++)
  622. {
  623. int rot = 270;
  624. if (this.m_strSlotName[i * TBody.strSlotNameItemCnt + 1] == "_ROOT_")
  625. {
  626. rot = 90;
  627. }
  628. this.goSlot[i].LoadHitcheckData(this.m_trBones, this.m_strSlotName[i * TBody.strSlotNameItemCnt + 2], rot, this.m_strSlotName[i * TBody.strSlotNameItemCnt], this.IsCrcBody);
  629. }
  630. this.goSlot[0].m_strModelFileName = f_strModelFileName;
  631. if (this.boMAN)
  632. {
  633. this.SetManHide(this.m_bManMeshHide);
  634. }
  635. if (this.m_hitFloorPlane == null)
  636. {
  637. GameObject gameObject7 = new GameObject("FloorPlane-Maid[" + this.maid.ActiveSlotNo + "]");
  638. gameObject7.transform.SetParent(GameMain.Instance.BgMgr.Parent.transform, false);
  639. gameObject7.transform.position = new Vector3(0f, this.m_BoneHitY, 0f);
  640. this.m_hitFloorPlane = gameObject7.AddComponent<DynamicBonePlaneCollider>();
  641. this.m_trFloorPlane = gameObject7.transform;
  642. }
  643. if (!this.crcHitFloorPlane)
  644. {
  645. this.crcHitFloorPlane = this.m_trFloorPlane.gameObject.AddComponent<NativePlaneCollider>();
  646. }
  647. }
  648. else
  649. {
  650. CMT.SearchAndAddTrans(this.m_trBones, this.m_dicBones);
  651. CMT.SearchAndAddTrans(this.m_trBones2, this.m_dicBonesMR);
  652. this.trBip = this.m_dicBones[text];
  653. this.trsHead = this.m_dicBones[text + " Head"];
  654. this.trsNeck = this.m_dicBones[text + " Neck"];
  655. if (!f_maid.boMAN)
  656. {
  657. if (this.m_AudioParent != null)
  658. {
  659. UnityEngine.Object.DestroyImmediate(this.m_AudioParent);
  660. }
  661. this.m_AudioParent = this.trsNeck.gameObject.AddComponent<AudioSourceParent>();
  662. this.m_AudioParent.AttachVoice(this.trsNeck, new AudioSourceParent.dgOnDettach(this.OnDetattchVoice));
  663. this.SetVoicePitch(this.maid.VoicePitch);
  664. this.SetVoiceGroup(this.maid.status.voiceGroup);
  665. Debug.Log(this.maid.name + " Voice割り当て");
  666. }
  667. this.quaDefHead = this.trsHead.localRotation;
  668. this.quaDefNeck = this.trsNeck.localRotation;
  669. this.UpperArmR = this.m_dicBones[text + " R UpperArm"];
  670. this.UpperArmL = this.m_dicBones[text + " L UpperArm"];
  671. this.ForearmR = this.m_dicBones[text + " R Forearm"];
  672. this.ForearmL = this.m_dicBones[text + " L Forearm"];
  673. this.HandL = this.m_dicBones[text + " L Hand"];
  674. this.HandL_NubY = new GameObject("L Hand nub1").transform;
  675. this.HandL_NubY.transform.parent = this.HandL;
  676. this.HandL_NubY.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  677. this.HandL_NubY.transform.localRotation = Quaternion.identity;
  678. this.HandR = this.m_dicBones[text + " R Hand"];
  679. this.HandR_NubY = new GameObject("R Hand nub1").transform;
  680. this.HandR_NubY.transform.parent = this.HandR;
  681. this.HandR_NubY.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  682. this.HandR_NubY.transform.localRotation = Quaternion.identity;
  683. this.ClavicleL = this.m_dicBones[text + " L Clavicle"];
  684. this.ClavicleR = this.m_dicBones[text + " R Clavicle"];
  685. if (this.UpperArmR == null)
  686. {
  687. Debug.LogError("UpperArmR null");
  688. }
  689. if (this.UpperArmL == null)
  690. {
  691. Debug.LogError("UpperArmL null");
  692. }
  693. if (this.ForearmR == null)
  694. {
  695. Debug.LogError("ForearmR null");
  696. }
  697. if (this.ForearmL == null)
  698. {
  699. Debug.LogError("ForearmL null");
  700. }
  701. if (this.HandR == null)
  702. {
  703. Debug.LogError("HandR null");
  704. }
  705. if (this.HandL == null)
  706. {
  707. Debug.LogError("HandL null");
  708. }
  709. Transform transform;
  710. this.CenterBone = ((!this.m_dicBones.TryGetValue("center", out transform)) ? null : transform);
  711. this.ToeR = ((!this.m_dicBones.TryGetValue(text + " R Toe2Nub", out transform)) ? null : transform);
  712. this.ToeL = ((!this.m_dicBones.TryGetValue(text + " L Toe2Nub", out transform)) ? null : transform);
  713. this.Pelvis = ((!this.m_dicBones.TryGetValue(text + " Pelvis", out transform)) ? null : transform);
  714. this.FootStep = ((!this.m_dicBones.TryGetValue(text + " Footsteps", out transform)) ? null : transform);
  715. this.Spine = ((!this.m_dicBones.TryGetValue(text + " Spine", out transform)) ? null : transform);
  716. this.Spine0a = ((!this.m_dicBones.TryGetValue(text + " Spine0a", out transform)) ? null : transform);
  717. this.Spine1a = ((!this.m_dicBones.TryGetValue(text + " Spine1a", out transform)) ? null : transform);
  718. if (this.boMAN)
  719. {
  720. this.trManChinko = this.m_dicBones["chinkoCenter"];
  721. if (this.trManChinko != null)
  722. {
  723. this.vecChinkoOffset = this.trManChinko.transform.localPosition;
  724. }
  725. }
  726. if (!this.boMAN && this.IsCrcBody)
  727. {
  728. foreach (AutoKupaCtrl.MorphType morphType in (AutoKupaCtrl.MorphType[])Enum.GetValues(typeof(AutoKupaCtrl.MorphType)))
  729. {
  730. this.KupaDataDic[morphType] = new AutoKupaCtrl(this, morphType);
  731. }
  732. this.VaginaKupa = this.KupaDataDic[AutoKupaCtrl.MorphType.Vagina];
  733. this.AnalKupa = this.KupaDataDic[AutoKupaCtrl.MorphType.Anal];
  734. this.Kupa = this.KupaDataDic[AutoKupaCtrl.MorphType.Kupa];
  735. }
  736. this.Uppertwist_L = ((!this.m_dicBones.TryGetValue("UpperTwist1_L", out transform)) ? null : transform);
  737. this.Uppertwist1_L = ((!this.m_dicBones.TryGetValue("UpperTwist2_L", out transform)) ? null : transform);
  738. this.Kata_L = ((!this.m_dicBones.TryGetValue("Kata_L", out transform)) ? null : transform);
  739. if (this.Kata_L != null)
  740. {
  741. this.quaKata_L = this.Kata_L.localRotation;
  742. }
  743. this.Uppertwist_R = ((!this.m_dicBones.TryGetValue("UpperTwist1_R", out transform)) ? null : transform);
  744. this.Uppertwist1_R = ((!this.m_dicBones.TryGetValue("UpperTwist2_R", out transform)) ? null : transform);
  745. this.Kata_R = ((!this.m_dicBones.TryGetValue("Kata_R", out transform)) ? null : transform);
  746. if (this.Kata_R != null)
  747. {
  748. this.quaKata_R = this.Kata_R.localRotation;
  749. }
  750. this.Foretwist_L = ((!this.m_dicBones.TryGetValue("ForeTwist1_L", out transform)) ? null : transform);
  751. this.Foretwist1_L = ((!this.m_dicBones.TryGetValue("ForeTwist2_L", out transform)) ? null : transform);
  752. this.Foretwist_L_MR = ((!this.m_dicBonesMR.TryGetValue("ForeTwist1_L", out transform)) ? null : transform);
  753. this.Foretwist1_L_MR = ((!this.m_dicBonesMR.TryGetValue("ForeTwist2_L", out transform)) ? null : transform);
  754. this.Foretwist_R = ((!this.m_dicBones.TryGetValue("ForeTwist1_R", out transform)) ? null : transform);
  755. this.Foretwist1_R = ((!this.m_dicBones.TryGetValue("ForeTwist2_R", out transform)) ? null : transform);
  756. this.Foretwist_R_MR = ((!this.m_dicBonesMR.TryGetValue("ForeTwist1_R", out transform)) ? null : transform);
  757. this.Foretwist1_R_MR = ((!this.m_dicBonesMR.TryGetValue("ForeTwist2_R", out transform)) ? null : transform);
  758. this.momoniku_L = ((!this.m_dicBones.TryGetValue("momoniku_L", out transform)) ? null : transform);
  759. this.momoniku_R = ((!this.m_dicBones.TryGetValue("momoniku_R", out transform)) ? null : transform);
  760. this.Calf_L = ((!this.m_dicBones.TryGetValue(text + " L Calf", out transform)) ? null : transform);
  761. this.Calf_R = ((!this.m_dicBones.TryGetValue(text + " R Calf", out transform)) ? null : transform);
  762. this.momoniku_L_MR = ((!this.m_dicBonesMR.TryGetValue("momoniku_L", out transform)) ? null : transform);
  763. this.momoniku_R_MR = ((!this.m_dicBonesMR.TryGetValue("momoniku_R", out transform)) ? null : transform);
  764. this.Thigh_R = ((!this.m_dicBones.TryGetValue(text + " R Thigh", out transform)) ? null : transform);
  765. this.Thigh_L = ((!this.m_dicBones.TryGetValue(text + " L Thigh", out transform)) ? null : transform);
  766. this.Thigh_R_MR = ((!this.m_dicBonesMR.TryGetValue(text + " R Thigh", out transform)) ? null : transform);
  767. this.Thigh_L_MR = ((!this.m_dicBonesMR.TryGetValue(text + " L Thigh", out transform)) ? null : transform);
  768. if (this.Thigh_L != null)
  769. {
  770. this.quaThigh_L = this.Thigh_L.localRotation;
  771. }
  772. if (this.Thigh_R != null)
  773. {
  774. this.quaThigh_R = this.Thigh_R.localRotation;
  775. }
  776. this.HandL_MR = ((!this.m_dicBonesMR.TryGetValue(text + " L Hand", out transform)) ? null : transform);
  777. if (this.HandL_MR != null)
  778. {
  779. this.HandL_NubY_MR = new GameObject("L Hand nub1").transform;
  780. this.HandL_NubY_MR.transform.parent = this.HandL_MR;
  781. this.HandL_NubY_MR.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  782. this.HandL_NubY_MR.transform.localRotation = Quaternion.identity;
  783. }
  784. this.HandR_MR = ((!this.m_dicBonesMR.TryGetValue(text + " R Hand", out transform)) ? null : transform);
  785. if (this.HandR_MR != null)
  786. {
  787. this.HandR_NubY_MR = new GameObject("R Hand nub1").transform;
  788. this.HandR_NubY_MR.transform.parent = this.HandR_MR;
  789. this.HandR_NubY_MR.transform.localPosition = new Vector3(0f, 0.01f, 0f);
  790. this.HandR_NubY_MR.transform.localRotation = Quaternion.identity;
  791. }
  792. this.momotwist_L = ((!this.m_dicBones.TryGetValue("ThighTwist1_L", out transform)) ? null : transform);
  793. this.momotwist2_L = ((!this.m_dicBones.TryGetValue("ThighTwist2_L", out transform)) ? null : transform);
  794. this.momotwist_R = ((!this.m_dicBones.TryGetValue("ThighTwist1_R", out transform)) ? null : transform);
  795. this.momotwist2_R = ((!this.m_dicBones.TryGetValue("ThighTwist2_R", out transform)) ? null : transform);
  796. if (this.momotwist_L != null)
  797. {
  798. this.q_momotwist_L = this.momotwist_L.localRotation;
  799. }
  800. if (this.momotwist2_L != null)
  801. {
  802. this.q_momotwist2_L = this.momotwist2_L.localRotation;
  803. }
  804. if (this.momotwist_R != null)
  805. {
  806. this.q_momotwist_R = this.momotwist_R.localRotation;
  807. }
  808. if (this.momotwist2_R != null)
  809. {
  810. this.q_momotwist2_R = this.momotwist2_R.localRotation;
  811. }
  812. this.Hip_L_nub = ((!this.m_dicBones.TryGetValue("Hip_L_nub", out transform)) ? null : transform);
  813. this.Hip_R_nub = ((!this.m_dicBones.TryGetValue("Hip_R_nub", out transform)) ? null : transform);
  814. this.Hip_L = ((!this.m_dicBones.TryGetValue("Hip_L", out transform)) ? null : transform);
  815. this.Hip_R = ((!this.m_dicBones.TryGetValue("Hip_R", out transform)) ? null : transform);
  816. this.Hip_L_MR = ((!this.m_dicBonesMR.TryGetValue("Hip_L", out transform)) ? null : transform);
  817. this.Hip_R_MR = ((!this.m_dicBonesMR.TryGetValue("Hip_R", out transform)) ? null : transform);
  818. this.ikMouthCenter = ((!this.m_dicBones.TryGetValue("_IK_mouth", out transform)) ? null : transform);
  819. this.limbColliderMgr.Init(this);
  820. foreach (Maid.AutoTwist key in (Maid.AutoTwist[])Enum.GetValues(typeof(Maid.AutoTwist)))
  821. {
  822. switch (key)
  823. {
  824. case Maid.AutoTwist.ShoulderL:
  825. this.m_TwistDataDic[key] = new ShoulderTwist(true, this);
  826. break;
  827. case Maid.AutoTwist.ShoulderR:
  828. this.m_TwistDataDic[key] = new ShoulderTwist(false, this);
  829. break;
  830. case Maid.AutoTwist.WristL:
  831. this.m_TwistDataDic[key] = new WristTwist(true, this);
  832. break;
  833. case Maid.AutoTwist.WristR:
  834. this.m_TwistDataDic[key] = new WristTwist(false, this);
  835. break;
  836. case Maid.AutoTwist.ThighL:
  837. this.m_TwistDataDic[key] = new ThighTwist(true, this);
  838. break;
  839. case Maid.AutoTwist.ThighR:
  840. this.m_TwistDataDic[key] = new ThighTwist(false, this);
  841. break;
  842. case Maid.AutoTwist.AnkleL:
  843. this.m_TwistDataDic[key] = new AnkleTwist(true, this);
  844. break;
  845. case Maid.AutoTwist.AnkleR:
  846. this.m_TwistDataDic[key] = new AnkleTwist(false, this);
  847. break;
  848. }
  849. }
  850. if (this.FullBodyIK != null)
  851. {
  852. this.FullBodyIK.Init();
  853. }
  854. this.InsertObjArrayDic[AutoKupaCtrl.InsertObjType.Finger_L0] = new Transform[]
  855. {
  856. this.GetBone(text + " L Finger0"),
  857. this.GetBone(text + " L Finger01"),
  858. this.GetBone(text + " L Finger02"),
  859. this.GetBone(text + " L Finger0Nub")
  860. };
  861. this.InsertObjArrayDic[AutoKupaCtrl.InsertObjType.Finger_L1] = new Transform[]
  862. {
  863. this.GetBone(text + " L Finger1"),
  864. this.GetBone(text + " L Finger11"),
  865. this.GetBone(text + " L Finger12"),
  866. this.GetBone(text + " L Finger1Nub")
  867. };
  868. this.InsertObjArrayDic[AutoKupaCtrl.InsertObjType.Finger_L2] = new Transform[]
  869. {
  870. this.GetBone(text + " L Finger2"),
  871. this.GetBone(text + " L Finger21"),
  872. this.GetBone(text + " L Finger22"),
  873. this.GetBone(text + " L Finger2Nub")
  874. };
  875. this.InsertObjArrayDic[AutoKupaCtrl.InsertObjType.Finger_L3] = new Transform[]
  876. {
  877. this.GetBone(text + " L Finger3"),
  878. this.GetBone(text + " L Finger31"),
  879. this.GetBone(text + " L Finger32"),
  880. this.GetBone(text + " L Finger3Nub")
  881. };
  882. this.InsertObjArrayDic[AutoKupaCtrl.InsertObjType.Finger_L4] = new Transform[]
  883. {
  884. this.GetBone(text + " L Finger4"),
  885. this.GetBone(text + " L Finger41"),
  886. this.GetBone(text + " L Finger42"),
  887. this.GetBone(text + " L Finger4Nub")
  888. };
  889. this.InsertObjArrayDic[AutoKupaCtrl.InsertObjType.Finger_R0] = new Transform[]
  890. {
  891. this.GetBone(text + " R Finger0"),
  892. this.GetBone(text + " R Finger01"),
  893. this.GetBone(text + " R Finger02"),
  894. this.GetBone(text + " R Finger0Nub")
  895. };
  896. this.InsertObjArrayDic[AutoKupaCtrl.InsertObjType.Finger_R1] = new Transform[]
  897. {
  898. this.GetBone(text + " R Finger1"),
  899. this.GetBone(text + " R Finger11"),
  900. this.GetBone(text + " R Finger12"),
  901. this.GetBone(text + " R Finger1Nub")
  902. };
  903. this.InsertObjArrayDic[AutoKupaCtrl.InsertObjType.Finger_R2] = new Transform[]
  904. {
  905. this.GetBone(text + " R Finger2"),
  906. this.GetBone(text + " R Finger21"),
  907. this.GetBone(text + " R Finger22"),
  908. this.GetBone(text + " R Finger2Nub")
  909. };
  910. this.InsertObjArrayDic[AutoKupaCtrl.InsertObjType.Finger_R3] = new Transform[]
  911. {
  912. this.GetBone(text + " R Finger3"),
  913. this.GetBone(text + " R Finger31"),
  914. this.GetBone(text + " R Finger32"),
  915. this.GetBone(text + " R Finger3Nub")
  916. };
  917. this.InsertObjArrayDic[AutoKupaCtrl.InsertObjType.Finger_R4] = new Transform[]
  918. {
  919. this.GetBone(text + " R Finger4"),
  920. this.GetBone(text + " R Finger41"),
  921. this.GetBone(text + " R Finger42"),
  922. this.GetBone(text + " R Finger4Nub")
  923. };
  924. if (this.boMAN)
  925. {
  926. this.InsertObjArrayDic[AutoKupaCtrl.InsertObjType.Penis] = this.fullBodyIK.GetIKCtrl(FullBodyIKMgr.IKEffectorType.Penis).chainBones;
  927. }
  928. if (!this.boMAN)
  929. {
  930. if (this.IsCrcBody)
  931. {
  932. this.dbMuneL = this.m_dicBones["Mune_L"].gameObject.AddComponent<DynamicMuneBone>();
  933. this.dbMuneL.Init(this.maid, true);
  934. this.dbMuneR = this.m_dicBones["Mune_R"].gameObject.AddComponent<DynamicMuneBone>();
  935. this.dbMuneR.Init(this.maid, false);
  936. this.AddDynamicBone(this.dbMuneL);
  937. this.AddDynamicBone(this.dbMuneR);
  938. for (int l = 0; l < this.goSlot.Count; l++)
  939. {
  940. int rot2 = 270;
  941. if (this.m_strSlotNameCRC[l * TBody.strSlotNameItemCnt + 1] == "_ROOT_")
  942. {
  943. rot2 = 90;
  944. }
  945. this.goSlot[l].LoadHitcheckData(this.m_trBones, this.m_strSlotNameCRC[l * TBody.strSlotNameItemCnt + 2], rot2, this.m_strSlotNameCRC[l * TBody.strSlotNameItemCnt], true);
  946. }
  947. }
  948. else
  949. {
  950. this.jbMuneL = this.m_dicBones["Mune_L"].gameObject.AddComponent<jiggleBone>();
  951. this.jbMuneL.Init(this);
  952. this.jbMuneR = this.m_dicBones["Mune_R"].gameObject.AddComponent<jiggleBone>();
  953. this.jbMuneR.Init(this);
  954. this.jbMuneL.enabled = false;
  955. this.jbMuneR.enabled = false;
  956. for (int m = 0; m < this.goSlot.Count; m++)
  957. {
  958. int rot3 = 270;
  959. if (this.m_strSlotName[m * TBody.strSlotNameItemCnt + 1] == "_ROOT_")
  960. {
  961. rot3 = 90;
  962. }
  963. this.goSlot[m].LoadHitcheckData(this.m_trBones, this.m_strSlotName[m * TBody.strSlotNameItemCnt + 2], rot3, this.m_strSlotName[m * TBody.strSlotNameItemCnt], true);
  964. }
  965. }
  966. }
  967. this.goSlot[0].m_strModelFileName = f_strModelFileName;
  968. if (!this.boMAN)
  969. {
  970. if (this.m_trFloorPlane == null)
  971. {
  972. GameObject gameObject8 = new GameObject(string.Format("FloorPlane-Maid[{0}]", this.maid.ActiveSlotNo));
  973. gameObject8.transform.SetParent(GameMain.Instance.BgMgr.Parent.transform, false);
  974. gameObject8.transform.position = new Vector3(0f, this.m_BoneHitY, 0f);
  975. this.m_trFloorPlane = gameObject8.transform;
  976. if (this.m_hitFloorPlane == null)
  977. {
  978. this.m_hitFloorPlane = gameObject8.AddComponent<DynamicBonePlaneCollider>();
  979. }
  980. }
  981. if (!this.crcHitFloorPlane)
  982. {
  983. this.crcHitFloorPlane = this.m_trFloorPlane.gameObject.AddComponent<NativePlaneCollider>();
  984. }
  985. }
  986. if (this.boMAN)
  987. {
  988. this.SetManHide(this.m_bManMeshHide);
  989. }
  990. if (this.boMAN)
  991. {
  992. this.maid.FaceAnime("通常", 1f, 0);
  993. }
  994. else
  995. {
  996. this.maid.CrossFade("maid_stand01.anm", false, true, false, 0.5f, 1f);
  997. this.maid.FaceAnime("通常", 1f, 0);
  998. if (GameMain.Instance.VRMode)
  999. {
  1000. if (GameMain.Instance.OvrMgr != null)
  1001. {
  1002. this.trsLookTarget = GameMain.Instance.OvrMgr.EyeAnchor;
  1003. }
  1004. }
  1005. else if (GameMain.Instance.MainCamera != null)
  1006. {
  1007. this.trsLookTarget = GameMain.Instance.MainCamera.transform;
  1008. }
  1009. }
  1010. }
  1011. }
  1012. public void AddDynamicBone(IDynamicBone dynamic_bone)
  1013. {
  1014. if (!this.IDynamicBoneList.Contains(dynamic_bone))
  1015. {
  1016. this.IDynamicBoneList.Add(dynamic_bone);
  1017. }
  1018. }
  1019. public void RemoveDynamicBone(IDynamicBone dynamic_bone)
  1020. {
  1021. if (this.IDynamicBoneList.Contains(dynamic_bone))
  1022. {
  1023. this.IDynamicBoneList.Remove(dynamic_bone);
  1024. }
  1025. }
  1026. public void AddItem(MPN mpn, string slotname, string filename, string AttachSlot, string AttachName, bool f_bTemp)
  1027. {
  1028. this.AddItem(mpn, 0, slotname, filename, AttachSlot, AttachName, f_bTemp, 100);
  1029. }
  1030. public void AddItem(MPN mpn, int subno, string slotname, string filename, string AttachSlot, string AttachName, bool f_bTemp, int version)
  1031. {
  1032. this.AddItem(mpn, 0, slotname, filename, AttachSlot, AttachName, f_bTemp, 100, false, null);
  1033. }
  1034. public void AddItem(MPN mpn, int subno, string slotname, string filename, string AttachSlot, string AttachName, bool f_bTemp, int version, bool crcImport, TBodySkin.SplitParam splitParam)
  1035. {
  1036. int num = (int)TBody.hashSlotName[slotname];
  1037. string bonename;
  1038. if (this.IsCrcBody)
  1039. {
  1040. bonename = this.m_strSlotNameCRC[num * TBody.strSlotNameItemCnt + 1];
  1041. }
  1042. else
  1043. {
  1044. bonename = this.m_strSlotName[num * TBody.strSlotNameItemCnt + 1];
  1045. }
  1046. int layer = 10;
  1047. TBodySkin tbodySkin = this.goSlot[num, subno];
  1048. tbodySkin.m_strModelFileName = filename;
  1049. int attachSubNo = 0;
  1050. if (AttachSlot == "hairT" || AttachSlot == "hairT_2")
  1051. {
  1052. attachSubNo = subno;
  1053. }
  1054. tbodySkin.Load(mpn, this.m_trBones2, this.m_trBones, this.m_dicTrans, bonename, filename, slotname, AttachSlot, attachSubNo, AttachName, layer, f_bTemp, version, crcImport, splitParam);
  1055. tbodySkin.SyojiType = 0;
  1056. tbodySkin.RID = Path.GetFileName(filename).ToLower().GetHashCode();
  1057. tbodySkin.m_AttachName = null;
  1058. tbodySkin.m_AttachSlotIdx = 0;
  1059. if (AttachSlot == "ボーンにアタッチ")
  1060. {
  1061. tbodySkin.m_trsBoneAttach = CMT.SearchObjName(this.m_trBones, AttachName, true);
  1062. }
  1063. else if (AttachSlot != string.Empty)
  1064. {
  1065. if (!TBody.hashSlotName.ContainsKey(AttachSlot))
  1066. {
  1067. return;
  1068. }
  1069. int attachSlotIdx = (int)TBody.hashSlotName[AttachSlot];
  1070. tbodySkin.m_AttachName = AttachName;
  1071. tbodySkin.m_AttachSlotIdx = attachSlotIdx;
  1072. }
  1073. if (slotname == "head")
  1074. {
  1075. this.Face = tbodySkin;
  1076. if (!this.boMAN)
  1077. {
  1078. this.trsEyeL = CMT.SearchObjName(this.Face.obj_tr, "Eye_L", false);
  1079. this.trsEyeR = CMT.SearchObjName(this.Face.obj_tr, "Eye_R", false);
  1080. this.quaDefEyeL = this.trsEyeL.localRotation;
  1081. this.quaDefEyeR = this.trsEyeR.localRotation;
  1082. this.EyeEulerAngle = Vector3.zero;
  1083. }
  1084. }
  1085. if (slotname == "body" && !this.boMAN)
  1086. {
  1087. if (this.IsCrcBody)
  1088. {
  1089. this.quaUppertwist_L = CMT.SearchObjName(tbodySkin.obj_tr, "UpperTwist1_L", false).localRotation;
  1090. this.quaUppertwist_R = CMT.SearchObjName(tbodySkin.obj_tr, "UpperTwist1_R", false).localRotation;
  1091. }
  1092. else
  1093. {
  1094. this.quaUppertwist_L = CMT.SearchObjName(tbodySkin.obj_tr, "Uppertwist_L", false).localRotation;
  1095. this.quaUppertwist_R = CMT.SearchObjName(tbodySkin.obj_tr, "Uppertwist_R", false).localRotation;
  1096. }
  1097. this.quaUpperArmL = CMT.SearchObjName(tbodySkin.obj_tr, "Bip01 L UpperArm", false).localRotation;
  1098. this.quaUpperArmR = CMT.SearchObjName(tbodySkin.obj_tr, "Bip01 R UpperArm", false).localRotation;
  1099. }
  1100. this.bonemorph.Init();
  1101. this.bonemorph.InitBoneMorphEdit(tbodySkin.obj_tr, mpn, (TBody.SlotID)num, tbodySkin);
  1102. this.bonemorph.AddRoot(this.m_trBones);
  1103. this.bonemorph.Blend();
  1104. if (this.boMAN)
  1105. {
  1106. this.SetManHide(this.m_bManMeshHide);
  1107. }
  1108. }
  1109. private Transform SearchItemTarget(string f_strSlotName, string f_strObjTarget)
  1110. {
  1111. Transform result = null;
  1112. try
  1113. {
  1114. int i = (int)TBody.hashSlotName[f_strSlotName];
  1115. Transform obj_tr = this.goSlot[i].obj_tr;
  1116. result = obj_tr.Find(f_strObjTarget);
  1117. }
  1118. catch (Exception ex)
  1119. {
  1120. Debug.LogError("SearchItemTarget 不正\n" + ex.Message);
  1121. }
  1122. return result;
  1123. }
  1124. public void SetSlotOffsetPos(string f_strSlotName, string f_strObjTarget, Vector3 f_vPos)
  1125. {
  1126. Transform transform = this.SearchItemTarget(f_strSlotName, f_strObjTarget);
  1127. if (transform != null)
  1128. {
  1129. transform.localPosition = f_vPos;
  1130. }
  1131. }
  1132. public void SetSlotOffsetRot(string f_strSlotName, string f_strObjTarget, Vector3 f_vRot)
  1133. {
  1134. Transform transform = this.SearchItemTarget(f_strSlotName, f_strObjTarget);
  1135. if (transform != null)
  1136. {
  1137. transform.localRotation = Quaternion.Euler(f_vRot);
  1138. }
  1139. }
  1140. public void MuneYureL(float onL)
  1141. {
  1142. if (this.jbMuneL != null)
  1143. {
  1144. this.jbMuneL.BlendValueON = onL;
  1145. }
  1146. }
  1147. public float GetMuneYureL()
  1148. {
  1149. if (this.IsCrcBody)
  1150. {
  1151. return (!(this.dbMuneL != null)) ? 0f : Convert.ToSingle(this.dbMuneL.isDynamicOn);
  1152. }
  1153. return (!(this.jbMuneL != null)) ? 0f : this.jbMuneL.BlendValueON;
  1154. }
  1155. public void MuneYureR(float onR)
  1156. {
  1157. if (this.jbMuneR != null)
  1158. {
  1159. this.jbMuneR.BlendValueON = onR;
  1160. }
  1161. }
  1162. public float GetMuneYureR()
  1163. {
  1164. if (this.IsCrcBody)
  1165. {
  1166. return (!(this.dbMuneR != null)) ? 0f : Convert.ToSingle(this.dbMuneR.isDynamicOn);
  1167. }
  1168. return (!(this.jbMuneR != null)) ? 0f : this.jbMuneR.BlendValueON;
  1169. }
  1170. public void SetMuneYureL(bool is_on)
  1171. {
  1172. if (this.IsCrcBody)
  1173. {
  1174. if (this.dbMuneL)
  1175. {
  1176. this.dbMuneL.isDynamicOn = is_on;
  1177. }
  1178. }
  1179. else if (this.jbMuneL)
  1180. {
  1181. this.jbMuneL.BlendValueON = Convert.ToSingle(is_on);
  1182. }
  1183. }
  1184. public void SetMuneYureLWithEnable(bool is_on)
  1185. {
  1186. this.SetMuneYureL(is_on);
  1187. if (!this.IsCrcBody && this.jbMuneL)
  1188. {
  1189. this.jbMuneL.enabled = is_on;
  1190. }
  1191. }
  1192. public void SetMuneYureR(bool is_on)
  1193. {
  1194. if (this.IsCrcBody)
  1195. {
  1196. if (this.dbMuneR)
  1197. {
  1198. this.dbMuneR.isDynamicOn = is_on;
  1199. }
  1200. }
  1201. else if (this.jbMuneR)
  1202. {
  1203. this.jbMuneR.BlendValueON = Convert.ToSingle(is_on);
  1204. }
  1205. }
  1206. public void SetMuneYureRWithEnable(bool is_on)
  1207. {
  1208. this.SetMuneYureR(is_on);
  1209. if (!this.IsCrcBody && this.jbMuneR)
  1210. {
  1211. this.jbMuneR.enabled = is_on;
  1212. }
  1213. }
  1214. public void SetBoneHitHeightY(float f_fY)
  1215. {
  1216. this.BoneHitHeightY = f_fY;
  1217. }
  1218. public void VertexMorph_FromProcItem(string tag, float f)
  1219. {
  1220. tag = tag.ToLower();
  1221. if (!this.boMaid)
  1222. {
  1223. if (tag != "hara")
  1224. {
  1225. return;
  1226. }
  1227. tag = "karadal";
  1228. }
  1229. if (this.goSlot[0].morph == null)
  1230. {
  1231. return;
  1232. }
  1233. if (!this.IsCrcBody)
  1234. {
  1235. if (this.boMaid)
  1236. {
  1237. if (tag == "munel")
  1238. {
  1239. this.jbMuneL.BlendValue = f;
  1240. this.jbMuneR.BlendValue = f;
  1241. this.goSlot[3].bonehair.bodyhit.ScaleMune("MUNE", f * 0.3f + 0.8f);
  1242. this.goSlot[3].m_BonehairBodyhitScaleBackup["MUNE"] = f * 0.3f + 0.8f;
  1243. this.goSlot[4].bonehair.bodyhit.ScaleMune("MUNE", f * 0.3f + 0.8f);
  1244. this.goSlot[4].m_BonehairBodyhitScaleBackup["MUNE"] = f * 0.3f + 0.8f;
  1245. if (GameMain.Instance.VRMode && this.m_HitChildColliderR != null && this.m_HitChildColliderL != null)
  1246. {
  1247. float num = this.jbMuneL.BlendValue / 1.3f;
  1248. SphereCollider hitChildColliderR = this.m_HitChildColliderR;
  1249. Vector3 center = new Vector3(0f, 0f, this.m_fHitCenterZMin + (this.m_fHitCenterZMax - this.m_fHitCenterZMin) * num);
  1250. this.m_HitChildColliderL.center = center;
  1251. hitChildColliderR.center = center;
  1252. SphereCollider hitChildColliderR2 = this.m_HitChildColliderR;
  1253. float radius = this.m_fHitRadiusMin + (this.m_fHitRadiusMax - this.m_fHitRadiusMin) * num;
  1254. this.m_HitChildColliderL.radius = radius;
  1255. hitChildColliderR2.radius = radius;
  1256. }
  1257. }
  1258. if (tag == "hara")
  1259. {
  1260. this.goSlot[9].bonehair.bodyhit.ScaleMune("HARA", f);
  1261. this.goSlot[9].m_BonehairBodyhitScaleBackup["HARA"] = f;
  1262. }
  1263. }
  1264. if (tag == "regfat" || tag == "regmeet")
  1265. {
  1266. float blendValues = this.goSlot[0].morph.GetBlendValues((int)this.goSlot[0].morph.hash["regfat"]);
  1267. float blendValues2 = this.goSlot[0].morph.GetBlendValues((int)this.goSlot[0].morph.hash["regmeet"]);
  1268. float num2 = (blendValues + blendValues2) * 0.5f;
  1269. if (num2 < 0.5f)
  1270. {
  1271. num2 = num2 * 0.1f + 0.95f;
  1272. }
  1273. else
  1274. {
  1275. num2 = num2 * 0.4f + 0.8f;
  1276. }
  1277. this.goSlot[9].bonehair.bodyhit.ScaleMune("MOMO", num2);
  1278. this.goSlot[9].m_BonehairBodyhitScaleBackup["MOMO"] = num2;
  1279. }
  1280. }
  1281. else if (this.boMaid && tag == "munel")
  1282. {
  1283. this.dbMuneL.ApplyMuneProp(MPN.MuneL, f);
  1284. this.dbMuneR.ApplyMuneProp(MPN.MuneL, f);
  1285. }
  1286. if (tag == "mabutaupin")
  1287. {
  1288. this.goSlot[1].morph.m_MabutaUpIn.rate = f;
  1289. }
  1290. if (tag == "mabutaupin2")
  1291. {
  1292. this.goSlot[1].morph.m_MabutaUpIn2.rate = f;
  1293. }
  1294. if (tag == "mabutaupmiddle")
  1295. {
  1296. this.goSlot[1].morph.m_MabutaUpMiddle.rate = f;
  1297. }
  1298. if (tag == "mabutaupout")
  1299. {
  1300. this.goSlot[1].morph.m_MabutaUpOut.rate = f;
  1301. }
  1302. if (tag == "mabutaupout2")
  1303. {
  1304. this.goSlot[1].morph.m_MabutaUpOut2.rate = f;
  1305. }
  1306. if (tag == "mabutalowin")
  1307. {
  1308. this.goSlot[1].morph.m_MabutaLowIn.rate = f;
  1309. }
  1310. if (tag == "mabutalowupmiddle")
  1311. {
  1312. this.goSlot[1].morph.m_MabutaLowUpMiddle.rate = f;
  1313. }
  1314. if (tag == "mabutalowupout")
  1315. {
  1316. this.goSlot[1].morph.m_MabutaLowUpOut.rate = f;
  1317. }
  1318. if (this.IsCrcBody && !this.boMAN)
  1319. {
  1320. TMorphSkin tmorphSkin = (TMorphSkin)this.goSlot[1].morph;
  1321. if (tag == "hitomishapeup")
  1322. {
  1323. tmorphSkin.m_HitomiShapeUp.rate = f;
  1324. }
  1325. if (tag == "hitomishapelow")
  1326. {
  1327. tmorphSkin.m_HitomiShapeLow.rate = f;
  1328. }
  1329. if (tag == "hitomishapein")
  1330. {
  1331. tmorphSkin.m_HitomiShapeIn.rate = f;
  1332. }
  1333. if (tag == "hitomishapeoutup")
  1334. {
  1335. tmorphSkin.m_HitomiShapeOutUp.rate = f;
  1336. }
  1337. if (tag == "hitomishapeoutlow")
  1338. {
  1339. tmorphSkin.m_HitomiShapeOutLow.rate = f;
  1340. }
  1341. if (tag == "hohoshape")
  1342. {
  1343. tmorphSkin.m_HohoShape.rate = f;
  1344. }
  1345. if (tag == "ha1")
  1346. {
  1347. tmorphSkin.m_Ha1.rate = f;
  1348. }
  1349. if (tag == "ha2")
  1350. {
  1351. tmorphSkin.m_Ha2.rate = f;
  1352. }
  1353. if (tag == "ha3")
  1354. {
  1355. tmorphSkin.m_Ha3.rate = f;
  1356. }
  1357. if (tag == "ha4")
  1358. {
  1359. tmorphSkin.m_Ha4.rate = f;
  1360. }
  1361. if (tag == "ha5")
  1362. {
  1363. tmorphSkin.m_Ha5.rate = f;
  1364. }
  1365. if (tag == "ha6")
  1366. {
  1367. tmorphSkin.m_Ha6.rate = f;
  1368. }
  1369. }
  1370. try
  1371. {
  1372. if (this.goSlot[0].morph.hash.ContainsKey(tag))
  1373. {
  1374. int f_nIdx = (int)this.goSlot[0].morph.hash[tag];
  1375. this.goSlot[0].morph.SetBlendValues(f_nIdx, f);
  1376. this.goSlot[0].morph.FixBlendValues();
  1377. }
  1378. }
  1379. catch
  1380. {
  1381. NDebug.Assert(false, "Null MorphTarget=" + tag);
  1382. }
  1383. int num3 = 1;
  1384. if (this.IsCrcBody)
  1385. {
  1386. num3 = 0;
  1387. }
  1388. for (int i = num3; i < this.goSlot.Count; i++)
  1389. {
  1390. TMorph morph = this.goSlot[i].morph;
  1391. if (morph != null)
  1392. {
  1393. bool flag = false;
  1394. if (morph.Contains(tag))
  1395. {
  1396. int f_nIdx2 = (int)morph.hash[tag];
  1397. morph.SetBlendValues(f_nIdx2, f);
  1398. flag = true;
  1399. }
  1400. if (this.IsCrcBody && !this.boMAN)
  1401. {
  1402. TMorphSkin tmorphSkin2 = morph as TMorphSkin;
  1403. if (tmorphSkin2 != null)
  1404. {
  1405. if (tag == "kuikomipants")
  1406. {
  1407. tmorphSkin2.BaseBlendValue_Kuikomi[0] = f;
  1408. flag = true;
  1409. }
  1410. else if (tag == "kuikomistkg")
  1411. {
  1412. tmorphSkin2.BaseBlendValue_Kuikomi[1] = f;
  1413. flag = true;
  1414. }
  1415. else if (tag == "chikubiweartotsu")
  1416. {
  1417. tmorphSkin2.ChikubiWearTotsu = f;
  1418. flag = true;
  1419. }
  1420. }
  1421. }
  1422. if (flag)
  1423. {
  1424. morph.FixBlendValues();
  1425. }
  1426. }
  1427. }
  1428. this.m_MorphBlendValues[tag] = f;
  1429. this.onVertexMorphApply.Invoke(tag, f);
  1430. }
  1431. public void BoneMorph_FromProcItem(string tag, float f)
  1432. {
  1433. if (!this.IsCrcBody && !this.boMaid)
  1434. {
  1435. return;
  1436. }
  1437. bool flag = false;
  1438. if (tag == "sintyou")
  1439. {
  1440. flag = true;
  1441. this.bonemorph.SCALE_Sintyou = f;
  1442. }
  1443. if (tag == "koshi")
  1444. {
  1445. flag = true;
  1446. this.bonemorph.SCALE_Koshi = f;
  1447. }
  1448. if (tag == "kata")
  1449. {
  1450. flag = true;
  1451. this.bonemorph.SCALE_Kata = f;
  1452. }
  1453. if (tag == "west")
  1454. {
  1455. flag = true;
  1456. this.bonemorph.SCALE_West = f;
  1457. }
  1458. if (tag == "DouPer")
  1459. {
  1460. flag = true;
  1461. this.bonemorph.SCALE_DouPer = f;
  1462. }
  1463. if (!this.IsCrcBody && (tag == "koshi" || tag == "west"))
  1464. {
  1465. float num = (this.bonemorph.SCALE_Koshi + this.bonemorph.SCALE_West) * 0.5f;
  1466. this.goSlot[7].bonehair.bodyhit.ScaleMune("KOSHI_SVAL", f);
  1467. if (num < 1f)
  1468. {
  1469. num = num * 0.1f + 0.95f;
  1470. }
  1471. else
  1472. {
  1473. num = num * 0.8f + 0.4f;
  1474. }
  1475. this.goSlot[7].bonehair.bodyhit.ScaleMune("KOSHI_SCL", num);
  1476. }
  1477. if (tag == "KubiScl")
  1478. {
  1479. flag = true;
  1480. this.bonemorph.SCALE_Kubi = f;
  1481. }
  1482. if (tag == "UdeScl")
  1483. {
  1484. flag = true;
  1485. this.bonemorph.SCALE_Ude = f;
  1486. }
  1487. if (tag == "EyeSclX")
  1488. {
  1489. flag = true;
  1490. this.bonemorph.SCALE_EyeX = f;
  1491. }
  1492. if (tag == "EyeSclY")
  1493. {
  1494. flag = true;
  1495. this.bonemorph.SCALE_EyeY = f;
  1496. }
  1497. if (tag == "EyePosX")
  1498. {
  1499. flag = true;
  1500. this.bonemorph.Postion_EyeX = f;
  1501. }
  1502. if (tag == "EyePosY")
  1503. {
  1504. flag = true;
  1505. this.bonemorph.Postion_EyeY = f;
  1506. }
  1507. if (tag == "EyeBallPosX")
  1508. {
  1509. flag = true;
  1510. this.bonemorph.EyeBallPosX = f;
  1511. }
  1512. if (tag == "EyeBallPosY")
  1513. {
  1514. flag = true;
  1515. this.bonemorph.EyeBallPosY = f;
  1516. }
  1517. if (tag == "EyeBallSclX")
  1518. {
  1519. flag = true;
  1520. this.bonemorph.EyeBallSclX = f;
  1521. }
  1522. if (tag == "EyeBallSclY")
  1523. {
  1524. flag = true;
  1525. this.bonemorph.EyeBallSclY = f;
  1526. }
  1527. if (tag == "HeadX")
  1528. {
  1529. flag = true;
  1530. this.bonemorph.SCALE_HeadX = f;
  1531. }
  1532. if (tag == "HeadY")
  1533. {
  1534. flag = true;
  1535. this.bonemorph.SCALE_HeadY = f;
  1536. }
  1537. if (tag == "EarRot")
  1538. {
  1539. this.bonemorph.ROT_Ear = f;
  1540. }
  1541. if (tag == "EarScl")
  1542. {
  1543. this.bonemorph.SCALE_Ear = f;
  1544. }
  1545. if (tag == "NosePos")
  1546. {
  1547. this.bonemorph.POS_Nose = f;
  1548. }
  1549. if (tag == "NoseScl")
  1550. {
  1551. this.bonemorph.SCALE_Nose = f;
  1552. }
  1553. if (tag == "MayuX")
  1554. {
  1555. this.bonemorph.POS_MayuX = f;
  1556. }
  1557. if (tag == "MayuY")
  1558. {
  1559. this.bonemorph.POS_MayuY = f;
  1560. }
  1561. if (tag == "MayuRot")
  1562. {
  1563. this.bonemorph.ROT_Mayu = f;
  1564. }
  1565. if (this.goSlot[1].morph != null)
  1566. {
  1567. if (tag == "EyeClose")
  1568. {
  1569. this.goSlot[1].morph.m_fEyeCloseRate = f;
  1570. }
  1571. if (tag == "EarNone")
  1572. {
  1573. this.goSlot[1].morph.m_EarNoneData.rate = (f != 0f);
  1574. }
  1575. if (tag == "EarElf")
  1576. {
  1577. this.goSlot[1].morph.m_EarElfData.rate = f;
  1578. }
  1579. if (tag == "FaceShape")
  1580. {
  1581. this.goSlot[1].morph.m_FaceShapeData.rate = f;
  1582. }
  1583. if (tag == "FaceShapeSlim")
  1584. {
  1585. this.goSlot[1].morph.m_FaceShapeSlimData.rate = f;
  1586. }
  1587. if (tag == "MayuShapeIn")
  1588. {
  1589. this.goSlot[1].morph.m_MayuShapeIn.rate = Mathf.Lerp(-1f, 1f, f);
  1590. }
  1591. if (tag == "MayuShapeOut")
  1592. {
  1593. this.goSlot[1].morph.m_MayuShapeOut.rate = Mathf.Lerp(-1f, 1f, f);
  1594. }
  1595. }
  1596. if (tag == "MayuLong")
  1597. {
  1598. this.bonemorph.MayuLong = f;
  1599. }
  1600. if (tag == "Yorime")
  1601. {
  1602. this.bonemorph.Yorime = f;
  1603. }
  1604. if (this.IsCrcBody && tag == "HitomiRot")
  1605. {
  1606. ((TMorphBone)this.bonemorph).HitomiRot = f;
  1607. }
  1608. bool flag2;
  1609. if (this.IsCrcBody)
  1610. {
  1611. flag2 = (this.dbMuneL != null && this.dbMuneR != null);
  1612. }
  1613. else
  1614. {
  1615. flag2 = (this.jbMuneL != null && this.jbMuneR != null);
  1616. }
  1617. if (flag2)
  1618. {
  1619. if (this.IsCrcBody)
  1620. {
  1621. if (tag != null)
  1622. {
  1623. if (!(tag == "MuneUpDown"))
  1624. {
  1625. if (!(tag == "MuneYori"))
  1626. {
  1627. if (!(tag == "MuneYawaraka"))
  1628. {
  1629. if (!(tag == "MuneLong"))
  1630. {
  1631. if (tag == "MuneDir")
  1632. {
  1633. this.dbMuneL.ApplyMuneProp(MPN.MuneDir, f);
  1634. this.dbMuneR.ApplyMuneProp(MPN.MuneDir, f);
  1635. }
  1636. }
  1637. else
  1638. {
  1639. this.dbMuneL.ApplyMuneProp(MPN.MuneLong, f);
  1640. this.dbMuneR.ApplyMuneProp(MPN.MuneLong, f);
  1641. }
  1642. }
  1643. else
  1644. {
  1645. this.dbMuneL.ApplyMuneProp(MPN.MuneYawaraka, f);
  1646. this.dbMuneR.ApplyMuneProp(MPN.MuneYawaraka, f);
  1647. }
  1648. }
  1649. else
  1650. {
  1651. this.dbMuneL.ApplyMuneProp(MPN.MuneYori, f);
  1652. this.dbMuneR.ApplyMuneProp(MPN.MuneYori, f);
  1653. }
  1654. }
  1655. else
  1656. {
  1657. this.dbMuneL.ApplyMuneProp(MPN.MuneUpDown, f);
  1658. this.dbMuneR.ApplyMuneProp(MPN.MuneUpDown, f);
  1659. }
  1660. }
  1661. }
  1662. else
  1663. {
  1664. if (tag == "MuneUpDown")
  1665. {
  1666. this.jbMuneL.MuneUpDown = (f - 0.5f) * 60f;
  1667. this.jbMuneR.MuneUpDown = (f - 0.5f) * 60f;
  1668. this.jbMuneL.BlendValue2 = f - 0.5f;
  1669. if (this.IsCrcBody)
  1670. {
  1671. this.jbMuneR.BlendValue2 = f - 0.5f;
  1672. }
  1673. else
  1674. {
  1675. this.jbMuneR.BlendValue2 = -(f - 0.5f);
  1676. }
  1677. this.jbMuneL.MuneUpDown_f = Mathf.Abs(f - 0.5f) * 2f;
  1678. this.jbMuneR.MuneUpDown_f = Mathf.Abs(f - 0.5f) * 2f;
  1679. flag = true;
  1680. }
  1681. if (tag == "MuneYori")
  1682. {
  1683. this.jbMuneL.MuneYori = (f - 0.5f) * 25f;
  1684. if (this.IsCrcBody)
  1685. {
  1686. this.jbMuneR.MuneYori = -(f - 0.5f) * 25f;
  1687. }
  1688. else
  1689. {
  1690. this.jbMuneR.MuneYori = (f - 0.5f) * 25f;
  1691. }
  1692. this.jbMuneL.MuneYori_f = Mathf.Abs(f - 0.5f) * 2f;
  1693. this.jbMuneR.MuneYori_f = Mathf.Abs(f - 0.5f) * 2f;
  1694. flag = true;
  1695. }
  1696. if (tag == "MuneYawaraka")
  1697. {
  1698. jiggleBone jbMuneR = this.jbMuneR;
  1699. this.jbMuneL.m_fMuneYawaraka = f;
  1700. jbMuneR.m_fMuneYawaraka = f;
  1701. flag = true;
  1702. }
  1703. }
  1704. }
  1705. if (this.IsCrcBody)
  1706. {
  1707. TMorphBone tmorphBone = (TMorphBone)this.bonemorph;
  1708. if (tag == "MunePosX")
  1709. {
  1710. tmorphBone.MunePosX = f;
  1711. }
  1712. if (tag == "MunePosY")
  1713. {
  1714. tmorphBone.MunePosY = f;
  1715. }
  1716. if (tag == "MuneThick")
  1717. {
  1718. tmorphBone.MuneThick = f;
  1719. }
  1720. if (tag == "MuneLong")
  1721. {
  1722. tmorphBone.MuneLong = f;
  1723. }
  1724. if (tag == "MuneDir")
  1725. {
  1726. tmorphBone.MuneDir = f;
  1727. }
  1728. if (tag == "DouThick1X")
  1729. {
  1730. tmorphBone.DouThick1X = f;
  1731. }
  1732. if (tag == "DouThick1Y")
  1733. {
  1734. tmorphBone.DouThick1Y = f;
  1735. }
  1736. if (tag == "DouThick2X")
  1737. {
  1738. tmorphBone.DouThick2X = f;
  1739. }
  1740. if (tag == "DouThick2Y")
  1741. {
  1742. tmorphBone.DouThick2Y = f;
  1743. }
  1744. if (tag == "DouThick3X")
  1745. {
  1746. tmorphBone.DouThick3X = f;
  1747. }
  1748. if (tag == "DouThick3Y")
  1749. {
  1750. tmorphBone.DouThick3Y = f;
  1751. }
  1752. if (tag == "ShoulderThick")
  1753. {
  1754. tmorphBone.ShoulderThick = f;
  1755. }
  1756. if (tag == "UpperArmThickX")
  1757. {
  1758. tmorphBone.UpperArmThickX = f;
  1759. }
  1760. if (tag == "UpperArmThickY")
  1761. {
  1762. tmorphBone.UpperArmThickY = f;
  1763. }
  1764. if (tag == "LowerArmThickX")
  1765. {
  1766. tmorphBone.LowerArmThickX = f;
  1767. }
  1768. if (tag == "LowerArmThickY")
  1769. {
  1770. tmorphBone.LowerArmThickY = f;
  1771. }
  1772. if (tag == "ElbowThickX")
  1773. {
  1774. tmorphBone.ElbowThickX = f;
  1775. }
  1776. if (tag == "ElbowThickY")
  1777. {
  1778. tmorphBone.ElbowThickY = f;
  1779. }
  1780. if (tag == "NeckThickX")
  1781. {
  1782. tmorphBone.NeckThickX = f;
  1783. }
  1784. if (tag == "NeckThickY")
  1785. {
  1786. tmorphBone.NeckThickY = f;
  1787. }
  1788. if (tag == "HandSize")
  1789. {
  1790. tmorphBone.HandSize = f;
  1791. }
  1792. if (tag == "DouThick4X")
  1793. {
  1794. tmorphBone.DouThick4X = f;
  1795. }
  1796. if (tag == "DouThick4Y")
  1797. {
  1798. tmorphBone.DouThick4Y = f;
  1799. }
  1800. if (tag == "DouThick5X")
  1801. {
  1802. tmorphBone.DouThick5X = f;
  1803. }
  1804. if (tag == "DouThick5Y")
  1805. {
  1806. tmorphBone.DouThick5Y = f;
  1807. }
  1808. if (tag == "WaistPos")
  1809. {
  1810. tmorphBone.WaistPos = f;
  1811. }
  1812. if (tag == "HipRot")
  1813. {
  1814. tmorphBone.HipRot = f;
  1815. }
  1816. if (tag == "ThighThickX")
  1817. {
  1818. tmorphBone.ThighThickX = f;
  1819. }
  1820. if (tag == "ThighThickY")
  1821. {
  1822. tmorphBone.ThighThickY = f;
  1823. }
  1824. if (tag == "KneeThickX")
  1825. {
  1826. tmorphBone.KneeThickX = f;
  1827. }
  1828. if (tag == "KneeThickY")
  1829. {
  1830. tmorphBone.KneeThickY = f;
  1831. }
  1832. if (tag == "CalfThickX")
  1833. {
  1834. tmorphBone.CalfThickX = f;
  1835. }
  1836. if (tag == "CalfThickY")
  1837. {
  1838. tmorphBone.CalfThickY = f;
  1839. }
  1840. if (tag == "AnkleThickX")
  1841. {
  1842. tmorphBone.AnkleThickX = f;
  1843. }
  1844. if (tag == "AnkleThickY")
  1845. {
  1846. tmorphBone.AnkleThickY = f;
  1847. }
  1848. if (tag == "FootSize")
  1849. {
  1850. tmorphBone.FootSize = f;
  1851. }
  1852. if (tag == "UpperArmLowerThickX")
  1853. {
  1854. tmorphBone.UpperArmLowerThickX = f;
  1855. }
  1856. if (tag == "UpperArmLowerThickY")
  1857. {
  1858. tmorphBone.UpperArmLowerThickY = f;
  1859. }
  1860. if (tag == "WristThickX")
  1861. {
  1862. tmorphBone.WristThickX = f;
  1863. }
  1864. if (tag == "WristThickY")
  1865. {
  1866. tmorphBone.WristThickY = f;
  1867. }
  1868. if (tag == "ClavicleThick")
  1869. {
  1870. tmorphBone.ClavicleThick = f;
  1871. }
  1872. if (tag == "ShoulderTension")
  1873. {
  1874. tmorphBone.ShoulderTension = f;
  1875. }
  1876. if (tag == "ThighLowerThickX")
  1877. {
  1878. tmorphBone.ThighLowerThickX = f;
  1879. }
  1880. if (tag == "ThighLowerThickY")
  1881. {
  1882. tmorphBone.ThighLowerThickY = f;
  1883. }
  1884. if (tag == "ThighShin")
  1885. {
  1886. tmorphBone.ThighShin = f;
  1887. }
  1888. }
  1889. if (tag == "MayuThick")
  1890. {
  1891. this.goSlot[1].MayuThick = f;
  1892. }
  1893. if (this.IsCrcBody)
  1894. {
  1895. if (tag == "FutaePosX")
  1896. {
  1897. this.goSlot[1].MaterialMgr.FutaePosX = f;
  1898. }
  1899. if (tag == "FutaePosY")
  1900. {
  1901. this.goSlot[1].MaterialMgr.FutaePosY = f;
  1902. }
  1903. if (tag == "FutaeRot")
  1904. {
  1905. this.goSlot[1].MaterialMgr.FutaeRot = f;
  1906. }
  1907. if (tag == "HitomiHiPosX")
  1908. {
  1909. this.goSlot[1].MaterialMgr.HitomiHiPosX = f;
  1910. }
  1911. if (tag == "HitomiHiPosY")
  1912. {
  1913. this.goSlot[1].MaterialMgr.HitomiHiPosY = f;
  1914. }
  1915. if (tag == "HitomiHiSclY")
  1916. {
  1917. this.goSlot[1].MaterialMgr.HitomiHiSclY = f;
  1918. }
  1919. if (tag == "WearSuso")
  1920. {
  1921. this.UpdateMyBoneMorph("裾", f);
  1922. }
  1923. }
  1924. if (!flag)
  1925. {
  1926. }
  1927. this.bonemorph.Blend();
  1928. this.onBoneMorphApply.Invoke(tag, f);
  1929. }
  1930. public void SetVisibleNodeSlot(string slotname, int subNo, bool boSetFlag, string name)
  1931. {
  1932. if (!this.boMaid)
  1933. {
  1934. return;
  1935. }
  1936. if (!TBody.hashSlotName.ContainsKey(slotname))
  1937. {
  1938. NDebug.Assert("SetVisibleNodeSlot: not found slot name " + slotname, false);
  1939. return;
  1940. }
  1941. int i = (int)TBody.hashSlotName[slotname];
  1942. this.goSlot[i, subNo].SetVisibleFlag(boSetFlag, name, this.goSlot[0].obj_tr, false);
  1943. }
  1944. public void SetVisibleNodeSlotParts(string slotname, int subNo, string target, bool boSetFlag, string name)
  1945. {
  1946. if (!this.boMaid)
  1947. {
  1948. return;
  1949. }
  1950. if (!TBody.hashSlotName.ContainsKey(slotname))
  1951. {
  1952. NDebug.Assert("SetVisibleNodeSlot: not found slot name " + slotname, false);
  1953. return;
  1954. }
  1955. int i = (int)TBody.hashSlotName[slotname];
  1956. this.goSlot[i, subNo].SetVisibleFlagParts(boSetFlag, target, name, this.goSlot[0].obj_tr, false);
  1957. }
  1958. public void AddMask(string slotname, int subNo, string maskslot)
  1959. {
  1960. if (!TBody.hashSlotName.ContainsKey(slotname) || !TBody.hashSlotName.ContainsKey(maskslot))
  1961. {
  1962. return;
  1963. }
  1964. int i = (int)TBody.hashSlotName[slotname];
  1965. int item = (int)TBody.hashSlotName[maskslot];
  1966. this.goSlot[i, subNo].listMaskSlot.Add(item);
  1967. }
  1968. public void DelItem(MPN mpn, string slotname)
  1969. {
  1970. if (!TBody.hashSlotName.ContainsKey(slotname))
  1971. {
  1972. return;
  1973. }
  1974. this.MulTexRemove(slotname);
  1975. int num = (int)TBody.hashSlotName[slotname];
  1976. for (int i = 0; i < this.goSlot.CountChildren(num); i++)
  1977. {
  1978. TBodySkin tbodySkin = this.goSlot[num, i];
  1979. tbodySkin.DelItem();
  1980. tbodySkin.RID = 0;
  1981. tbodySkin.boVisible = false;
  1982. tbodySkin.SyojiType = 0;
  1983. tbodySkin.m_ParentMPN = MPN.null_mpn;
  1984. this.SetVisibleNodeSlot(slotname, i, true, "_ALL_");
  1985. }
  1986. this.bonemorph.Init();
  1987. this.bonemorph.DelBoneMorphEdit(mpn, (TBody.SlotID)num);
  1988. this.bonemorph.AddRoot(this.m_trBones);
  1989. this.bonemorph.Blend();
  1990. }
  1991. public void ChangeCol(string name, int matno, string prop_name, Color col)
  1992. {
  1993. int i = (int)TBody.hashSlotName[name];
  1994. GameObject obj = this.goSlot[i].obj;
  1995. if (obj == null)
  1996. {
  1997. return;
  1998. }
  1999. List<Renderer> list = new List<Renderer>(3);
  2000. obj.transform.GetComponentsInChildren<Renderer>(true, list);
  2001. for (int j = 0; j < list.Count; j++)
  2002. {
  2003. Renderer renderer = list[j];
  2004. if (renderer != null && renderer.material != null && matno < renderer.materials.Length)
  2005. {
  2006. renderer.materials[matno].SetColor(prop_name, col);
  2007. }
  2008. }
  2009. }
  2010. public void ChangeTex(string slotname, int subPropNo, int matno, string prop_name, string filename, Dictionary<string, byte[]> dicModTexData, MaidParts.PARTS_COLOR f_ePartsColorId = MaidParts.PARTS_COLOR.NONE)
  2011. {
  2012. if (!this.boMaid)
  2013. {
  2014. return;
  2015. }
  2016. if (TBody.NoAlphaIdxSet == null)
  2017. {
  2018. TBody.NoAlphaIdxSet = new HashSet<int>();
  2019. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairF"]);
  2020. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairR"]);
  2021. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairS"]);
  2022. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairT"]);
  2023. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["hairAho"]);
  2024. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["body"]);
  2025. TBody.NoAlphaIdxSet.Add((int)TBody.hashSlotName["head"]);
  2026. }
  2027. Texture texture = null;
  2028. NDebug.Assert(TBody.hashSlotName.ContainsKey(slotname), "テクスチャ変更:スロット名がみつかりません。:" + slotname);
  2029. int num = (int)TBody.hashSlotName[slotname];
  2030. TBodySkin tbodySkin = this.goSlot[num, subPropNo];
  2031. GameObject obj = tbodySkin.obj;
  2032. if (obj == null)
  2033. {
  2034. return;
  2035. }
  2036. if (filename.IndexOf("*") != -1)
  2037. {
  2038. filename = filename.Replace("*", Path.GetFileNameWithoutExtension(tbodySkin.m_strModelFileName));
  2039. }
  2040. TextureResource textureResource = null;
  2041. if (dicModTexData != null)
  2042. {
  2043. filename = filename.ToLower();
  2044. if (!dicModTexData.ContainsKey(filename))
  2045. {
  2046. Debug.LogError("MOD:テクスチャの変更:" + filename + "は見つかりませんでした。");
  2047. return;
  2048. }
  2049. byte[] array = dicModTexData[filename];
  2050. if (array.Length == EditMod.dummyImg.Length && array[EditMod.dummyImg.Length - 1] == 105 && array[EditMod.dummyImg.Length - 2] == 101 && array[EditMod.dummyImg.Length - 3] == 110)
  2051. {
  2052. textureResource = ImportCM.LoadTexture(GameUty.FileSystem, filename, false);
  2053. }
  2054. else
  2055. {
  2056. textureResource = new TextureResource(2, 2, TextureFormat.ARGB32, null, array);
  2057. }
  2058. }
  2059. else
  2060. {
  2061. textureResource = ImportCM.LoadTexture(GameUty.FileSystem, filename, false);
  2062. }
  2063. List<Renderer> list = new List<Renderer>(3);
  2064. obj.transform.GetComponentsInChildren<Renderer>(true, list);
  2065. for (int i = 0; i < list.Count; i++)
  2066. {
  2067. Renderer renderer = list[i];
  2068. if (!(renderer == null) && !(renderer.material == null))
  2069. {
  2070. if (matno < renderer.materials.Length)
  2071. {
  2072. try
  2073. {
  2074. Material material = renderer.materials[matno];
  2075. material.SetTexture(prop_name, null);
  2076. tbodySkin.TextureCache.RemoveTexture(matno, prop_name);
  2077. }
  2078. catch (Exception ex)
  2079. {
  2080. NDebug.Assert("テクスチャの変更に失敗しました。以前のテクスチャを破棄できませんでした。" + ex.Message, false);
  2081. goto IL_4DE;
  2082. }
  2083. this.MulTexRemove(slotname, matno, prop_name, -1);
  2084. if (texture == null)
  2085. {
  2086. Texture2D texture2D = textureResource.CreateTexture2D();
  2087. texture2D.name = filename;
  2088. bool flag = true;
  2089. if (TBody.NoAlphaIdxSet.Contains(num) && (prop_name == "_MainTex" || prop_name == "_OutlineTex" || prop_name == "_ShadowTex" || prop_name == "_ToonRamp"))
  2090. {
  2091. flag = false;
  2092. if (slotname == "head")
  2093. {
  2094. if (matno != 5)
  2095. {
  2096. flag = true;
  2097. }
  2098. }
  2099. else if (slotname == "body" && matno != 0)
  2100. {
  2101. flag = true;
  2102. }
  2103. }
  2104. bool flag2 = !RenderTextureCache.CheckSupportsRenderTextureFormat(RenderTextureFormat.R8);
  2105. if (flag || flag2 || MaidParts.PARTS_COLOR.NONE >= f_ePartsColorId || f_ePartsColorId >= MaidParts.PARTS_COLOR.MAX)
  2106. {
  2107. texture = texture2D;
  2108. }
  2109. else
  2110. {
  2111. byte[] tex_byte = textureResource.data;
  2112. Action<Texture2D, RenderTexture> CreateR8Tex = delegate(Texture2D src_tex2d, RenderTexture dest_render_tex)
  2113. {
  2114. RenderTexture active = RenderTexture.active;
  2115. Material systemMaterial = GameUty.GetSystemMaterial(GameUty.SystemMaterial.TexTo8bitTex);
  2116. Graphics.Blit(src_tex2d, dest_render_tex, systemMaterial);
  2117. RenderTexture.active = active;
  2118. };
  2119. Action<RenderTexture> value = delegate(RenderTexture recreate_tex)
  2120. {
  2121. byte[] tex_byte = tex_byte;
  2122. string filename2 = filename;
  2123. Texture2D texture2D2 = new Texture2D(2, 2, TextureFormat.RGBA32, false);
  2124. texture2D2.LoadImage(tex_byte);
  2125. CreateR8Tex(texture2D2, recreate_tex);
  2126. recreate_tex.name = filename2;
  2127. UnityEngine.Object.Destroy(texture2D2);
  2128. };
  2129. KeyValuePair<int, Action<RenderTexture>> recreate_func = new KeyValuePair<int, Action<RenderTexture>>(0, value);
  2130. RenderTexture texture2 = InfinityColorTextureCache.render_cache.GetTexture(texture2D.width, texture2D.height, RenderTextureFormat.R8, recreate_func);
  2131. texture2.name = filename;
  2132. CreateR8Tex(texture2D, texture2);
  2133. UnityEngine.Object.Destroy(texture2D);
  2134. texture = texture2;
  2135. }
  2136. }
  2137. tbodySkin.TextureCache.AddTexture(matno, prop_name, texture, f_ePartsColorId);
  2138. texture = tbodySkin.TextureCache.GetModifiedTexture(matno, prop_name);
  2139. Material material2 = renderer.materials[matno];
  2140. material2.SetTexture(prop_name, texture);
  2141. }
  2142. }
  2143. IL_4DE:;
  2144. }
  2145. }
  2146. private Material GetMaterial(string f_strSlotname, int f_nMatNo)
  2147. {
  2148. NDebug.Assert(TBody.hashSlotName.ContainsKey(f_strSlotname), "スロット名がみつかりません。:" + f_strSlotname);
  2149. int i = (int)TBody.hashSlotName[f_strSlotname];
  2150. TBodySkin tbodySkin = this.goSlot[i];
  2151. GameObject obj = tbodySkin.obj;
  2152. if (obj == null)
  2153. {
  2154. return null;
  2155. }
  2156. foreach (Transform transform in obj.transform.GetComponentsInChildren<Transform>(true))
  2157. {
  2158. Renderer component = transform.GetComponent<Renderer>();
  2159. if (component != null && component.material != null && f_nMatNo < component.materials.Length)
  2160. {
  2161. return component.materials[f_nMatNo];
  2162. }
  2163. }
  2164. return null;
  2165. }
  2166. 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)
  2167. {
  2168. if (!this.boMaid)
  2169. {
  2170. return;
  2171. }
  2172. if (f_nLayerNo < 0)
  2173. {
  2174. NDebug.Assert("レイヤー番号は0以上を使ってください。", false);
  2175. }
  2176. TBody.TexLay.Mat mat;
  2177. if (!this.m_dicLaySlot.TryGetValue(f_strSlotname, out mat))
  2178. {
  2179. mat = new TBody.TexLay.Mat();
  2180. this.m_dicLaySlot.Add(f_strSlotname, mat);
  2181. }
  2182. TBody.TexLay.Prop prop;
  2183. if (!mat.dicPropInMat.TryGetValue(f_nMatNo, out prop))
  2184. {
  2185. prop = new TBody.TexLay.Prop();
  2186. mat.dicPropInMat.Add(f_nMatNo, prop);
  2187. }
  2188. TBody.TexLay.Lay lay;
  2189. if (!prop.dicLayInProp.TryGetValue(f_strPropName, out lay))
  2190. {
  2191. Material material = this.GetMaterial(f_strSlotname, f_nMatNo);
  2192. Texture texture = material.GetTexture(f_strPropName);
  2193. if (texture == null)
  2194. {
  2195. NDebug.Assert("テクスチャが設定されていませんでした。", false);
  2196. }
  2197. lay = new TBody.TexLay.Lay(texture);
  2198. material.SetTexture(f_strPropName, lay.rtBase);
  2199. prop.dicLayInProp.Add(f_strPropName, lay);
  2200. }
  2201. TBody.TexLay.OrderTex orderTex = lay.listLayer.Find((TBody.TexLay.OrderTex x) => x.nLayerNo == f_nLayerNo);
  2202. if (orderTex == null)
  2203. {
  2204. orderTex = new TBody.TexLay.OrderTex();
  2205. orderTex.nLayerNo = f_nLayerNo;
  2206. lay.listLayer.Add(orderTex);
  2207. }
  2208. else
  2209. {
  2210. UnityEngine.Object.Destroy(orderTex.tex);
  2211. orderTex.tex = null;
  2212. }
  2213. Texture2D texture2D;
  2214. if (f_strFileName.Contains("res:"))
  2215. {
  2216. string text = "Texture/" + f_strFileName.Replace("res:", string.Empty);
  2217. UnityEngine.Object @object = Resources.Load(text);
  2218. if (@object == null)
  2219. {
  2220. NDebug.Assert("Resourcesからテクスチャ" + text + "はみつかりません。", false);
  2221. }
  2222. texture2D = (UnityEngine.Object.Instantiate(@object) as Texture2D);
  2223. texture2D.name = text;
  2224. }
  2225. else
  2226. {
  2227. texture2D = ImportCM.CreateTexture(f_strFileName);
  2228. texture2D.name = f_strFileName;
  2229. }
  2230. orderTex.mode = f_eBlendMode;
  2231. if (f_bAdd)
  2232. {
  2233. TBody.TexLay.LaySet laySet = new TBody.TexLay.LaySet();
  2234. laySet.tex = texture2D;
  2235. laySet.bNoTransfrom = f_bNoTransform;
  2236. laySet.nX = f_nX;
  2237. laySet.nY = f_nY;
  2238. laySet.fRot = f_fRot;
  2239. laySet.fScale = f_nScale;
  2240. laySet.nTargetBodyTexSize = f_nTargetBodyTexSize;
  2241. laySet.fAlpha = f_fAlpha;
  2242. laySet.sprop = f_SubProp;
  2243. if (laySet.sprop != null)
  2244. {
  2245. laySet.sprop.strSlotName = f_strSlotname;
  2246. }
  2247. orderTex.listLaySet.Add(laySet);
  2248. }
  2249. else
  2250. {
  2251. orderTex.RemoveLaySet();
  2252. orderTex.tex = texture2D;
  2253. }
  2254. }
  2255. public void MulTexProc()
  2256. {
  2257. foreach (KeyValuePair<string, TBody.TexLay.Mat> keyValuePair in this.m_dicLaySlot)
  2258. {
  2259. this.MulTexProc(keyValuePair.Key);
  2260. }
  2261. }
  2262. public void MulTexProc(string slotname)
  2263. {
  2264. RenderTexture active = RenderTexture.active;
  2265. TBody.TexLay.Mat mat;
  2266. if (this.m_dicLaySlot.TryGetValue(slotname, out mat))
  2267. {
  2268. foreach (KeyValuePair<int, TBody.TexLay.Prop> keyValuePair in mat.dicPropInMat)
  2269. {
  2270. foreach (KeyValuePair<string, TBody.TexLay.Lay> keyValuePair2 in keyValuePair.Value.dicLayInProp)
  2271. {
  2272. if (keyValuePair2.Value.rtBase == null)
  2273. {
  2274. Debug.LogWarning("MulTexProc rtBase is null.");
  2275. }
  2276. if (!keyValuePair2.Value.rtBase.IsCreated())
  2277. {
  2278. Debug.LogWarning("MulTexProc rtBase is lost.");
  2279. }
  2280. Graphics.Blit(keyValuePair2.Value.texBack, keyValuePair2.Value.rtBase);
  2281. List<TBody.TexLay.OrderTex> listLayer = keyValuePair2.Value.listLayer;
  2282. keyValuePair2.Value.Sort();
  2283. for (int i = 0; i < listLayer.Count; i++)
  2284. {
  2285. TBody.TexLay.OrderTex orderTex = listLayer[i];
  2286. Material systemMaterial = GameUty.GetSystemMaterial(orderTex.mode);
  2287. if (keyValuePair2.Value.rtBase == null)
  2288. {
  2289. Debug.LogWarning("texture layer base is not existed.");
  2290. }
  2291. else if (orderTex.listLaySet.Count == 0)
  2292. {
  2293. systemMaterial.SetFloat("_Alpha", 1f);
  2294. Graphics.Blit(orderTex.tex, keyValuePair2.Value.rtBase, systemMaterial);
  2295. }
  2296. else
  2297. {
  2298. RenderTexture active2 = RenderTexture.active;
  2299. RenderTexture.active = keyValuePair2.Value.rtBase;
  2300. for (int j = 0; j < orderTex.listLaySet.Count; j++)
  2301. {
  2302. TBody.TexLay.LaySet laySet = orderTex.listLaySet[j];
  2303. if (laySet.bNoTransfrom)
  2304. {
  2305. if (laySet.sprop != null)
  2306. {
  2307. systemMaterial.SetFloat("_Alpha", laySet.sprop.fTexMulAlpha);
  2308. }
  2309. else
  2310. {
  2311. systemMaterial.SetFloat("_Alpha", laySet.fAlpha);
  2312. }
  2313. RenderTexture active3 = RenderTexture.active;
  2314. Graphics.Blit(laySet.tex, keyValuePair2.Value.rtBase, systemMaterial);
  2315. RenderTexture.active = active3;
  2316. }
  2317. else if (keyValuePair2.Value.rtBase.width == laySet.nTargetBodyTexSize)
  2318. {
  2319. Vector3 s = new Vector3(laySet.fScale, laySet.fScale, 1f);
  2320. Vector3 pos = new Vector3((float)laySet.nX, (float)laySet.nY, 0f);
  2321. Quaternion q = Quaternion.Euler(new Vector3(0f, 0f, laySet.fRot));
  2322. GL.PushMatrix();
  2323. GL.LoadPixelMatrix(0f, (float)keyValuePair2.Value.rtBase.width, (float)keyValuePair2.Value.rtBase.height, 0f);
  2324. GL.MultMatrix(Matrix4x4.TRS(pos, q, s));
  2325. 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);
  2326. GL.PopMatrix();
  2327. }
  2328. else
  2329. {
  2330. float num = (float)(keyValuePair2.Value.rtBase.width / laySet.nTargetBodyTexSize);
  2331. Vector3 s2 = new Vector3(laySet.fScale * num, laySet.fScale * num, 1f);
  2332. Vector3 pos2 = new Vector3((float)laySet.nX * num, (float)laySet.nY * num, 0f);
  2333. Quaternion q2 = Quaternion.Euler(new Vector3(0f, 0f, laySet.fRot));
  2334. GL.PushMatrix();
  2335. GL.LoadPixelMatrix(0f, (float)keyValuePair2.Value.rtBase.width, (float)keyValuePair2.Value.rtBase.height, 0f);
  2336. GL.MultMatrix(Matrix4x4.TRS(pos2, q2, s2));
  2337. 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);
  2338. GL.PopMatrix();
  2339. }
  2340. }
  2341. RenderTexture.active = active2;
  2342. }
  2343. }
  2344. }
  2345. }
  2346. }
  2347. RenderTexture.active = active;
  2348. }
  2349. public void MulTexRemove(string f_strSlotname)
  2350. {
  2351. TBody.TexLay.Mat mat;
  2352. if (this.m_dicLaySlot.TryGetValue(f_strSlotname, out mat))
  2353. {
  2354. mat.Remove();
  2355. }
  2356. this.m_dicLaySlot.Remove(f_strSlotname);
  2357. }
  2358. public void MulTexRemove(string f_strSlotname, int f_nMatNo, string f_strPropName, int f_nLayNo = -1)
  2359. {
  2360. TBody.TexLay.Mat mat;
  2361. if (this.m_dicLaySlot.TryGetValue(f_strSlotname, out mat))
  2362. {
  2363. TBody.TexLay.Prop prop;
  2364. if (mat.dicPropInMat.TryGetValue(f_nMatNo, out prop))
  2365. {
  2366. TBody.TexLay.Lay lay;
  2367. if (prop.dicLayInProp.TryGetValue(f_strPropName, out lay))
  2368. {
  2369. lay.Remove(f_nLayNo);
  2370. if (lay.listLayer.Count == 0)
  2371. {
  2372. prop.dicLayInProp.Remove(f_strPropName);
  2373. }
  2374. }
  2375. if (prop.dicLayInProp.Count == 0)
  2376. {
  2377. mat.dicPropInMat.Remove(f_nMatNo);
  2378. }
  2379. }
  2380. if (mat.dicPropInMat.Count == 0)
  2381. {
  2382. this.m_dicLaySlot.Remove(f_strSlotname);
  2383. }
  2384. }
  2385. }
  2386. public void AddMyBoneMorph(TBody.SlotID slotId, string name, List<TBodySkin.MyBoneMorph> myBoneMorphs)
  2387. {
  2388. TBodySkin tbodySkin = this.goSlot[(int)slotId];
  2389. tbodySkin.AddMyBoneMorph(name, myBoneMorphs);
  2390. }
  2391. public void UpdateMyBoneMorph(string name, float val)
  2392. {
  2393. for (int i = 0; i < this.goSlot.Count; i++)
  2394. {
  2395. for (int j = 0; j < this.goSlot.CountChildren(i); j++)
  2396. {
  2397. TBodySkin tbodySkin = this.goSlot[i, j];
  2398. if (tbodySkin != null)
  2399. {
  2400. tbodySkin.UpdateMyBoneMorph(name, val);
  2401. }
  2402. }
  2403. }
  2404. }
  2405. public void AddBaseBlendValue(TBody.SlotID parentSlotId, TMorphSkin.BaseBlendValue.Tag tag, string blendName, float defValue)
  2406. {
  2407. for (int i = 0; i < this.goSlot.Count; i++)
  2408. {
  2409. TBodySkin tbodySkin = this.goSlot[i];
  2410. if (tbodySkin != null && tbodySkin.morph != null)
  2411. {
  2412. TMorphSkin tmorphSkin = tbodySkin.morph as TMorphSkin;
  2413. if (tmorphSkin != null)
  2414. {
  2415. tmorphSkin.AddBaseBlendValue(parentSlotId, tag, blendName, defValue);
  2416. }
  2417. }
  2418. }
  2419. }
  2420. public void RemoveBaseBlendValue(TBody.SlotID parentSlotId)
  2421. {
  2422. for (int i = 0; i < this.goSlot.Count; i++)
  2423. {
  2424. TBodySkin tbodySkin = this.goSlot[i];
  2425. if (tbodySkin != null && tbodySkin.morph != null)
  2426. {
  2427. TMorphSkin tmorphSkin = tbodySkin.morph as TMorphSkin;
  2428. if (tmorphSkin != null)
  2429. {
  2430. tmorphSkin.RemoveBaseBlendValue(parentSlotId);
  2431. }
  2432. }
  2433. }
  2434. }
  2435. public void AddChikubiState(TBody.SlotID slotId, int subNo, TBodySkin.CHIKUBI_STATE state)
  2436. {
  2437. TBodySkin tbodySkin = this.goSlot[(int)slotId, subNo];
  2438. if (tbodySkin != null)
  2439. {
  2440. tbodySkin.m_chikubiState = state;
  2441. }
  2442. }
  2443. public TBodySkin.CHIKUBI_STATE IsChikubiState()
  2444. {
  2445. bool flag = false;
  2446. foreach (TBody.SlotID slotID in TBody.m_chikubiStateSlot)
  2447. {
  2448. for (int j = 0; j < this.goSlot.CountChildren((int)slotID); j++)
  2449. {
  2450. TBodySkin tbodySkin = this.goSlot[(int)slotID, j];
  2451. if (tbodySkin != null && tbodySkin.boVisible)
  2452. {
  2453. if (tbodySkin.m_chikubiState == TBodySkin.CHIKUBI_STATE.固定凸)
  2454. {
  2455. flag = true;
  2456. }
  2457. else if (tbodySkin.m_chikubiState == TBodySkin.CHIKUBI_STATE.基本凹)
  2458. {
  2459. return TBodySkin.CHIKUBI_STATE.基本凹;
  2460. }
  2461. }
  2462. }
  2463. }
  2464. if (flag)
  2465. {
  2466. return TBodySkin.CHIKUBI_STATE.固定凸;
  2467. }
  2468. return TBodySkin.CHIKUBI_STATE.None;
  2469. }
  2470. public void UpdateInfinityColor(MaidParts.PARTS_COLOR f_eColorType)
  2471. {
  2472. bool flag = false;
  2473. for (int i = 0; i < this.goSlot.Count; i++)
  2474. {
  2475. TBodySkin tbodySkin = this.goSlot[i];
  2476. if (tbodySkin.TextureCache.UpdateColor(f_eColorType))
  2477. {
  2478. flag = true;
  2479. }
  2480. }
  2481. if (flag)
  2482. {
  2483. this.MulTexProc();
  2484. }
  2485. }
  2486. public void ChangeShader(string f_strSlotName, int f_nMatNo, string f_strShaderFileName)
  2487. {
  2488. if (!TBody.hashSlotName.ContainsKey(f_strSlotName))
  2489. {
  2490. NDebug.Assert("シェーダー変更:スロット名がみつかりません。:" + f_strSlotName, false);
  2491. }
  2492. int i = (int)TBody.hashSlotName[f_strSlotName];
  2493. this.goSlot[i].ChangeShader(f_nMatNo, f_strShaderFileName);
  2494. }
  2495. public void RestoreShader(string f_strSlotName)
  2496. {
  2497. int i = (int)TBody.hashSlotName[f_strSlotName];
  2498. this.goSlot[i].RestoreShader();
  2499. }
  2500. public void ChangeMaterial(string f_strSlotName, int f_nMatNo, string f_strFileName)
  2501. {
  2502. if (!TBody.hashSlotName.ContainsKey(f_strSlotName))
  2503. {
  2504. NDebug.Assert("マテリアル変更:スロット名がみつかりません。:" + f_strSlotName, false);
  2505. }
  2506. int i = (int)TBody.hashSlotName[f_strSlotName];
  2507. TBodySkin tbodySkin = this.goSlot[i];
  2508. GameObject obj = tbodySkin.obj;
  2509. if (obj == null)
  2510. {
  2511. return;
  2512. }
  2513. foreach (Transform transform in obj.transform.GetComponentsInChildren<Transform>(true))
  2514. {
  2515. Renderer component = transform.GetComponent<Renderer>();
  2516. if (component != null && component.material != null && f_nMatNo < component.materials.Length)
  2517. {
  2518. ImportCM.LoadMaterial(f_strFileName, tbodySkin, component.materials[f_nMatNo]);
  2519. }
  2520. }
  2521. }
  2522. 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)
  2523. {
  2524. if (!TBody.hashSlotName.ContainsKey(f_strDestSlotName))
  2525. {
  2526. NDebug.Assert("マテリアルプロパティ変更:スロット名がみつかりません。:" + f_strDestSlotName, false);
  2527. }
  2528. MPN f_SrcMpn = (MPN)Enum.Parse(typeof(MPN), f_strSrcMpnName, true);
  2529. int i = (int)TBody.hashSlotName[f_strDestSlotName];
  2530. TBodySkin tbodySkin = this.goSlot[i];
  2531. tbodySkin.SetMaterialProperty(f_SrcMpn, f_nMatNo, f_strPropName, f_strTypeName, f_strValue, f_bEditSave);
  2532. }
  2533. public string GetMaterialProperty(string f_strDestSlotName, int f_nMatNo, string f_strPropName, string f_strType = "AUTO")
  2534. {
  2535. if (!TBody.hashSlotName.ContainsKey(f_strDestSlotName))
  2536. {
  2537. NDebug.Assert("マテリアルプロパティ変更:スロット名がみつかりません。:" + f_strDestSlotName, false);
  2538. }
  2539. int i = (int)TBody.hashSlotName[f_strDestSlotName];
  2540. TBodySkin tbodySkin = this.goSlot[i];
  2541. return tbodySkin.GetMaterialProperty(f_nMatNo, f_strPropName, f_strType);
  2542. }
  2543. public void SetMaskMode(TBody.MaskMode f_eMode)
  2544. {
  2545. if (Product.isPublic && f_eMode == TBody.MaskMode.Nude)
  2546. {
  2547. f_eMode = TBody.MaskMode.Underwear;
  2548. }
  2549. this.m_eMaskMode = f_eMode;
  2550. if (Product.isPublic && f_eMode == TBody.MaskMode.Nude)
  2551. {
  2552. this.m_eMaskMode = TBody.MaskMode.None;
  2553. }
  2554. for (int i = 0; i < this.goSlot.Count; i++)
  2555. {
  2556. this.m_hFoceHide[(TBody.SlotID)i] = true;
  2557. }
  2558. if (this.IsCrcBody)
  2559. {
  2560. HashSet<TBody.SlotID> hashSet = CM3.newBodyPartsMask[this.m_eMaskMode];
  2561. foreach (TBody.SlotID slotID in hashSet)
  2562. {
  2563. this.m_hFoceHide[slotID] = false;
  2564. }
  2565. }
  2566. else
  2567. {
  2568. if (this.m_eMaskMode == TBody.MaskMode.Nude)
  2569. {
  2570. this.m_hFoceHide[TBody.SlotID.stkg] = false;
  2571. }
  2572. if (this.m_eMaskMode == TBody.MaskMode.Nude || this.m_eMaskMode == TBody.MaskMode.Underwear)
  2573. {
  2574. this.m_hFoceHide[TBody.SlotID.mizugi] = false;
  2575. this.m_hFoceHide[TBody.SlotID.onepiece] = false;
  2576. }
  2577. if (this.m_eMaskMode == TBody.MaskMode.Nude || this.m_eMaskMode == TBody.MaskMode.Underwear || this.m_eMaskMode == TBody.MaskMode.Swim)
  2578. {
  2579. this.m_hFoceHide[TBody.SlotID.wear] = false;
  2580. this.m_hFoceHide[TBody.SlotID.skirt] = false;
  2581. this.m_hFoceHide[TBody.SlotID.shoes] = false;
  2582. this.m_hFoceHide[TBody.SlotID.headset] = false;
  2583. this.m_hFoceHide[TBody.SlotID.glove] = false;
  2584. this.m_hFoceHide[TBody.SlotID.accKubi] = false;
  2585. this.m_hFoceHide[TBody.SlotID.accKubiwa] = false;
  2586. }
  2587. if (this.m_eMaskMode == TBody.MaskMode.Nude || this.m_eMaskMode == TBody.MaskMode.Swim)
  2588. {
  2589. this.m_hFoceHide[TBody.SlotID.bra] = false;
  2590. this.m_hFoceHide[TBody.SlotID.panz] = false;
  2591. }
  2592. }
  2593. this.FixMaskFlag();
  2594. this.FixVisibleFlag(false);
  2595. }
  2596. public void SetManHide(bool hide)
  2597. {
  2598. if (!this.boMAN)
  2599. {
  2600. return;
  2601. }
  2602. SkinnedMeshRenderer[] componentsInChildren = base.GetComponentsInChildren<SkinnedMeshRenderer>();
  2603. foreach (SkinnedMeshRenderer skinnedMeshRenderer in componentsInChildren)
  2604. {
  2605. bool flag = false;
  2606. foreach (Material material in skinnedMeshRenderer.materials)
  2607. {
  2608. if (material.shader.name.ToLower().Contains("cm3d2/man"))
  2609. {
  2610. flag = true;
  2611. break;
  2612. }
  2613. }
  2614. if (flag)
  2615. {
  2616. skinnedMeshRenderer.enabled = !hide;
  2617. }
  2618. }
  2619. this.m_bManMeshHide = hide;
  2620. }
  2621. public bool IsManHide()
  2622. {
  2623. return this.boMAN && this.m_bManMeshHide;
  2624. }
  2625. public void SetMask(TBody.SlotID f_eSlot, bool f_bVisible)
  2626. {
  2627. if (f_eSlot <= TBody.SlotID.eye)
  2628. {
  2629. return;
  2630. }
  2631. this.m_hFoceHide[f_eSlot] = f_bVisible;
  2632. this.FixMaskFlag();
  2633. this.FixVisibleFlag(false);
  2634. }
  2635. public bool GetMask(TBody.SlotID f_eSlot)
  2636. {
  2637. return !this.m_hFoceHide.ContainsKey(f_eSlot) || (bool)this.m_hFoceHide[f_eSlot];
  2638. }
  2639. public bool GetSlotVisible(TBody.SlotID f_eSlot)
  2640. {
  2641. return this.GetSlotLoaded(f_eSlot) && this.goSlot[(int)f_eSlot].boVisible;
  2642. }
  2643. public bool GetSlotLoaded(TBody.SlotID f_eSlot)
  2644. {
  2645. return this.goSlot[(int)f_eSlot].obj != null;
  2646. }
  2647. public void SetMask(MPN parentMpn, bool visible)
  2648. {
  2649. List<TBodySkin> list = new List<TBodySkin>();
  2650. for (int i = 0; i < this.goSlot.Count; i++)
  2651. {
  2652. for (int j = 0; j < this.goSlot.CountChildren(i); j++)
  2653. {
  2654. if (this.goSlot[i, j].m_ParentMPN == parentMpn)
  2655. {
  2656. list.Add(this.goSlot[i, j]);
  2657. }
  2658. }
  2659. }
  2660. if (list.Count == 0)
  2661. {
  2662. return;
  2663. }
  2664. foreach (TBodySkin tbodySkin in list)
  2665. {
  2666. TBody.SlotID slotId = tbodySkin.SlotId;
  2667. if (slotId > TBody.SlotID.eye)
  2668. {
  2669. this.m_hFoceHide[slotId] = visible;
  2670. }
  2671. }
  2672. this.FixMaskFlag();
  2673. this.FixVisibleFlag(false);
  2674. }
  2675. public bool GetMask(MPN parentMpn)
  2676. {
  2677. List<TBodySkin> list = new List<TBodySkin>();
  2678. for (int i = 0; i < this.goSlot.Count; i++)
  2679. {
  2680. for (int j = 0; j < this.goSlot.CountChildren(i); j++)
  2681. {
  2682. if (this.goSlot[i, j].m_ParentMPN == parentMpn)
  2683. {
  2684. list.Add(this.goSlot[i, j]);
  2685. }
  2686. }
  2687. }
  2688. if (list.Count == 0)
  2689. {
  2690. return false;
  2691. }
  2692. using (List<TBodySkin>.Enumerator enumerator = list.GetEnumerator())
  2693. {
  2694. if (enumerator.MoveNext())
  2695. {
  2696. TBodySkin tbodySkin = enumerator.Current;
  2697. TBody.SlotID slotId = tbodySkin.SlotId;
  2698. return this.GetMask(slotId);
  2699. }
  2700. }
  2701. return false;
  2702. }
  2703. public bool GetSlotVisible(MPN parentMpn)
  2704. {
  2705. for (int i = 0; i < this.goSlot.Count; i++)
  2706. {
  2707. for (int j = 0; j < this.goSlot.CountChildren(i); j++)
  2708. {
  2709. if (this.goSlot[i, j].m_ParentMPN == parentMpn && this.goSlot[i, j].obj != null && this.goSlot[i, j].boVisible)
  2710. {
  2711. return true;
  2712. }
  2713. }
  2714. }
  2715. return false;
  2716. }
  2717. public bool GetSlotLoaded(MPN parentMpn)
  2718. {
  2719. for (int i = 0; i < this.goSlot.Count; i++)
  2720. {
  2721. for (int j = 0; j < this.goSlot.CountChildren(i); j++)
  2722. {
  2723. if (parentMpn == this.goSlot[i, j].m_ParentMPN && this.goSlot[i, j].obj != null)
  2724. {
  2725. return true;
  2726. }
  2727. }
  2728. }
  2729. return false;
  2730. }
  2731. public void FixMaskFlag()
  2732. {
  2733. if (!this.boMaid)
  2734. {
  2735. return;
  2736. }
  2737. if (this.IsCrcBody)
  2738. {
  2739. for (int i = 0; i < this.goSlot.Count; i++)
  2740. {
  2741. for (int j = 0; j < this.goSlot.CountChildren(i); j++)
  2742. {
  2743. this.goSlot[i, j].boVisible = true;
  2744. }
  2745. }
  2746. for (int k = 0; k < this.goSlot.Count; k++)
  2747. {
  2748. for (int l = 0; l < this.goSlot.CountChildren(k); l++)
  2749. {
  2750. TBodySkin tbodySkin = this.goSlot[k, l];
  2751. if (!this.GetMask((TBody.SlotID)k))
  2752. {
  2753. tbodySkin.boVisible = false;
  2754. }
  2755. if (!tbodySkin.IsPartHideOnSlotVisible())
  2756. {
  2757. tbodySkin.boVisible = false;
  2758. }
  2759. if (tbodySkin.boVisible)
  2760. {
  2761. foreach (int num in tbodySkin.listMaskSlot)
  2762. {
  2763. for (int m = 0; m < this.goSlot.CountChildren(num); m++)
  2764. {
  2765. this.goSlot[num, m].boVisible = false;
  2766. }
  2767. }
  2768. }
  2769. }
  2770. }
  2771. }
  2772. else
  2773. {
  2774. for (int n = 0; n < this.goSlot.Count; n++)
  2775. {
  2776. this.goSlot[n].boVisible = true;
  2777. }
  2778. for (int num2 = 0; num2 < this.goSlot.Count; num2++)
  2779. {
  2780. if (!this.GetMask((TBody.SlotID)num2))
  2781. {
  2782. this.goSlot[num2].boVisible = false;
  2783. }
  2784. if (this.goSlot[num2].boVisible)
  2785. {
  2786. foreach (int i2 in this.goSlot[num2].listMaskSlot)
  2787. {
  2788. this.goSlot[i2].boVisible = false;
  2789. }
  2790. }
  2791. }
  2792. }
  2793. this.boVisible_NIP = this.goSlot[(int)TBody.hashSlotName["accNipR"]].boVisible;
  2794. this.boVisible_HESO = this.goSlot[(int)TBody.hashSlotName["accHeso"]].boVisible;
  2795. this.boVisible_XXX = this.goSlot[(int)TBody.hashSlotName["accXXX"]].boVisible;
  2796. this.boVisible_BRA = this.goSlot[(int)TBody.hashSlotName["bra"]].boVisible;
  2797. this.boVisible_PANZU = this.goSlot[(int)TBody.hashSlotName["panz"]].boVisible;
  2798. this.boVisible_SKIRT = (this.goSlot[(int)TBody.hashSlotName["skirt"]].RID != 0 & this.goSlot[(int)TBody.hashSlotName["skirt"]].boVisible);
  2799. this.boVisible_WEAR = (this.goSlot[(int)TBody.hashSlotName["wear"]].RID != 0 & this.goSlot[(int)TBody.hashSlotName["wear"]].boVisible);
  2800. this.boMizugi_panz = this.goSlot[(int)TBody.hashSlotName["panz"]].boMizugi;
  2801. this.slotno_accXXX = (int)TBody.hashSlotName["accXXX"];
  2802. if (Product.isPublic)
  2803. {
  2804. this.goSlot[(int)TBody.hashSlotName["chikubi"]].boVisible = false;
  2805. this.goSlot[(int)TBody.hashSlotName["underhair"]].boVisible = false;
  2806. this.goSlot[(int)TBody.hashSlotName["moza"]].boVisible = false;
  2807. }
  2808. }
  2809. public void FixVisibleFlag(bool f_bNonPartsLook = false)
  2810. {
  2811. if (!this.boMaid)
  2812. {
  2813. return;
  2814. }
  2815. if (this.goSlot[0].morph == null)
  2816. {
  2817. return;
  2818. }
  2819. for (int i = 0; i < this.goSlot.Count; i++)
  2820. {
  2821. TBodySkin tbodySkin = this.goSlot[i];
  2822. if (tbodySkin.morph != null)
  2823. {
  2824. tbodySkin.morph.ClearAllVisibleFlag(true);
  2825. }
  2826. }
  2827. if (!f_bNonPartsLook)
  2828. {
  2829. for (int j = 0; j < this.goSlot.Count; j++)
  2830. {
  2831. if (this.goSlot[j].boVisible && !(this.goSlot[j].obj == null))
  2832. {
  2833. for (int k = 0; k < this.goSlot[0].morph.BoneNames.Count; k++)
  2834. {
  2835. string key = this.goSlot[0].morph.BoneNames[k];
  2836. bool flag = true;
  2837. if (this.goSlot[j].m_dicDelNodeBody.ContainsKey(key))
  2838. {
  2839. flag = this.goSlot[j].m_dicDelNodeBody[key];
  2840. }
  2841. if (!flag)
  2842. {
  2843. this.goSlot[0].morph.SetVisibleFlag1(k, false);
  2844. }
  2845. }
  2846. TBodySkin tbodySkin2 = this.goSlot[j];
  2847. if (tbodySkin2.m_dicDelNodeParts != null)
  2848. {
  2849. for (int l = 1; l < this.goSlot.Count; l++)
  2850. {
  2851. TBodySkin tbodySkin3 = this.goSlot[l];
  2852. if (tbodySkin3.morph != null)
  2853. {
  2854. for (int m = 0; m < tbodySkin3.morph.BoneNames.Count; m++)
  2855. {
  2856. string key2 = tbodySkin3.morph.BoneNames[m];
  2857. bool flag2 = true;
  2858. Dictionary<string, bool> dictionary;
  2859. bool flag3;
  2860. if (tbodySkin2.m_dicDelNodeParts.TryGetValue(tbodySkin3.Category, out dictionary) && dictionary.TryGetValue(key2, out flag3))
  2861. {
  2862. flag2 = flag3;
  2863. }
  2864. if (!flag2)
  2865. {
  2866. tbodySkin3.morph.SetVisibleFlag1(m, false);
  2867. }
  2868. }
  2869. }
  2870. }
  2871. }
  2872. }
  2873. }
  2874. }
  2875. for (int n = 0; n < this.goSlot.Count; n++)
  2876. {
  2877. TBodySkin tbodySkin4 = this.goSlot[n];
  2878. if (tbodySkin4.morph != null)
  2879. {
  2880. tbodySkin4.morph.FixVisibleFlag();
  2881. tbodySkin4.morph.FixBlendValues();
  2882. }
  2883. }
  2884. }
  2885. public void AddSkinMask(TBody.SlotID slot, int subNo, string texFileName)
  2886. {
  2887. TBodySkin slot2 = this.GetSlot(0);
  2888. slot2.MaterialMgr.AddSkinMask(slot, subNo, texFileName);
  2889. }
  2890. public void FixSkinMask()
  2891. {
  2892. TBodySkin slot = this.GetSlot(0);
  2893. slot.MaterialMgr.FixSkinMask();
  2894. }
  2895. public int GetSlotUserParam(string slotname, string tag)
  2896. {
  2897. return 0;
  2898. }
  2899. public void SetChinkoVisible(bool f_bVisible)
  2900. {
  2901. this.SetChinkoVisibleIn(f_bVisible);
  2902. if (this.maid.pairMan != null)
  2903. {
  2904. this.maid.pairMan.body0.SetChinkoVisibleIn(f_bVisible);
  2905. }
  2906. }
  2907. private void SetChinkoVisibleIn(bool f_bVisible)
  2908. {
  2909. if (Product.isPublic)
  2910. {
  2911. f_bVisible = false;
  2912. }
  2913. Vector3 localScale = (!f_bVisible) ? Vector3.zero : Vector3.one;
  2914. for (int i = 0; i < this.goSlot.Count; i++)
  2915. {
  2916. GameObject obj = this.goSlot[i].obj;
  2917. if (obj != null)
  2918. {
  2919. Transform transform = CMT.SearchObjName(obj.transform, "chinkoCenter", false);
  2920. if (transform != null)
  2921. {
  2922. transform.localScale = localScale;
  2923. }
  2924. }
  2925. }
  2926. }
  2927. public bool GetChinkoVisible()
  2928. {
  2929. for (int i = 0; i < this.goSlot.Count; i++)
  2930. {
  2931. GameObject obj = this.goSlot[i].obj;
  2932. if (obj != null)
  2933. {
  2934. Transform transform = CMT.SearchObjName(obj.transform, "chinkoCenter", false);
  2935. if (transform != null && transform.localScale == Vector3.zero)
  2936. {
  2937. return false;
  2938. }
  2939. }
  2940. }
  2941. return true;
  2942. }
  2943. public string GetPartsParam(string f_strTag)
  2944. {
  2945. for (int i = 0; i < this.goSlot.Count; i++)
  2946. {
  2947. string param = this.goSlot[i].GetParam(f_strTag);
  2948. if (!string.IsNullOrEmpty(param))
  2949. {
  2950. return param;
  2951. }
  2952. }
  2953. return string.Empty;
  2954. }
  2955. private string GetAnimeTag(string filename = "")
  2956. {
  2957. return filename.ToLower();
  2958. }
  2959. public void StopAnime(string filename = "")
  2960. {
  2961. if (this.m_Bones == null)
  2962. {
  2963. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  2964. }
  2965. Animation animation = this.m_Animation;
  2966. if (filename == string.Empty || filename == "ALL")
  2967. {
  2968. animation.Stop();
  2969. IEnumerator enumerator = animation.GetEnumerator();
  2970. try
  2971. {
  2972. while (enumerator.MoveNext())
  2973. {
  2974. object obj = enumerator.Current;
  2975. AnimationState animationState = (AnimationState)obj;
  2976. AnimationClip clip = animation.GetClip(animationState.name);
  2977. int num = animationState.name.IndexOf(" - Queued Clone");
  2978. if (num <= 0)
  2979. {
  2980. animation.RemoveClip(animationState.name);
  2981. }
  2982. UnityEngine.Object.Destroy(clip);
  2983. }
  2984. }
  2985. finally
  2986. {
  2987. IDisposable disposable;
  2988. if ((disposable = (enumerator as IDisposable)) != null)
  2989. {
  2990. disposable.Dispose();
  2991. }
  2992. }
  2993. }
  2994. else
  2995. {
  2996. string animeTag = this.GetAnimeTag(filename);
  2997. animation.Stop(animeTag);
  2998. }
  2999. }
  3000. public void StopAnimeLayer(int layerno)
  3001. {
  3002. if (this.m_Bones == null)
  3003. {
  3004. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  3005. }
  3006. if (layerno < 2)
  3007. {
  3008. Debug.LogError("モーションレイヤーの停止は2以上を指定して下さい。");
  3009. }
  3010. Animation animation = this.m_Animation;
  3011. IEnumerator enumerator = animation.GetEnumerator();
  3012. try
  3013. {
  3014. while (enumerator.MoveNext())
  3015. {
  3016. object obj = enumerator.Current;
  3017. AnimationState animationState = (AnimationState)obj;
  3018. if (animation.IsPlaying(animationState.name) && animationState.layer == layerno)
  3019. {
  3020. animation.Stop(animationState.name);
  3021. }
  3022. }
  3023. }
  3024. finally
  3025. {
  3026. IDisposable disposable;
  3027. if ((disposable = (enumerator as IDisposable)) != null)
  3028. {
  3029. disposable.Dispose();
  3030. }
  3031. }
  3032. }
  3033. public void SetAnimeTime(int layerno, float time)
  3034. {
  3035. if (this.m_Bones == null)
  3036. {
  3037. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  3038. }
  3039. Animation animation = this.m_Animation;
  3040. IEnumerator enumerator = animation.GetEnumerator();
  3041. try
  3042. {
  3043. while (enumerator.MoveNext())
  3044. {
  3045. object obj = enumerator.Current;
  3046. AnimationState animationState = (AnimationState)obj;
  3047. if (animation.IsPlaying(animationState.name) && animationState.layer == layerno)
  3048. {
  3049. animationState.time = time;
  3050. }
  3051. }
  3052. }
  3053. finally
  3054. {
  3055. IDisposable disposable;
  3056. if ((disposable = (enumerator as IDisposable)) != null)
  3057. {
  3058. disposable.Dispose();
  3059. }
  3060. }
  3061. }
  3062. public void SetAnimeSpeed(int layerno, float speed)
  3063. {
  3064. if (this.m_Bones == null)
  3065. {
  3066. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  3067. }
  3068. Animation animation = this.m_Animation;
  3069. IEnumerator enumerator = animation.GetEnumerator();
  3070. try
  3071. {
  3072. while (enumerator.MoveNext())
  3073. {
  3074. object obj = enumerator.Current;
  3075. AnimationState animationState = (AnimationState)obj;
  3076. if (animation.IsPlaying(animationState.name) && animationState.layer == layerno)
  3077. {
  3078. animationState.speed = speed;
  3079. }
  3080. }
  3081. }
  3082. finally
  3083. {
  3084. IDisposable disposable;
  3085. if ((disposable = (enumerator as IDisposable)) != null)
  3086. {
  3087. disposable.Dispose();
  3088. }
  3089. }
  3090. }
  3091. public float GetAnimeTime()
  3092. {
  3093. if (this.m_Bones == null)
  3094. {
  3095. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  3096. }
  3097. Animation animation = this.m_Animation;
  3098. IEnumerator enumerator = animation.GetEnumerator();
  3099. try
  3100. {
  3101. while (enumerator.MoveNext())
  3102. {
  3103. object obj = enumerator.Current;
  3104. AnimationState animationState = (AnimationState)obj;
  3105. if (animation.IsPlaying(animationState.name))
  3106. {
  3107. return animationState.time;
  3108. }
  3109. }
  3110. }
  3111. finally
  3112. {
  3113. IDisposable disposable;
  3114. if ((disposable = (enumerator as IDisposable)) != null)
  3115. {
  3116. disposable.Dispose();
  3117. }
  3118. }
  3119. return 0f;
  3120. }
  3121. public string CrossFade(string filename, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float fade = 0.5f, float weight = 1f)
  3122. {
  3123. if (this.m_Bones == null)
  3124. {
  3125. NDebug.Assert("まだ読み込まれる前のBodyにモーションを指定しようとしました。" + base.gameObject.name, false);
  3126. }
  3127. string animeTag = this.GetAnimeTag(filename);
  3128. AnimationState animationState = this.LoadAnime(animeTag, fileSystem, filename, additive, loop);
  3129. if (animationState == null)
  3130. {
  3131. return string.Empty;
  3132. }
  3133. Animation animation = this.m_Animation;
  3134. if (boAddQue)
  3135. {
  3136. if (weight != 1f)
  3137. {
  3138. animation.PlayQueued(animeTag, QueueMode.CompleteOthers);
  3139. animation[animeTag].weight = weight;
  3140. }
  3141. else
  3142. {
  3143. animation.CrossFadeQueued(animeTag, fade, QueueMode.CompleteOthers);
  3144. }
  3145. }
  3146. else
  3147. {
  3148. if (animationState.layer == 0)
  3149. {
  3150. this.anist = animationState;
  3151. }
  3152. if (weight != 1f)
  3153. {
  3154. animation.Play(animeTag);
  3155. animation[animeTag].weight = weight;
  3156. }
  3157. else
  3158. {
  3159. animation.CrossFade(animeTag, fade);
  3160. }
  3161. }
  3162. return animeTag;
  3163. }
  3164. public string CrossFade(string tag, byte[] byte_data, bool additive = false, bool loop = false, bool boAddQue = false, float fade = 0.5f, float weight = 1f)
  3165. {
  3166. if (this.m_Bones == null)
  3167. {
  3168. NDebug.Assert("まだ読み込まれる前のBodyにモーションを指定しようとしました。" + base.gameObject.name, false);
  3169. }
  3170. AnimationState animationState = this.LoadAnime(tag, byte_data, additive, loop);
  3171. Animation animation = this.m_Animation;
  3172. if (boAddQue)
  3173. {
  3174. if (weight != 1f)
  3175. {
  3176. animation.PlayQueued(tag, QueueMode.CompleteOthers);
  3177. animation[tag].weight = weight;
  3178. }
  3179. else
  3180. {
  3181. animation.CrossFadeQueued(tag, fade, QueueMode.CompleteOthers);
  3182. }
  3183. }
  3184. else
  3185. {
  3186. if (animationState.layer == 0)
  3187. {
  3188. this.anist = animationState;
  3189. }
  3190. if (weight != 1f)
  3191. {
  3192. animation.Play(tag);
  3193. animation[tag].weight = weight;
  3194. }
  3195. else
  3196. {
  3197. animation.CrossFade(tag, fade);
  3198. }
  3199. }
  3200. return tag;
  3201. }
  3202. public string CrossFadeAbsolute(string filename, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float fade = 0.5f, float weight = 1f)
  3203. {
  3204. if (this.m_Bones == null)
  3205. {
  3206. NDebug.Assert("まだ読み込まれる前のBodyにモーションを指定しようとしました。" + base.gameObject.name, false);
  3207. }
  3208. string text = this.GetAnimeTag(filename);
  3209. if (boAddQue)
  3210. {
  3211. AnimationClip clip = this.m_Animation.GetClip(text);
  3212. if (clip != null)
  3213. {
  3214. text += "_2";
  3215. }
  3216. }
  3217. this.IsAnimationChange = true;
  3218. AnimationState animationState = this.LoadAnime(text, fileSystem, filename, additive, loop);
  3219. if (animationState == null)
  3220. {
  3221. return string.Empty;
  3222. }
  3223. Animation animation = this.m_Animation;
  3224. if (boAddQue)
  3225. {
  3226. if (weight != 1f)
  3227. {
  3228. animation.PlayQueued(text, QueueMode.CompleteOthers);
  3229. animation[text].weight = weight;
  3230. }
  3231. else
  3232. {
  3233. animation.CrossFadeQueued(text, fade, QueueMode.CompleteOthers);
  3234. }
  3235. }
  3236. else
  3237. {
  3238. if (animationState.layer == 0)
  3239. {
  3240. this.anist = animationState;
  3241. }
  3242. if (weight != 1f)
  3243. {
  3244. animation.Play(text);
  3245. animation[text].weight = weight;
  3246. }
  3247. else
  3248. {
  3249. animation.CrossFade(text, fade);
  3250. }
  3251. }
  3252. return text;
  3253. }
  3254. public Animation GetAnimation()
  3255. {
  3256. if (this.m_Bones == null)
  3257. {
  3258. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  3259. }
  3260. return this.m_Animation;
  3261. }
  3262. public void CacheLoadAnime(AFileSystemBase fileSystem, string filename, bool load_mune_l, bool load_mune_r)
  3263. {
  3264. string animeTag = this.GetAnimeTag(filename);
  3265. Animation animation = this.m_Animation;
  3266. AnimationClip animationClip = animation.GetClip(animeTag);
  3267. byte b = 0;
  3268. byte b2 = 0;
  3269. bool flag = this.m_AnimCache.TryGetValue(animeTag, out b);
  3270. b2 |= ((!load_mune_l) ? 0 : 1);
  3271. b2 |= ((!load_mune_r) ? 0 : 2);
  3272. if (animationClip == null || !flag || b != b2 || this.m_bForceReloadAnime)
  3273. {
  3274. animationClip = ImportCM.LoadAniClipNative(fileSystem, filename, (b2 & 1) != 0, (b2 & 2) != 0, false);
  3275. if (animationClip == null)
  3276. {
  3277. return;
  3278. }
  3279. animation.AddClip(animationClip, animeTag);
  3280. if (animeTag.Contains("_l_"))
  3281. {
  3282. for (int i = 2; i <= 8; i++)
  3283. {
  3284. if (animeTag.Contains("_l_" + i.ToString() + "_"))
  3285. {
  3286. animation[animeTag].layer = i;
  3287. break;
  3288. }
  3289. }
  3290. }
  3291. this.m_AnimCache[animeTag] = b2;
  3292. }
  3293. }
  3294. public AnimationState LoadAnime(string tag, AFileSystemBase fileSystem, string filename, bool additive, bool loop)
  3295. {
  3296. if (this.m_Bones == null)
  3297. {
  3298. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  3299. }
  3300. Animation animation = this.m_Animation;
  3301. AnimationClip animationClip = animation.GetClip(tag);
  3302. byte b = 0;
  3303. byte b2 = 0;
  3304. bool flag = this.m_AnimCache.TryGetValue(tag, out b);
  3305. if (this.IsCrcBody)
  3306. {
  3307. b2 |= ((!(this.dbMuneL != null) || this.dbMuneL.isDynamicOn) ? 0 : 1);
  3308. b2 |= ((!(this.dbMuneR != null) || this.dbMuneR.isDynamicOn) ? 0 : 2);
  3309. }
  3310. else
  3311. {
  3312. b2 |= ((!(this.jbMuneL != null) || this.jbMuneL.BlendValueON != 0f) ? 0 : 1);
  3313. b2 |= ((!(this.jbMuneR != null) || this.jbMuneR.BlendValueON != 0f) ? 0 : 2);
  3314. }
  3315. if (animationClip == null || !flag || b != b2 || this.m_bForceReloadAnime)
  3316. {
  3317. animationClip = ImportCM.LoadAniClipNative(fileSystem, filename, (b2 & 1) != 0, (b2 & 2) != 0, false);
  3318. if (animationClip == null)
  3319. {
  3320. return null;
  3321. }
  3322. animation.AddClip(animationClip, tag);
  3323. if (tag.Contains("_l_"))
  3324. {
  3325. for (int i = 2; i <= 8; i++)
  3326. {
  3327. if (tag.Contains("_l_" + i.ToString() + "_"))
  3328. {
  3329. animation[tag].layer = i;
  3330. break;
  3331. }
  3332. }
  3333. }
  3334. this.m_AnimCache[tag] = b2;
  3335. }
  3336. this.IsAnimationChange = (filename != this.LastAnimeFN);
  3337. this.LastAnimeFN = filename;
  3338. AnimationState animationState = animation[tag];
  3339. if (additive)
  3340. {
  3341. animationState.blendMode = AnimationBlendMode.Additive;
  3342. }
  3343. else
  3344. {
  3345. animationState.blendMode = AnimationBlendMode.Blend;
  3346. }
  3347. if (loop)
  3348. {
  3349. animationState.wrapMode = WrapMode.Loop;
  3350. }
  3351. else
  3352. {
  3353. animationState.wrapMode = WrapMode.Once;
  3354. }
  3355. animationState.speed = 1f;
  3356. animationState.time = 0f;
  3357. animationState.weight = 0f;
  3358. animationState.enabled = false;
  3359. return animationState;
  3360. }
  3361. public AnimationState LoadAnime(string tag, byte[] byte_data, bool additive, bool loop)
  3362. {
  3363. if (this.m_Bones == null)
  3364. {
  3365. Debug.LogError("未だキャラがロードさていません。" + base.gameObject.name);
  3366. }
  3367. Animation animation = this.m_Animation;
  3368. AnimationClip clip = animation.GetClip(tag);
  3369. clip = ImportCM.LoadAniClipNative(byte_data, true, true, false);
  3370. animation.AddClip(clip, tag);
  3371. if (tag.Contains("_l_"))
  3372. {
  3373. for (int i = 2; i <= 8; i++)
  3374. {
  3375. if (tag.Contains("_l_" + i.ToString() + "_"))
  3376. {
  3377. animation[tag].layer = i;
  3378. break;
  3379. }
  3380. }
  3381. }
  3382. this.IsAnimationChange = (tag != this.LastAnimeFN);
  3383. this.LastAnimeFN = tag;
  3384. AnimationState animationState = animation[tag];
  3385. if (additive)
  3386. {
  3387. animationState.blendMode = AnimationBlendMode.Additive;
  3388. }
  3389. else
  3390. {
  3391. animationState.blendMode = AnimationBlendMode.Blend;
  3392. }
  3393. if (loop)
  3394. {
  3395. animationState.wrapMode = WrapMode.Loop;
  3396. }
  3397. else
  3398. {
  3399. animationState.wrapMode = WrapMode.Once;
  3400. }
  3401. animationState.speed = 1f;
  3402. animationState.time = 0f;
  3403. animationState.weight = 0f;
  3404. animationState.enabled = false;
  3405. return animationState;
  3406. }
  3407. public void ReloadAnimation()
  3408. {
  3409. if (string.IsNullOrEmpty(this.LastAnimeFN))
  3410. {
  3411. return;
  3412. }
  3413. this.CrossFade(this.LastAnimeFN, GameUty.FileSystem, false, true, false, 0f, 1f);
  3414. }
  3415. public void ItemAnimationLoad(TBody.SlotID f_slot, string f_strAnimName)
  3416. {
  3417. this.goSlot[(int)f_slot].AnimationLoad(f_strAnimName);
  3418. }
  3419. public void ItemAnimationPlay(TBody.SlotID f_slot, string f_strAnimName, bool f_bLoop)
  3420. {
  3421. this.goSlot[(int)f_slot].AnimationPlay(f_strAnimName, f_bLoop);
  3422. }
  3423. public void ItemAnimationStop(TBody.SlotID f_slot)
  3424. {
  3425. this.goSlot[(int)f_slot].AnimationStop();
  3426. }
  3427. public void MaterialAnimatorAdd(TBody.SlotID f_slot, int f_nMateNo)
  3428. {
  3429. this.goSlot[(int)f_slot].MaterialAnimatorAdd(f_nMateNo);
  3430. }
  3431. public List<TBodySkin> GetSlotListFromMPN(MPN f_mpn)
  3432. {
  3433. List<TBodySkin> list = new List<TBodySkin>();
  3434. for (int i = 0; i < this.goSlot.Count; i++)
  3435. {
  3436. TBodySkin tbodySkin = this.goSlot[i];
  3437. if (tbodySkin.m_ParentMPN == f_mpn)
  3438. {
  3439. list.Add(tbodySkin);
  3440. }
  3441. }
  3442. return list;
  3443. }
  3444. public List<KeyValuePair<TBody.SlotID, string>> GetAttachPointListFromMPN(MPN f_mpn)
  3445. {
  3446. List<KeyValuePair<TBody.SlotID, string>> list = new List<KeyValuePair<TBody.SlotID, string>>();
  3447. for (int i = 0; i < this.goSlot.Count; i++)
  3448. {
  3449. TBodySkin tbodySkin = this.goSlot[i];
  3450. if (tbodySkin.m_ParentMPN == f_mpn)
  3451. {
  3452. if (!string.IsNullOrEmpty(tbodySkin.m_AttachName))
  3453. {
  3454. if (tbodySkin.m_AttachVisible)
  3455. {
  3456. list.Add(new KeyValuePair<TBody.SlotID, string>((TBody.SlotID)tbodySkin.m_AttachSlotIdx, tbodySkin.m_AttachName));
  3457. }
  3458. }
  3459. else
  3460. {
  3461. list.Add(new KeyValuePair<TBody.SlotID, string>(tbodySkin.SlotId, string.Empty));
  3462. }
  3463. }
  3464. }
  3465. return list;
  3466. }
  3467. public void SetAttachPoint(string slotname, int subNo, string apname, Vector3 v, Quaternion q, bool f_bTemp)
  3468. {
  3469. if (!TBody.hashSlotName.ContainsKey(slotname))
  3470. {
  3471. Debug.LogError("アタッチポイントがありません。" + slotname + " の " + apname);
  3472. return;
  3473. }
  3474. int i = (int)TBody.hashSlotName[slotname];
  3475. this.goSlot[i, subNo].morph.SetAttachPoint(apname, v, q, f_bTemp);
  3476. }
  3477. public void SetAttachPointLocal(TBody.SlotID slotid, string apname, Vector3 vPosLocal, Quaternion qRotlocal, Vector3 vScaleRate)
  3478. {
  3479. if (string.IsNullOrEmpty(apname))
  3480. {
  3481. this.goSlot[(int)slotid].SetAttachObjPointLocal(vPosLocal, qRotlocal, vScaleRate);
  3482. }
  3483. }
  3484. public void GetAttachPointLocal(TBody.SlotID slotid, string apname, out Vector3 vPosLocal, out Quaternion qRotLocal, out Vector3 vScaleRate)
  3485. {
  3486. if (!string.IsNullOrEmpty(apname))
  3487. {
  3488. vPosLocal = Vector3.zero;
  3489. qRotLocal = Quaternion.identity;
  3490. vScaleRate = Vector3.zero;
  3491. }
  3492. else
  3493. {
  3494. this.goSlot[(int)slotid].GetAttachObjPointLocal(out vPosLocal, out qRotLocal, out vScaleRate);
  3495. }
  3496. }
  3497. public void CopyAttachPoint(TBody.SlotID slotid, string apname)
  3498. {
  3499. if (!string.IsNullOrEmpty(apname))
  3500. {
  3501. if (this.goSlot[(int)slotid].morph != null)
  3502. {
  3503. this.goSlot[(int)slotid].morph.CopyAttachObjPoint(apname);
  3504. }
  3505. }
  3506. else
  3507. {
  3508. this.goSlot[(int)slotid].CopyAttachObjPoint();
  3509. }
  3510. }
  3511. public void PasteAttachPoint(TBody.SlotID slotid, string apname)
  3512. {
  3513. if (!string.IsNullOrEmpty(apname))
  3514. {
  3515. if (this.goSlot[(int)slotid].morph != null)
  3516. {
  3517. this.goSlot[(int)slotid].morph.PastAttachObjPoint(apname);
  3518. }
  3519. }
  3520. else
  3521. {
  3522. this.goSlot[(int)slotid].PastAttachObjPoint();
  3523. }
  3524. }
  3525. public void SetAttachPointWorld(TBody.SlotID slotid, string apname, Vector3 vPosWorld, Quaternion qRotWorld, Vector3 vScaleRate)
  3526. {
  3527. if (!string.IsNullOrEmpty(apname))
  3528. {
  3529. if (this.goSlot[(int)slotid].morph != null)
  3530. {
  3531. this.goSlot[(int)slotid].morph.SetAttachPointWorld(apname, vPosWorld, qRotWorld, vScaleRate);
  3532. }
  3533. }
  3534. else
  3535. {
  3536. this.goSlot[(int)slotid].SetAttachCenterPointWorld(vPosWorld, qRotWorld, vScaleRate);
  3537. }
  3538. }
  3539. public void GetAttachPointWorld(TBody.SlotID slotid, string apname, out Vector3 vPosWorld, out Quaternion qRotWorld, out Vector3 vScaleRate)
  3540. {
  3541. vPosWorld = (vScaleRate = Vector3.zero);
  3542. qRotWorld = Quaternion.identity;
  3543. if (!string.IsNullOrEmpty(apname))
  3544. {
  3545. if (this.goSlot[(int)slotid].morph != null)
  3546. {
  3547. this.goSlot[(int)slotid].morph.GetAttachPoint(apname, out vPosWorld, out qRotWorld, out vScaleRate, false);
  3548. }
  3549. }
  3550. else
  3551. {
  3552. this.goSlot[(int)slotid].GetAttachCenterPointWorld(out vPosWorld, out qRotWorld, out vScaleRate);
  3553. }
  3554. }
  3555. public void ResetAttachPoint(TBody.SlotID slotid, string apname = null)
  3556. {
  3557. if (!string.IsNullOrEmpty(apname))
  3558. {
  3559. if (this.goSlot[(int)slotid].morph != null)
  3560. {
  3561. this.goSlot[(int)slotid].morph.ResetAttachPoint(apname);
  3562. }
  3563. }
  3564. else
  3565. {
  3566. this.goSlot[(int)slotid].ResetAttachCenterPoint();
  3567. }
  3568. }
  3569. public void SetEnableAttachPointEdit(bool f_bEnable, TBody.SlotID slotid, string apname = null)
  3570. {
  3571. if (!string.IsNullOrEmpty(apname))
  3572. {
  3573. if (this.goSlot[(int)slotid].morph != null)
  3574. {
  3575. this.goSlot[(int)slotid].morph.SetEnableAttachPointEdit(f_bEnable, apname);
  3576. }
  3577. }
  3578. else
  3579. {
  3580. this.goSlot[(int)slotid].EnablePartsPosEdit = f_bEnable;
  3581. }
  3582. }
  3583. public bool GetEnableAttachPointEdit(TBody.SlotID slotid, string apname = null)
  3584. {
  3585. if (!string.IsNullOrEmpty(apname))
  3586. {
  3587. return this.goSlot[(int)slotid].morph != null && this.goSlot[(int)slotid].morph.GetEnableAttachPointEdit(apname);
  3588. }
  3589. return this.goSlot[(int)slotid].EnablePartsPosEdit;
  3590. }
  3591. public void SetHairLengthDataList(string f_strSlotName, int subPropNo, string f_strGroupName, string f_strBoneSearchType, string f_strBoneName, Vector3 f_vScaleMin, Vector3 f_vScaleMax)
  3592. {
  3593. if (!TBody.hashSlotName.ContainsKey(f_strSlotName))
  3594. {
  3595. Debug.LogError("髪ボーン長さグループがありません。" + f_strSlotName + " の " + f_strGroupName);
  3596. return;
  3597. }
  3598. int i = (int)TBody.hashSlotName[f_strSlotName];
  3599. this.goSlot[i, subPropNo].m_HairLengthCtrl.SearchAndAddHairLengthTarget(f_strGroupName, f_strBoneSearchType, f_strBoneName, f_vScaleMin, f_vScaleMax);
  3600. }
  3601. public Dictionary<string, TBodySkin.HairLengthCtrl.HairLength> GetHairLengthListFromMPN(MPN f_mpn)
  3602. {
  3603. for (int i = 0; i < this.goSlot.Count; i++)
  3604. {
  3605. TBodySkin tbodySkin = this.goSlot[i];
  3606. if (tbodySkin.m_ParentMPN == f_mpn && tbodySkin.m_HairLengthCtrl.IsHairLengthEditable)
  3607. {
  3608. return tbodySkin.m_HairLengthCtrl.HairLengthGroupList;
  3609. }
  3610. }
  3611. return null;
  3612. }
  3613. public void HairLengthBlend()
  3614. {
  3615. for (int i = 0; i < this.goSlot.Count; i++)
  3616. {
  3617. for (int j = 0; j < this.goSlot.CountChildren(i); j++)
  3618. {
  3619. TBodySkin tbodySkin = this.goSlot[i, j];
  3620. if (tbodySkin != null)
  3621. {
  3622. TBodySkin.HairLengthCtrl hairLengthCtrl = tbodySkin.m_HairLengthCtrl;
  3623. if (hairLengthCtrl != null)
  3624. {
  3625. hairLengthCtrl.HairLenghtBlend();
  3626. }
  3627. }
  3628. }
  3629. }
  3630. }
  3631. public void ItemScaleReset()
  3632. {
  3633. for (int i = 0; i < this.goSlot.Count; i++)
  3634. {
  3635. this.goSlot[i].ItemScaleReset();
  3636. }
  3637. }
  3638. public AutoKupaCtrl GetKupaCtrl(AutoKupaCtrl.MorphType morph_type)
  3639. {
  3640. if (this.KupaDataDic.ContainsKey(morph_type))
  3641. {
  3642. return this.KupaDataDic[morph_type];
  3643. }
  3644. return null;
  3645. }
  3646. public void KupaReset()
  3647. {
  3648. foreach (AutoKupaCtrl autoKupaCtrl in this.KupaDataDic.Values)
  3649. {
  3650. autoKupaCtrl.DoneStateReset();
  3651. }
  3652. }
  3653. public Transform[] GetKupaInsertObjs(AutoKupaCtrl.InsertObjType insert)
  3654. {
  3655. if (this.InsertObjArrayDic.ContainsKey(insert))
  3656. {
  3657. return this.InsertObjArrayDic[insert];
  3658. }
  3659. if (insert != AutoKupaCtrl.InsertObjType.HandItem_R && insert != AutoKupaCtrl.InsertObjType.HandItem_L)
  3660. {
  3661. return null;
  3662. }
  3663. Transform transform = (insert != AutoKupaCtrl.InsertObjType.HandItem_R) ? this.GetBone("_IK_handL") : this.GetBone("_IK_handR");
  3664. if (transform.childCount == 0)
  3665. {
  3666. return null;
  3667. }
  3668. Transform transform2 = null;
  3669. for (int i = 0; i < transform.childCount; i++)
  3670. {
  3671. Transform child = transform.GetChild(i);
  3672. if (child.name.Contains("_SM_"))
  3673. {
  3674. transform2 = child;
  3675. break;
  3676. }
  3677. }
  3678. if (!transform2)
  3679. {
  3680. return null;
  3681. }
  3682. Transform transform3 = transform2.Find("Bone_center");
  3683. Transform transform4 = transform3.Find("Bone_insert1");
  3684. return UnityUtility.GetAllChildren(transform4, true).ToArray();
  3685. }
  3686. public void SetShoulderTwistCalcType(bool is_left, ShoulderTwist.CalcType calc_mode)
  3687. {
  3688. Maid.AutoTwist key = (!is_left) ? Maid.AutoTwist.ShoulderR : Maid.AutoTwist.ShoulderL;
  3689. if (!this.m_TwistDataDic.ContainsKey(key))
  3690. {
  3691. return;
  3692. }
  3693. ShoulderTwist shoulderTwist = this.m_TwistDataDic[key] as ShoulderTwist;
  3694. shoulderTwist.SetCalcMode(calc_mode);
  3695. }
  3696. public void ProcCosAnime()
  3697. {
  3698. if (!this.CosAnimeMode)
  3699. {
  3700. return;
  3701. }
  3702. if (this.anist != null)
  3703. {
  3704. if (this.MotionBlenFadeVal < 1f)
  3705. {
  3706. this.MotionBlenFadeVal += Time.deltaTime * this.CosAnimePlusT;
  3707. if (this.MotionBlenFadeVal >= 1f)
  3708. {
  3709. if (this.oldAnimeTag != null)
  3710. {
  3711. this.m_Animation.Stop(this.oldAnimeTag);
  3712. this.oldAnimeTag = null;
  3713. }
  3714. this.MotionBlenFadeVal = 1f;
  3715. this.anist.weight = 1f;
  3716. this.anist.layer = 0;
  3717. }
  3718. else
  3719. {
  3720. this.anist.weight = UTY.COSS2(UTY.COSS(Mathf.Pow(this.MotionBlenFadeVal, 0.5f)), 2f);
  3721. }
  3722. }
  3723. }
  3724. }
  3725. public void WarpInit()
  3726. {
  3727. if (this.IsCrcBody)
  3728. {
  3729. for (int i = 0; i < this.IDynamicBoneList.Count; i++)
  3730. {
  3731. if (this.IDynamicBoneList[i] != null)
  3732. {
  3733. this.IDynamicBoneList[i].PhysicsReset();
  3734. }
  3735. }
  3736. }
  3737. else
  3738. {
  3739. this.jbMuneL.boWarpInit = true;
  3740. this.jbMuneR.boWarpInit = true;
  3741. for (int j = 0; j < this.goSlot.Count; j++)
  3742. {
  3743. for (int k = 0; k < this.goSlot.CountChildren(j); k++)
  3744. {
  3745. TBodySkin tbodySkin = this.goSlot[j, k];
  3746. if (tbodySkin != null && tbodySkin.bonehair3 != null)
  3747. {
  3748. tbodySkin.bonehair3.WarpInit();
  3749. }
  3750. }
  3751. }
  3752. }
  3753. }
  3754. public bool IsMotionScritChange(string file_name, string label_name)
  3755. {
  3756. return this.LastMSName != file_name || this.LastMSLabelName != label_name;
  3757. }
  3758. public void SetMotionScriptInfo(string file_name, string label_name)
  3759. {
  3760. if (!this.isMotionScriptSet)
  3761. {
  3762. bool flag = this.LastMSName != file_name;
  3763. bool flag2 = this.LastMSLabelName != label_name;
  3764. this.IsMotionScriptChange = (flag || flag2);
  3765. }
  3766. this.LastMSName = file_name;
  3767. this.LastMSLabelName = label_name;
  3768. this.isMotionScriptSet = true;
  3769. }
  3770. public void OnEnable()
  3771. {
  3772. this.OnChangeScreenSizeOrAA();
  3773. this.ManColorUpdate();
  3774. }
  3775. private void OnDisable()
  3776. {
  3777. this.isMotionScriptSet = false;
  3778. }
  3779. private void Update()
  3780. {
  3781. this.isLateUpdateEnd = false;
  3782. this.m_IsSkinMeshUpdatedOnce = false;
  3783. this.isMotionScriptSet = false;
  3784. for (int i = 0; i < this.goSlot.Count; i++)
  3785. {
  3786. this.goSlot[i].TextureCache.Update();
  3787. }
  3788. bool flag = false;
  3789. foreach (KeyValuePair<string, TBody.TexLay.Mat> keyValuePair in this.m_dicLaySlot)
  3790. {
  3791. flag |= keyValuePair.Value.Reset();
  3792. }
  3793. if (flag)
  3794. {
  3795. Debug.Log("MulTexReset");
  3796. this.MulTexProc();
  3797. }
  3798. if (!this.isLoadedBody)
  3799. {
  3800. return;
  3801. }
  3802. if (!this.boMAN)
  3803. {
  3804. this.posCalfCenter = (this.Calf_R.position + this.Calf_L.position) * 0.5f;
  3805. Vector3 vector = this.CenterBone.position + this.CenterBone.forward * 100f;
  3806. if ((this.CenterPosOld - vector).sqrMagnitude > 0.25f && !OvrIK.IsModeVRIK)
  3807. {
  3808. this.WarpInit();
  3809. }
  3810. if (this.IsCrcBody)
  3811. {
  3812. this.dbMuneL.PreUpdate();
  3813. this.dbMuneR.PreUpdate();
  3814. }
  3815. else
  3816. {
  3817. this.jbMuneL.boBRA = !this.boVisible_NIP;
  3818. this.jbMuneR.boBRA = !this.boVisible_NIP;
  3819. }
  3820. this.CenterPosOld = vector;
  3821. if (GameMain.Instance.VRMode)
  3822. {
  3823. this.m_trHandHitR = (this.m_trHandHitL = null);
  3824. OvrMgr ovrMgr = GameMain.Instance.OvrMgr;
  3825. if (ovrMgr != null)
  3826. {
  3827. OvrMgr.OvrObject.Controller left_controller = ovrMgr.ovr_obj.left_controller;
  3828. if (left_controller != null && left_controller.controller != null && left_controller.controller.HandEnable)
  3829. {
  3830. this.m_trHandHitL = left_controller.hand_trans_hit;
  3831. }
  3832. OvrMgr.OvrObject.Controller right_controller = ovrMgr.ovr_obj.right_controller;
  3833. if (right_controller != null && right_controller.controller != null && right_controller.controller.HandEnable)
  3834. {
  3835. this.m_trHandHitR = right_controller.hand_trans_hit;
  3836. }
  3837. }
  3838. if (this.m_trHandHitL != null || this.m_trHandHitR != null || this.m_trHandLeapHitL != null || this.m_trHandLeapHitR != null)
  3839. {
  3840. foreach (TBodySkin tbodySkin in this.goSlot.GetListParents())
  3841. {
  3842. if (this.m_trHandHitL != null)
  3843. {
  3844. this.m_bNoHandL = false;
  3845. foreach (THitSphere thitSphere in tbodySkin.bonehair.bodyhit.m_listHandHitL)
  3846. {
  3847. thitSphere.vs = thitSphere.t.InverseTransformPoint(this.m_trHandHitL.position);
  3848. }
  3849. }
  3850. else if (!this.m_bNoHandL)
  3851. {
  3852. foreach (THitSphere thitSphere2 in tbodySkin.bonehair.bodyhit.m_listHandHitL)
  3853. {
  3854. thitSphere2.vs.y = -99999f;
  3855. }
  3856. this.m_bNoHandL = true;
  3857. }
  3858. if (this.m_trHandLeapHitL != null)
  3859. {
  3860. if (tbodySkin.bonehair.bodyhit.m_HandHitLeapL != null)
  3861. {
  3862. tbodySkin.bonehair.bodyhit.m_HandHitLeapL.vs = tbodySkin.bonehair.bodyhit.m_HandHitLeapL.t.InverseTransformPoint(this.m_trHandLeapHitL.position);
  3863. }
  3864. }
  3865. else if (tbodySkin.bonehair.bodyhit.m_HandHitLeapL != null)
  3866. {
  3867. tbodySkin.bonehair.bodyhit.m_HandHitLeapL.vs.y = -10000f;
  3868. }
  3869. if (this.m_trHandHitR != null)
  3870. {
  3871. this.m_bNoHandR = false;
  3872. foreach (THitSphere thitSphere3 in tbodySkin.bonehair.bodyhit.m_listHandHitR)
  3873. {
  3874. thitSphere3.vs = thitSphere3.t.transform.InverseTransformPoint(this.m_trHandHitR.position);
  3875. }
  3876. }
  3877. else if (!this.m_bNoHandR)
  3878. {
  3879. foreach (THitSphere thitSphere4 in tbodySkin.bonehair.bodyhit.m_listHandHitR)
  3880. {
  3881. thitSphere4.vs.y = -99999f;
  3882. }
  3883. this.m_bNoHandR = true;
  3884. }
  3885. if (this.m_trHandLeapHitR != null)
  3886. {
  3887. if (tbodySkin.bonehair.bodyhit.m_HandHitLeapR != null)
  3888. {
  3889. tbodySkin.bonehair.bodyhit.m_HandHitLeapR.vs = tbodySkin.bonehair.bodyhit.m_HandHitLeapR.t.InverseTransformPoint(this.m_trHandLeapHitR.position);
  3890. }
  3891. }
  3892. else if (tbodySkin.bonehair.bodyhit.m_HandHitLeapR != null)
  3893. {
  3894. tbodySkin.bonehair.bodyhit.m_HandHitLeapR.vs.y = -10000f;
  3895. }
  3896. }
  3897. }
  3898. float num = this.m_fHitLimitDistanceMin + (this.m_fHitLimitDistanceMax - this.m_fHitLimitDistanceMin);
  3899. if (this.IsCrcBody)
  3900. {
  3901. num *= this.dbMuneL.muneSizeNormalized;
  3902. }
  3903. else
  3904. {
  3905. num *= this.jbMuneL.BlendValue / 1.3f;
  3906. }
  3907. if (this.m_trsMuneLsub != null && this.m_trHitChildL != null)
  3908. {
  3909. Vector3 vector2 = this.m_trsMuneL.InverseTransformPoint(this.m_trHitChildL.position);
  3910. if ((vector2 - this.m_trHitParentL.localPosition).magnitude < num)
  3911. {
  3912. this.m_trsMuneLsub.localPosition = vector2;
  3913. }
  3914. else
  3915. {
  3916. this.m_trsMuneLsub.localPosition = this.m_trHitParentL.localPosition + (vector2 - this.m_trHitParentL.localPosition).normalized * num;
  3917. this.m_trHitChildL.position = this.m_trsMuneLsub.position;
  3918. }
  3919. }
  3920. if (this.m_trsMuneRsub != null && this.m_trHitChildR != null)
  3921. {
  3922. Vector3 vector3 = this.m_trsMuneR.InverseTransformPoint(this.m_trHitChildR.position);
  3923. if ((vector3 - this.m_trHitParentR.localPosition).magnitude < num)
  3924. {
  3925. this.m_trsMuneRsub.localPosition = vector3;
  3926. }
  3927. else
  3928. {
  3929. this.m_trsMuneRsub.localPosition = this.m_trHitParentR.localPosition + (vector3 - this.m_trHitParentR.localPosition).normalized * num;
  3930. this.m_trHitChildR.position = this.m_trsMuneRsub.position;
  3931. }
  3932. }
  3933. }
  3934. }
  3935. }
  3936. private void LateUpdate()
  3937. {
  3938. if (!this.isLoadedBody)
  3939. {
  3940. return;
  3941. }
  3942. this.maid.OffsetUpdate();
  3943. this.MoveHeadAndEye();
  3944. this.MoveMomoniku();
  3945. if (!this.boMAN)
  3946. {
  3947. if (this.IsCrcBody)
  3948. {
  3949. if (!this.maid.body0.dbMuneL.isDynamicOn)
  3950. {
  3951. if (this.maid.body0.dbMuneL.enabled)
  3952. {
  3953. this.maid.body0.dbMuneL.enabled = false;
  3954. }
  3955. }
  3956. else if (!this.maid.body0.dbMuneL.enabled)
  3957. {
  3958. this.maid.body0.dbMuneL.enabled = true;
  3959. }
  3960. if (!this.maid.body0.dbMuneR.isDynamicOn)
  3961. {
  3962. if (this.maid.body0.dbMuneR.enabled)
  3963. {
  3964. this.maid.body0.dbMuneR.enabled = false;
  3965. }
  3966. }
  3967. else if (!this.maid.body0.dbMuneR.enabled)
  3968. {
  3969. this.maid.body0.dbMuneR.enabled = true;
  3970. }
  3971. this.dbMuneL.DynamicUpdate();
  3972. this.dbMuneR.DynamicUpdate();
  3973. }
  3974. else
  3975. {
  3976. this.jbMuneL.LateUpdateSelf();
  3977. this.jbMuneR.LateUpdateSelf();
  3978. }
  3979. }
  3980. if (this.boMAN)
  3981. {
  3982. if (this.trManChinko != null)
  3983. {
  3984. this.trManChinko.localPosition = this.vecChinkoOffset;
  3985. }
  3986. if (this.chinkoCtrl != null)
  3987. {
  3988. this.chinkoCtrl.SelfUpdate();
  3989. }
  3990. }
  3991. if (this.OnLateUpdate != null)
  3992. {
  3993. this.OnLateUpdate();
  3994. }
  3995. if (!this.boMAN)
  3996. {
  3997. this.JumpDis = Mathf.Max((this.Calf_L_pos_old - this.Calf_L.position).magnitude, (this.Calf_R_pos_old - this.Calf_R.position).magnitude);
  3998. this.JumpDis = Mathf.Max(this.JumpDis, (this.Thigh_L_pos_old - this.Thigh_L.position).magnitude);
  3999. this.JumpDis = Mathf.Max(this.JumpDis, (this.Thigh_R_pos_old - this.Thigh_R.position).magnitude);
  4000. this.JumpDis = Mathf.Clamp01(this.JumpDis * 20f);
  4001. this.JumpDis = (this.JumpDis + this.JumpDis_old) * 0.5f;
  4002. this.JumpDis_old = this.JumpDis;
  4003. }
  4004. if (!this.boMAN)
  4005. {
  4006. this.Calf_L_pos_old = this.Calf_L.position;
  4007. this.Calf_R_pos_old = this.Calf_R.position;
  4008. this.Thigh_L_pos_old = this.Thigh_L.position;
  4009. this.Thigh_R_pos_old = this.Thigh_R.position;
  4010. foreach (AutoKupaCtrl autoKupaCtrl in this.KupaDataDic.Values)
  4011. {
  4012. if (autoKupaCtrl.isUpdateTBody)
  4013. {
  4014. autoKupaCtrl.KupaUpdate();
  4015. }
  4016. }
  4017. }
  4018. if (this.fullBodyIK != null)
  4019. {
  4020. if (this.fullBodyIK.isNeedAttachTargetUpdatePreExec || this.fullBodyIK.partnerList.Count > 0)
  4021. {
  4022. this.IKAttachTargetUpdate();
  4023. }
  4024. this.fullBodyIK.IKUpdate();
  4025. }
  4026. if (this.fullBodyIK == null || !this.fullBodyIK.isUpdateLate)
  4027. {
  4028. this.AutoTwist();
  4029. this.IKAttachTargetUpdate();
  4030. }
  4031. for (int i = 0; i < this.goSlot.Count; i++)
  4032. {
  4033. for (int j = 0; j < this.goSlot.CountChildren(i); j++)
  4034. {
  4035. TBodySkin tbodySkin = this.goSlot[i, j];
  4036. if (tbodySkin != null)
  4037. {
  4038. if (this.IsCrcBody)
  4039. {
  4040. tbodySkin.SelfLateUpdate();
  4041. }
  4042. else
  4043. {
  4044. tbodySkin.Update();
  4045. }
  4046. }
  4047. }
  4048. }
  4049. this.limbColliderMgr.UpdateColliderTransform();
  4050. this.isLateUpdateEnd = true;
  4051. this.onLateUpdateEnd.Invoke();
  4052. }
  4053. public void SkinMeshUpdateOnce()
  4054. {
  4055. if (this.m_IsSkinMeshUpdatedOnce)
  4056. {
  4057. return;
  4058. }
  4059. this.SkinMeshUpdate();
  4060. }
  4061. public void SkinMeshUpdate()
  4062. {
  4063. for (int i = 0; i < this.goSlot.Count; i++)
  4064. {
  4065. for (int j = 0; j < this.goSlot.CountChildren(i); j++)
  4066. {
  4067. TBodySkin tbodySkin = this.goSlot[i, j];
  4068. if (tbodySkin != null)
  4069. {
  4070. if (tbodySkin.obj != null)
  4071. {
  4072. tbodySkin.CopyTrans();
  4073. }
  4074. tbodySkin.Update();
  4075. }
  4076. }
  4077. }
  4078. this.m_IsSkinMeshUpdatedOnce = true;
  4079. }
  4080. public void IKAttachTargetUpdate()
  4081. {
  4082. for (int i = 0; i < this.goSlot.Count; i++)
  4083. {
  4084. for (int j = 0; j < this.goSlot.CountChildren(i); j++)
  4085. {
  4086. TBodySkin tbodySkin = this.goSlot[i, j];
  4087. if (tbodySkin != null)
  4088. {
  4089. if (tbodySkin.obj != null)
  4090. {
  4091. tbodySkin.CopyTrans();
  4092. }
  4093. tbodySkin.LateAttachUpdate();
  4094. }
  4095. }
  4096. }
  4097. TMorphBone tmorphBone = this.bonemorph as TMorphBone;
  4098. if (tmorphBone != null)
  4099. {
  4100. tmorphBone.UpdateIKTargetBone();
  4101. }
  4102. }
  4103. public float DegPer(float r, float per)
  4104. {
  4105. if (r <= 180f)
  4106. {
  4107. return r * per;
  4108. }
  4109. return (r - 360f) * per;
  4110. }
  4111. private float AxisAngleOnAxisPlane(Vector3 fromDirection, Vector3 toDirection, Vector3 axis)
  4112. {
  4113. fromDirection.Normalize();
  4114. axis.Normalize();
  4115. Vector3 rhs = toDirection - axis * Vector3.Dot(axis, toDirection);
  4116. rhs.Normalize();
  4117. return Mathf.Acos(Vector3.Dot(fromDirection, rhs)) * ((Vector3.Dot(Vector3.Cross(axis, fromDirection), rhs) >= 0f) ? 57.29578f : -57.29578f);
  4118. }
  4119. public void AutoTwist()
  4120. {
  4121. if (this.IsCrcBody)
  4122. {
  4123. if (this.boAutoTwistShoulderL && this.Uppertwist_L != null)
  4124. {
  4125. this.m_TwistDataDic[Maid.AutoTwist.ShoulderL].ApplyTwist();
  4126. }
  4127. if (this.boAutoTwistShoulderR && this.Uppertwist_R != null)
  4128. {
  4129. this.m_TwistDataDic[Maid.AutoTwist.ShoulderR].ApplyTwist();
  4130. }
  4131. if (this.boAutoTwistWristL && this.Foretwist_L != null)
  4132. {
  4133. this.m_TwistDataDic[Maid.AutoTwist.WristL].ApplyTwist();
  4134. }
  4135. if (this.boAutoTwistWristR && this.Foretwist_R != null)
  4136. {
  4137. this.m_TwistDataDic[Maid.AutoTwist.WristR].ApplyTwist();
  4138. }
  4139. if (this.boAutoTwistThighL && this.momotwist_L != null)
  4140. {
  4141. this.m_TwistDataDic[Maid.AutoTwist.ThighL].ApplyTwist();
  4142. }
  4143. if (this.boAutoTwistThighR & this.momotwist_R != null)
  4144. {
  4145. this.m_TwistDataDic[Maid.AutoTwist.ThighR].ApplyTwist();
  4146. }
  4147. this.m_TwistDataDic[Maid.AutoTwist.AnkleL].ApplyTwist();
  4148. this.m_TwistDataDic[Maid.AutoTwist.AnkleR].ApplyTwist();
  4149. }
  4150. else
  4151. {
  4152. if (this.boAutoTwistShoulderL && this.Uppertwist_L != null)
  4153. {
  4154. Quaternion localRotation = this.UpperArmL.localRotation;
  4155. float x = (Quaternion.Inverse(this.quaUpperArmL) * localRotation).eulerAngles.x;
  4156. this.Uppertwist_L.localRotation = Quaternion.Euler(-0.017453292f * this.DegPer(x, this.fDegPer), 0f, 0f);
  4157. this.Uppertwist1_L.localRotation = Quaternion.Euler(-0.017453292f * this.DegPer(x, this.fDegPer1), 0f, 0f);
  4158. this.Kata_L.localRotation = this.quaKata_L;
  4159. this.Kata_L.rotation = Quaternion.Slerp(this.Kata_L.rotation, this.UpperArmL.rotation, this.fRota);
  4160. }
  4161. if (this.boAutoTwistShoulderR && this.Uppertwist_R != null)
  4162. {
  4163. Quaternion localRotation2 = this.UpperArmR.localRotation;
  4164. float x2 = (Quaternion.Inverse(this.quaUpperArmR) * localRotation2).eulerAngles.x;
  4165. this.Uppertwist_R.localRotation = Quaternion.Euler(-0.017453292f * this.DegPer(x2, this.fDegPer), 0f, 0f);
  4166. this.Uppertwist1_R.localRotation = Quaternion.Euler(-0.017453292f * this.DegPer(x2, 0.2f), 0f, 0f);
  4167. this.Kata_R.localRotation = this.quaKata_R;
  4168. this.Kata_R.rotation = Quaternion.Slerp(this.Kata_R.rotation, this.Uppertwist_R.rotation, 0.5f);
  4169. }
  4170. if (this.boAutoTwistWristL && this.Foretwist_L != null)
  4171. {
  4172. Vector3 fromDirection = this.HandL_MR.localRotation * Vector3.up;
  4173. fromDirection.Normalize();
  4174. Vector3 toDirection = this.HandL.localRotation * Vector3.up;
  4175. toDirection.Normalize();
  4176. this.m_fAngleHandL = this.AxisAngleOnAxisPlane(fromDirection, toDirection, new Vector3(1f, 0f, 0f)) * -1f;
  4177. this.Foretwist_L.localRotation = Quaternion.AngleAxis(this.m_fAngleHandL, this.Foretwist_L_MR.localRotation * Vector3.left) * this.Foretwist_L_MR.localRotation;
  4178. this.Foretwist1_L.localRotation = Quaternion.AngleAxis(this.m_fAngleHandL * 0.5f, this.Foretwist1_L_MR.localRotation * Vector3.left) * this.Foretwist1_L_MR.localRotation;
  4179. }
  4180. if (this.boAutoTwistWristR && this.Foretwist_R != null)
  4181. {
  4182. Vector3 fromDirection2 = this.HandR_MR.localRotation * Vector3.up;
  4183. fromDirection2.Normalize();
  4184. Vector3 toDirection2 = this.HandR.localRotation * Vector3.up;
  4185. toDirection2.Normalize();
  4186. float num = this.AxisAngleOnAxisPlane(fromDirection2, toDirection2, new Vector3(1f, 0f, 0f)) * -1f;
  4187. this.Foretwist_R.localRotation = Quaternion.AngleAxis(num, this.Foretwist_R_MR.localRotation * Vector3.left) * this.Foretwist_R_MR.localRotation;
  4188. this.Foretwist1_R.localRotation = Quaternion.AngleAxis(num * 0.5f, this.Foretwist1_R_MR.localRotation * Vector3.left) * this.Foretwist1_R_MR.localRotation;
  4189. }
  4190. if (this.boAutoTwistThighL && this.momotwist_L != null)
  4191. {
  4192. Quaternion quaternion = this.Thigh_L.localRotation;
  4193. quaternion = Quaternion.Inverse(this.quaThigh_L) * quaternion;
  4194. Vector3 vector = quaternion * Vector3.forward;
  4195. float num2 = quaternion.eulerAngles.x;
  4196. if (vector.z < 0f)
  4197. {
  4198. num2 = 180f - num2;
  4199. }
  4200. this.momotwist_L.localRotation = Quaternion.Euler(-0.017453292f * this.DegPer(num2, this.fDegPer), 0f, 0f) * this.q_momotwist_L;
  4201. this.momotwist2_L.localRotation = Quaternion.Euler(0.017453292f * this.DegPer(num2, 0.7f), 0f, 0f) * this.q_momotwist2_L;
  4202. }
  4203. if (this.boAutoTwistThighR & this.momotwist_R != null)
  4204. {
  4205. Quaternion quaternion2 = this.Thigh_R.localRotation;
  4206. quaternion2 = Quaternion.Inverse(this.quaThigh_R) * quaternion2;
  4207. Vector3 vector2 = quaternion2 * Vector3.forward;
  4208. float num3 = quaternion2.eulerAngles.x;
  4209. if (vector2.z < 0f)
  4210. {
  4211. num3 = 180f - num3;
  4212. }
  4213. this.momotwist_R.localRotation = Quaternion.Euler(-0.017453292f * this.DegPer(num3, this.fDegPer), 0f, 0f) * this.q_momotwist_R;
  4214. this.momotwist2_R.localRotation = Quaternion.Euler(0.017453292f * this.DegPer(num3, 0.7f), 0f, 0f) * this.q_momotwist2_R;
  4215. }
  4216. }
  4217. }
  4218. public void MoveMomoniku()
  4219. {
  4220. if (!TBody.boMoveMomoniku || this.momoniku_L == null || this.momoniku_R == null)
  4221. {
  4222. return;
  4223. }
  4224. float num = Mathf.Clamp(Vector3.Dot(Vector3.up, this.Thigh_L.up), 0f, 0.8f);
  4225. float num2 = Mathf.Clamp(Vector3.Dot(Vector3.up, this.Thigh_R.up), 0f, 0.8f);
  4226. this.momoniku_L.localRotation = this.momoniku_L_MR.localRotation;
  4227. this.momoniku_R.localRotation = this.momoniku_R_MR.localRotation;
  4228. this.momoniku_L.Rotate(0f, 0f, num * 10f);
  4229. this.momoniku_R.Rotate(0f, 0f, -num2 * 10f);
  4230. this.Hip_L.localRotation = Quaternion.Slerp(this.Hip_L_MR.localRotation, this.Thigh_L.localRotation, 0.67f);
  4231. this.Hip_R.localRotation = Quaternion.Slerp(this.Hip_R_MR.localRotation, this.Thigh_R.localRotation, 0.67f);
  4232. }
  4233. public void MoveHeadAndEye()
  4234. {
  4235. if (this.trsHead == null)
  4236. {
  4237. return;
  4238. }
  4239. if (GameMain.Instance.VRMode && GameMain.Instance.OvrMgr == null)
  4240. {
  4241. return;
  4242. }
  4243. CameraMain mainCamera = GameMain.Instance.MainCamera;
  4244. if (mainCamera == null)
  4245. {
  4246. return;
  4247. }
  4248. Vector3 a;
  4249. if (this.trsLookTarget == null)
  4250. {
  4251. a = this.trsHead.TransformPoint(this.offsetLookTarget);
  4252. if (this.boEyeSorashi)
  4253. {
  4254. Vector3 vector = a - this.trsHead.position;
  4255. Vector3 vector2;
  4256. if (GameMain.Instance.VRMode)
  4257. {
  4258. vector2 = GameMain.Instance.OvrMgr.EyeAnchor.position;
  4259. }
  4260. else
  4261. {
  4262. vector2 = mainCamera.transform.position - this.trsHead.position;
  4263. }
  4264. float num = Vector3.Dot(vector.normalized, vector2.normalized);
  4265. if (this.EyeSorashiCnt > 0)
  4266. {
  4267. this.EyeSorashiCnt++;
  4268. if (this.EyeSorashiCnt > 200)
  4269. {
  4270. this.EyeSorashiCnt = 0;
  4271. }
  4272. }
  4273. if (num > 0.9f && this.EyeSorashiCnt == 0)
  4274. {
  4275. if (this.EyeSorashiTgl)
  4276. {
  4277. this.offsetLookTarget = new Vector3(-0.5f, 1f, -0.7f);
  4278. }
  4279. else
  4280. {
  4281. this.offsetLookTarget = new Vector3(-0.6f, 1f, 0.6f);
  4282. }
  4283. this.EyeSorashiTgl = !this.EyeSorashiTgl;
  4284. this.EyeSorashiCnt = 1;
  4285. }
  4286. }
  4287. }
  4288. else
  4289. {
  4290. a = this.trsLookTarget.position;
  4291. }
  4292. if (this.boLockHeadAndEye)
  4293. {
  4294. return;
  4295. }
  4296. if (this.boHeadToCam)
  4297. {
  4298. this.HeadToCamPer += Time.deltaTime * this.HeadToCamFadeSpeed;
  4299. }
  4300. else
  4301. {
  4302. this.HeadToCamPer -= Time.deltaTime * this.HeadToCamFadeSpeed;
  4303. }
  4304. this.HeadToCamPer = Mathf.Clamp01(this.HeadToCamPer);
  4305. this.boChkEye = false;
  4306. Vector3 vector3 = a - this.trsNeck.position;
  4307. vector3 = Quaternion.Inverse(this.trsNeck.rotation) * vector3;
  4308. Quaternion quaternion = default(Quaternion);
  4309. quaternion.SetFromToRotation(Vector3.up, vector3);
  4310. Vector3 eulerAngles = quaternion.eulerAngles;
  4311. if (eulerAngles.x >= 180f)
  4312. {
  4313. eulerAngles.x -= 360f;
  4314. }
  4315. if (eulerAngles.z >= 180f)
  4316. {
  4317. eulerAngles.z -= 360f;
  4318. }
  4319. if (this.boHeadToCamInMode)
  4320. {
  4321. if (-80f >= eulerAngles.x || eulerAngles.x >= 80f || -50f >= eulerAngles.z || eulerAngles.z >= 60f)
  4322. {
  4323. this.boHeadToCamInMode = false;
  4324. }
  4325. }
  4326. else if (-60f < eulerAngles.x && eulerAngles.x < 60f && -40f < eulerAngles.z && eulerAngles.z < 50f)
  4327. {
  4328. this.boHeadToCamInMode = true;
  4329. }
  4330. if (this.boHeadToCamInMode)
  4331. {
  4332. this.boChkEye = true;
  4333. float num2 = 0.3f;
  4334. if (eulerAngles.x > this.HeadEulerAngle.x + 10f)
  4335. {
  4336. this.HeadEulerAngleG.x = this.HeadEulerAngleG.x + num2;
  4337. }
  4338. else if (eulerAngles.x < this.HeadEulerAngle.x - 10f)
  4339. {
  4340. this.HeadEulerAngleG.x = this.HeadEulerAngleG.x - num2;
  4341. }
  4342. else
  4343. {
  4344. this.HeadEulerAngleG.x = this.HeadEulerAngleG.x * 0.95f;
  4345. }
  4346. if (eulerAngles.z > this.HeadEulerAngle.z + 10f)
  4347. {
  4348. this.HeadEulerAngleG.z = this.HeadEulerAngleG.z + num2;
  4349. }
  4350. else if (eulerAngles.z < this.HeadEulerAngle.z - 10f)
  4351. {
  4352. this.HeadEulerAngleG.z = this.HeadEulerAngleG.z - num2;
  4353. }
  4354. else
  4355. {
  4356. this.HeadEulerAngleG.z = this.HeadEulerAngleG.z * 0.95f;
  4357. }
  4358. }
  4359. else
  4360. {
  4361. float num3 = 0.1f;
  4362. if (0f > this.HeadEulerAngle.x + 10f)
  4363. {
  4364. this.HeadEulerAngleG.x = this.HeadEulerAngleG.x + num3;
  4365. }
  4366. if (0f < this.HeadEulerAngle.x - 10f)
  4367. {
  4368. this.HeadEulerAngleG.x = this.HeadEulerAngleG.x - num3;
  4369. }
  4370. if (0f > this.HeadEulerAngle.z + 10f)
  4371. {
  4372. this.HeadEulerAngleG.z = this.HeadEulerAngleG.z + num3;
  4373. }
  4374. if (0f < this.HeadEulerAngle.z - 10f)
  4375. {
  4376. this.HeadEulerAngleG.z = this.HeadEulerAngleG.z - num3;
  4377. }
  4378. }
  4379. this.HeadEulerAngleG *= 0.95f;
  4380. this.HeadEulerAngle += this.HeadEulerAngleG;
  4381. Quaternion b = this.quaDefHead * Quaternion.Euler(this.HeadEulerAngle.x * 0.4f, 0f, this.HeadEulerAngle.z * 0.4f);
  4382. this.trsHead.localRotation = Quaternion.Slerp(this.trsHead.localRotation, b, UTY.COSS(this.HeadToCamPer));
  4383. if (!this.boMAN && this.trsEyeL != null && this.trsEyeR != null)
  4384. {
  4385. Vector3 vector4 = a - this.trsHead.position;
  4386. vector4 = Quaternion.Inverse(this.trsHead.rotation) * vector4;
  4387. Quaternion lhs = default(Quaternion);
  4388. lhs.SetFromToRotation(Vector3.up, vector4);
  4389. Vector3 eulerAngles2 = lhs.eulerAngles;
  4390. if (eulerAngles2.x >= 180f)
  4391. {
  4392. eulerAngles2.x -= 360f;
  4393. }
  4394. if (eulerAngles2.z >= 180f)
  4395. {
  4396. eulerAngles2.z -= 360f;
  4397. }
  4398. Vector3 view = Vector3.Normalize(a - this.trsEyeL.position);
  4399. lhs.SetLookRotation(view, Vector3.up);
  4400. lhs *= Quaternion.Euler(0f, 90f, 0f);
  4401. if (this.boEyeToCam && this.boChkEye)
  4402. {
  4403. float num4 = 0.5f;
  4404. if (this.boEyeSorashi)
  4405. {
  4406. num4 = 0.05f;
  4407. }
  4408. this.EyeEulerAngle = this.EyeEulerAngle * (1f - num4) + eulerAngles2 * num4;
  4409. }
  4410. else
  4411. {
  4412. this.EyeEulerAngle *= 0.95f;
  4413. }
  4414. if (this.IsCrcBody)
  4415. {
  4416. this.trsEyeL.localRotation = this.quaDefEyeL * Quaternion.Euler(this.m_editEyeRotX, -this.EyeEulerAngle.x * 0.2f + this.m_editYorime, -this.EyeEulerAngle.z * 0.1f);
  4417. this.trsEyeR.localRotation = this.quaDefEyeR * Quaternion.Euler(-this.m_editEyeRotX, this.EyeEulerAngle.x * 0.2f + this.m_editYorime, this.EyeEulerAngle.z * 0.1f);
  4418. }
  4419. else
  4420. {
  4421. this.trsEyeL.localRotation = this.quaDefEyeL * Quaternion.Euler(0f, -this.EyeEulerAngle.x * 0.2f + this.m_editYorime, -this.EyeEulerAngle.z * 0.1f);
  4422. this.trsEyeR.localRotation = this.quaDefEyeR * Quaternion.Euler(0f, this.EyeEulerAngle.x * 0.2f + this.m_editYorime, this.EyeEulerAngle.z * 0.1f);
  4423. }
  4424. }
  4425. }
  4426. public void OnChangeScreenSizeOrAA()
  4427. {
  4428. if (this.goSlot != null)
  4429. {
  4430. for (int i = 0; i < this.goSlot.Count; i++)
  4431. {
  4432. this.goSlot[i].OnChangeScreenSizeOrAA();
  4433. }
  4434. }
  4435. base.StartCoroutine(this.CoReseize());
  4436. }
  4437. private IEnumerator CoReseize()
  4438. {
  4439. yield return null;
  4440. yield break;
  4441. }
  4442. public void ManColorUpdate()
  4443. {
  4444. if (this.boMAN)
  4445. {
  4446. for (int i = 0; i < this.goSlot.Count; i++)
  4447. {
  4448. TBodySkin tbodySkin = this.goSlot[i];
  4449. if (tbodySkin != null)
  4450. {
  4451. tbodySkin.ManColorUpdate();
  4452. }
  4453. }
  4454. }
  4455. }
  4456. private void OnDrawGizmos()
  4457. {
  4458. if (this.m_drawBodyHitSphere)
  4459. {
  4460. for (int i = 0; i < this.goSlot.Count; i++)
  4461. {
  4462. TBodySkin tbodySkin = this.goSlot[i];
  4463. if (tbodySkin != null && tbodySkin.m_ParentMPN == MPN.wear)
  4464. {
  4465. tbodySkin.bonehair.DrawGizmos();
  4466. }
  4467. }
  4468. }
  4469. }
  4470. private bool m_bIsLoadedBody;
  4471. private AudioSourceParent m_AudioParent;
  4472. public GameObject m_Bones;
  4473. public Transform m_trBones;
  4474. public GameObject m_Bones2;
  4475. public Transform m_trBones2;
  4476. public Dictionary<string, Transform> m_dicBones = new Dictionary<string, Transform>();
  4477. public Dictionary<string, Transform> m_dicBonesMR = new Dictionary<string, Transform>();
  4478. public Transform trBip;
  4479. public Dictionary<string, Transform> m_dicTrans = new Dictionary<string, Transform>();
  4480. public Transform m_trAttachCache;
  4481. public Animation m_Animation;
  4482. private Dictionary<string, byte> m_AnimCache = new Dictionary<string, byte>();
  4483. public bool m_bForceReloadAnime;
  4484. private bool boMaid = true;
  4485. public bool boMAN;
  4486. [SerializeField]
  4487. private FullBodyIKMgr FullBodyIK;
  4488. public PermTempAction onLateUpdateEnd = new PermTempAction();
  4489. public bool isLateUpdateEnd;
  4490. private bool m_IsSkinMeshUpdatedOnce;
  4491. [SerializeField]
  4492. private float MotionBlendTime = 0.5f;
  4493. [Header("くぱぁ三兄弟")]
  4494. [SerializeField]
  4495. private AutoKupaCtrl VaginaKupa;
  4496. [SerializeField]
  4497. private AutoKupaCtrl AnalKupa;
  4498. [SerializeField]
  4499. private AutoKupaCtrl Kupa;
  4500. private Dictionary<AutoKupaCtrl.MorphType, AutoKupaCtrl> KupaDataDic = new Dictionary<AutoKupaCtrl.MorphType, AutoKupaCtrl>();
  4501. private Dictionary<AutoKupaCtrl.InsertObjType, Transform[]> InsertObjArrayDic = new Dictionary<AutoKupaCtrl.InsertObjType, Transform[]>();
  4502. public Action OnLateUpdate;
  4503. private Transform m_SMbody;
  4504. public Transform trsHead;
  4505. public Transform trsNeck;
  4506. public Quaternion quaDefHead;
  4507. public Quaternion quaDefNeck;
  4508. private Vector3 HeadEulerAngle;
  4509. private Vector3 HeadEulerAngleG;
  4510. public Transform Uppertwist_L;
  4511. public Transform Uppertwist1_L;
  4512. public Transform Kata_L;
  4513. public Transform ClavicleL;
  4514. public Transform Uppertwist_R;
  4515. public Transform Uppertwist1_R;
  4516. public Transform Kata_R;
  4517. public Transform ClavicleR;
  4518. public Quaternion quaKata_L;
  4519. public Quaternion quaKata_R;
  4520. public Quaternion quaUppertwist_L;
  4521. public Quaternion quaUpperArmL;
  4522. public Quaternion quaUppertwist_R;
  4523. public Quaternion quaUpperArmR;
  4524. private Transform momoniku_L;
  4525. private Transform momoniku_R;
  4526. private Transform momoniku_L_MR;
  4527. private Transform momoniku_R_MR;
  4528. public Transform Calf_L;
  4529. public Transform Calf_R;
  4530. public Transform Thigh_L;
  4531. public Transform Thigh_R;
  4532. public Transform Thigh_L_MR;
  4533. public Transform Thigh_R_MR;
  4534. public Transform Hip_R_nub;
  4535. public Transform Hip_R;
  4536. public Transform Hip_L_nub;
  4537. public Transform Hip_L;
  4538. private Quaternion quaThigh_L;
  4539. private Quaternion quaThigh_R;
  4540. private Transform Hip_L_MR;
  4541. private Transform Hip_R_MR;
  4542. private Dictionary<Maid.AutoTwist, ATwistCtrl> m_TwistDataDic = new Dictionary<Maid.AutoTwist, ATwistCtrl>();
  4543. public Vector3 m_vecDebug_Hand;
  4544. public float m_fAngleHandL;
  4545. private Transform HandL_NubY;
  4546. private Transform HandR_NubY;
  4547. private Transform HandL_NubY_MR;
  4548. private Transform HandR_NubY_MR;
  4549. public Transform UpperArmR;
  4550. public Transform UpperArmL;
  4551. private Transform ForearmR;
  4552. private Transform ForearmL;
  4553. private Transform HandR;
  4554. private Transform HandL;
  4555. private Transform HandR_MR;
  4556. private Transform HandL_MR;
  4557. private Transform Foretwist1_L;
  4558. private Transform Foretwist_L;
  4559. private Transform Foretwist1_L_MR;
  4560. private Transform Foretwist_L_MR;
  4561. private Transform Foretwist1_R;
  4562. private Transform Foretwist_R;
  4563. private Transform Foretwist1_R_MR;
  4564. private Transform Foretwist_R_MR;
  4565. private Transform momotwist_L;
  4566. private Transform momotwist2_L;
  4567. private Transform momotwist_R;
  4568. private Transform momotwist2_R;
  4569. private Quaternion q_momotwist_L;
  4570. private Quaternion q_momotwist2_L;
  4571. private Quaternion q_momotwist_R;
  4572. private Quaternion q_momotwist2_R;
  4573. private List<IDynamicBone> IDynamicBoneList = new List<IDynamicBone>();
  4574. public Transform ToeR;
  4575. public Transform ToeL;
  4576. public Transform CenterBone;
  4577. public Transform Pelvis;
  4578. public Transform FootStep;
  4579. public Transform Spine;
  4580. public Transform Spine0a;
  4581. public Transform Spine1a;
  4582. public Transform trManChinko;
  4583. public Vector3 vecChinkoOffset = default(Vector3);
  4584. public GameObject goMoza;
  4585. public GameObject goMozaANL;
  4586. public Transform ikMouthCenter;
  4587. public TBody.Slot goSlot;
  4588. private float m_BoneHitY;
  4589. public DynamicBonePlaneCollider m_hitFloorPlane;
  4590. public NativePlaneCollider crcHitFloorPlane;
  4591. public Transform m_trFloorPlane;
  4592. public TBody.ModeHirR Mode_HairR;
  4593. public bool boMizugi_panz;
  4594. public bool boVisible_NIP;
  4595. public bool boVisible_HESO;
  4596. public bool boVisible_XXX;
  4597. public bool boVisible_BRA;
  4598. public bool boVisible_PANZU;
  4599. public bool boVisible_SKIRT;
  4600. public bool boVisible_WEAR;
  4601. public bool boLockHeadAndEye;
  4602. public bool boEyeToCam = true;
  4603. public bool boChkEye;
  4604. public bool boHeadToCam = true;
  4605. public float HeadToCamPer;
  4606. public bool boHeadToCamInMode;
  4607. public float HeadToCamFadeSpeed = 1f;
  4608. public Transform trsLookTarget;
  4609. public Vector3 offsetLookTarget = new Vector3(0f, 1f, 0f);
  4610. public bool boEyeSorashi;
  4611. public int EyeSorashiCnt;
  4612. public bool EyeSorashiTgl;
  4613. private AnimationState anist;
  4614. private float MotionBlenFadeVal = 1f;
  4615. private float CosAnimePlusT = 1f;
  4616. private string oldAnimeTag;
  4617. public bool CosAnimeMode;
  4618. public int slotno_accXXX;
  4619. public Vector3 CenterPosOld = Vector3.zero;
  4620. public Vector3 Calf_L_pos_old;
  4621. public Vector3 Calf_R_pos_old;
  4622. public Vector3 Thigh_L_pos_old;
  4623. public Vector3 Thigh_R_pos_old;
  4624. public Vector3 posCalfCenter;
  4625. public float JumpDis;
  4626. public float JumpDis_old;
  4627. public static readonly string[] m_strDefSlotName = new string[]
  4628. {
  4629. "body",
  4630. "_ROOT_",
  4631. "IK",
  4632. "head",
  4633. "Bip01 Head",
  4634. "Jyouhanshin",
  4635. "eye",
  4636. "Bip01 Head",
  4637. "Jyouhanshin",
  4638. "hairF",
  4639. "Bip01 Head",
  4640. "Jyouhanshin",
  4641. "hairR",
  4642. "Bip01 Head",
  4643. "Jyouhanshin",
  4644. "hairS",
  4645. "Bip01 Head",
  4646. "Jyouhanshin",
  4647. "hairS_2",
  4648. "Bip01 Head",
  4649. "Jyouhanshin",
  4650. "hairT",
  4651. "Bip01 Head",
  4652. "Jyouhanshin",
  4653. "hairT_2",
  4654. "Bip01 Head",
  4655. "Jyouhanshin",
  4656. "wear",
  4657. "_ROOT_",
  4658. "Uwagi",
  4659. "skirt",
  4660. "_ROOT_",
  4661. "Kahanshin",
  4662. "onepiece",
  4663. "_ROOT_",
  4664. "Kahanshin",
  4665. "mizugi",
  4666. "_ROOT_",
  4667. "Kahanshin",
  4668. "mizugi_top",
  4669. "_ROOT_",
  4670. "Kahanshin",
  4671. "mizugi_buttom",
  4672. "_ROOT_",
  4673. "Kahanshin",
  4674. "panz",
  4675. "_ROOT_",
  4676. "Kahanshin",
  4677. "slip",
  4678. "_ROOT_",
  4679. "Kahanshin",
  4680. "bra",
  4681. "_ROOT_",
  4682. "Jyouhanshin",
  4683. "stkg",
  4684. "_ROOT_",
  4685. "Kahanshin",
  4686. "shoes",
  4687. "_ROOT_",
  4688. "Kahanshin",
  4689. "headset",
  4690. "Bip01 Head",
  4691. "Jyouhanshin",
  4692. "glove",
  4693. "_ROOT_",
  4694. "Uwagi",
  4695. "accHead",
  4696. "Bip01 Head",
  4697. "Jyouhanshin",
  4698. "accHead_2",
  4699. "Bip01 Head",
  4700. "Jyouhanshin",
  4701. "hairAho",
  4702. "Bip01 Head",
  4703. "Jyouhanshin",
  4704. "accHana",
  4705. "_ROOT_",
  4706. "Jyouhanshin",
  4707. "accHa",
  4708. "Bip01 Head",
  4709. "Jyouhanshin",
  4710. "accKami_1_",
  4711. "Bip01 Head",
  4712. "Jyouhanshin",
  4713. "accMiMiR",
  4714. "Bip01 Head",
  4715. "Jyouhanshin",
  4716. "accKamiSubR",
  4717. "Bip01 Head",
  4718. "Jyouhanshin",
  4719. "accNipR",
  4720. "_ROOT_",
  4721. "Uwagi",
  4722. "HandItemR",
  4723. "_IK_handR",
  4724. "Uwagi",
  4725. "accKubi",
  4726. "Bip01 Spine1a",
  4727. "Jyouhanshin",
  4728. "accKubiwa",
  4729. "Bip01 Neck",
  4730. "Jyouhanshin",
  4731. "accHeso",
  4732. "Bip01 Head",
  4733. "Jyouhanshin",
  4734. "accUde",
  4735. "_ROOT_",
  4736. "Uwagi",
  4737. "accUde_2",
  4738. "_ROOT_",
  4739. "Uwagi",
  4740. "accAshi",
  4741. "_ROOT_",
  4742. "Uwagi",
  4743. "accAshi_2",
  4744. "_ROOT_",
  4745. "Uwagi",
  4746. "accSenaka",
  4747. "_ROOT_",
  4748. "Uwagi",
  4749. "accShippo",
  4750. "Bip01 Spine",
  4751. "Uwagi",
  4752. "accKoshi",
  4753. "_ROOT_",
  4754. "Uwagi",
  4755. "accAnl",
  4756. "_ROOT_",
  4757. "Uwagi",
  4758. "accVag",
  4759. "_ROOT_",
  4760. "Uwagi",
  4761. "kubiwa",
  4762. "_ROOT_",
  4763. "Uwagi",
  4764. "megane",
  4765. "Bip01 Head",
  4766. "Jyouhanshin",
  4767. "accXXX",
  4768. "_ROOT_",
  4769. "Uwagi",
  4770. "chinko",
  4771. "Bip01 Pelvis",
  4772. "Uwagi",
  4773. "chikubi",
  4774. "_ROOT_",
  4775. "Jyouhanshin",
  4776. "accFace",
  4777. "Bip01 Head",
  4778. "Jyouhanshin",
  4779. "accHat",
  4780. "Bip01 Head",
  4781. "Jyouhanshin",
  4782. "kousoku_upper",
  4783. "_ROOT_",
  4784. "Uwagi",
  4785. "kousoku_lower",
  4786. "_ROOT_",
  4787. "Kahanshin",
  4788. "seieki_naka",
  4789. "_ROOT_",
  4790. "Uwagi",
  4791. "seieki_hara",
  4792. "_ROOT_",
  4793. "Uwagi",
  4794. "seieki_face",
  4795. "_ROOT_",
  4796. "Uwagi",
  4797. "seieki_mune",
  4798. "_ROOT_",
  4799. "Uwagi",
  4800. "seieki_hip",
  4801. "_ROOT_",
  4802. "Uwagi",
  4803. "seieki_ude",
  4804. "_ROOT_",
  4805. "Uwagi",
  4806. "seieki_ashi",
  4807. "_ROOT_",
  4808. "Uwagi",
  4809. "accNipL",
  4810. "_ROOT_",
  4811. "Uwagi",
  4812. "accMiMiL",
  4813. "Bip01 Head",
  4814. "Jyouhanshin",
  4815. "accKamiSubL",
  4816. "Bip01 Head",
  4817. "Jyouhanshin",
  4818. "accKami_2_",
  4819. "Bip01 Head",
  4820. "Jyouhanshin",
  4821. "accKami_3_",
  4822. "Bip01 Head",
  4823. "Jyouhanshin",
  4824. "HandItemL",
  4825. "_IK_handL",
  4826. "Uwagi",
  4827. "underhair",
  4828. "_ROOT_",
  4829. "Kahanshin",
  4830. "asshair",
  4831. "_ROOT_",
  4832. "Kahanshin",
  4833. "moza",
  4834. "_ROOT_",
  4835. "Kahanshin",
  4836. "end"
  4837. };
  4838. public static readonly string[] m_strDefSlotNameCRC = new string[]
  4839. {
  4840. "body",
  4841. "_ROOT_",
  4842. "IK",
  4843. "head",
  4844. "Bip01 Head",
  4845. "Jyouhanshin",
  4846. "eye",
  4847. "Bip01 Head",
  4848. "Jyouhanshin",
  4849. "hairF",
  4850. "Bip01 Head",
  4851. "Jyouhanshin",
  4852. "hairR",
  4853. "Bip01 Head",
  4854. "Jyouhanshin",
  4855. "hairS",
  4856. "Bip01 Head",
  4857. "Jyouhanshin",
  4858. "hairS_2",
  4859. "Bip01 Head",
  4860. "Jyouhanshin",
  4861. "hairT",
  4862. "Bip01 Head",
  4863. "Jyouhanshin",
  4864. "hairT_2",
  4865. "Bip01 Head",
  4866. "Jyouhanshin",
  4867. "wear",
  4868. "_ROOT_",
  4869. "Uwagi",
  4870. "skirt",
  4871. "_ROOT_",
  4872. "Kahanshin",
  4873. "onepiece",
  4874. "_ROOT_",
  4875. "Kahanshin",
  4876. "mizugi",
  4877. "_ROOT_",
  4878. "Kahanshin",
  4879. "mizugi_top",
  4880. "_ROOT_",
  4881. "Kahanshin",
  4882. "mizugi_buttom",
  4883. "_ROOT_",
  4884. "Kahanshin",
  4885. "panz",
  4886. "_ROOT_",
  4887. "Kahanshin",
  4888. "slip",
  4889. "_ROOT_",
  4890. "Kahanshin",
  4891. "bra",
  4892. "_ROOT_",
  4893. "Jyouhanshin",
  4894. "stkg",
  4895. "_ROOT_",
  4896. "Kahanshin",
  4897. "shoes",
  4898. "_ROOT_",
  4899. "Kahanshin",
  4900. "headset",
  4901. "Bip01 Head",
  4902. "Jyouhanshin",
  4903. "glove",
  4904. "_ROOT_",
  4905. "Uwagi",
  4906. "accHead",
  4907. "Bip01 Head",
  4908. "Jyouhanshin",
  4909. "accHead_2",
  4910. "Bip01 Head",
  4911. "Jyouhanshin",
  4912. "hairAho",
  4913. "Bip01 Head",
  4914. "Jyouhanshin",
  4915. "accHana",
  4916. "_ROOT_",
  4917. "Jyouhanshin",
  4918. "accHa",
  4919. "Bip01 Head",
  4920. "Jyouhanshin",
  4921. "accKami_1_",
  4922. "Bip01 Head",
  4923. "Jyouhanshin",
  4924. "accMiMiR",
  4925. "Bip01 Head",
  4926. "Jyouhanshin",
  4927. "accKamiSubR",
  4928. "Bip01 Head",
  4929. "Jyouhanshin",
  4930. "accNipR",
  4931. "_ROOT_",
  4932. "Uwagi",
  4933. "HandItemR",
  4934. "_IK_handR",
  4935. "Uwagi",
  4936. "accKubi",
  4937. "_ROOT_",
  4938. "Jyouhanshin",
  4939. "accKubiwa",
  4940. "_ROOT_",
  4941. "Jyouhanshin",
  4942. "accHeso",
  4943. "_ROOT_",
  4944. "Jyouhanshin",
  4945. "accUde",
  4946. "_ROOT_",
  4947. "Uwagi",
  4948. "accUde_2",
  4949. "_ROOT_",
  4950. "Uwagi",
  4951. "accAshi",
  4952. "_ROOT_",
  4953. "Uwagi",
  4954. "accAshi_2",
  4955. "_ROOT_",
  4956. "Uwagi",
  4957. "accSenaka",
  4958. "_ROOT_",
  4959. "Uwagi",
  4960. "accShippo",
  4961. "_ROOT_",
  4962. "Uwagi",
  4963. "accKoshi",
  4964. "_ROOT_",
  4965. "Uwagi",
  4966. "accAnl",
  4967. "_ROOT_",
  4968. "Uwagi",
  4969. "accVag",
  4970. "_ROOT_",
  4971. "Uwagi",
  4972. "kubiwa",
  4973. "_ROOT_",
  4974. "Uwagi",
  4975. "megane",
  4976. "Bip01 Head",
  4977. "Jyouhanshin",
  4978. "accXXX",
  4979. "_ROOT_",
  4980. "Uwagi",
  4981. "chinko",
  4982. "Bip01 Pelvis",
  4983. "Uwagi",
  4984. "chikubi",
  4985. "_ROOT_",
  4986. "Jyouhanshin",
  4987. "accFace",
  4988. "Bip01 Head",
  4989. "Jyouhanshin",
  4990. "accHat",
  4991. "Bip01 Head",
  4992. "Jyouhanshin",
  4993. "kousoku_upper",
  4994. "_ROOT_",
  4995. "Uwagi",
  4996. "kousoku_lower",
  4997. "_ROOT_",
  4998. "Kahanshin",
  4999. "seieki_naka",
  5000. "_ROOT_",
  5001. "Uwagi",
  5002. "seieki_hara",
  5003. "_ROOT_",
  5004. "Uwagi",
  5005. "seieki_face",
  5006. "_ROOT_",
  5007. "Uwagi",
  5008. "seieki_mune",
  5009. "_ROOT_",
  5010. "Uwagi",
  5011. "seieki_hip",
  5012. "_ROOT_",
  5013. "Uwagi",
  5014. "seieki_ude",
  5015. "_ROOT_",
  5016. "Uwagi",
  5017. "seieki_ashi",
  5018. "_ROOT_",
  5019. "Uwagi",
  5020. "accNipL",
  5021. "_ROOT_",
  5022. "Uwagi",
  5023. "accMiMiL",
  5024. "Bip01 Head",
  5025. "Jyouhanshin",
  5026. "accKamiSubL",
  5027. "Bip01 Head",
  5028. "Jyouhanshin",
  5029. "accKami_2_",
  5030. "Bip01 Head",
  5031. "Jyouhanshin",
  5032. "accKami_3_",
  5033. "Bip01 Head",
  5034. "Jyouhanshin",
  5035. "HandItemL",
  5036. "_IK_handL",
  5037. "Uwagi",
  5038. "underhair",
  5039. "_ROOT_",
  5040. "Kahanshin",
  5041. "asshair",
  5042. "_ROOT_",
  5043. "Kahanshin",
  5044. "moza",
  5045. "_ROOT_",
  5046. "Kahanshin",
  5047. "end"
  5048. };
  5049. private static readonly string[] m_multiSlot = new string[]
  5050. {
  5051. "hairT",
  5052. "hairT_2",
  5053. "hairS",
  5054. "hairS_2",
  5055. "hairAho",
  5056. "headset",
  5057. "glove",
  5058. "accHead",
  5059. "accHead_2",
  5060. "accHana",
  5061. "accKami_1_",
  5062. "accMiMiR",
  5063. "accKamiSubR",
  5064. "accNipR",
  5065. "accKubi",
  5066. "accKubiwa",
  5067. "accHeso",
  5068. "accUde",
  5069. "accUde_2",
  5070. "accAshi",
  5071. "accAshi_2",
  5072. "accSenaka",
  5073. "accShippo",
  5074. "accKoshi",
  5075. "accVag",
  5076. "kubiwa",
  5077. "megane",
  5078. "accxxx",
  5079. "accFace",
  5080. "accHat",
  5081. "accNipL",
  5082. "accMiMiL",
  5083. "accKamiSubL",
  5084. "accKami_2_",
  5085. "accKami_3_"
  5086. };
  5087. private static readonly TBody.SlotID[] m_chikubiStateSlot = new TBody.SlotID[]
  5088. {
  5089. TBody.SlotID.wear,
  5090. TBody.SlotID.onepiece,
  5091. TBody.SlotID.mizugi_top,
  5092. TBody.SlotID.mizugi,
  5093. TBody.SlotID.bra,
  5094. TBody.SlotID.slip,
  5095. TBody.SlotID.accSenaka
  5096. };
  5097. private string[] m_strSlotName;
  5098. private string[] m_strSlotNameCRC;
  5099. private static int strSlotNameItemCnt = 3;
  5100. public static Hashtable hashSlotName;
  5101. private static HashSet<int> NoAlphaIdxSet = null;
  5102. public TBodySkin Face;
  5103. public BoneMorph_ bonemorph;
  5104. public Transform trsEyeL;
  5105. public Transform trsEyeR;
  5106. public Quaternion quaDefEyeL;
  5107. public Quaternion quaDefEyeR;
  5108. private Vector3 EyeEulerAngle;
  5109. public float ManAlpha = 1f;
  5110. public string LastAnimeFN;
  5111. private bool IsAnimationChange;
  5112. private bool IsMotionScriptChange;
  5113. private string LastMSName = string.Empty;
  5114. private string LastMSLabelName = string.Empty;
  5115. public Maid maid;
  5116. public static bool boMoveMomoniku = true;
  5117. public bool boAutoTwistShoulderL = true;
  5118. public bool boAutoTwistShoulderR = true;
  5119. public bool boAutoTwistWristL = true;
  5120. public bool boAutoTwistWristR = true;
  5121. public bool boAutoTwistThighL = true;
  5122. public bool boAutoTwistThighR = true;
  5123. public Dictionary<string, float> m_MorphBlendValues = new Dictionary<string, float>();
  5124. public Transform m_trHandHitL;
  5125. public Transform m_trHandHitR;
  5126. public Transform m_trHandLeapHitL;
  5127. public Transform m_trHandLeapHitR;
  5128. public float m_fHitLimitDistanceMin = 0.01f;
  5129. public float m_fHitLimitDistanceMax = 0.04f;
  5130. public float m_fHitCenterZMin = -0.3f;
  5131. public float m_fHitCenterZMax;
  5132. public float m_fHitRadiusMin = 0.1f;
  5133. public float m_fHitRadiusMax = 0.32f;
  5134. public bool m_bNewPhyscs = true;
  5135. public bool m_bNewSkirtPhyscs = true;
  5136. private Transform m_trsMuneL;
  5137. private Transform m_trsMuneR;
  5138. private Transform m_trsMuneLsub;
  5139. private Transform m_trsMuneRsub;
  5140. private Transform m_trHitParentL;
  5141. private Transform m_trHitParentR;
  5142. private Transform m_trHitChildL;
  5143. private Transform m_trHitChildR;
  5144. private SphereCollider m_HitChildColliderL;
  5145. private SphereCollider m_HitChildColliderR;
  5146. private bool m_bManMeshHide;
  5147. public bool m_drawBodyHitSphere;
  5148. public float m_editYorime;
  5149. public float m_editEyeRotX;
  5150. private int m_bodyVer;
  5151. private bool m_IsCrcBodyImported;
  5152. private PermTempAction<string, float> OnBoneMorphApply = new PermTempAction<string, float>();
  5153. private PermTempAction<string, float> OnVertexMorphApply = new PermTempAction<string, float>();
  5154. public static int SUB_SLOT_NO = 5;
  5155. private Dictionary<string, TBody.TexLay.Mat> m_dicLaySlot = new Dictionary<string, TBody.TexLay.Mat>();
  5156. private TBody.MaskMode m_eMaskMode;
  5157. private Hashtable m_hFoceHide = new Hashtable();
  5158. private bool m_bNoHandL;
  5159. private bool m_bNoHandR;
  5160. public GameObject m_chinkoTargetObj;
  5161. public float fDegPer = 31.1f;
  5162. public float fDegPer1 = 0.2f;
  5163. public float fRota = 0.5f;
  5164. public class Slot
  5165. {
  5166. public TBodySkin this[int i]
  5167. {
  5168. get
  5169. {
  5170. return this.m_slots[i][0];
  5171. }
  5172. private set
  5173. {
  5174. this.m_slots[i][0] = value;
  5175. }
  5176. }
  5177. public TBodySkin this[int i, int j]
  5178. {
  5179. get
  5180. {
  5181. if (j == -1)
  5182. {
  5183. j = 0;
  5184. }
  5185. return this.m_slots[i][j];
  5186. }
  5187. private set
  5188. {
  5189. if (j == -1)
  5190. {
  5191. j = 0;
  5192. }
  5193. this.m_slots[i][j] = value;
  5194. }
  5195. }
  5196. public List<TBodySkin> GetListParents()
  5197. {
  5198. return (from a in this.m_slots
  5199. select a[0]).ToList<TBodySkin>();
  5200. }
  5201. public int Count
  5202. {
  5203. get
  5204. {
  5205. return this.m_slots.Count;
  5206. }
  5207. }
  5208. public int CountChildren(int slotNo)
  5209. {
  5210. return this.m_slots[slotNo].Count;
  5211. }
  5212. public bool HasChildren(int slotNo)
  5213. {
  5214. return 1 < this.CountChildren(slotNo);
  5215. }
  5216. public void Add(TBodySkin bodySkin)
  5217. {
  5218. this.m_slots.Add(new List<TBodySkin>
  5219. {
  5220. bodySkin
  5221. });
  5222. }
  5223. public void AddChild(int i, TBodySkin bodySkin)
  5224. {
  5225. this.m_slots[i].Add(bodySkin);
  5226. }
  5227. public void DeleteObjAll()
  5228. {
  5229. int num = this.m_slots.Count - 1;
  5230. while (0 <= num)
  5231. {
  5232. int num2 = this.m_slots[num].Count - 1;
  5233. while (0 <= num2)
  5234. {
  5235. if (this.m_slots[num][num2] != null)
  5236. {
  5237. this.m_slots[num][num2].DeleteObj(false);
  5238. }
  5239. num2--;
  5240. }
  5241. num--;
  5242. }
  5243. }
  5244. private List<List<TBodySkin>> m_slots = new List<List<TBodySkin>>();
  5245. }
  5246. public class IKCMO
  5247. {
  5248. public void Init(Transform hip, Transform knee, Transform ankle, TBody b)
  5249. {
  5250. this.body = b;
  5251. this.defLEN1 = (hip.position - knee.position).magnitude;
  5252. this.defLEN2 = (ankle.position - knee.position).magnitude;
  5253. this.knee_old = knee.position;
  5254. this.defHipQ = hip.localRotation;
  5255. this.defKneeQ = knee.localRotation;
  5256. this.vechand = Vector3.zero;
  5257. }
  5258. public void Porc(Transform hip, Transform knee, Transform ankle, Vector3 tgt, Vector3 vechand_offset, AIKCtrl ik_data)
  5259. {
  5260. tgt += this.vechand;
  5261. if (ik_data.pointIKData.isBlendNow)
  5262. {
  5263. if (ik_data.pointIKData.blendType == AIKCtrl.IKBlendType.IK_To_Detach)
  5264. {
  5265. tgt = Vector3.Lerp(tgt, ik_data.constraintTarget.position, ik_data.pointIKData.blendWeight);
  5266. }
  5267. else
  5268. {
  5269. tgt = Vector3.Lerp(ik_data.GetBlendBasePos(), tgt, ik_data.pointIKData.blendWeight);
  5270. }
  5271. }
  5272. if ((knee.position - this.knee_old).sqrMagnitude > 1f)
  5273. {
  5274. this.knee_old = knee.position;
  5275. }
  5276. this.knee_old = this.knee_old * 0.5f + knee.position * 0.5f;
  5277. Vector3 normalized = (this.knee_old - tgt).normalized;
  5278. this.knee_old = tgt + normalized * this.defLEN2;
  5279. Vector3 normalized2 = (this.knee_old - hip.position).normalized;
  5280. this.knee_old = hip.position + normalized2 * this.defLEN1;
  5281. if (!this.body.boMAN)
  5282. {
  5283. Vector3 zero = Vector3.zero;
  5284. bool flag = this.body.goSlot[0].bonehair.bodyhit.SphereMove_hair(ref this.knee_old, ref zero, Vector3.zero);
  5285. if (flag)
  5286. {
  5287. Debug.DrawLine(this.body.Spine0a.position, this.knee_old, Color.white);
  5288. }
  5289. }
  5290. default(Quaternion).SetLookRotation(normalized2);
  5291. hip.localRotation = this.defHipQ;
  5292. hip.transform.rotation = Quaternion.FromToRotation(knee.transform.position - hip.transform.position, this.knee_old - hip.transform.position) * hip.transform.rotation;
  5293. knee.localRotation = this.defKneeQ;
  5294. knee.transform.rotation = Quaternion.FromToRotation(ankle.transform.position - knee.transform.position, tgt - knee.transform.position) * knee.transform.rotation;
  5295. Debug.DrawLine(hip.position, this.knee_old, Color.yellow);
  5296. Debug.DrawLine(ankle.position, this.knee_old, Color.yellow);
  5297. this.vechand = ankle.rotation * vechand_offset;
  5298. }
  5299. private TBody body;
  5300. private float defLEN1;
  5301. private float defLEN2;
  5302. private Vector3 knee_old;
  5303. private Quaternion defHipQ;
  5304. private Quaternion defKneeQ;
  5305. private Vector3 vechand;
  5306. }
  5307. public enum ModeHirR
  5308. {
  5309. Normal,
  5310. NoFront
  5311. }
  5312. public enum SlotID
  5313. {
  5314. body,
  5315. head,
  5316. eye,
  5317. hairF,
  5318. hairR,
  5319. hairS,
  5320. hairS_2,
  5321. hairT,
  5322. hairT_2,
  5323. wear,
  5324. skirt,
  5325. onepiece,
  5326. mizugi,
  5327. mizugi_top,
  5328. mizugi_buttom,
  5329. panz,
  5330. slip,
  5331. bra,
  5332. stkg,
  5333. shoes,
  5334. headset,
  5335. glove,
  5336. accHead,
  5337. accHead_2,
  5338. hairAho,
  5339. accHana,
  5340. accHa,
  5341. accKami_1_,
  5342. accMiMiR,
  5343. accKamiSubR,
  5344. accNipR,
  5345. HandItemR,
  5346. accKubi,
  5347. accKubiwa,
  5348. accHeso,
  5349. accUde,
  5350. accUde_2,
  5351. accAshi,
  5352. accAshi_2,
  5353. accSenaka,
  5354. accShippo,
  5355. accKoshi,
  5356. accAnl,
  5357. accVag,
  5358. kubiwa,
  5359. megane,
  5360. accXXX,
  5361. chinko,
  5362. chikubi,
  5363. accFace,
  5364. accHat,
  5365. kousoku_upper,
  5366. kousoku_lower,
  5367. seieki_naka,
  5368. seieki_hara,
  5369. seieki_face,
  5370. seieki_mune,
  5371. seieki_hip,
  5372. seieki_ude,
  5373. seieki_ashi,
  5374. accNipL,
  5375. accMiMiL,
  5376. accKamiSubL,
  5377. accKami_2_,
  5378. accKami_3_,
  5379. HandItemL,
  5380. underhair,
  5381. asshair,
  5382. moza,
  5383. end
  5384. }
  5385. public class TexLay
  5386. {
  5387. public class LaySet
  5388. {
  5389. public void Remove()
  5390. {
  5391. UnityEngine.Object.Destroy(this.tex);
  5392. this.tex = null;
  5393. }
  5394. public int nLayerNo;
  5395. public bool bNoTransfrom;
  5396. public int nX;
  5397. public int nY;
  5398. public float fRot;
  5399. public float fScale;
  5400. public int nTargetBodyTexSize;
  5401. public Texture tex;
  5402. public GameUty.SystemMaterial mode;
  5403. public float fAlpha = 1f;
  5404. public SubProp sprop;
  5405. }
  5406. public class OrderTex
  5407. {
  5408. public void SortLaySet()
  5409. {
  5410. this.listLaySet.Sort(delegate(TBody.TexLay.LaySet x, TBody.TexLay.LaySet y)
  5411. {
  5412. if (x.nLayerNo < y.nLayerNo)
  5413. {
  5414. return -1;
  5415. }
  5416. if (x.nLayerNo > y.nLayerNo)
  5417. {
  5418. return 1;
  5419. }
  5420. return 0;
  5421. });
  5422. }
  5423. public void Remove()
  5424. {
  5425. UnityEngine.Object.Destroy(this.tex);
  5426. this.tex = null;
  5427. this.RemoveLaySet();
  5428. }
  5429. public void RemoveLaySet()
  5430. {
  5431. for (int i = 0; i < this.listLaySet.Count; i++)
  5432. {
  5433. this.listLaySet[i].Remove();
  5434. }
  5435. this.listLaySet.Clear();
  5436. }
  5437. public int nLayerNo;
  5438. public Texture2D texBack;
  5439. public Texture2D tex;
  5440. public GameUty.SystemMaterial mode;
  5441. public List<TBody.TexLay.LaySet> listLaySet = new List<TBody.TexLay.LaySet>();
  5442. }
  5443. public class Lay
  5444. {
  5445. public Lay(Texture f_texBack)
  5446. {
  5447. this.rtBase = new RenderTexture(f_texBack.width, f_texBack.height, 0);
  5448. this.texBack = f_texBack;
  5449. this.rtBase.name = "rt:src:" + f_texBack.name;
  5450. RenderTexture active = RenderTexture.active;
  5451. Graphics.Blit(this.texBack, this.rtBase);
  5452. RenderTexture.active = active;
  5453. }
  5454. public void Sort()
  5455. {
  5456. this.listLayer.Sort(delegate(TBody.TexLay.OrderTex x, TBody.TexLay.OrderTex y)
  5457. {
  5458. if (x.nLayerNo < y.nLayerNo)
  5459. {
  5460. return -1;
  5461. }
  5462. if (x.nLayerNo > y.nLayerNo)
  5463. {
  5464. return 1;
  5465. }
  5466. return 0;
  5467. });
  5468. }
  5469. public void Remove(int f_nLayNo = -1)
  5470. {
  5471. if (f_nLayNo == -1)
  5472. {
  5473. for (int i = 0; i < this.listLayer.Count; i++)
  5474. {
  5475. this.listLayer[i].Remove();
  5476. }
  5477. this.listLayer.Clear();
  5478. }
  5479. else
  5480. {
  5481. TBody.TexLay.OrderTex[] array = (from ot in this.listLayer
  5482. where ot.nLayerNo == f_nLayNo
  5483. select ot).ToArray<TBody.TexLay.OrderTex>();
  5484. for (int j = 0; j < array.Length; j++)
  5485. {
  5486. if (this.listLayer[j].nLayerNo == f_nLayNo)
  5487. {
  5488. this.listLayer[j].Remove();
  5489. }
  5490. }
  5491. this.listLayer.RemoveAll((TBody.TexLay.OrderTex ot) => ot.nLayerNo == f_nLayNo);
  5492. }
  5493. if (this.listLayer.Count == 0 && this.rtBase != null)
  5494. {
  5495. UnityEngine.Object.DestroyImmediate(this.rtBase);
  5496. this.rtBase = null;
  5497. }
  5498. }
  5499. public bool Reset()
  5500. {
  5501. bool result = false;
  5502. if (!this.rtBase.IsCreated())
  5503. {
  5504. Debug.Log("画面リサイズによる、テクスチャレイヤーRTの再生成");
  5505. this.rtBase.Create();
  5506. RenderTexture active = RenderTexture.active;
  5507. Graphics.Blit(this.texBack, this.rtBase);
  5508. RenderTexture.active = active;
  5509. result = true;
  5510. }
  5511. return result;
  5512. }
  5513. public Texture texBack;
  5514. public RenderTexture rtBase;
  5515. public List<TBody.TexLay.OrderTex> listLayer = new List<TBody.TexLay.OrderTex>();
  5516. public bool bDel;
  5517. }
  5518. public class Prop
  5519. {
  5520. public void Remove()
  5521. {
  5522. foreach (KeyValuePair<string, TBody.TexLay.Lay> keyValuePair in this.dicLayInProp)
  5523. {
  5524. keyValuePair.Value.Remove(-1);
  5525. }
  5526. this.dicLayInProp.Clear();
  5527. }
  5528. public bool Reset()
  5529. {
  5530. bool flag = false;
  5531. foreach (KeyValuePair<string, TBody.TexLay.Lay> keyValuePair in this.dicLayInProp)
  5532. {
  5533. flag |= keyValuePair.Value.Reset();
  5534. }
  5535. return flag;
  5536. }
  5537. public Dictionary<string, TBody.TexLay.Lay> dicLayInProp = new Dictionary<string, TBody.TexLay.Lay>();
  5538. }
  5539. public class Mat
  5540. {
  5541. public void Remove()
  5542. {
  5543. foreach (KeyValuePair<int, TBody.TexLay.Prop> keyValuePair in this.dicPropInMat)
  5544. {
  5545. keyValuePair.Value.Remove();
  5546. }
  5547. this.dicPropInMat.Clear();
  5548. }
  5549. public bool Reset()
  5550. {
  5551. bool flag = false;
  5552. foreach (KeyValuePair<int, TBody.TexLay.Prop> keyValuePair in this.dicPropInMat)
  5553. {
  5554. flag |= keyValuePair.Value.Reset();
  5555. }
  5556. return flag;
  5557. }
  5558. public Dictionary<int, TBody.TexLay.Prop> dicPropInMat = new Dictionary<int, TBody.TexLay.Prop>();
  5559. }
  5560. }
  5561. public enum MaskMode
  5562. {
  5563. None,
  5564. Underwear,
  5565. Swim,
  5566. Nude
  5567. }
  5568. }