TBodySkin.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Reflection;
  6. using System.Text.RegularExpressions;
  7. using UnityEngine;
  8. public class TBodySkin
  9. {
  10. public TBodySkin(TBody body_, string cate_, TBody.SlotID slot_id_, bool man)
  11. {
  12. this.boVisible = true;
  13. this.body = body_;
  14. this.Category = cate_;
  15. this.SlotId = slot_id_;
  16. this.m_bMan = man;
  17. this.m_trMaid = this.body.maid.transform;
  18. this.m_trMaidOffs = this.body.maid.m_goOffset.transform;
  19. this.bonehair = new TBoneHair_(this);
  20. this.TextureCache = new InfinityColorTextureCache(body_.maid);
  21. this.bonehair2 = new BoneHair2(this);
  22. this.bonehair3 = new BoneHair3(this);
  23. this.m_HairLengthCtrl = new TBodySkin.HairLengthCtrl(this);
  24. }
  25. public void AddRtMaterial(Material f_mat)
  26. {
  27. this.m_listRtMaterial.Add(f_mat);
  28. }
  29. public void DeleteObj()
  30. {
  31. this.m_ParentMPN = MPN.null_mpn;
  32. this.m_mp = null;
  33. this.m_animItem = null;
  34. this.body.MulTexRemove(this.Category);
  35. this.TextureCache.RemoveTexture();
  36. this.m_listManAlphaMat.Clear();
  37. this.m_HairLengthCtrl.NotExistThenClearHairLength();
  38. this.listTrs = null;
  39. this.listTrsScr = null;
  40. this.trsBoneAttach = null;
  41. foreach (UnityEngine.Object @object in this.listDEL)
  42. {
  43. UnityEngine.Object.DestroyImmediate(@object);
  44. }
  45. this.listDEL = new List<UnityEngine.Object>();
  46. this.boMizugi = false;
  47. if (this.morph != null)
  48. {
  49. this.morph.DeleteObj();
  50. this.morph = null;
  51. }
  52. this.boVisible = false;
  53. this.listMaskSlot = new List<int>();
  54. this.m_dicBackupShader.Clear();
  55. if (this.bonehair != null)
  56. {
  57. this.bonehair.Init();
  58. }
  59. if (this.bonehair2 != null)
  60. {
  61. this.bonehair2.Uninit();
  62. }
  63. if (this.bonehair3 != null)
  64. {
  65. this.bonehair3.Uninit();
  66. }
  67. if (this.obj != null)
  68. {
  69. this.obj_tr.parent = null;
  70. UnityEngine.Object.DestroyImmediate(this.obj);
  71. this.obj = null;
  72. this.obj_tr = null;
  73. }
  74. this.m_dicDelNodeParts.Clear();
  75. this.m_dicParam.Clear();
  76. this.m_dicParam2.Clear();
  77. this.m_OriVert.Clear();
  78. this.m_ParentMPN = MPN.null_mpn;
  79. this.m_mp = null;
  80. this.m_bHitFloorY = true;
  81. }
  82. public void NewParamSet(string A)
  83. {
  84. string[] stringList = UTY.GetStringList(A);
  85. string key = stringList[1];
  86. int num = (stringList.Length - 2) / 2;
  87. KeyValuePair<float, string>[] array = new KeyValuePair<float, string>[num];
  88. for (int i = 0; i < num; i++)
  89. {
  90. string value = stringList[3 + i * 2];
  91. float key2 = float.Parse(stringList[2 + i * 2]);
  92. array[i] = new KeyValuePair<float, string>(key2, value);
  93. }
  94. this.dicParamSet[key] = array;
  95. }
  96. public void SetParam(string f_strTag, string f_strValue)
  97. {
  98. if (this.m_dicParam.ContainsKey(f_strTag))
  99. {
  100. this.m_dicParam[f_strTag] = f_strValue;
  101. }
  102. else
  103. {
  104. this.m_dicParam.Add(f_strTag, f_strValue);
  105. }
  106. }
  107. public string GetParam(string f_strTag)
  108. {
  109. string empty;
  110. this.m_dicParam.TryGetValue(f_strTag, out empty);
  111. if (empty == null)
  112. {
  113. empty = string.Empty;
  114. }
  115. return empty;
  116. }
  117. public void SetParam2(string f_strTag, string f_strValue)
  118. {
  119. if (this.m_dicParam2.ContainsKey(f_strTag))
  120. {
  121. this.m_dicParam2[f_strTag] = f_strValue;
  122. }
  123. else
  124. {
  125. this.m_dicParam2.Add(f_strTag, f_strValue);
  126. }
  127. }
  128. public string GetParam2(string f_strTag)
  129. {
  130. string empty;
  131. this.m_dicParam2.TryGetValue(f_strTag, out empty);
  132. if (empty == null)
  133. {
  134. empty = string.Empty;
  135. }
  136. return empty;
  137. }
  138. public void SetMaterialProperty(MPN f_SrcMpn, int f_nMatNo, string f_strPropName, string f_strTypeName, string f_strValue, bool f_bEditSave)
  139. {
  140. if (this.obj == null)
  141. {
  142. return;
  143. }
  144. foreach (Transform transform in this.obj.transform.GetComponentsInChildren<Transform>(true))
  145. {
  146. Renderer component = transform.GetComponent<Renderer>();
  147. if (component != null && component.material != null && f_nMatNo < component.materials.Length)
  148. {
  149. Material material = component.materials[f_nMatNo];
  150. if (f_strTypeName == "DEFINE")
  151. {
  152. if (f_strValue == "0")
  153. {
  154. material.DisableKeyword(f_strPropName);
  155. }
  156. else if (f_strValue == "1")
  157. {
  158. material.EnableKeyword(f_strPropName);
  159. }
  160. }
  161. else
  162. {
  163. Type type = Assembly.Load("UnityEngine.dll").GetType(f_strTypeName);
  164. if (type == null)
  165. {
  166. type = Type.GetType(f_strTypeName, false, true);
  167. }
  168. if (type == null)
  169. {
  170. Debug.LogError("タイプ " + f_strTypeName + " は存在しません。");
  171. return;
  172. }
  173. if (material.HasProperty(f_strPropName))
  174. {
  175. material.SetFloat(f_strPropName, float.Parse(f_strValue));
  176. if (f_bEditSave)
  177. {
  178. this.body.maid.SetMaterialProperty(f_SrcMpn, this.SlotId, f_nMatNo, f_strPropName, f_strTypeName, f_strValue);
  179. }
  180. else
  181. {
  182. MatPropSave materialProperty = this.body.maid.GetMaterialProperty(f_SrcMpn, this.SlotId);
  183. if (materialProperty != null)
  184. {
  185. this.SetMaterialProperty(f_SrcMpn, materialProperty.nMatNo, materialProperty.strPropName, materialProperty.strTypeName, materialProperty.strValue, true);
  186. }
  187. }
  188. }
  189. else
  190. {
  191. Debug.LogWarning(f_strPropName + "はありませんでした。");
  192. }
  193. }
  194. }
  195. }
  196. }
  197. public string GetMaterialProperty(int f_nMatNo, string f_strPropName, string f_strType = "AUTO")
  198. {
  199. if (this.obj == null)
  200. {
  201. return string.Empty;
  202. }
  203. bool flag = f_strType == "DEFINE";
  204. Transform[] componentsInChildren = this.obj.transform.GetComponentsInChildren<Transform>(true);
  205. int i = 0;
  206. while (i < componentsInChildren.Length)
  207. {
  208. Transform transform = componentsInChildren[i];
  209. Renderer component = transform.GetComponent<Renderer>();
  210. if (component != null && component.material != null && f_nMatNo < component.materials.Length)
  211. {
  212. Material material = component.materials[f_nMatNo];
  213. if (flag)
  214. {
  215. return (!material.IsKeywordEnabled(f_strPropName)) ? "0" : "1";
  216. }
  217. return material.GetFloat(f_strPropName).ToString();
  218. }
  219. else
  220. {
  221. i++;
  222. }
  223. }
  224. return string.Empty;
  225. }
  226. public void ChangeShader(int f_nMatNo, string f_strShaderFileName)
  227. {
  228. this.ChangeShader(f_nMatNo, Resources.Load<Shader>("Shaders/" + f_strShaderFileName));
  229. }
  230. private void ChangeShader(int f_nMatNo, Shader f_shader)
  231. {
  232. GameObject gameObject = this.obj;
  233. if (gameObject == null)
  234. {
  235. return;
  236. }
  237. foreach (Transform transform in gameObject.transform.GetComponentsInChildren<Transform>(true))
  238. {
  239. Renderer component = transform.GetComponent<Renderer>();
  240. if (component != null && component.material != null && f_nMatNo < component.materials.Length)
  241. {
  242. if (!this.m_dicBackupShader.ContainsKey(f_nMatNo))
  243. {
  244. this.m_dicBackupShader[f_nMatNo] = component.materials[f_nMatNo].shader;
  245. }
  246. Material material = component.materials[f_nMatNo];
  247. int renderQueue = material.renderQueue;
  248. material.shader = f_shader;
  249. material.renderQueue = renderQueue;
  250. }
  251. }
  252. }
  253. public void RestoreShader()
  254. {
  255. foreach (KeyValuePair<int, Shader> keyValuePair in this.m_dicBackupShader)
  256. {
  257. this.ChangeShader(keyValuePair.Key, keyValuePair.Value);
  258. }
  259. this.m_dicBackupShader.Clear();
  260. }
  261. public bool EnablePartsPosEdit
  262. {
  263. get
  264. {
  265. return this.m_bEnablePartPosEdit;
  266. }
  267. set
  268. {
  269. if (this.m_bEnablePartPosEdit == value)
  270. {
  271. return;
  272. }
  273. if (value)
  274. {
  275. BoneAttachPos tbodySkinPos = this.body.maid.GetTBodySkinPos(this.m_ParentMPN, this.SlotId);
  276. if (tbodySkinPos != null && this.obj_tr != null)
  277. {
  278. Vector3 vector = tbodySkinPos.pss.position;
  279. this.obj_tr.localPosition = vector;
  280. this.m_vPosLocal = vector;
  281. Quaternion rotation = tbodySkinPos.pss.rotation;
  282. this.obj_tr.localRotation = rotation;
  283. this.m_qRotLocal = rotation;
  284. vector = tbodySkinPos.pss.scale;
  285. this.obj_tr.localScale = vector;
  286. this.m_vScaleRate = vector;
  287. }
  288. }
  289. else if (this.obj_tr != null)
  290. {
  291. this.obj_tr.localPosition = this.m_vDefPosLocal;
  292. this.obj_tr.localRotation = this.m_qDefRotLocal;
  293. this.obj_tr.localScale = this.m_vDefScaleLocal;
  294. }
  295. if (this.center_tr != null)
  296. {
  297. this.center_tr.localPosition = this.m_vCenterPosLocal;
  298. this.center_tr.localRotation = Quaternion.identity;
  299. this.center_tr.localScale = Vector3.one;
  300. }
  301. this.m_bEnablePartPosEdit = value;
  302. this.body.maid.SetTBodySkinPos(this.m_ParentMPN, this.SlotId, this.m_vPosLocal, this.m_qRotLocal, this.m_vScaleRate, this.m_bEnablePartPosEdit);
  303. }
  304. }
  305. public bool GetAttachObjPointLocal(out Vector3 f_vPosLocal, out Quaternion f_vRotLocal, out Vector3 f_vScaleLocal)
  306. {
  307. f_vPosLocal = Vector3.zero;
  308. f_vRotLocal = Quaternion.identity;
  309. f_vScaleLocal = Vector3.zero;
  310. return false;
  311. }
  312. public bool SetAttachObjPointLocal(Vector3 f_vPosLocal, Quaternion f_vRotLocal, Vector3 f_vScaleLocal)
  313. {
  314. return false;
  315. }
  316. public bool CopyAttachObjPoint()
  317. {
  318. if (this.center_tr == null || this.obj_tr == null)
  319. {
  320. return false;
  321. }
  322. this.m_vTempAttachPointPos = this.obj_tr.localPosition;
  323. this.m_qTempAttachPointRot = this.obj_tr.localRotation;
  324. this.m_vTempAttachPointScale = this.obj_tr.localScale;
  325. return true;
  326. }
  327. public bool PastAttachObjPoint()
  328. {
  329. if (this.center_tr == null || this.obj_tr == null || !this.m_bEnablePartPosEdit)
  330. {
  331. return false;
  332. }
  333. Vector3 vector = this.m_vTempAttachPointPos;
  334. this.obj_tr.localPosition = vector;
  335. this.m_vPosLocal = vector;
  336. Quaternion qTempAttachPointRot = this.m_qTempAttachPointRot;
  337. this.obj_tr.localRotation = qTempAttachPointRot;
  338. this.m_qRotLocal = qTempAttachPointRot;
  339. vector = this.m_vTempAttachPointScale;
  340. this.obj_tr.localScale = vector;
  341. this.m_vScaleRate = vector;
  342. this.center_tr.localPosition = this.m_vCenterPosLocal;
  343. this.center_tr.localRotation = Quaternion.identity;
  344. this.center_tr.localScale = Vector3.one;
  345. this.body.maid.SetTBodySkinPos(this.m_ParentMPN, this.SlotId, this.m_vPosLocal, this.m_qRotLocal, this.m_vScaleRate, this.m_bEnablePartPosEdit);
  346. return true;
  347. }
  348. public bool GetAttachCenterPointWorld(out Vector3 f_vPosWorld, out Quaternion f_vRotWorld, out Vector3 f_vScaleLocal)
  349. {
  350. if (this.center_tr == null)
  351. {
  352. f_vPosWorld = Vector3.zero;
  353. f_vRotWorld = Quaternion.identity;
  354. f_vScaleLocal = Vector3.zero;
  355. return false;
  356. }
  357. f_vPosWorld = this.center_tr.position;
  358. f_vRotWorld = this.center_tr.rotation;
  359. f_vScaleLocal = this.m_vScaleRate;
  360. return true;
  361. }
  362. public bool SetAttachCenterPointWorld(Vector3 f_vPosWorld, Quaternion f_vRotWorld, Vector3 f_vScaleLocal)
  363. {
  364. if (this.center_tr == null || !this.m_bEnablePartPosEdit)
  365. {
  366. return false;
  367. }
  368. Transform parent = this.center_tr.parent;
  369. Transform parent2 = this.obj_tr.parent;
  370. this.obj_tr.localPosition = (this.m_vPosLocal = this.m_vDefPosLocal);
  371. this.obj_tr.localRotation = (this.m_qRotLocal = this.m_qDefRotLocal);
  372. this.obj_tr.localScale = (this.m_vScaleRate = this.m_vDefScaleLocal);
  373. this.center_tr.localPosition = this.m_vCenterPosLocal;
  374. this.center_tr.localRotation = Quaternion.identity;
  375. this.center_tr.localScale = Vector3.one;
  376. this.center_tr.SetParent(this.obj_tr.parent, true);
  377. this.obj_tr.SetParent(this.center_tr, true);
  378. this.center_tr.position = f_vPosWorld;
  379. this.center_tr.rotation = f_vRotWorld;
  380. this.center_tr.localScale = f_vScaleLocal;
  381. this.obj_tr.SetParent(parent2, true);
  382. this.center_tr.SetParent(parent, true);
  383. this.center_tr.localPosition = this.m_vCenterPosLocal;
  384. this.center_tr.localRotation = Quaternion.identity;
  385. this.center_tr.localScale = Vector3.one;
  386. this.m_vPosLocal = this.obj_tr.localPosition;
  387. this.m_qRotLocal = this.obj_tr.localRotation;
  388. this.m_vScaleRate = this.obj_tr.localScale;
  389. this.body.maid.SetTBodySkinPos(this.m_ParentMPN, this.SlotId, this.m_vPosLocal, this.m_qRotLocal, this.m_vScaleRate, this.m_bEnablePartPosEdit);
  390. return true;
  391. }
  392. public bool ResetAttachCenterPoint()
  393. {
  394. if (this.center_tr == null)
  395. {
  396. return false;
  397. }
  398. this.obj_tr.localPosition = (this.m_vPosLocal = this.m_vDefPosLocal);
  399. this.obj_tr.localRotation = (this.m_qRotLocal = this.m_qDefRotLocal);
  400. this.obj_tr.localScale = (this.m_vScaleRate = this.m_vDefScaleLocal);
  401. this.center_tr.localPosition = this.m_vCenterPosLocal;
  402. this.center_tr.localRotation = Quaternion.identity;
  403. this.center_tr.localScale = Vector3.one;
  404. this.body.maid.ClearTBodySkinPos(this.m_ParentMPN, this.SlotId);
  405. return true;
  406. }
  407. public void LoadHitcheckData(Transform body_bone, string fn, int rot, string tag)
  408. {
  409. this.bonehair.Init();
  410. this.bonehair.LoadHitCheck(body_bone, fn + ".hitcheck", rot, tag);
  411. this.bonehair2.Init();
  412. this.bonehair3.Init();
  413. }
  414. 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)
  415. {
  416. this.DeleteObj();
  417. if (mpn == MPN.accashi || mpn == MPN.shoes)
  418. {
  419. this.m_bHitFloorY = false;
  420. }
  421. this.m_ParentMPN = mpn;
  422. if (this.m_ParentMPN != MPN.null_mpn)
  423. {
  424. this.m_mp = this.body.maid.GetProp(this.m_ParentMPN);
  425. }
  426. this.m_bTemp = f_bTemp;
  427. this.boVisible = true;
  428. Vector3 position = srcbody.position;
  429. Quaternion rotation = srcbody.rotation;
  430. Vector3 localScale = srcbody.localScale;
  431. Vector3 position2 = body1.position;
  432. Quaternion rotation2 = body1.rotation;
  433. Vector3 localScale2 = body1.localScale;
  434. srcbody.position = Vector3.zero;
  435. srcbody.rotation = Quaternion.identity;
  436. srcbody.localScale = new Vector3(1f / srcbody.lossyScale.x, 1f / srcbody.lossyScale.y, 1f / srcbody.lossyScale.z);
  437. body1.position = Vector3.zero;
  438. body1.rotation = Quaternion.identity;
  439. body1.localScale = new Vector3(1f / body1.lossyScale.x, 1f / body1.lossyScale.y, 1f / body1.lossyScale.z);
  440. this.morph = new TMorph(this);
  441. GameObject gameObject = ImportCM.LoadSkinMesh_R(filename, this.morph, slotname, this, layer);
  442. if (this.m_bMan)
  443. {
  444. foreach (Transform transform in gameObject.GetComponentsInChildren<Transform>(true))
  445. {
  446. Renderer component = transform.GetComponent<Renderer>();
  447. if (!(component == null) && component.materials != null)
  448. {
  449. foreach (Material material in component.materials)
  450. {
  451. if (material.shader.name == "CM3D2/Man")
  452. {
  453. this.m_listManAlphaMat.Add(material);
  454. }
  455. if (material.shader.name == "CM3D2/Mosaic")
  456. {
  457. material.SetFloat("_FloatValue1", 15f);
  458. }
  459. }
  460. }
  461. }
  462. }
  463. if (this.body.m_bNewPhyscs)
  464. {
  465. if (!this.bonehair2.InitGameObject(gameObject, mpn))
  466. {
  467. bool bNoSkirt = this.bonehair3.InitGameObject(gameObject, mpn);
  468. this.bonehair.SearchGameObj(gameObject, bNoSkirt);
  469. }
  470. }
  471. else
  472. {
  473. this.bonehair.SearchGameObj(gameObject, false);
  474. }
  475. this.morph.InitGameObject(gameObject);
  476. gameObject.transform.parent = CMT.SearchObjName(srcbody, bonename, true);
  477. Vector3 localPosition = gameObject.transform.localPosition;
  478. Vector3 localScale3 = gameObject.transform.localScale;
  479. Quaternion localRotation = gameObject.transform.localRotation;
  480. gameObject.transform.parent = CMT.SearchObjName(body1, bonename, true);
  481. if (!string.IsNullOrEmpty(AttachSlot))
  482. {
  483. this.AttachVisible = true;
  484. }
  485. if (AttachSlot == "ボーンにアタッチ" && (bonename == "_IK_handR" || bonename == "_IK_handL"))
  486. {
  487. localPosition = Vector3.zero;
  488. localRotation = Quaternion.identity;
  489. localScale3 = Vector3.one;
  490. }
  491. gameObject.transform.localPosition = localPosition;
  492. gameObject.transform.localRotation = localRotation;
  493. gameObject.transform.localScale = localScale3;
  494. this.obj = gameObject;
  495. this.obj_tr = this.obj.transform;
  496. this.listTrs = new List<Transform>(200);
  497. this.listTrsScr = new List<Transform>(4);
  498. CMT.BindTrans(this.listTrs, this.listTrsScr, trans, gameObject.transform);
  499. srcbody.position = position;
  500. srcbody.rotation = rotation;
  501. srcbody.localScale = localScale;
  502. body1.position = position2;
  503. body1.rotation = rotation2;
  504. body1.localScale = localScale2;
  505. this.ItemScaleReset();
  506. this.OnChangeScreenSizeOrAA();
  507. if (this.m_bMan)
  508. {
  509. this.ManColorUpdate();
  510. }
  511. foreach (KeyValuePair<string, float> keyValuePair in this.m_BonehairBodyhitScaleBackup)
  512. {
  513. this.bonehair.bodyhit.ScaleMune(keyValuePair.Key, keyValuePair.Value);
  514. }
  515. IEnumerator enumerator2 = this.morph.hash.Keys.GetEnumerator();
  516. try
  517. {
  518. while (enumerator2.MoveNext())
  519. {
  520. object obj = enumerator2.Current;
  521. string key = (string)obj;
  522. int f_nIdx = (int)this.morph.hash[key];
  523. float f_fValue;
  524. if (this.body.m_MorphBlendValues.TryGetValue(key, out f_fValue))
  525. {
  526. this.morph.SetBlendValues(f_nIdx, f_fValue);
  527. }
  528. }
  529. }
  530. finally
  531. {
  532. IDisposable disposable;
  533. if ((disposable = (enumerator2 as IDisposable)) != null)
  534. {
  535. disposable.Dispose();
  536. }
  537. }
  538. this.morph.FixBlendValues();
  539. this.m_vDefPosLocal = (this.m_vPosLocal = this.obj_tr.localPosition);
  540. this.m_qDefRotLocal = (this.m_qRotLocal = this.obj_tr.localRotation);
  541. this.m_vDefScaleLocal = (this.m_vScaleRate = this.obj_tr.localScale);
  542. 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))
  543. {
  544. SkinnedMeshRenderer componentInChildren = this.obj_tr.GetComponentInChildren<SkinnedMeshRenderer>(true);
  545. if (componentInChildren != null)
  546. {
  547. Bounds bounds = componentInChildren.bounds;
  548. GameObject gameObject2 = new GameObject("center");
  549. gameObject2.transform.SetParent(this.obj_tr, false);
  550. gameObject2.transform.position = bounds.center;
  551. GameObject gameObject3 = new GameObject("center2");
  552. gameObject3.transform.SetParent(gameObject2.transform, false);
  553. gameObject3.transform.position = bounds.center;
  554. this.m_vCenterPosLocal = gameObject2.transform.localPosition;
  555. this.center_tr = gameObject2.transform;
  556. this.center_tr2 = gameObject3.transform;
  557. BoneAttachPos tbodySkinPos = this.body.maid.GetTBodySkinPos(this.m_ParentMPN, this.SlotId);
  558. if (tbodySkinPos != null)
  559. {
  560. this.m_vPosLocal = tbodySkinPos.pss.position;
  561. this.m_qRotLocal = tbodySkinPos.pss.rotation;
  562. this.m_vScaleRate = tbodySkinPos.pss.scale;
  563. this.m_bEnablePartPosEdit = tbodySkinPos.bEnable;
  564. if (this.m_bEnablePartPosEdit)
  565. {
  566. this.obj_tr.localPosition = tbodySkinPos.pss.position;
  567. this.obj_tr.localRotation = tbodySkinPos.pss.rotation;
  568. this.obj_tr.localScale = tbodySkinPos.pss.scale;
  569. }
  570. }
  571. else
  572. {
  573. this.body.maid.ClearTBodySkinPos(this.m_ParentMPN, this.SlotId);
  574. }
  575. }
  576. }
  577. this.m_HairLengthCtrl.NotExistThenClearHairLength();
  578. 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))
  579. {
  580. this.LayerCheck(this.obj);
  581. }
  582. }
  583. public void ItemScaleReset()
  584. {
  585. if (this.m_mp != null && this.m_mp.bNoScale)
  586. {
  587. Transform parent = this.obj_tr.parent;
  588. this.obj_tr.SetParent(null, true);
  589. this.obj_tr.localScale = Vector3.one;
  590. this.obj_tr.SetParent(parent, true);
  591. }
  592. }
  593. private void LayerCheck(GameObject goParent)
  594. {
  595. for (int i = 0; i < goParent.transform.childCount; i++)
  596. {
  597. this.LayerCheck(goParent.transform.GetChild(i).gameObject);
  598. }
  599. goParent.layer = LayerMask.NameToLayer("Face");
  600. }
  601. public void SetVisibleFlag(bool boSetFlag, string name, Transform t = null, bool boTgt = false)
  602. {
  603. if (t.name.IndexOf(name) >= 0)
  604. {
  605. boTgt = true;
  606. }
  607. if (name == "_ALL_")
  608. {
  609. boTgt = true;
  610. }
  611. if (boTgt)
  612. {
  613. this.m_dicDelNodeBody[t.name] = boSetFlag;
  614. }
  615. IEnumerator enumerator = t.GetEnumerator();
  616. try
  617. {
  618. while (enumerator.MoveNext())
  619. {
  620. object obj = enumerator.Current;
  621. Transform t2 = (Transform)obj;
  622. this.SetVisibleFlag(boSetFlag, name, t2, boTgt);
  623. }
  624. }
  625. finally
  626. {
  627. IDisposable disposable;
  628. if ((disposable = (enumerator as IDisposable)) != null)
  629. {
  630. disposable.Dispose();
  631. }
  632. }
  633. }
  634. public void SetVisibleFlagParts(bool f_bSetFlag, string f_strTargetSlot, string f_strBoneName, Transform t = null, bool boTgt = false)
  635. {
  636. if (t.name.IndexOf(f_strBoneName) >= 0)
  637. {
  638. boTgt = true;
  639. }
  640. if (f_strBoneName == "_ALL_")
  641. {
  642. boTgt = true;
  643. }
  644. if (boTgt)
  645. {
  646. Dictionary<string, bool> dictionary;
  647. if (!this.m_dicDelNodeParts.TryGetValue(f_strTargetSlot, out dictionary))
  648. {
  649. dictionary = new Dictionary<string, bool>();
  650. this.m_dicDelNodeParts.Add(f_strTargetSlot, dictionary);
  651. }
  652. dictionary[t.name] = f_bSetFlag;
  653. }
  654. IEnumerator enumerator = t.GetEnumerator();
  655. try
  656. {
  657. while (enumerator.MoveNext())
  658. {
  659. object obj = enumerator.Current;
  660. Transform t2 = (Transform)obj;
  661. this.SetVisibleFlagParts(f_bSetFlag, f_strTargetSlot, f_strBoneName, t2, boTgt);
  662. }
  663. }
  664. finally
  665. {
  666. IDisposable disposable;
  667. if ((disposable = (enumerator as IDisposable)) != null)
  668. {
  669. disposable.Dispose();
  670. }
  671. }
  672. }
  673. public void CopyTrans()
  674. {
  675. for (int i = 0; i < this.listTrs.Count; i += 2)
  676. {
  677. this.listTrs[i].localRotation = this.listTrs[i + 1].localRotation;
  678. this.listTrs[i].localPosition = this.listTrs[i + 1].localPosition;
  679. }
  680. for (int j = 0; j < this.listTrsScr.Count; j += 2)
  681. {
  682. this.listTrsScr[j].localScale = this.listTrsScr[j + 1].localScale;
  683. }
  684. this.TightSkirt();
  685. }
  686. public void TightSkirt()
  687. {
  688. }
  689. private void LookAtAxis(Transform f_trSrc, Vector3 f_vTargetPosWorld, TBodySkin.Axis f_axis, Vector3 f_vForwardWorld)
  690. {
  691. Vector3 position = f_trSrc.InverseTransformPoint(f_vTargetPosWorld);
  692. if (f_axis == TBodySkin.Axis.X)
  693. {
  694. position.x = 0f;
  695. }
  696. else if (f_axis == TBodySkin.Axis.Y)
  697. {
  698. position.y = 0f;
  699. }
  700. else
  701. {
  702. position.z = 0f;
  703. }
  704. Vector3 vector = f_trSrc.TransformPoint(position);
  705. Debug.DrawLine(vector, f_trSrc.position, Color.cyan);
  706. Quaternion lhs = Quaternion.FromToRotation(f_vForwardWorld, (vector - f_trSrc.position).normalized);
  707. f_trSrc.rotation = lhs * f_trSrc.rotation;
  708. }
  709. public void OnChangeScreenSizeOrAA()
  710. {
  711. bool flag = QualitySettings.antiAliasing != 0;
  712. if (this.obj == null)
  713. {
  714. return;
  715. }
  716. bool flag2 = !flag && !GameMain.Instance.MainCamera.IsBloomEnabled;
  717. if (GameMain.Instance.VRMode && !GameMain.Instance.VRDummyMode)
  718. {
  719. flag2 = false;
  720. }
  721. this.obj.GetComponentsInChildren<Renderer>(true, this.m_listRnederTemp);
  722. for (int i = 0; i < this.m_listRnederTemp.Count; i++)
  723. {
  724. Renderer renderer = this.m_listRnederTemp[i];
  725. if (!(renderer.material == null))
  726. {
  727. foreach (Material material in renderer.materials)
  728. {
  729. if (flag2)
  730. {
  731. material.EnableKeyword("UV_POS_REVERSE");
  732. material.DisableKeyword("UV_POS_NORMAL");
  733. }
  734. else
  735. {
  736. material.DisableKeyword("UV_POS_NORMAL");
  737. material.DisableKeyword("UV_POS_REVERSE");
  738. }
  739. }
  740. }
  741. }
  742. }
  743. private IEnumerator CoReFixBlendValues()
  744. {
  745. yield return null;
  746. this.morph.ResetBlendValues();
  747. yield break;
  748. }
  749. public void ManColorUpdate()
  750. {
  751. for (int i = 0; i < this.m_listManAlphaMat.Count; i++)
  752. {
  753. Material material = this.m_listManAlphaMat[i];
  754. material.SetFloat("_FloatValue2", (float)GameMain.Instance.CMSystem.ManAlpha / 100f);
  755. material.SetColor("_Color", this.body.maid.ManColor);
  756. }
  757. }
  758. public bool AnimationLoad(string f_strAnimName)
  759. {
  760. if (this.m_animItem == null)
  761. {
  762. this.m_animItem = this.obj.AddComponent<Animation>();
  763. }
  764. if (this.m_animItem.GetClip(f_strAnimName) == null)
  765. {
  766. string text = f_strAnimName;
  767. if (string.IsNullOrEmpty(Path.GetExtension(text)))
  768. {
  769. text += ".anm";
  770. }
  771. AnimationClip animationClip = ImportCM.LoadAniClipNative(GameUty.FileSystem, text, true, true, true);
  772. if (animationClip == null)
  773. {
  774. NDebug.Assert("アニメーション " + text + " が見つかりません。", false);
  775. return false;
  776. }
  777. this.m_animItem.Stop();
  778. this.m_animItem.AddClip(animationClip, f_strAnimName);
  779. this.m_animItem.clip = animationClip;
  780. this.m_animItem.playAutomatically = true;
  781. }
  782. this.m_animItem.Stop();
  783. return true;
  784. }
  785. public bool AnimationPlay(string f_strAnimName, bool f_bLoop)
  786. {
  787. if (this.m_animItem == null)
  788. {
  789. Debug.LogError("まだアイテムアニメが読まれていません。");
  790. return false;
  791. }
  792. this.m_animItem.Stop();
  793. this.m_animItem.wrapMode = ((!f_bLoop) ? WrapMode.Once : WrapMode.Loop);
  794. if (this.m_animItem.GetClip(f_strAnimName) == null)
  795. {
  796. NDebug.Assert("アニメーション " + f_strAnimName + " は設定されていません。", false);
  797. return false;
  798. }
  799. this.m_animItem[f_strAnimName].time = 0f;
  800. this.m_animItem.Play(f_strAnimName);
  801. return true;
  802. }
  803. public bool AnimationStop()
  804. {
  805. if (this.m_animItem == null)
  806. {
  807. return false;
  808. }
  809. this.m_animItem.Stop();
  810. return true;
  811. }
  812. public bool MaterialAnimatorAdd(int f_nMateNo)
  813. {
  814. Renderer componentInChildren = this.obj.GetComponentInChildren<Renderer>();
  815. if (componentInChildren != null)
  816. {
  817. MaterialAnimator materialAnimator = componentInChildren.gameObject.AddComponent<MaterialAnimator>();
  818. materialAnimator.m_nMateNo = f_nMateNo;
  819. materialAnimator.Init();
  820. }
  821. return true;
  822. }
  823. public void Update()
  824. {
  825. if (this.obj == null)
  826. {
  827. return;
  828. }
  829. if (this.obj.activeSelf != this.boVisible)
  830. {
  831. CMT.SetActiveFlag(this.obj_tr, this.boVisible);
  832. if (this.boVisible)
  833. {
  834. this.body.StartCoroutine(this.CoReFixBlendValues());
  835. }
  836. }
  837. if (!this.boVisible)
  838. {
  839. return;
  840. }
  841. if (this.trsBoneAttach != null)
  842. {
  843. this.obj_tr.position = this.trsBoneAttach.position;
  844. this.obj_tr.rotation = this.trsBoneAttach.rotation;
  845. }
  846. if (this.AttachName != null && this.body.goSlot[this.AttachSlotIdx].morph != null)
  847. {
  848. Vector3 position;
  849. Quaternion rotation;
  850. Vector3 vector;
  851. if (this.body.goSlot[this.AttachSlotIdx].morph.GetAttachPoint(this.AttachName, out position, out rotation, out vector, this.m_bTemp))
  852. {
  853. if (!this.AttachVisible)
  854. {
  855. this.obj_tr.localScale = Vector3.one;
  856. this.AttachVisible = true;
  857. }
  858. this.obj_tr.position = position;
  859. this.obj_tr.rotation = rotation;
  860. this.obj_tr.localScale = new Vector3(this.m_vDefScaleLocal.x * vector.x, this.m_vDefScaleLocal.y * vector.y, this.m_vDefScaleLocal.z * vector.z);
  861. }
  862. else if (this.AttachVisible)
  863. {
  864. this.obj_tr.localScale = Vector3.zero;
  865. this.AttachVisible = false;
  866. }
  867. }
  868. Vector3 localScale = this.m_trMaid.localScale;
  869. Vector3 localScale2 = this.m_trMaidOffs.localScale;
  870. if (localScale.x < 0.998f || 1.002f < localScale.x || localScale2.x < 0.998f || 1.002f < localScale2.x)
  871. {
  872. this.m_trMaid.localScale = Vector3.one;
  873. this.m_trMaidOffs.localScale = Vector3.one;
  874. this.bonehair.Update();
  875. this.bonehair3.UpdateSelf();
  876. this.m_trMaid.localScale = localScale;
  877. this.m_trMaidOffs.localScale = localScale2;
  878. }
  879. else
  880. {
  881. this.bonehair.Update();
  882. this.bonehair3.UpdateSelf();
  883. }
  884. }
  885. public TBody body;
  886. public string Category;
  887. public TBody.SlotID SlotId;
  888. public bool boVisible = true;
  889. public List<int> listMaskSlot = new List<int>();
  890. public GameObject obj;
  891. public Transform obj_tr;
  892. public Transform center_tr;
  893. public Transform center_tr2;
  894. private List<Transform> listTrs;
  895. private List<Transform> listTrsScr;
  896. public List<UnityEngine.Object> listDEL = new List<UnityEngine.Object>();
  897. public Dictionary<string, UnityEngine.Object> dicDel = new Dictionary<string, UnityEngine.Object>();
  898. private List<Material> m_listRtMaterial = new List<Material>();
  899. public TMorph morph;
  900. public Dictionary<string, bool> m_dicDelNodeBody = new Dictionary<string, bool>();
  901. public Dictionary<string, Dictionary<string, bool>> m_dicDelNodeParts = new Dictionary<string, Dictionary<string, bool>>();
  902. public TBoneHair_ bonehair;
  903. public BoneHair2 bonehair2;
  904. public BoneHair3 bonehair3;
  905. public bool boMizugi;
  906. public Dictionary<string, KeyValuePair<float, string>[]> dicParamSet = new Dictionary<string, KeyValuePair<float, string>[]>();
  907. private Dictionary<string, string> m_dicParam = new Dictionary<string, string>();
  908. private Dictionary<string, string> m_dicParam2 = new Dictionary<string, string>();
  909. public Transform trsBoneAttach;
  910. public string AttachName;
  911. public bool AttachVisible;
  912. public int AttachSlotIdx;
  913. private Quaternion AttachRotation;
  914. public Vector3 m_vDefScaleLocal;
  915. public Vector3 m_vScaleRate;
  916. public Vector3 m_vTempAttachPointScale;
  917. public Vector3 m_vDefPosLocal;
  918. public Vector3 m_vPosLocal;
  919. public Vector3 m_vCenterPosLocal;
  920. public Vector3 m_vTempAttachPointPos;
  921. public Quaternion m_qDefRotLocal;
  922. public Quaternion m_qRotLocal;
  923. public Quaternion m_qTempAttachPointRot;
  924. public int RID;
  925. public int SyojiType;
  926. public string m_strModelFileName = string.Empty;
  927. public MPN m_ParentMPN;
  928. public MaidProp m_mp;
  929. private bool m_bMan;
  930. private List<Material> m_listManAlphaMat = new List<Material>();
  931. public InfinityColorTextureCache TextureCache;
  932. private bool m_bEnablePartPosEdit;
  933. public Dictionary<string, float> m_BonehairBodyhitScaleBackup = new Dictionary<string, float>();
  934. public Dictionary<string, TMorph.TempAttachPos> m_dicTempAttachPoint = new Dictionary<string, TMorph.TempAttachPos>();
  935. public bool m_bHitFloorY = true;
  936. private Transform m_trMaid;
  937. private Transform m_trMaidOffs;
  938. private Dictionary<int, Shader> m_dicBackupShader = new Dictionary<int, Shader>();
  939. private bool m_bTemp;
  940. private Transform m_trThigh_L;
  941. private Transform m_trThigh_R;
  942. private Transform m_trCalf_L;
  943. private Transform m_trCalf_R;
  944. private Transform m_trFoot_L;
  945. private Transform m_trFoot_R;
  946. public TBodySkin.OriVert m_OriVert = new TBodySkin.OriVert();
  947. public TBodySkin.HairLengthCtrl m_HairLengthCtrl;
  948. private Animation m_animItem;
  949. private List<Renderer> m_listRnederTemp = new List<Renderer>(4);
  950. public class HairLengthCtrl
  951. {
  952. public HairLengthCtrl(TBodySkin f_trTbodySkin)
  953. {
  954. this.m_tbskin = f_trTbodySkin;
  955. this.m_maid = this.m_tbskin.body.maid;
  956. }
  957. public bool IsHairLengthEditable
  958. {
  959. get
  960. {
  961. return this.m_dicHairLenght != null && this.m_dicHairLenght.Count != 0;
  962. }
  963. }
  964. public Dictionary<string, TBodySkin.HairLengthCtrl.HairLength> HairLengthGroupList
  965. {
  966. get
  967. {
  968. return this.m_dicHairLenght;
  969. }
  970. }
  971. public void NotExistThenClearHairLength()
  972. {
  973. if (this.m_maid.NotExistThenClearHairLengthMP(this.m_tbskin.m_ParentMPN, this.m_tbskin.SlotId))
  974. {
  975. }
  976. this.m_dicHairLenght.Clear();
  977. }
  978. public void SearchAndAddHairLengthTarget(string f_strGroupName, string f_strBoneSearchType, string f_strBoneName, Vector3 f_vScaleMin, Vector3 f_vScaleMax)
  979. {
  980. if (this.m_tbskin == null || this.m_tbskin.obj_tr == null)
  981. {
  982. NDebug.Assert("髪ボーン拡縮検索 親が未だありません。", false);
  983. }
  984. string pattern = f_strBoneName.Replace("*", ".*");
  985. TBodySkin.HairLengthCtrl.SerchMode mode = TBodySkin.HairLengthCtrl.SerchMode.ALL;
  986. if (f_strBoneSearchType == "fbrother")
  987. {
  988. mode = TBodySkin.HairLengthCtrl.SerchMode.FIRST_BROTHER;
  989. }
  990. else if (f_strBoneSearchType == "fchild")
  991. {
  992. mode = TBodySkin.HairLengthCtrl.SerchMode.FIRST_CHILD;
  993. }
  994. else if (f_strBoneSearchType == "all")
  995. {
  996. mode = TBodySkin.HairLengthCtrl.SerchMode.ALL;
  997. }
  998. else
  999. {
  1000. NDebug.Assert("髪ボーン検索タイプが不正です。 " + f_strBoneSearchType, false);
  1001. }
  1002. this.SearchObjName(f_strGroupName, this.m_tbskin.obj_tr, new Regex(pattern), mode);
  1003. TBodySkin.HairLengthCtrl.HairLength hairLength;
  1004. if (this.m_dicHairLenght.TryGetValue(f_strGroupName, out hairLength))
  1005. {
  1006. hairLength.vScaleMin = f_vScaleMin;
  1007. hairLength.vScaleMax = f_vScaleMax;
  1008. }
  1009. float lengthRate = 0.5f;
  1010. if (this.m_maid.GetHairLengthFromMP(this.m_tbskin.m_ParentMPN, this.m_tbskin.SlotId, f_strGroupName, out lengthRate))
  1011. {
  1012. hairLength.SetLengthRate(lengthRate);
  1013. }
  1014. else
  1015. {
  1016. this.m_maid.ClearHairLengthMP(this.m_tbskin.m_ParentMPN, this.m_tbskin.SlotId);
  1017. }
  1018. this.HairLenghtBlend();
  1019. }
  1020. private Transform SearchObjName(string f_strGroupName, Transform t, Regex regex, TBodySkin.HairLengthCtrl.SerchMode mode)
  1021. {
  1022. string name = t.name;
  1023. if (regex.IsMatch(name))
  1024. {
  1025. TBodySkin.HairLengthCtrl.HairLength hairLength;
  1026. if (!this.m_dicHairLenght.TryGetValue(f_strGroupName, out hairLength))
  1027. {
  1028. hairLength = new TBodySkin.HairLengthCtrl.HairLength(this.m_tbskin, f_strGroupName);
  1029. this.m_dicHairLenght[f_strGroupName] = hairLength;
  1030. }
  1031. hairLength.listTarget.Add(new TBodySkin.HairLengthCtrl.HairLengthTarget
  1032. {
  1033. trTarget = t,
  1034. vScaleDef = t.localScale
  1035. });
  1036. if (mode == TBodySkin.HairLengthCtrl.SerchMode.FIRST_BROTHER || mode == TBodySkin.HairLengthCtrl.SerchMode.FIRST_CHILD)
  1037. {
  1038. return t;
  1039. }
  1040. }
  1041. for (int i = 0; i < t.childCount; i++)
  1042. {
  1043. Transform child = t.GetChild(i);
  1044. Transform transform = this.SearchObjName(f_strGroupName, child, regex, mode);
  1045. if (transform != null && mode == TBodySkin.HairLengthCtrl.SerchMode.FIRST_CHILD)
  1046. {
  1047. return transform;
  1048. }
  1049. }
  1050. return null;
  1051. }
  1052. public void HairLenghtBlend()
  1053. {
  1054. foreach (KeyValuePair<string, TBodySkin.HairLengthCtrl.HairLength> keyValuePair in this.m_dicHairLenght)
  1055. {
  1056. float lengthRate = keyValuePair.Value.GetLengthRate();
  1057. for (int i = 0; i < keyValuePair.Value.listTarget.Count; i++)
  1058. {
  1059. TBodySkin.HairLengthCtrl.HairLengthTarget hairLengthTarget = keyValuePair.Value.listTarget[i];
  1060. Vector3 localScale = hairLengthTarget.vScaleDef;
  1061. if (lengthRate < 0.5f)
  1062. {
  1063. localScale = Vector3.Lerp(keyValuePair.Value.vScaleMin, hairLengthTarget.vScaleDef, lengthRate / 0.5f);
  1064. }
  1065. else if (0.5f < lengthRate)
  1066. {
  1067. localScale = Vector3.Lerp(hairLengthTarget.vScaleDef, keyValuePair.Value.vScaleMax, (lengthRate - 0.5f) / 0.5f);
  1068. }
  1069. hairLengthTarget.trTarget.localScale = localScale;
  1070. }
  1071. }
  1072. }
  1073. private Dictionary<string, TBodySkin.HairLengthCtrl.HairLength> m_dicHairLenght = new Dictionary<string, TBodySkin.HairLengthCtrl.HairLength>();
  1074. private TBodySkin m_tbskin;
  1075. private Maid m_maid;
  1076. public class HairLengthTarget
  1077. {
  1078. public Transform trTarget;
  1079. public Vector3 vScaleDef;
  1080. }
  1081. public class HairLength
  1082. {
  1083. public HairLength(TBodySkin f_tbskin, string f_strGroupName)
  1084. {
  1085. this.m_tbskin = f_tbskin;
  1086. this.strGroupName = f_strGroupName;
  1087. }
  1088. public float GetLengthRate()
  1089. {
  1090. return this.fLenghtRate;
  1091. }
  1092. public void SetLengthRate(float f_fRate)
  1093. {
  1094. Maid maid = this.m_tbskin.body.maid;
  1095. MPN parentMPN = this.m_tbskin.m_ParentMPN;
  1096. TBody.SlotID slotId = this.m_tbskin.SlotId;
  1097. string f_strName = this.strGroupName;
  1098. this.fLenghtRate = f_fRate;
  1099. maid.SetHairLengthSaveToMP(parentMPN, slotId, f_strName, f_fRate);
  1100. }
  1101. private TBodySkin m_tbskin;
  1102. private string strGroupName;
  1103. private float fLenghtRate = 0.5f;
  1104. public Vector3 vScaleMin;
  1105. public Vector3 vScaleMax;
  1106. public List<TBodySkin.HairLengthCtrl.HairLengthTarget> listTarget = new List<TBodySkin.HairLengthCtrl.HairLengthTarget>();
  1107. }
  1108. private enum SerchMode
  1109. {
  1110. FIRST_CHILD,
  1111. FIRST_BROTHER,
  1112. ALL
  1113. }
  1114. }
  1115. public class OriVert
  1116. {
  1117. public void Clear()
  1118. {
  1119. this.VCount = 0;
  1120. this.vOriVert = null;
  1121. this.vOriNorm = null;
  1122. this.nSubMeshCount = 0;
  1123. this.nSubMeshOriTri = null;
  1124. this.bwWeight = null;
  1125. }
  1126. public int VCount;
  1127. public Vector3[] vOriVert;
  1128. public Vector3[] vOriNorm;
  1129. public int nSubMeshCount;
  1130. public int[][] nSubMeshOriTri;
  1131. public BoneWeight[] bwWeight;
  1132. }
  1133. private enum Axis
  1134. {
  1135. X,
  1136. Y,
  1137. Z
  1138. }
  1139. }