TBodySkin.cs 35 KB

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