1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using UnityEngine;
- 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 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 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_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;
- 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);
- 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.IKHandL.SetKinematicTgt(this.HandL, 3);
- this.IKHandL.IkCmoInit(this);
- if (!this.StrIKDataPair.ContainsKey("左手"))
- {
- this.StrIKDataPair.Add("左手", this.IKHandL);
- }
- this.IKHandR.SetKinematicTgt(this.HandR, 3);
- this.IKHandR.IkCmoInit(this);
- if (!this.StrIKDataPair.ContainsKey("右手"))
- {
- this.StrIKDataPair.Add("右手", this.IKHandR);
- }
- 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);
- this.vecChinkoOffset = this.trManChinko.transform.localPosition;
- }
- 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);
- 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>();
- }
- Transform transform = (!this.m_trsMuneLsub) ? CMT.SearchObjName(this.m_trBones, "Mune_L_sub", true) : this.m_trsMuneLsub;
- Transform transform2 = (!this.m_trsMuneRsub) ? CMT.SearchObjName(this.m_trBones, "Mune_R_sub", true) : this.m_trsMuneRsub;
- this.IKMuneL.CreateAttachPointObj("_IK_nippleL", transform, this, "body", "乳首左");
- this.IKMuneR.CreateAttachPointObj("_IK_nippleR", transform2, this, "body", "乳首右");
- this.IKMuneL.SetKinematicTgt(transform, 2);
- this.IKMuneR.SetKinematicTgt(transform2, 2);
- if (!this.StrIKDataPair.ContainsKey("左胸"))
- {
- this.StrIKDataPair.Add("左胸", this.IKMuneL);
- }
- if (!this.StrIKDataPair.ContainsKey("右胸"))
- {
- this.StrIKDataPair.Add("右胸", this.IKMuneR);
- }
- 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)
- {
- 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);
- 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 == "MayuY")
- {
- this.bonemorph.POS_MayuY = f;
- }
- if (tag == "EyeClose")
- {
- this.goSlot[1].morph.m_fEyeCloseRate = f;
- }
- if (tag == "FaceShape")
- {
- this.goSlot[1].morph.m_fFaceShapeRate = 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;
- }
- textureResource = new TextureResource(2, 2, TextureFormat.ARGB32, null, dicModTexData[filename]);
- }
- 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_4AE;
- }
- 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_4AE:;
- }
- }
- 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)
- {
- this.m_eMaskMode = f_eMode;
- 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"];
- }
- 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)
- {
- 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()
- {
- 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.IKHandL.IKExec(this.goSlot);
- this.IKHandR.IKExec(this.goSlot);
- this.MoveMomoniku();
- this.AutoTwist();
- if (!this.boMAN)
- {
- this.IKMuneL.SyncAttachPoint();
- this.IKMuneR.SyncAttachPoint();
- this.jbMuneL.LateUpdateSelf();
- this.jbMuneR.LateUpdateSelf();
- this.IKMuneL.IKExec(this.goSlot);
- this.IKMuneR.IKExec(this.goSlot);
- }
- if (this.boMAN && this.trManChinko != null)
- {
- this.trManChinko.localPosition = this.vecChinkoOffset;
- }
- for (int i = 0; i < this.goSlot.Count; i++)
- {
- if (this.goSlot[i].obj != null)
- {
- this.goSlot[i].CopyTrans();
- }
- }
- 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;
- }
- for (int j = 0; j < this.goSlot.Count; j++)
- {
- this.goSlot[j].Update();
- }
- 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;
- }
- }
- 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 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;
- public IKMgrData IKHandL = new IKMgrData();
- public IKMgrData IKHandR = new IKMgrData();
- public IKMgrData IKMuneL = new IKMgrData();
- public IKMgrData IKMuneR = new IKMgrData();
- public Dictionary<string, IKMgrData> StrIKDataPair = new Dictionary<string, IKMgrData>();
- 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;
- 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 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)
- {
- tgt += this.vechand;
- 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
- }
- }
|