123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Text.RegularExpressions;
- using UnityEngine;
- public class TBodySkin
- {
- public TBodySkin(TBody body_, string cate_, TBody.SlotID slot_id_, bool man, int subNo = 0)
- {
- this.boVisible = true;
- this.crcPartHideVisible = true;
- this.body = body_;
- this.Category = cate_;
- this.SlotId = slot_id_;
- this.m_bMan = man;
- this.m_subNo = subNo;
- this.m_trMaid = this.body.maid.transform;
- this.m_trMaidOffs = this.body.maid.m_goOffset.transform;
- this.MaterialMgr = new MaterialMgr(this);
- this.dbManager = new DynamicBoneMgr(body_, this);
- this.bonehair = new TBoneHair_(this);
- this.TextureCache = new InfinityColorTextureCache(body_.maid);
- this.bonehair2 = new BoneHair2(this);
- this.bonehair3 = new BoneHair3(this);
- this.m_HairLengthCtrl = new TBodySkin.HairLengthCtrl(this);
- }
- public void AddRtMaterial(Material f_mat)
- {
- this.m_listRtMaterial.Add(f_mat);
- }
- public DynamicBoneMgr dbManager { get; private set; }
- public int PartsVersion
- {
- get
- {
- return this.m_partsVersion;
- }
- }
- public KupaCtrl kupaCtrl { get; private set; }
- public MaterialMgr MaterialMgr { get; private set; }
- public bool IsCRC
- {
- get
- {
- return this.m_IsCrcImported || 200 <= this.m_partsVersion;
- }
- }
- public TongueCtrl tongueCtrl { get; private set; }
- public void DelItem()
- {
- if (this.m_pairSlotIds != null)
- {
- foreach (TBody.SlotID f_nSlotNo in this.m_pairSlotIds)
- {
- this.body.GetSlot((int)f_nSlotNo, this.m_subNo).DelItem();
- }
- }
- this.DeleteObj(true);
- }
- public void DeleteObj(bool fromDelItem = false)
- {
- this.m_ParentMPN = MPN.null_mpn;
- this.m_mp = null;
- this.RID = 0;
- this.SyojiType = 0;
- this.m_animItem = null;
- this.MaterialMgr.Remove();
- this.m_isHiheel = false;
- this.m_chikubiState = TBodySkin.CHIKUBI_STATE.None;
- if (this.dbManager != null)
- {
- this.dbManager.UnInit();
- }
- this.body.MulTexRemove(this.Category);
- this.TextureCache.RemoveTexture();
- this.m_listManAlphaMat.Clear();
- this.m_HairLengthCtrl.NotExistThenClearHairLength();
- this.listTrs = null;
- this.listTrsScr = null;
- foreach (UnityEngine.Object @object in this.listDEL)
- {
- UnityEngine.Object.DestroyImmediate(@object);
- }
- this.listDEL = new List<UnityEngine.Object>();
- this.boMizugi = false;
- if (this.morph != null)
- {
- this.morph.DeleteObj();
- this.morph = null;
- }
- if (this.IsCRC && this.SlotId != TBody.SlotID.body)
- {
- this.body.RemoveBaseBlendValue(this.SlotId);
- }
- this.boVisible = false;
- this.crcPartHideVisible = false;
- this.listMaskSlot = new List<int>();
- this.m_dicBackupShader.Clear();
- if (this.bonehair != null)
- {
- this.bonehair.Init();
- }
- if (this.bonehair2 != null)
- {
- this.bonehair2.Uninit();
- }
- if (this.bonehair3 != null)
- {
- this.bonehair3.Uninit();
- }
- if (this.obj != null)
- {
- this.obj_tr.parent = null;
- UnityEngine.Object.DestroyImmediate(this.obj);
- this.obj = null;
- this.obj_tr = null;
- }
- if (this.m_myBoneMorphs != null)
- {
- this.m_myBoneMorphs = null;
- }
- this.m_dicDelNodeParts.Clear();
- if (this.m_goCenter != null)
- {
- UnityEngine.Object.Destroy(this.m_goCenter);
- this.m_goCenter = null;
- }
- if (this.m_copyRoot != null)
- {
- UnityEngine.Object.Destroy(this.m_copyRoot[0].Item2.gameObject);
- this.m_copyRoot = null;
- }
- if (this.m_copyObjTr != null)
- {
- UnityEngine.Object.Destroy(this.m_copyObjTr);
- this.m_copyObjTr = null;
- }
- this.m_NewAttachRealSlot = TBody.SlotID.end;
- this.m_dicParam.Clear();
- this.m_dicParam2.Clear();
- this.m_OriVert.Clear();
- this.m_ParentMPN = MPN.null_mpn;
- this.m_mp = null;
- this.m_bHitFloorY = true;
- this.kupaCtrl = null;
- if (!string.IsNullOrEmpty(this.m_AttachName))
- {
- TMorphSkin tmorphSkin = this.body.GetSlot(this.m_AttachSlotIdx, this.m_AttachSlotSubIdx).morph as TMorphSkin;
- if (tmorphSkin != null)
- {
- tmorphSkin.RemoveNewAttachPoint(this.m_AttachName);
- }
- }
- this.m_attachType = TBodySkin.ATTACH_TYPE.NONE;
- this.m_trsBoneAttach = null;
- this.m_BackAttachName = (this.m_AttachName = null);
- this.m_BackAttachSlotIdx = (this.m_AttachSlotIdx = 0);
- this.m_BackAttachSlotSubIdx = (this.m_AttachSlotSubIdx = 0);
- this.m_boneAttachEdited = false;
- this.m_savedAttachPos = null;
- this.m_BackBones = null;
- if (this.attachPosObj != null)
- {
- UnityEngine.Object.Destroy(this.attachPosObj);
- }
- if (this.IsCRC)
- {
- if (this.m_pairSlotIds != null)
- {
- if (!fromDelItem)
- {
- foreach (TBody.SlotID f_nSlotNo in this.m_pairSlotIds)
- {
- this.body.GetSlot((int)f_nSlotNo, this.m_subNo).DeleteObj(false);
- }
- }
- this.m_pairSlotIds = null;
- }
- this.m_dicDelNodeBody.Clear();
- }
- this.m_partsVersion = 0;
- this.m_IsCrcImported = false;
- }
- public void NewParamSet(string A)
- {
- string[] stringList = UTY.GetStringList(A);
- string key = stringList[1];
- int num = (stringList.Length - 2) / 2;
- KeyValuePair<float, string>[] array = new KeyValuePair<float, string>[num];
- for (int i = 0; i < num; i++)
- {
- string value = stringList[3 + i * 2];
- float key2 = float.Parse(stringList[2 + i * 2]);
- array[i] = new KeyValuePair<float, string>(key2, value);
- }
- this.dicParamSet[key] = array;
- }
- public void SetParam(string f_strTag, string f_strValue)
- {
- if (this.m_dicParam.ContainsKey(f_strTag))
- {
- this.m_dicParam[f_strTag] = f_strValue;
- }
- else
- {
- this.m_dicParam.Add(f_strTag, f_strValue);
- }
- }
- public string GetParam(string f_strTag)
- {
- string empty;
- this.m_dicParam.TryGetValue(f_strTag, out empty);
- if (empty == null)
- {
- empty = string.Empty;
- }
- return empty;
- }
- public void SetParam2(string f_strTag, string f_strValue)
- {
- if (this.m_dicParam2.ContainsKey(f_strTag))
- {
- this.m_dicParam2[f_strTag] = f_strValue;
- }
- else
- {
- this.m_dicParam2.Add(f_strTag, f_strValue);
- }
- }
- public string GetParam2(string f_strTag)
- {
- string empty;
- this.m_dicParam2.TryGetValue(f_strTag, out empty);
- if (empty == null)
- {
- empty = string.Empty;
- }
- return empty;
- }
- public void SetMaterialProperty(MPN f_SrcMpn, int f_nMatNo, string f_strPropName, string f_strTypeName, string f_strValue, bool f_bEditSave)
- {
- if (this.obj == null)
- {
- return;
- }
- foreach (Transform transform in this.obj.transform.GetComponentsInChildren<Transform>(true))
- {
- Renderer component = transform.GetComponent<Renderer>();
- if (component != null && component.material != null && f_nMatNo < component.materials.Length)
- {
- Material material = component.materials[f_nMatNo];
- if (f_strTypeName == "DEFINE")
- {
- if (f_strValue == "0")
- {
- material.DisableKeyword(f_strPropName);
- }
- else if (f_strValue == "1")
- {
- material.EnableKeyword(f_strPropName);
- }
- }
- else if (material.HasProperty(f_strPropName))
- {
- if (f_strTypeName == "Color")
- {
- string[] array = f_strValue.Split(new char[]
- {
- ':'
- });
- material.SetColor(f_strPropName, new Color(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]), float.Parse(array[3])));
- }
- else
- {
- material.SetFloat(f_strPropName, float.Parse(f_strValue));
- }
- if (f_bEditSave)
- {
- this.body.maid.SetMaterialProperty(f_SrcMpn, this.SlotId, f_nMatNo, f_strPropName, f_strTypeName, f_strValue);
- }
- else
- {
- MatPropSave materialProperty = this.body.maid.GetMaterialProperty(f_SrcMpn, this.SlotId);
- if (materialProperty != null)
- {
- this.SetMaterialProperty(f_SrcMpn, materialProperty.nMatNo, materialProperty.strPropName, materialProperty.strTypeName, materialProperty.strValue, true);
- }
- }
- }
- else
- {
- Debug.LogError(f_strPropName + "はありませんでした。");
- }
- }
- }
- }
- public string GetMaterialProperty(int f_nMatNo, string f_strPropName, string f_strType = "AUTO")
- {
- if (this.obj == null)
- {
- return string.Empty;
- }
- Transform[] componentsInChildren = this.obj.transform.GetComponentsInChildren<Transform>(true);
- int i = 0;
- while (i < componentsInChildren.Length)
- {
- Transform transform = componentsInChildren[i];
- Renderer component = transform.GetComponent<Renderer>();
- if (component != null && component.material != null && f_nMatNo < component.materials.Length)
- {
- Material material = component.materials[f_nMatNo];
- if (f_strType == "DEFINE")
- {
- return (!material.IsKeywordEnabled(f_strPropName)) ? "0" : "1";
- }
- if (f_strType == "Color")
- {
- Color color = material.GetColor(f_strPropName);
- return string.Concat(new string[]
- {
- color.r.ToString(),
- ":",
- color.g.ToString(),
- ":",
- color.b.ToString(),
- ":",
- color.a.ToString()
- });
- }
- return material.GetFloat(f_strPropName).ToString();
- }
- else
- {
- i++;
- }
- }
- return string.Empty;
- }
- public void ChangeShader(int f_nMatNo, string f_strShaderFileName)
- {
- this.ChangeShader(f_nMatNo, Resources.Load<Shader>("Shaders/" + f_strShaderFileName));
- }
- private void ChangeShader(int f_nMatNo, Shader f_shader)
- {
- GameObject gameObject = this.obj;
- if (gameObject == null)
- {
- return;
- }
- foreach (Transform transform in gameObject.transform.GetComponentsInChildren<Transform>(true))
- {
- Renderer component = transform.GetComponent<Renderer>();
- if (component != null && component.material != null && f_nMatNo < component.materials.Length)
- {
- if (!this.m_dicBackupShader.ContainsKey(f_nMatNo))
- {
- this.m_dicBackupShader[f_nMatNo] = component.materials[f_nMatNo].shader;
- }
- Material material = component.materials[f_nMatNo];
- int renderQueue = material.renderQueue;
- material.shader = f_shader;
- material.renderQueue = renderQueue;
- }
- }
- }
- public void RestoreShader()
- {
- foreach (KeyValuePair<int, Shader> keyValuePair in this.m_dicBackupShader)
- {
- this.ChangeShader(keyValuePair.Key, keyValuePair.Value);
- }
- this.m_dicBackupShader.Clear();
- }
- public float MayuThick
- {
- set
- {
- if (!this.m_bMan && this.SlotId == TBody.SlotID.head && 120 <= this.PartsVersion)
- {
- SkinnedMeshRenderer componentInChildren = this.obj.GetComponentInChildren<SkinnedMeshRenderer>();
- Material material = componentInChildren.materials[3];
- float num = 0.5f * (value - 0.5f) / -0.5f;
- material.SetTextureScale("_MainTex", new Vector2(1f, 1f + num));
- material.SetTextureOffset("_MainTex", new Vector2(0f, -(num / 2f)));
- }
- }
- }
- public bool EnablePartsPosEdit
- {
- get
- {
- return this.m_bEnablePartPosEdit;
- }
- set
- {
- if (this.m_bEnablePartPosEdit == value)
- {
- return;
- }
- if (value)
- {
- BoneAttachPos tbodySkinPos = this.body.maid.GetTBodySkinPos(this.m_ParentMPN, this.SlotId);
- if (tbodySkinPos != null && this.obj_tr != null)
- {
- Vector3 vector = tbodySkinPos.pss.position;
- this.obj_tr.localPosition = vector;
- this.m_vPosLocal = vector;
- Quaternion rotation = tbodySkinPos.pss.rotation;
- this.obj_tr.localRotation = rotation;
- this.m_qRotLocal = rotation;
- vector = tbodySkinPos.pss.scale;
- this.obj_tr.localScale = vector;
- this.m_vScaleRate = vector;
- }
- }
- else if (this.obj_tr != null)
- {
- this.obj_tr.localPosition = this.m_vDefPosLocal;
- this.obj_tr.localRotation = this.m_qDefRotLocal;
- this.obj_tr.localScale = this.m_vDefScaleLocal;
- }
- if (this.center_tr != null)
- {
- this.center_tr.localPosition = this.m_vCenterPosLocal;
- this.center_tr.localRotation = Quaternion.identity;
- this.center_tr.localScale = Vector3.one;
- }
- this.m_bEnablePartPosEdit = value;
- this.body.maid.SetTBodySkinPos(this.m_ParentMPN, this.SlotId, this.m_vPosLocal, this.m_qRotLocal, this.m_vScaleRate, this.m_bEnablePartPosEdit);
- }
- }
- public bool GetAttachObjPointLocal(out Vector3 f_vPosLocal, out Quaternion f_vRotLocal, out Vector3 f_vScaleLocal)
- {
- f_vPosLocal = Vector3.zero;
- f_vRotLocal = Quaternion.identity;
- f_vScaleLocal = Vector3.zero;
- return false;
- }
- public bool SetAttachObjPointLocal(Vector3 f_vPosLocal, Quaternion f_vRotLocal, Vector3 f_vScaleLocal)
- {
- return false;
- }
- public bool CopyAttachObjPoint()
- {
- if (this.center_tr == null || this.obj_tr == null)
- {
- return false;
- }
- this.m_vTempAttachPointPos = this.obj_tr.localPosition;
- this.m_qTempAttachPointRot = this.obj_tr.localRotation;
- this.m_vTempAttachPointScale = this.obj_tr.localScale;
- return true;
- }
- public bool PastAttachObjPoint()
- {
- if (this.center_tr == null || this.obj_tr == null || !this.m_bEnablePartPosEdit)
- {
- return false;
- }
- Vector3 vector = this.m_vTempAttachPointPos;
- this.obj_tr.localPosition = vector;
- this.m_vPosLocal = vector;
- Quaternion qTempAttachPointRot = this.m_qTempAttachPointRot;
- this.obj_tr.localRotation = qTempAttachPointRot;
- this.m_qRotLocal = qTempAttachPointRot;
- vector = this.m_vTempAttachPointScale;
- this.obj_tr.localScale = vector;
- this.m_vScaleRate = vector;
- this.center_tr.localPosition = this.m_vCenterPosLocal;
- this.center_tr.localRotation = Quaternion.identity;
- this.center_tr.localScale = Vector3.one;
- this.body.maid.SetTBodySkinPos(this.m_ParentMPN, this.SlotId, this.m_vPosLocal, this.m_qRotLocal, this.m_vScaleRate, this.m_bEnablePartPosEdit);
- return true;
- }
- public bool GetAttachCenterPointWorld(out Vector3 f_vPosWorld, out Quaternion f_vRotWorld, out Vector3 f_vScaleLocal)
- {
- if (this.center_tr == null)
- {
- f_vPosWorld = Vector3.zero;
- f_vRotWorld = Quaternion.identity;
- f_vScaleLocal = Vector3.zero;
- return false;
- }
- f_vPosWorld = this.center_tr.position;
- f_vRotWorld = this.center_tr.rotation;
- f_vScaleLocal = this.m_vScaleRate;
- return true;
- }
- public bool SetAttachCenterPointWorld(Vector3 f_vPosWorld, Quaternion f_vRotWorld, Vector3 f_vScaleLocal)
- {
- if (this.center_tr == null || !this.m_bEnablePartPosEdit)
- {
- return false;
- }
- Transform parent = this.center_tr.parent;
- Transform parent2 = this.obj_tr.parent;
- this.obj_tr.localPosition = (this.m_vPosLocal = this.m_vDefPosLocal);
- this.obj_tr.localRotation = (this.m_qRotLocal = this.m_qDefRotLocal);
- this.obj_tr.localScale = (this.m_vScaleRate = this.m_vDefScaleLocal);
- this.center_tr.localPosition = this.m_vCenterPosLocal;
- this.center_tr.localRotation = Quaternion.identity;
- this.center_tr.localScale = Vector3.one;
- this.center_tr.SetParent(this.obj_tr.parent, true);
- this.obj_tr.SetParent(this.center_tr, true);
- this.center_tr.position = f_vPosWorld;
- this.center_tr.rotation = f_vRotWorld;
- this.center_tr.localScale = f_vScaleLocal;
- this.obj_tr.SetParent(parent2, true);
- this.center_tr.SetParent(parent, true);
- this.center_tr.localPosition = this.m_vCenterPosLocal;
- this.center_tr.localRotation = Quaternion.identity;
- this.center_tr.localScale = Vector3.one;
- this.m_vPosLocal = this.obj_tr.localPosition;
- this.m_qRotLocal = this.obj_tr.localRotation;
- this.m_vScaleRate = this.obj_tr.localScale;
- this.body.maid.SetTBodySkinPos(this.m_ParentMPN, this.SlotId, this.m_vPosLocal, this.m_qRotLocal, this.m_vScaleRate, this.m_bEnablePartPosEdit);
- return true;
- }
- public bool ResetAttachCenterPoint()
- {
- if (this.center_tr == null)
- {
- return false;
- }
- this.obj_tr.localPosition = (this.m_vPosLocal = this.m_vDefPosLocal);
- this.obj_tr.localRotation = (this.m_qRotLocal = this.m_qDefRotLocal);
- this.obj_tr.localScale = (this.m_vScaleRate = this.m_vDefScaleLocal);
- this.center_tr.localPosition = this.m_vCenterPosLocal;
- this.center_tr.localRotation = Quaternion.identity;
- this.center_tr.localScale = Vector3.one;
- this.body.maid.ClearTBodySkinPos(this.m_ParentMPN, this.SlotId);
- return true;
- }
- public void LoadHitcheckData(Transform body_bone, string fn, int rot, string tag)
- {
- this.LoadHitcheckData(body_bone, fn, rot, tag, false);
- }
- public void LoadHitcheckData(Transform body_bone, string fn, int rot, string tag, bool isNewBody)
- {
- if (isNewBody)
- {
- this.LoadHitcheckData(body_bone, fn + ".hitcheck", rot, tag);
- }
- if (!isNewBody)
- {
- this.bonehair.Init();
- this.bonehair.LoadHitCheck(body_bone, fn + ".hitcheck", rot, tag);
- }
- this.bonehair2.Init();
- this.bonehair3.Init();
- }
- public void Load(MPN mpn, Transform srcbody, Transform body1, Dictionary<string, Transform> trans, string bonename, string filename, string slotname, string AttachSlot, int layer, bool f_bTemp)
- {
- this.Load(mpn, srcbody, body1, trans, bonename, filename, slotname, AttachSlot, 0, string.Empty, layer, f_bTemp, 100, false, null);
- }
- public void Load(MPN mpn, Transform srcbody, Transform body1, Dictionary<string, Transform> trans, string bonename, string filename, string slotname, string AttachSlot, int layer, bool f_bTemp, int version)
- {
- this.Load(mpn, srcbody, body1, trans, bonename, filename, slotname, AttachSlot, 0, string.Empty, layer, f_bTemp, 100, false, null);
- }
- public void Load(MPN mpn, Transform srcbody, Transform body1, Dictionary<string, Transform> trans, string bonename, string filename, string slotname, string AttachSlot, int AttachSubNo, string AttachName, int layer, bool f_bTemp, int version, bool crcImport, TBodySkin.SplitParam splitParam)
- {
- this.DeleteObj(false);
- this.m_partsVersion = version;
- this.m_IsCrcImported = crcImport;
- if (mpn == MPN.accashi || mpn == MPN.shoes)
- {
- this.m_bHitFloorY = false;
- }
- if (mpn == MPN.shoes && filename.ToLower().Contains("_heel"))
- {
- this.m_isHiheel = true;
- }
- this.m_ParentMPN = mpn;
- if (this.m_ParentMPN != MPN.null_mpn)
- {
- this.m_mp = this.body.maid.GetProp(this.m_ParentMPN);
- }
- this.m_bTemp = f_bTemp;
- this.boVisible = true;
- this.crcPartHideVisible = true;
- Vector3 position = srcbody.position;
- Quaternion rotation = srcbody.rotation;
- Vector3 localScale = srcbody.localScale;
- Vector3 position2 = body1.position;
- Quaternion rotation2 = body1.rotation;
- Vector3 localScale2 = body1.localScale;
- srcbody.position = Vector3.zero;
- srcbody.rotation = Quaternion.identity;
- srcbody.localScale = new Vector3(1f / srcbody.lossyScale.x, 1f / srcbody.lossyScale.y, 1f / srcbody.lossyScale.z);
- body1.position = Vector3.zero;
- body1.rotation = Quaternion.identity;
- body1.localScale = new Vector3(1f / body1.lossyScale.x, 1f / body1.lossyScale.y, 1f / body1.lossyScale.z);
- if (this.IsCRC)
- {
- this.morph = new TMorphSkin(this, this.m_bMan);
- }
- else
- {
- this.morph = new TMorph(this);
- }
- GameObject gameObject = ImportCM.LoadSkinMesh_R(filename, this.morph, slotname, this, layer);
- if (this.IsCRC && mpn == MPN.head)
- {
- gameObject.name = "_SM_Face";
- }
- if (this.m_bMan)
- {
- foreach (Transform transform in gameObject.GetComponentsInChildren<Transform>(true))
- {
- Renderer component = transform.GetComponent<Renderer>();
- if (!(component == null) && component.materials != null)
- {
- foreach (Material material in component.materials)
- {
- if (material.shader.name == "CM3D2/Man")
- {
- this.m_listManAlphaMat.Add(material);
- }
- if (material.shader.name == "CM3D2/Mosaic")
- {
- material.SetFloat("_FloatValue1", 15f);
- }
- }
- }
- }
- }
- if (this.m_bMan && Product.isEnglish && !Product.isPublic)
- {
- foreach (Transform transform2 in gameObject.GetComponentsInChildren<Transform>(true))
- {
- Renderer component2 = transform2.GetComponent<Renderer>();
- if (!(component2 == null) && component2.materials != null)
- {
- foreach (Material material2 in component2.materials)
- {
- if (material2.shader.name == "CM3D2/Mosaic")
- {
- material2.shader = Shader.Find("CM3D2/Mosaic_en");
- }
- }
- }
- }
- }
- foreach (Transform transform3 in gameObject.GetComponentsInChildren<Transform>(true))
- {
- Renderer component3 = transform3.GetComponent<Renderer>();
- if (!(component3 == null) && component3.materials != null)
- {
- Material[] materials3 = component3.materials;
- this.MaterialMgr.Init(gameObject, materials3);
- break;
- }
- }
- this.morph.InitGameObject(gameObject);
- if (Product.isEnglish && !Product.isPublic)
- {
- if (mpn == MPN.body)
- {
- this.kupaCtrl = new KupaCtrl(this.body, this.morph);
- }
- else if (mpn == MPN.moza)
- {
- this.body.GetSlot(0).kupaCtrl.AddMozaMorph(this.morph);
- }
- }
- if (this.IsCRC && this.m_bMan && (mpn == MPN.head || mpn == MPN.hairf || mpn == MPN.hairr || mpn == MPN.hairs || mpn == MPN.headset || mpn == MPN.acchat))
- {
- gameObject.transform.localPosition = new Vector3(0f, 0.10818f, 0.00143f);
- }
- gameObject.transform.parent = CMT.SearchObjName(srcbody, bonename, true);
- Vector3 localPosition = gameObject.transform.localPosition;
- Vector3 localScale3 = gameObject.transform.localScale;
- Quaternion localRotation = gameObject.transform.localRotation;
- gameObject.transform.parent = CMT.SearchObjName(body1, bonename, true);
- if (!string.IsNullOrEmpty(AttachSlot))
- {
- this.m_AttachVisible = true;
- }
- if (AttachSlot == "ボーンにアタッチ" && (bonename == "_IK_handR" || bonename == "_IK_handL"))
- {
- localPosition = Vector3.zero;
- localRotation = Quaternion.identity;
- localScale3 = Vector3.one;
- }
- this.m_trsBoneAttach = null;
- this.m_BackAttachName = (this.m_AttachName = null);
- this.m_BackAttachSlotIdx = (this.m_AttachSlotIdx = 0);
- this.m_BackAttachSlotSubIdx = (this.m_AttachSlotSubIdx = 0);
- if (this.IsCRC)
- {
- if (bonename == "_ROOT_")
- {
- this.m_attachType = TBodySkin.ATTACH_TYPE.BONE_ROOT;
- }
- else
- {
- this.m_attachType = TBodySkin.ATTACH_TYPE.BONE_CHILD_DEF;
- }
- if (AttachSlot == "ボーンにアタッチ")
- {
- this.m_attachType = TBodySkin.ATTACH_TYPE.BONE_CHILD_MENU;
- this.m_trsBoneAttach = this.body.m_dicBones[AttachName];
- }
- else if (AttachSlot != string.Empty)
- {
- this.m_attachType = TBodySkin.ATTACH_TYPE.VERTEX;
- this.m_AttachName = AttachName;
- this.m_BackAttachName = AttachName;
- this.m_BackAttachSlotIdx = (this.m_AttachSlotIdx = (int)TBody.hashSlotName[AttachSlot]);
- this.m_AttachSlotSubIdx = AttachSubNo;
- this.m_BackAttachSlotSubIdx = AttachSubNo;
- }
- }
- gameObject.transform.localPosition = localPosition;
- gameObject.transform.localRotation = localRotation;
- gameObject.transform.localScale = localScale3;
- this.obj = gameObject;
- this.obj_tr = this.obj.transform;
- this.listTrs = new List<Transform>(200);
- this.listTrsScr = new List<Transform>(4);
- CMT.BindTrans(this.listTrs, this.listTrsScr, trans, gameObject.transform, this.body.IsCrcBody);
- srcbody.position = position;
- srcbody.rotation = rotation;
- srcbody.localScale = localScale;
- body1.position = position2;
- body1.rotation = rotation2;
- body1.localScale = localScale2;
- if (this.body.m_bNewPhyscs)
- {
- if (!this.dbManager.SetUpGameObject(gameObject, mpn) && !this.bonehair2.InitGameObject(gameObject, mpn))
- {
- bool bNoSkirt = this.bonehair3.InitGameObject(gameObject, mpn);
- if (!this.body.IsCrcBody)
- {
- this.bonehair.SearchGameObj(gameObject, bNoSkirt);
- }
- }
- }
- else if (!this.body.IsCrcBody)
- {
- this.bonehair.SearchGameObj(gameObject, false);
- }
- this.ItemScaleReset();
- this.OnChangeScreenSizeOrAA();
- if (this.m_bMan)
- {
- this.ManColorUpdate();
- }
- if (!this.body.IsCrcBody)
- {
- foreach (KeyValuePair<string, float> keyValuePair in this.m_BonehairBodyhitScaleBackup)
- {
- this.bonehair.bodyhit.ScaleMune(keyValuePair.Key, keyValuePair.Value);
- }
- }
- IEnumerator enumerator2 = this.morph.hash.Keys.GetEnumerator();
- try
- {
- while (enumerator2.MoveNext())
- {
- object obj = enumerator2.Current;
- string key = (string)obj;
- int f_nIdx = (int)this.morph.hash[key];
- float f_fValue;
- if (this.body.m_MorphBlendValues.TryGetValue(key, out f_fValue))
- {
- this.morph.SetBlendValues(f_nIdx, f_fValue);
- }
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator2 as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- this.morph.FixBlendValues();
- this.m_vDefPosLocal = (this.m_vPosLocal = this.obj_tr.localPosition);
- this.m_qDefRotLocal = (this.m_qRotLocal = this.obj_tr.localRotation);
- this.m_vDefScaleLocal = (this.m_vScaleRate = this.obj_tr.localScale);
- if (!this.IsCRC)
- {
- if (!f_bTemp && (this.SlotId == TBody.SlotID.accHat || this.SlotId == TBody.SlotID.headset || this.SlotId == TBody.SlotID.hairT || this.SlotId == TBody.SlotID.accSenaka || this.SlotId == TBody.SlotID.accKubi || this.SlotId == TBody.SlotID.accKubiwa || this.SlotId == TBody.SlotID.accShippo || this.SlotId == TBody.SlotID.accKubiwa))
- {
- SkinnedMeshRenderer componentInChildren = this.obj_tr.GetComponentInChildren<SkinnedMeshRenderer>(true);
- if (componentInChildren != null)
- {
- Bounds bounds = componentInChildren.bounds;
- GameObject gameObject2 = new GameObject("center");
- gameObject2.transform.SetParent(this.obj_tr, false);
- gameObject2.transform.position = bounds.center;
- GameObject gameObject3 = new GameObject("center2");
- gameObject3.transform.SetParent(gameObject2.transform, false);
- gameObject3.transform.position = bounds.center;
- this.m_vCenterPosLocal = gameObject2.transform.localPosition;
- this.center_tr = gameObject2.transform;
- this.center_tr2 = gameObject3.transform;
- BoneAttachPos tbodySkinPos = this.body.maid.GetTBodySkinPos(this.m_ParentMPN, this.SlotId);
- if (tbodySkinPos != null)
- {
- this.m_vPosLocal = tbodySkinPos.pss.position;
- this.m_qRotLocal = tbodySkinPos.pss.rotation;
- this.m_vScaleRate = tbodySkinPos.pss.scale;
- this.m_bEnablePartPosEdit = tbodySkinPos.bEnable;
- if (this.m_bEnablePartPosEdit)
- {
- this.obj_tr.localPosition = tbodySkinPos.pss.position;
- this.obj_tr.localRotation = tbodySkinPos.pss.rotation;
- this.obj_tr.localScale = tbodySkinPos.pss.scale;
- }
- }
- else
- {
- this.body.maid.ClearTBodySkinPos(this.m_ParentMPN, this.SlotId);
- }
- }
- }
- }
- else if (this.SlotId == TBody.SlotID.accHat || this.SlotId == TBody.SlotID.headset || this.SlotId == TBody.SlotID.hairS || this.SlotId == TBody.SlotID.hairS_2 || this.SlotId == TBody.SlotID.hairT || this.SlotId == TBody.SlotID.hairT_2 || this.SlotId == TBody.SlotID.hairAho || this.SlotId == TBody.SlotID.accKubiwa || this.SlotId == TBody.SlotID.accKami_1_ || this.SlotId == TBody.SlotID.accKami_2_ || this.SlotId == TBody.SlotID.accKami_3_ || this.SlotId == TBody.SlotID.accHead || this.SlotId == TBody.SlotID.accHead_2 || this.SlotId == TBody.SlotID.megane || this.SlotId == TBody.SlotID.accMiMiL || this.SlotId == TBody.SlotID.accMiMiR || this.SlotId == TBody.SlotID.accHana || this.SlotId == TBody.SlotID.accFace || this.SlotId == TBody.SlotID.accKubi || this.SlotId == TBody.SlotID.accNipL || this.SlotId == TBody.SlotID.accNipR || this.SlotId == TBody.SlotID.accKoshi || this.SlotId == TBody.SlotID.accUde || this.SlotId == TBody.SlotID.accUde_2 || this.SlotId == TBody.SlotID.glove || this.SlotId == TBody.SlotID.accHeso || this.SlotId == TBody.SlotID.accAshi || this.SlotId == TBody.SlotID.accAshi_2 || this.SlotId == TBody.SlotID.accSenaka || this.SlotId == TBody.SlotID.accShippo || this.SlotId == TBody.SlotID.accVag || this.SlotId == TBody.SlotID.accKamiSubL || this.SlotId == TBody.SlotID.accKamiSubR || this.SlotId == TBody.SlotID.accVag || this.SlotId == TBody.SlotID.accAnl || this.SlotId == TBody.SlotID.accXXX)
- {
- this.m_mf = this.obj_tr.GetComponentInChildren<SkinnedMeshRenderer>(true);
- if (this.m_mf != null)
- {
- if (splitParam != null)
- {
- if (splitParam.splitPartBone != null)
- {
- Transform[] bones = this.m_mf.bones;
- List<int> list = new List<int>();
- for (int n = 0; n < splitParam.splitPartBone.Length; n++)
- {
- string text = splitParam.splitPartBone[n];
- List<string> search = new List<string>();
- if (text.LastIndexOf('~') == text.Length - 1)
- {
- text = text.Remove(text.Length - 1, 1);
- Transform x = CMT.SearchObjName(this.listTrs[0], text, true);
- NDebug.Assert(x != null, "not found bone -> " + text);
- Action<Transform> AddChild = null;
- AddChild = delegate(Transform parent)
- {
- search.Add(parent.name);
- for (int num3 = 0; num3 < parent.childCount; num3++)
- {
- AddChild(parent.GetChild(num3));
- }
- };
- AddChild(x);
- }
- else
- {
- search.Add(text);
- }
- using (List<string>.Enumerator enumerator3 = search.GetEnumerator())
- {
- while (enumerator3.MoveNext())
- {
- string sea = enumerator3.Current;
- int num = Array.FindIndex<Transform>(bones, (Transform t) => sea == t.name);
- if (num != -1)
- {
- list.Add(num);
- }
- }
- }
- }
- ((TMorphSkin)this.morph).VisibleVtxByBonwWeight(list);
- }
- else if (splitParam.plane != Vector3Int.zero)
- {
- ((TMorphSkin)this.morph).VisibleVtxByPlane(splitParam.plane, splitParam.pos);
- }
- this.m_pairSlotIds = splitParam.pairSlotIds;
- }
- if (this.m_attachType == TBodySkin.ATTACH_TYPE.BONE_ROOT)
- {
- Transform transform4 = null;
- Dictionary<int, Transform> loadToRoot = new Dictionary<int, Transform>();
- Func<Transform, Transform, bool> CheckParent = null;
- CheckParent = delegate(Transform search, Transform tr)
- {
- if (tr == null)
- {
- return false;
- }
- loadToRoot[tr.GetInstanceID()] = tr;
- return tr == search || CheckParent(search, tr.parent);
- };
- Transform transform5 = this.m_mf.bones[0];
- while (transform5 != null)
- {
- bool flag = false;
- for (int num2 = 0; num2 < this.m_mf.bones.Length; num2++)
- {
- flag |= !CheckParent(transform5, this.m_mf.bones[num2]);
- }
- if (!flag)
- {
- transform4 = transform5;
- break;
- }
- transform5 = transform5.parent;
- }
- Transform transform6 = new GameObject(transform4.name).transform;
- Action<Transform, Transform> CopyHie = null;
- CopyHie = delegate(Transform src, Transform cpy)
- {
- if (this.m_copyRoot == null)
- {
- this.m_copyRoot = new List<Tuple<Transform, Transform>>();
- }
- cpy.position = src.position;
- cpy.rotation = src.rotation;
- cpy.localScale = src.localScale;
- this.m_copyRoot.Add(new Tuple<Transform, Transform>(src, cpy));
- for (int num3 = 0; num3 < src.childCount; num3++)
- {
- Transform child = src.GetChild(num3);
- if (loadToRoot.ContainsKey(child.GetInstanceID()))
- {
- Transform transform7 = new GameObject(child.name).transform;
- transform7.SetParent(cpy);
- CopyHie(child, transform7);
- }
- }
- };
- CopyHie(transform4, transform6);
- this.m_copyObjTr = transform6;
- transform6.parent = this.body.m_trAttachCache;
- this.m_BackBones = this.m_mf.bones;
- }
- Bounds bounds2 = this.m_mf.bounds;
- this.attachPosObj = new GameObject("_AM_" + this.obj_tr.name + " _AttachMoveCtrlPoints");
- this.attachPosObj.transform.SetParent(this.obj_tr.parent, false);
- this.attachPosObj.transform.position = this.obj_tr.position;
- GameObject gameObject4 = new GameObject("center_" + this.SlotId.ToString());
- gameObject4.transform.SetParent(this.attachPosObj.transform, false);
- gameObject4.transform.position = bounds2.center;
- gameObject4.transform.rotation = Quaternion.identity;
- this.m_goCenter = gameObject4;
- GameObject gameObject5 = new GameObject("center2");
- gameObject5.transform.SetParent(gameObject4.transform, false);
- gameObject5.transform.position = bounds2.center;
- gameObject5.transform.rotation = Quaternion.identity;
- if (this.m_attachType == TBodySkin.ATTACH_TYPE.BONE_CHILD_DEF && (this.SlotId == TBody.SlotID.hairS || this.SlotId == TBody.SlotID.hairS_2 || this.SlotId == TBody.SlotID.hairT || this.SlotId == TBody.SlotID.hairT_2 || this.SlotId == TBody.SlotID.hairAho) && this.m_mf.bones != null && this.m_mf.bones.Length != 0)
- {
- gameObject5.transform.position = this.m_mf.bones[0].position;
- }
- GameObject gameObject6 = new GameObject("center3");
- gameObject6.transform.SetParent(gameObject5.transform, false);
- gameObject6.transform.position = this.obj_tr.position;
- this.m_vCenterPosLocal = gameObject4.transform.localPosition;
- this.center_tr = gameObject4.transform;
- this.center_tr2 = gameObject5.transform;
- this.center_tr3 = gameObject6.transform;
- this.centerTrDef.SetFromTransformLocal(this.center_tr);
- this.centerTr2Def.SetFromTransformLocal(this.center_tr2);
- this.centerTr3Def.SetFromTransformLocal(this.center_tr3);
- }
- }
- this.m_HairLengthCtrl.NotExistThenClearHairLength();
- if (mpn == MPN.head)
- {
- Transform exists = gameObject.transform.Find("Bone_Face/Bero1");
- if (exists)
- {
- this.tongueCtrl = new TongueCtrl(this, gameObject);
- }
- else
- {
- this.tongueCtrl = null;
- }
- }
- if (OvrIK.IsModeVRIK && OvrIK.Instance != null && OvrIK.Instance.NowMaid == this.body.maid && (this.SlotId == TBody.SlotID.head || this.SlotId == TBody.SlotID.megane || this.SlotId == TBody.SlotID.accHead))
- {
- this.LayerCheck(this.obj);
- }
- }
- public bool LoadOrNewAttachPoint(string partName)
- {
- if (this.m_savedAttachPos == null)
- {
- return false;
- }
- SavedAttachData nap;
- if ((nap = this.m_savedAttachPos.Find((SavedAttachData a) => a.partName == partName)) == null)
- {
- return false;
- }
- if (!nap.bEnable)
- {
- return false;
- }
- if (Array.FindIndex<TBody.SlotID>(TBodySkin.m_findSlots, (TBody.SlotID s) => s == nap.eTargetSlotID) == -1)
- {
- Debug.Log("crc body attach target is not available. -> " + nap.eMySlotID.ToString());
- nap.bEnable = false;
- return false;
- }
- TBodySkin slot = this.body.GetSlot((int)nap.eTargetSlotID, nap.nTargetSlotNo);
- ((TMorphSkin)slot.morph).AddNewAttachPoint(this, nap.strTargetAttachPointName, nap.newAttachVidx);
- this.m_AttachVisible = true;
- this.m_AttachName = nap.strTargetAttachPointName;
- this.m_AttachSlotIdx = (int)slot.SlotId;
- this.center_tr2.localPosition = nap.prs2.position;
- this.center_tr2.localRotation = nap.prs2.rotation;
- this.center_tr3.localPosition = nap.prs3.position;
- this.center_tr3.localRotation = nap.prs3.rotation;
- this.center_tr3.localScale = nap.prs3.scale;
- this.m_boneAttachEdited = nap.boneAttachEdited;
- if (this.m_attachType == TBodySkin.ATTACH_TYPE.BONE_ROOT && this.m_boneAttachEdited)
- {
- foreach (Tuple<Transform, Transform> tuple in this.m_copyRoot)
- {
- tuple.Item2.position = tuple.Item1.position;
- tuple.Item2.rotation = tuple.Item1.rotation;
- tuple.Item2.localScale = tuple.Item1.localScale;
- nap.boneAttachedHie[tuple.Item1.name].SetToTransformLocal(tuple.Item2);
- }
- Transform[] array = new Transform[this.m_mf.bones.Length];
- for (int i = 0; i < this.m_mf.bones.Length; i++)
- {
- Transform sb = this.m_mf.bones[i];
- array[i] = this.m_copyRoot.Find((Tuple<Transform, Transform> t) => t.Item2.name == sb.name).Item2;
- }
- this.m_mf.bones = array;
- }
- return true;
- }
- public void ResetAttachPoint()
- {
- if (this.m_boneAttachEdited)
- {
- this.m_mf.bones = this.m_BackBones;
- }
- this.m_AttachName = this.m_BackAttachName;
- this.m_AttachSlotIdx = this.m_BackAttachSlotIdx;
- this.m_AttachSlotSubIdx = this.m_BackAttachSlotSubIdx;
- if (this.center_tr != null)
- {
- this.center_tr.rotation = Quaternion.identity;
- }
- if (this.center_tr2 != null)
- {
- this.center_tr2.rotation = Quaternion.identity;
- }
- if (this.center_tr3 != null)
- {
- this.center_tr3.localScale = Vector3.one;
- }
- this.obj_tr.localPosition = this.m_vDefPosLocal;
- this.obj_tr.localRotation = this.m_qDefRotLocal;
- this.obj_tr.localScale = this.m_vDefScaleLocal;
- this.centerTrDef.SetToTransformLocal(this.center_tr);
- this.centerTr2Def.SetToTransformLocal(this.center_tr2);
- this.centerTr3Def.SetToTransformLocal(this.center_tr3);
- this.m_boneAttachEdited = false;
- }
- public void ItemScaleReset()
- {
- if (this.m_mp != null && this.m_mp.bNoScale)
- {
- Transform parent = this.obj_tr.parent;
- this.obj_tr.SetParent(null, true);
- this.obj_tr.localScale = Vector3.one;
- this.obj_tr.SetParent(parent, true);
- }
- }
- private void LayerCheck(GameObject goParent)
- {
- for (int i = 0; i < goParent.transform.childCount; i++)
- {
- this.LayerCheck(goParent.transform.GetChild(i).gameObject);
- }
- goParent.layer = LayerMask.NameToLayer("Face");
- }
- public void AddMyBoneMorph(string name, List<TBodySkin.MyBoneMorph> myBoneMorphs)
- {
- if (this.m_myBoneMorphs == null)
- {
- this.m_myBoneMorphs = new Dictionary<string, List<TBodySkin.MyBoneMorph>>();
- }
- foreach (TBodySkin.MyBoneMorph myBoneMorph in myBoneMorphs)
- {
- myBoneMorph.targetTrs = CMT.SearchObjName(this.listTrs[0], myBoneMorph.targetBoneName, true);
- NDebug.Assert(myBoneMorph.targetTrs != null, "suso bone not found. -> " + myBoneMorph.targetBoneName);
- }
- this.m_myBoneMorphs[name] = myBoneMorphs;
- }
- public void UpdateMyBoneMorph(string name, float val)
- {
- List<TBodySkin.MyBoneMorph> list;
- if (this.m_myBoneMorphs == null || !this.m_myBoneMorphs.TryGetValue(name, out list))
- {
- return;
- }
- foreach (TBodySkin.MyBoneMorph myBoneMorph in list)
- {
- if (myBoneMorph.usePos)
- {
- myBoneMorph.targetTrs.localPosition = Vector3.Lerp(myBoneMorph.pos, myBoneMorph.pos2, val);
- }
- if (myBoneMorph.useRot)
- {
- myBoneMorph.targetTrs.localRotation = Quaternion.Lerp(Quaternion.Euler(myBoneMorph.rot), Quaternion.Euler(myBoneMorph.rot2), val);
- }
- if (myBoneMorph.useScl)
- {
- myBoneMorph.targetTrs.localScale = Vector3.Lerp(myBoneMorph.scl, myBoneMorph.scl2, val);
- }
- }
- }
- public void SetVisibleFlag(bool boSetFlag, string name, Transform t = null, bool boTgt = false)
- {
- if (t.name.IndexOf(name) >= 0)
- {
- boTgt = true;
- }
- if (name == "_ALL_")
- {
- boTgt = true;
- }
- if (boTgt)
- {
- this.m_dicDelNodeBody[t.name] = boSetFlag;
- }
- IEnumerator enumerator = t.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform t2 = (Transform)obj;
- this.SetVisibleFlag(boSetFlag, name, t2, boTgt);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- public void SetVisibleFlagParts(bool f_bSetFlag, string f_strTargetSlot, string f_strBoneName, Transform t = null, bool boTgt = false)
- {
- if (t.name.IndexOf(f_strBoneName) >= 0)
- {
- boTgt = true;
- }
- if (f_strBoneName == "_ALL_")
- {
- boTgt = true;
- }
- if (boTgt)
- {
- Dictionary<string, bool> dictionary;
- if (!this.m_dicDelNodeParts.TryGetValue(f_strTargetSlot, out dictionary))
- {
- dictionary = new Dictionary<string, bool>();
- this.m_dicDelNodeParts.Add(f_strTargetSlot, dictionary);
- }
- dictionary[t.name] = f_bSetFlag;
- }
- IEnumerator enumerator = t.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform t2 = (Transform)obj;
- this.SetVisibleFlagParts(f_bSetFlag, f_strTargetSlot, f_strBoneName, t2, boTgt);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- public bool IsPartHideOnSlotVisible()
- {
- return this.crcPartHideVisible;
- }
- public void CopyTrans()
- {
- for (int i = 0; i < this.listTrs.Count; i += 2)
- {
- this.listTrs[i].localRotation = this.listTrs[i + 1].localRotation;
- this.listTrs[i].localPosition = this.listTrs[i + 1].localPosition;
- }
- for (int j = 0; j < this.listTrsScr.Count; j += 2)
- {
- this.listTrsScr[j].localScale = this.listTrsScr[j + 1].localScale;
- }
- this.TightSkirt();
- }
- public void TightSkirt()
- {
- }
- private void LookAtAxis(Transform f_trSrc, Vector3 f_vTargetPosWorld, TBodySkin.Axis f_axis, Vector3 f_vForwardWorld)
- {
- Vector3 position = f_trSrc.InverseTransformPoint(f_vTargetPosWorld);
- if (f_axis == TBodySkin.Axis.X)
- {
- position.x = 0f;
- }
- else if (f_axis == TBodySkin.Axis.Y)
- {
- position.y = 0f;
- }
- else
- {
- position.z = 0f;
- }
- Vector3 vector = f_trSrc.TransformPoint(position);
- Debug.DrawLine(vector, f_trSrc.position, Color.cyan);
- Quaternion lhs = Quaternion.FromToRotation(f_vForwardWorld, (vector - f_trSrc.position).normalized);
- f_trSrc.rotation = lhs * f_trSrc.rotation;
- }
- public void OnChangeScreenSizeOrAA()
- {
- bool flag = QualitySettings.antiAliasing != 0;
- if (this.obj == null)
- {
- return;
- }
- bool flag2 = !flag && !GameMain.Instance.MainCamera.IsBloomEnabled;
- if (GameMain.Instance.VRMode && !GameMain.Instance.VRDummyMode)
- {
- flag2 = false;
- }
- this.obj.GetComponentsInChildren<Renderer>(true, this.m_listRnederTemp);
- for (int i = 0; i < this.m_listRnederTemp.Count; i++)
- {
- Renderer renderer = this.m_listRnederTemp[i];
- if (!(renderer.material == null))
- {
- foreach (Material material in renderer.materials)
- {
- if (flag2)
- {
- material.EnableKeyword("UV_POS_REVERSE");
- material.DisableKeyword("UV_POS_NORMAL");
- }
- else
- {
- material.DisableKeyword("UV_POS_NORMAL");
- material.DisableKeyword("UV_POS_REVERSE");
- }
- }
- }
- }
- }
- private IEnumerator CoReFixBlendValues()
- {
- yield return null;
- if (this.morph != null)
- {
- this.morph.ResetBlendValues();
- }
- yield break;
- }
- public void ManColorUpdate()
- {
- this.ManColorUpdateIn();
- if (this.body.maid.pairMan != null && this.body.maid.pairMan.body0 != null)
- {
- this.body.maid.pairMan.body0.GetSlot((int)this.SlotId).ManColorUpdateIn();
- }
- }
- private void ManColorUpdateIn()
- {
- for (int i = 0; i < this.m_listManAlphaMat.Count; i++)
- {
- Material material = this.m_listManAlphaMat[i];
- material.SetFloat("_FloatValue2", (float)GameMain.Instance.CMSystem.ManAlpha / 100f);
- material.SetColor("_Color", this.body.maid.ManColor);
- }
- }
- public bool AnimationLoad(string f_strAnimName)
- {
- if (this.m_animItem == null)
- {
- this.m_animItem = this.obj.AddComponent<Animation>();
- }
- if (this.m_animItem.GetClip(f_strAnimName) == null)
- {
- string text = f_strAnimName;
- if (string.IsNullOrEmpty(Path.GetExtension(text)))
- {
- text += ".anm";
- }
- AnimationClip animationClip = ImportCM.LoadAniClipNative(GameUty.FileSystem, text, true, true, true);
- if (animationClip == null)
- {
- NDebug.Assert("アニメーション " + text + " が見つかりません。", false);
- return false;
- }
- this.m_animItem.Stop();
- this.m_animItem.AddClip(animationClip, f_strAnimName);
- this.m_animItem.clip = animationClip;
- this.m_animItem.playAutomatically = true;
- }
- this.m_animItem.Stop();
- return true;
- }
- public bool AnimationPlay(string f_strAnimName, bool f_bLoop)
- {
- if (this.m_animItem == null)
- {
- Debug.LogError("まだアイテムアニメが読まれていません。");
- return false;
- }
- this.m_animItem.Stop();
- this.m_animItem.wrapMode = ((!f_bLoop) ? WrapMode.Once : WrapMode.Loop);
- if (this.m_animItem.GetClip(f_strAnimName) == null)
- {
- NDebug.Assert("アニメーション " + f_strAnimName + " は設定されていません。", false);
- return false;
- }
- this.m_animItem[f_strAnimName].time = 0f;
- this.m_animItem.Play(f_strAnimName);
- return true;
- }
- public bool AnimationStop()
- {
- if (this.m_animItem == null)
- {
- return false;
- }
- this.m_animItem.Stop();
- return true;
- }
- public void LateAttachUpdate()
- {
- if (this.obj == null)
- {
- return;
- }
- if (this.body.IsCrcBody)
- {
- return;
- }
- if (this.m_AttachName != null && this.body.goSlot[this.m_AttachSlotIdx].morph != null)
- {
- Vector3 position;
- Quaternion rotation;
- Vector3 vector;
- if (this.body.goSlot[this.m_AttachSlotIdx].morph.GetAttachPoint(this.m_AttachName, out position, out rotation, out vector, this.m_bTemp))
- {
- if (!this.m_AttachVisible)
- {
- this.obj_tr.localScale = Vector3.one;
- this.m_AttachVisible = true;
- }
- this.obj_tr.position = position;
- this.obj_tr.rotation = rotation;
- this.obj_tr.localScale = new Vector3(this.m_vDefScaleLocal.x * vector.x, this.m_vDefScaleLocal.y * vector.y, this.m_vDefScaleLocal.z * vector.z);
- }
- else if (this.m_AttachVisible)
- {
- this.obj_tr.localScale = Vector3.zero;
- this.m_AttachVisible = false;
- }
- }
- }
- public void SelfLateUpdate()
- {
- if (this.obj == null)
- {
- return;
- }
- if (!this.body.IsCrcBody)
- {
- return;
- }
- if (this.obj.activeSelf != this.boVisible)
- {
- CMT.SetActiveFlag(this.obj_tr, this.boVisible);
- if (this.boVisible)
- {
- this.body.StartCoroutine(this.CoReFixBlendValues());
- }
- }
- if (!this.boVisible)
- {
- return;
- }
- if (this.m_trsBoneAttach != null)
- {
- this.obj_tr.position = this.m_trsBoneAttach.position;
- this.obj_tr.rotation = this.m_trsBoneAttach.rotation;
- }
- if (this.m_AttachName != null)
- {
- TBodySkin slot = this.body.GetSlot(this.m_AttachSlotIdx, this.m_AttachSlotSubIdx);
- TMorphSkin tmorphSkin = slot.morph as TMorphSkin;
- if (tmorphSkin != null)
- {
- Vector3[] newAttachPointWorld = tmorphSkin.GetNewAttachPointWorld(this.m_AttachName);
- if (newAttachPointWorld == null)
- {
- Vector3 position;
- Quaternion rotation;
- Vector3 vector;
- if (tmorphSkin.GetAttachPoint(this.m_AttachName, out position, out rotation, out vector, this.m_bTemp))
- {
- if (!this.m_AttachVisible)
- {
- this.obj_tr.localScale = Vector3.one;
- this.m_AttachVisible = true;
- }
- this.obj_tr.position = position;
- this.obj_tr.rotation = rotation;
- this.obj_tr.localScale = new Vector3(this.m_vDefScaleLocal.x * vector.x, this.m_vDefScaleLocal.y * vector.y, this.m_vDefScaleLocal.z * vector.z);
- }
- else if (this.m_AttachVisible)
- {
- this.obj_tr.localScale = Vector3.zero;
- this.m_AttachVisible = false;
- }
- }
- else
- {
- this.center_tr.position = newAttachPointWorld[0];
- this.center_tr.LookAt(this.center_tr.position + (newAttachPointWorld[1] - newAttachPointWorld[0]).normalized, (newAttachPointWorld[2] - newAttachPointWorld[0]).normalized);
- if (this.m_copyObjTr != null)
- {
- this.m_copyObjTr.position = this.center_tr3.position;
- this.m_copyObjTr.rotation = this.center_tr3.rotation;
- this.m_copyObjTr.localScale = this.center_tr3.localScale;
- }
- else
- {
- this.obj_tr.position = this.center_tr3.position;
- this.obj_tr.rotation = this.center_tr3.rotation;
- this.obj_tr.localScale = this.center_tr3.localScale;
- }
- }
- }
- }
- if (this.SlotId == TBody.SlotID.head && this.morph != null)
- {
- Vector3[] newAttachPointWorld2 = ((TMorphSkin)this.morph).GetNewAttachPointWorld("上唇");
- Vector3[] newAttachPointWorld3 = ((TMorphSkin)this.morph).GetNewAttachPointWorld("下唇");
- if (newAttachPointWorld2 != null && newAttachPointWorld3 != null)
- {
- this.body.ikMouthCenter.position = newAttachPointWorld3[0] + (newAttachPointWorld2[0] - newAttachPointWorld3[0]) * 0.5f;
- }
- }
- if (this.kupaCtrl != null)
- {
- this.kupaCtrl.SelfUpdate();
- }
- Vector3 localScale = this.m_trMaid.localScale;
- Vector3 localScale2 = this.m_trMaidOffs.localScale;
- if (localScale.x < 0.998f || 1.002f < localScale.x || localScale2.x < 0.998f || 1.002f < localScale2.x)
- {
- this.m_trMaid.localScale = Vector3.one;
- this.m_trMaidOffs.localScale = Vector3.one;
- this.bonehair3.UpdateSelf();
- this.dbManager.DynamicUpdate();
- this.m_trMaid.localScale = localScale;
- this.m_trMaidOffs.localScale = localScale2;
- }
- else
- {
- this.bonehair3.UpdateSelf();
- this.dbManager.DynamicUpdate();
- }
- if (this.tongueCtrl != null)
- {
- this.tongueCtrl.TongueUpdate();
- }
- }
- public bool MaterialAnimatorAdd(int f_nMateNo)
- {
- Renderer componentInChildren = this.obj.GetComponentInChildren<Renderer>();
- if (componentInChildren != null)
- {
- MaterialAnimator materialAnimator = componentInChildren.gameObject.AddComponent<MaterialAnimator>();
- materialAnimator.m_nMateNo = f_nMateNo;
- materialAnimator.Init();
- }
- return true;
- }
- public void Update()
- {
- if (this.obj == null)
- {
- return;
- }
- if (this.body.IsCrcBody)
- {
- return;
- }
- if (this.obj.activeSelf != this.boVisible)
- {
- CMT.SetActiveFlag(this.obj_tr, this.boVisible);
- if (this.boVisible)
- {
- this.body.StartCoroutine(this.CoReFixBlendValues());
- }
- }
- if (!this.boVisible)
- {
- return;
- }
- if (this.m_trsBoneAttach != null)
- {
- this.obj_tr.position = this.m_trsBoneAttach.position;
- this.obj_tr.rotation = this.m_trsBoneAttach.rotation;
- }
- if (this.m_AttachName != null && this.body.goSlot[this.m_AttachSlotIdx].morph != null)
- {
- Vector3 position;
- Quaternion rotation;
- Vector3 vector;
- if (this.body.goSlot[this.m_AttachSlotIdx].morph.GetAttachPoint(this.m_AttachName, out position, out rotation, out vector, this.m_bTemp))
- {
- if (!this.m_AttachVisible)
- {
- this.obj_tr.localScale = Vector3.one;
- this.m_AttachVisible = true;
- }
- this.obj_tr.position = position;
- this.obj_tr.rotation = rotation;
- this.obj_tr.localScale = new Vector3(this.m_vDefScaleLocal.x * vector.x, this.m_vDefScaleLocal.y * vector.y, this.m_vDefScaleLocal.z * vector.z);
- }
- else if (this.m_AttachVisible)
- {
- this.obj_tr.localScale = Vector3.zero;
- this.m_AttachVisible = false;
- }
- }
- if (this.kupaCtrl != null)
- {
- this.kupaCtrl.SelfUpdate();
- }
- Vector3 localScale = this.m_trMaid.localScale;
- Vector3 localScale2 = this.m_trMaidOffs.localScale;
- if (localScale.x < 0.998f || 1.002f < localScale.x || localScale2.x < 0.998f || 1.002f < localScale2.x)
- {
- this.m_trMaid.localScale = Vector3.one;
- this.m_trMaidOffs.localScale = Vector3.one;
- this.bonehair.Update();
- this.bonehair3.UpdateSelf();
- this.m_trMaid.localScale = localScale;
- this.m_trMaidOffs.localScale = localScale2;
- }
- else
- {
- this.bonehair.Update();
- this.bonehair3.UpdateSelf();
- }
- }
- public TBody body;
- public string Category;
- public TBody.SlotID SlotId;
- public int m_subNo;
- public bool boVisible = true;
- public List<int> listMaskSlot = new List<int>();
- public bool crcPartHideVisible;
- public GameObject obj;
- public Transform obj_tr;
- public Transform center_tr;
- public Transform center_tr2;
- public Transform center_tr3;
- private PosRotScale centerTrDef = new PosRotScale();
- private PosRotScale centerTr2Def = new PosRotScale();
- private PosRotScale centerTr3Def = new PosRotScale();
- private GameObject attachPosObj;
- private List<Transform> listTrs;
- private List<Transform> listTrsScr;
- public List<UnityEngine.Object> listDEL = new List<UnityEngine.Object>();
- public Dictionary<string, UnityEngine.Object> dicDel = new Dictionary<string, UnityEngine.Object>();
- private List<Material> m_listRtMaterial = new List<Material>();
- public TMorph morph;
- public Dictionary<string, bool> m_dicDelNodeBody = new Dictionary<string, bool>();
- public Dictionary<string, Dictionary<string, bool>> m_dicDelNodeParts = new Dictionary<string, Dictionary<string, bool>>();
- public TBoneHair_ bonehair;
- public BoneHair2 bonehair2;
- public BoneHair3 bonehair3;
- public bool boMizugi;
- public Dictionary<string, KeyValuePair<float, string>[]> dicParamSet = new Dictionary<string, KeyValuePair<float, string>[]>();
- private Dictionary<string, string> m_dicParam = new Dictionary<string, string>();
- private Dictionary<string, string> m_dicParam2 = new Dictionary<string, string>();
- public TBodySkin.ATTACH_TYPE m_attachType;
- public Transform m_trsBoneAttach;
- public string m_AttachName;
- public bool m_AttachVisible;
- public int m_AttachSlotIdx;
- public int m_AttachSlotSubIdx;
- private Quaternion AttachRotation;
- public string m_BackAttachName;
- public int m_BackAttachSlotIdx;
- public int m_BackAttachSlotSubIdx;
- public Transform[] m_BackBones;
- public List<Tuple<Transform, Transform>> m_copyRoot;
- public Transform m_copyObjTr;
- public bool m_boneAttachEdited;
- public List<SavedAttachData> m_savedAttachPos;
- public Vector3 m_vDefScaleLocal;
- public Vector3 m_vScaleRate;
- public Vector3 m_vTempAttachPointScale;
- public Vector3 m_vDefPosLocal;
- public Vector3 m_vPosLocal;
- public Vector3 m_vCenterPosLocal;
- public Vector3 m_vTempAttachPointPos;
- public Quaternion m_qDefRotLocal;
- public Quaternion m_qRotLocal;
- public Quaternion m_qTempAttachPointRot;
- public int RID;
- public int SyojiType;
- public string m_strModelFileName = string.Empty;
- public MPN m_ParentMPN;
- public MaidProp m_mp;
- public bool m_bMan;
- private List<Material> m_listManAlphaMat = new List<Material>();
- public InfinityColorTextureCache TextureCache;
- private bool m_bEnablePartPosEdit;
- public Dictionary<string, float> m_BonehairBodyhitScaleBackup = new Dictionary<string, float>();
- public Dictionary<string, TMorph.TempAttachPos> m_dicTempAttachPoint = new Dictionary<string, TMorph.TempAttachPos>();
- public bool m_bHitFloorY = true;
- private Transform m_trMaid;
- private Transform m_trMaidOffs;
- private Dictionary<int, Shader> m_dicBackupShader = new Dictionary<int, Shader>();
- private bool m_bTemp;
- private Transform m_trThigh_L;
- private Transform m_trThigh_R;
- private Transform m_trCalf_L;
- private Transform m_trCalf_R;
- private Transform m_trFoot_L;
- private Transform m_trFoot_R;
- public SkinnedMeshRenderer m_mf;
- private GameObject m_goCenter;
- public TBody.SlotID m_NewAttachRealSlot = TBody.SlotID.end;
- public TBodySkin.OriVert m_OriVert = new TBodySkin.OriVert();
- public TBodySkin.HairLengthCtrl m_HairLengthCtrl;
- private Animation m_animItem;
- private int m_partsVersion;
- private bool m_IsCrcImported;
- public bool m_isHiheel;
- public Dictionary<string, List<TBodySkin.MyBoneMorph>> m_myBoneMorphs;
- public TBodySkin.CHIKUBI_STATE m_chikubiState;
- private List<TBody.SlotID> m_pairSlotIds;
- private static TBody.SlotID[] m_findSlots = new TBody.SlotID[]
- {
- TBody.SlotID.body,
- TBody.SlotID.head,
- TBody.SlotID.hairF,
- TBody.SlotID.hairR,
- TBody.SlotID.hairS,
- TBody.SlotID.hairT
- };
- private List<Renderer> m_listRnederTemp = new List<Renderer>(4);
- public class HairLengthCtrl
- {
- public HairLengthCtrl(TBodySkin f_trTbodySkin)
- {
- this.m_tbskin = f_trTbodySkin;
- this.m_maid = this.m_tbskin.body.maid;
- }
- public bool IsHairLengthEditable
- {
- get
- {
- return this.m_dicHairLenght != null && this.m_dicHairLenght.Count != 0;
- }
- }
- public Dictionary<string, TBodySkin.HairLengthCtrl.HairLength> HairLengthGroupList
- {
- get
- {
- return this.m_dicHairLenght;
- }
- }
- public void NotExistThenClearHairLength()
- {
- if (this.m_maid.NotExistThenClearHairLengthMP(this.m_tbskin.m_ParentMPN, this.m_tbskin.SlotId))
- {
- }
- this.m_dicHairLenght.Clear();
- }
- public void SearchAndAddHairLengthTarget(string f_strGroupName, string f_strBoneSearchType, string f_strBoneName, Vector3 f_vScaleMin, Vector3 f_vScaleMax)
- {
- if (this.m_tbskin == null || this.m_tbskin.obj_tr == null)
- {
- NDebug.Assert("髪ボーン拡縮検索 親が未だありません。", false);
- }
- string pattern = f_strBoneName.Replace("*", ".*");
- TBodySkin.HairLengthCtrl.SerchMode mode = TBodySkin.HairLengthCtrl.SerchMode.ALL;
- if (f_strBoneSearchType == "fbrother")
- {
- mode = TBodySkin.HairLengthCtrl.SerchMode.FIRST_BROTHER;
- }
- else if (f_strBoneSearchType == "fchild")
- {
- mode = TBodySkin.HairLengthCtrl.SerchMode.FIRST_CHILD;
- }
- else if (f_strBoneSearchType == "all")
- {
- mode = TBodySkin.HairLengthCtrl.SerchMode.ALL;
- }
- else
- {
- NDebug.Assert("髪ボーン検索タイプが不正です。 " + f_strBoneSearchType, false);
- }
- this.SearchObjAndAdd(f_strGroupName, this.m_tbskin.obj_tr, new Regex(pattern), mode, f_vScaleMin, f_vScaleMax);
- TBodySkin.HairLengthCtrl.HairLength hairLength;
- if (!this.m_dicHairLenght.TryGetValue(f_strGroupName, out hairLength))
- {
- Debug.LogError("髪ボーングループがありません。");
- return;
- }
- float lengthRate = 0.5f;
- if (this.m_maid.GetHairLengthFromMP(this.m_tbskin.m_ParentMPN, this.m_tbskin.SlotId, f_strGroupName, out lengthRate))
- {
- hairLength.SetLengthRate(lengthRate);
- }
- else
- {
- this.m_maid.ClearHairLengthMP(this.m_tbskin.m_ParentMPN, this.m_tbskin.SlotId);
- }
- this.HairLenghtBlend();
- }
- private Transform SearchObjAndAdd(string f_strGroupName, Transform t, Regex regex, TBodySkin.HairLengthCtrl.SerchMode mode, Vector3 f_vScaleMin, Vector3 f_vScaleMax)
- {
- string name = t.name;
- if (regex.IsMatch(name))
- {
- TBodySkin.HairLengthCtrl.HairLength hairLength;
- if (!this.m_dicHairLenght.TryGetValue(f_strGroupName, out hairLength))
- {
- hairLength = new TBodySkin.HairLengthCtrl.HairLength(this.m_tbskin, f_strGroupName);
- this.m_dicHairLenght[f_strGroupName] = hairLength;
- }
- hairLength.listTarget.Add(new TBodySkin.HairLengthCtrl.HairLengthTarget
- {
- trTarget = t,
- vScaleDef = t.localScale,
- vScaleMin = f_vScaleMin,
- vScaleMax = f_vScaleMax
- });
- if (mode == TBodySkin.HairLengthCtrl.SerchMode.FIRST_BROTHER || mode == TBodySkin.HairLengthCtrl.SerchMode.FIRST_CHILD)
- {
- return t;
- }
- }
- for (int i = 0; i < t.childCount; i++)
- {
- Transform child = t.GetChild(i);
- Transform transform = this.SearchObjAndAdd(f_strGroupName, child, regex, mode, f_vScaleMin, f_vScaleMax);
- if (transform != null && mode == TBodySkin.HairLengthCtrl.SerchMode.FIRST_CHILD)
- {
- return transform;
- }
- }
- return null;
- }
- public void HairLenghtBlend()
- {
- foreach (KeyValuePair<string, TBodySkin.HairLengthCtrl.HairLength> keyValuePair in this.m_dicHairLenght)
- {
- float lengthRate = keyValuePair.Value.GetLengthRate();
- for (int i = 0; i < keyValuePair.Value.listTarget.Count; i++)
- {
- TBodySkin.HairLengthCtrl.HairLengthTarget hairLengthTarget = keyValuePair.Value.listTarget[i];
- Vector3 localScale = hairLengthTarget.vScaleDef;
- if (lengthRate < 0.5f)
- {
- localScale = Vector3.Lerp(hairLengthTarget.vScaleMin, hairLengthTarget.vScaleDef, lengthRate / 0.5f);
- }
- else if (0.5f < lengthRate)
- {
- localScale = Vector3.Lerp(hairLengthTarget.vScaleDef, hairLengthTarget.vScaleMax, (lengthRate - 0.5f) / 0.5f);
- }
- hairLengthTarget.trTarget.localScale = localScale;
- }
- }
- }
- private Dictionary<string, TBodySkin.HairLengthCtrl.HairLength> m_dicHairLenght = new Dictionary<string, TBodySkin.HairLengthCtrl.HairLength>();
- private TBodySkin m_tbskin;
- private Maid m_maid;
- public class HairLengthTarget
- {
- public Transform trTarget;
- public Vector3 vScaleDef;
- public Vector3 vScaleMin;
- public Vector3 vScaleMax;
- }
- public class HairLength
- {
- public HairLength(TBodySkin f_tbskin, string f_strGroupName)
- {
- this.m_tbskin = f_tbskin;
- this.strGroupName = f_strGroupName;
- }
- public float GetLengthRate()
- {
- return this.fLenghtRate;
- }
- public void SetLengthRate(float f_fRate)
- {
- Maid maid = this.m_tbskin.body.maid;
- MPN parentMPN = this.m_tbskin.m_ParentMPN;
- TBody.SlotID slotId = this.m_tbskin.SlotId;
- string f_strName = this.strGroupName;
- this.fLenghtRate = f_fRate;
- maid.SetHairLengthSaveToMP(parentMPN, slotId, f_strName, f_fRate);
- }
- private TBodySkin m_tbskin;
- private string strGroupName;
- private float fLenghtRate = 0.5f;
- public List<TBodySkin.HairLengthCtrl.HairLengthTarget> listTarget = new List<TBodySkin.HairLengthCtrl.HairLengthTarget>();
- }
- private enum SerchMode
- {
- FIRST_CHILD,
- FIRST_BROTHER,
- ALL
- }
- }
- public enum ATTACH_TYPE
- {
- NONE,
- VERTEX,
- BONE_CHILD_DEF,
- BONE_CHILD_MENU,
- BONE_ROOT
- }
- public class OriVert
- {
- public void Clear()
- {
- this.VCount = 0;
- this.vOriVert = null;
- this.vOriNorm = null;
- this.vOriUV = null;
- this.nSubMeshCount = 0;
- this.nSubMeshOriTri = null;
- this.bwWeight = null;
- }
- public int VCount;
- public Vector3[] vOriVert;
- public Vector3[] vOriNorm;
- public Vector2[] vOriUV;
- public int nSubMeshCount;
- public int[][] nSubMeshOriTri;
- public BoneWeight[] bwWeight;
- public SkinThickness skinThick;
- }
- public class MyBoneMorph
- {
- public string name;
- public string targetBoneName;
- public Transform targetTrs;
- public bool usePos;
- public bool useRot;
- public bool useScl;
- public Vector3 pos;
- public Vector3 pos2;
- public Vector3 rot;
- public Vector3 rot2;
- public Vector3 scl;
- public Vector3 scl2;
- }
- public enum CHIKUBI_STATE
- {
- None,
- 固定凸,
- 基本凹
- }
- public class SplitParam
- {
- public string[] splitPartBone;
- public Vector3Int plane;
- public float pos;
- public List<TBody.SlotID> pairSlotIds;
- }
- private enum Axis
- {
- X,
- Y,
- Z
- }
- }
|