12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986 |
- 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;
- 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;
- }
- if (this.m_IKCtrl.IsSelfIKAttach || this.m_IKCtrl.IsTargetIKAttachSelf(true))
- {
- 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_IKCtrl.IKUpdate();
- if (!this.m_IKCtrl.IsUpdateLate)
- {
- this.AutoTwist();
- for (int j = 0; j < this.goSlot.Count; j++)
- {
- if (this.goSlot[j].obj != null)
- {
- this.goSlot[j].CopyTrans();
- }
- this.goSlot[j].Update();
- }
- }
- this.LateUpdateEnd = true;
- if (this.OnLateUpdateEnd != null)
- {
- this.OnLateUpdateEnd();
- }
- this.OnLateUpdateEnd = null;
- }
- 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;
- 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
- }
- }
|