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