Menu.cs 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Runtime.CompilerServices;
  7. using System.Text;
  8. using System.Text.RegularExpressions;
  9. using UnityEngine;
  10. public class Menu : MonoBehaviour
  11. {
  12. public static string[] GetModFiles()
  13. {
  14. string fullPath = Path.GetFullPath(".\\");
  15. string path = fullPath + "Mod";
  16. if (!Directory.Exists(path))
  17. {
  18. return null;
  19. }
  20. return Directory.GetFiles(path, "mod_*.mod", SearchOption.AllDirectories);
  21. }
  22. public static string GetModPathFileName(string f_strMenuFileName)
  23. {
  24. string[] modFiles = Menu.GetModFiles();
  25. if (modFiles == null)
  26. {
  27. NDebug.MessageBox("MODエラー", "MODフォルダが無いか、MODフォルダにMODファイルが1つもありません。\n" + f_strMenuFileName);
  28. return string.Empty;
  29. }
  30. string text = Array.Find<string>(modFiles, (string a) => Path.GetFileName(a).ToLower() == f_strMenuFileName.ToLower());
  31. if (string.IsNullOrEmpty(text))
  32. {
  33. NDebug.MessageBox("MODエラー", "MODフォルダにMODファイルが見つかりません。\n" + f_strMenuFileName);
  34. return string.Empty;
  35. }
  36. return text;
  37. }
  38. public static bool ProcScript(Maid maid, string filename, bool f_bTemp = false, SubProp f_SubProp = null)
  39. {
  40. return Menu.ProcScript(maid, new MaidProp
  41. {
  42. strFileName = filename,
  43. strTempFileName = filename
  44. }, f_bTemp, f_SubProp);
  45. }
  46. public static bool ProcScript(Maid maid, MaidProp mp, bool f_bTemp = false, SubProp f_SubProp = null)
  47. {
  48. string text;
  49. if (f_bTemp)
  50. {
  51. text = mp.strTempFileName;
  52. }
  53. else
  54. {
  55. text = mp.strFileName;
  56. }
  57. bool flag = false;
  58. string text2 = string.Empty;
  59. byte[] array = null;
  60. if (text.IndexOf("mod_") == 0)
  61. {
  62. flag = true;
  63. text2 = Menu.GetModPathFileName(text);
  64. if (string.IsNullOrEmpty(text2))
  65. {
  66. return false;
  67. }
  68. text = Menu.GetBaseItemFromMod(text2);
  69. try
  70. {
  71. using (FileStream fileStream = new FileStream(text2, FileMode.Open))
  72. {
  73. if (fileStream == null)
  74. {
  75. Debug.LogWarning("MODアイテムメニューファイルが見つかりません。" + text);
  76. return false;
  77. }
  78. array = new byte[fileStream.Length];
  79. fileStream.Read(array, 0, (int)fileStream.Length);
  80. }
  81. }
  82. catch (Exception ex)
  83. {
  84. Debug.LogError("ProcScript MODアイテムメニューファイルが読み込めませんでした。 : " + text + " : " + ex.Message);
  85. return false;
  86. }
  87. }
  88. byte[] cd = null;
  89. try
  90. {
  91. using (AFileBase afileBase = GameUty.FileOpen(text, null))
  92. {
  93. if (afileBase == null || !afileBase.IsValid())
  94. {
  95. Debug.LogError("アイテムメニューファイルが見つかりません。" + text);
  96. return false;
  97. }
  98. cd = afileBase.ReadAll();
  99. }
  100. }
  101. catch (Exception ex2)
  102. {
  103. Debug.LogError("ProcScript アイテムメニューファイルが読み込めませんでした。 : " + text + " : " + ex2.Message);
  104. return false;
  105. }
  106. Menu.ProcScriptBin(maid, cd, mp, f_bTemp, f_SubProp);
  107. if (flag)
  108. {
  109. Menu.ProcModScriptBin(maid, array, text2, false);
  110. }
  111. return true;
  112. }
  113. private static void ProcScriptBin(Maid maid, byte[] cd, string filename, bool f_bTemp = false, SubProp f_SubProp = null)
  114. {
  115. Menu.ProcScriptBin(maid, cd, new MaidProp
  116. {
  117. strFileName = filename,
  118. strTempFileName = filename
  119. }, f_bTemp, f_SubProp);
  120. }
  121. private static void ProcScriptBin(Maid maid, byte[] cd, MaidProp mp, bool f_bTemp = false, SubProp f_SubProp = null)
  122. {
  123. string text;
  124. if (f_bTemp)
  125. {
  126. text = mp.strTempFileName;
  127. }
  128. else
  129. {
  130. text = mp.strFileName;
  131. }
  132. TBody body = maid.body0;
  133. if (mp.idx == 61 || mp.idx == 64 || mp.idx == 65 || mp.idx == 66)
  134. {
  135. TBodySkin slot = body.GetSlot(1);
  136. if (slot.PartsVersion < 110)
  137. {
  138. return;
  139. }
  140. }
  141. List<Menu.LastParam> list = new List<Menu.LastParam>();
  142. BinaryReader binaryReader = new BinaryReader(new MemoryStream(cd), Encoding.UTF8);
  143. string text2 = binaryReader.ReadString();
  144. NDebug.Assert(text2 == "CM3D2_MENU", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + text2);
  145. int num = binaryReader.ReadInt32();
  146. string text3 = binaryReader.ReadString();
  147. string text4 = binaryReader.ReadString();
  148. string text5 = binaryReader.ReadString();
  149. string text6 = binaryReader.ReadString();
  150. long num2 = (long)binaryReader.ReadInt32();
  151. bool flag = false;
  152. string text7 = string.Empty;
  153. string text8 = string.Empty;
  154. string text9 = string.Empty;
  155. string slotname = string.Empty;
  156. int version = 100;
  157. for (;;)
  158. {
  159. try
  160. {
  161. for (;;)
  162. {
  163. IL_102:
  164. int num3 = (int)binaryReader.ReadByte();
  165. text8 = text7;
  166. text7 = string.Empty;
  167. if (num3 == 0)
  168. {
  169. break;
  170. }
  171. for (int i = 0; i < num3; i++)
  172. {
  173. text7 = text7 + "\"" + binaryReader.ReadString() + "\" ";
  174. }
  175. if (!(text7 == string.Empty))
  176. {
  177. goto IL_169;
  178. }
  179. }
  180. break;
  181. IL_169:
  182. string stringCom = UTY.GetStringCom(text7);
  183. string[] stringList = UTY.GetStringList(text7);
  184. if (stringCom == "end")
  185. {
  186. break;
  187. }
  188. if (stringCom == "name")
  189. {
  190. goto IL_13C4;
  191. }
  192. if (stringCom == "ver")
  193. {
  194. TBodySkin slot2 = body.GetSlot(stringList[1]);
  195. version = int.Parse(stringList[2]);
  196. goto IL_13C4;
  197. }
  198. if (stringCom == "アイテム")
  199. {
  200. Menu.SetMaidItemTemp(maid, stringList[1], f_bTemp);
  201. goto IL_13C4;
  202. }
  203. if (stringCom == "アイテム条件")
  204. {
  205. string slotname2 = stringList[1];
  206. if (stringList[2] == "に何か")
  207. {
  208. bool flag2 = false;
  209. TBodySkin slot3 = body.GetSlot(slotname2);
  210. if (stringList[3] == "有る")
  211. {
  212. if (slot3.obj != null)
  213. {
  214. flag2 = true;
  215. }
  216. }
  217. else if (stringList[3] == "無い")
  218. {
  219. if (slot3.obj == null)
  220. {
  221. flag2 = true;
  222. }
  223. }
  224. else
  225. {
  226. NDebug.Assert("アイテム条件が不正です。「有る」か「無い」かを指定してください。\n" + text7, false);
  227. }
  228. if (stringList[4] == "なら")
  229. {
  230. if (flag2)
  231. {
  232. Menu.SetMaidItemTemp(maid, stringList[5], f_bTemp);
  233. goto IL_2C3;
  234. }
  235. goto IL_2C3;
  236. IL_2C3:
  237. goto IL_2DA;
  238. }
  239. NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text7, false);
  240. goto IL_2DA;
  241. IL_2DA:
  242. goto IL_40E;
  243. }
  244. if (stringList[2] == "が")
  245. {
  246. bool flag3 = false;
  247. TBodySkin slot4 = body.GetSlot(slotname2);
  248. if (slot4.m_strModelFileName == stringList[3])
  249. {
  250. flag3 = true;
  251. }
  252. if (stringList[4] == "なら")
  253. {
  254. if (flag3)
  255. {
  256. Menu.SetMaidItemTemp(maid, stringList[5], f_bTemp);
  257. goto IL_33F;
  258. }
  259. goto IL_33F;
  260. IL_33F:
  261. goto IL_356;
  262. }
  263. NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text7, false);
  264. goto IL_356;
  265. IL_356:
  266. goto IL_40E;
  267. }
  268. if (!(stringList[2] == "のアイテムパラメータの"))
  269. {
  270. goto IL_40E;
  271. }
  272. bool flag4 = false;
  273. TBodySkin slot5 = body.GetSlot(slotname2);
  274. string param = slot5.GetParam(stringList[3].ToLower());
  275. if (stringList[4] == "が")
  276. {
  277. if (stringList[5].ToLower() == param)
  278. {
  279. flag4 = true;
  280. }
  281. }
  282. else
  283. {
  284. NDebug.Assert("アイテム条件が不正です。「が」が必要です。\n" + text7, false);
  285. }
  286. if (stringList[6] == "なら")
  287. {
  288. if (flag4)
  289. {
  290. Menu.SetMaidItemTemp(maid, stringList[7], f_bTemp);
  291. goto IL_3F7;
  292. }
  293. goto IL_3F7;
  294. IL_3F7:
  295. goto IL_40E;
  296. }
  297. NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text7, false);
  298. goto IL_40E;
  299. IL_40E:
  300. goto IL_13C4;
  301. }
  302. if (stringCom == "if")
  303. {
  304. if (stringList[1].IndexOf("maidprop[") != 0)
  305. {
  306. goto IL_58E;
  307. }
  308. string value = stringList[1].Substring(9, stringList[1].Length - 9 - 1);
  309. MPN mpn = (MPN)Enum.Parse(typeof(MPN), value, false);
  310. MaidProp prop = maid.GetProp(mpn);
  311. if (!(stringList[2] == "==") || !(stringList[3] == "nothing") || prop.nFileNameRID != 0 || !(stringList[4] == "?") || stringList[5].IndexOf("setprop[") != 0)
  312. {
  313. goto IL_58E;
  314. }
  315. string value2 = stringList[5].Substring(8, stringList[5].Length - 8 - 1);
  316. MPN idx = (MPN)Enum.Parse(typeof(MPN), value2, false);
  317. if (!(stringList[6] == "="))
  318. {
  319. goto IL_58E;
  320. }
  321. string text10;
  322. if (stringList[7].IndexOf("getprop[") == 0)
  323. {
  324. string value3 = stringList[7].Substring(8, stringList[7].Length - 8 - 1);
  325. MPN mpn2 = (MPN)Enum.Parse(typeof(MPN), value3, false);
  326. MaidProp prop2 = maid.GetProp(mpn2);
  327. text10 = prop2.strFileName;
  328. }
  329. else
  330. {
  331. text10 = stringList[7];
  332. }
  333. if (!string.IsNullOrEmpty(text10))
  334. {
  335. maid.SetProp(idx, text10, 0, false, false);
  336. goto IL_58E;
  337. }
  338. goto IL_58E;
  339. IL_58E:
  340. goto IL_13C4;
  341. }
  342. if (stringCom == "アイテムパラメータ")
  343. {
  344. if (stringList.Length == 4)
  345. {
  346. string text11 = stringList[1];
  347. string text12 = stringList[2].ToLower();
  348. string text13 = stringList[3].ToLower();
  349. list.Add(new Menu.LastParam(0, stringCom, new string[]
  350. {
  351. text11,
  352. text12,
  353. text13
  354. }));
  355. goto IL_603;
  356. }
  357. Debug.LogError("アイテムパラメータ 命令の引数が不正です。SlotNameを明示的に指定しする必要があります。アイテムパラメータ <スロット名> <変数名> <値> の順です。" + text7);
  358. goto IL_603;
  359. IL_603:
  360. goto IL_13C4;
  361. }
  362. if (stringCom == "半脱ぎ" || stringCom == "リソース参照")
  363. {
  364. string key;
  365. string value4;
  366. if (stringCom == "半脱ぎ")
  367. {
  368. key = "半脱ぎ";
  369. value4 = stringList[1];
  370. }
  371. else
  372. {
  373. key = stringList[1];
  374. value4 = stringList[2];
  375. }
  376. int hashCode = Path.GetFileName(text.ToLower()).ToLower().GetHashCode();
  377. SortedDictionary<string, string> sortedDictionary;
  378. if (Menu.m_dicResourceRef.TryGetValue(hashCode, out sortedDictionary))
  379. {
  380. string empty = string.Empty;
  381. if (sortedDictionary.TryGetValue(key, out empty))
  382. {
  383. sortedDictionary[key] = value4;
  384. goto IL_6B5;
  385. }
  386. sortedDictionary.Add(key, value4);
  387. goto IL_6B5;
  388. IL_6B5:
  389. goto IL_6DA;
  390. }
  391. sortedDictionary = new SortedDictionary<string, string>();
  392. sortedDictionary.Add(key, value4);
  393. Menu.m_dicResourceRef.Add(hashCode, sortedDictionary);
  394. goto IL_6DA;
  395. IL_6DA:
  396. goto IL_13C4;
  397. }
  398. if (stringCom == "set")
  399. {
  400. goto IL_13C4;
  401. }
  402. if (stringCom == "setname")
  403. {
  404. goto IL_13C4;
  405. }
  406. if (stringCom == "setslotitem")
  407. {
  408. string tag = stringList[1];
  409. uint val = uint.Parse(stringList[2]);
  410. maid.SetProp(tag, (int)val, false);
  411. goto IL_13C4;
  412. }
  413. if (stringCom == "additem")
  414. {
  415. string text14 = text9;
  416. if (stringList.Length > 1)
  417. {
  418. text14 = stringList[2];
  419. }
  420. slotname = text14;
  421. if (text14 == "body")
  422. {
  423. body.LoadBody_R(stringList[1], maid);
  424. }
  425. string attachSlot = string.Empty;
  426. string attachName = string.Empty;
  427. if (stringList.Length == 6)
  428. {
  429. if (stringList[3] == "アタッチ")
  430. {
  431. attachSlot = stringList[4];
  432. attachName = stringList[5];
  433. }
  434. }
  435. else if (stringList.Length == 5 && stringList[3] == "ボーンにアタッチ")
  436. {
  437. attachSlot = "ボーンにアタッチ";
  438. attachName = stringList[4];
  439. }
  440. if (text14 == "handitemr")
  441. {
  442. attachSlot = "ボーンにアタッチ";
  443. attachName = "_IK_handR";
  444. }
  445. if (text14 == "handiteml")
  446. {
  447. attachSlot = "ボーンにアタッチ";
  448. attachName = "_IK_handL";
  449. }
  450. body.AddItem((MPN)Enum.Parse(typeof(MPN), text9, true), text14, stringList[1], attachSlot, attachName, f_bTemp, version);
  451. body.SetVisibleNodeSlot(text14, true, "_ALL_");
  452. goto IL_13C4;
  453. }
  454. if (stringCom == "nofloory")
  455. {
  456. TBody.SlotID index = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), stringList[1], true);
  457. body.goSlot[(int)index].m_bHitFloorY = false;
  458. goto IL_13C4;
  459. }
  460. if (stringCom == "saveitem")
  461. {
  462. text5 = stringList[1];
  463. goto IL_13C4;
  464. }
  465. if (stringCom == "category")
  466. {
  467. text9 = stringList[1];
  468. goto IL_13C4;
  469. }
  470. if (stringCom == "maskitem")
  471. {
  472. if (stringList.Length > 1)
  473. {
  474. string maskslot = stringList[1];
  475. body.AddMask(text9, maskslot);
  476. goto IL_90A;
  477. }
  478. goto IL_90A;
  479. IL_90A:
  480. goto IL_13C4;
  481. }
  482. if (stringCom == "delitem")
  483. {
  484. string slotname3 = text9;
  485. if (stringList.Length > 1)
  486. {
  487. slotname3 = stringList[1];
  488. }
  489. body.DelItem((MPN)Enum.Parse(typeof(MPN), text9, true), slotname3);
  490. goto IL_13C4;
  491. }
  492. if (stringCom == "node消去")
  493. {
  494. body.SetVisibleNodeSlot(text9, false, stringList[1]);
  495. goto IL_13C4;
  496. }
  497. if (stringCom == "node表示")
  498. {
  499. body.SetVisibleNodeSlot(text9, true, stringList[1]);
  500. goto IL_13C4;
  501. }
  502. if (stringCom == "パーツnode消去")
  503. {
  504. body.SetVisibleNodeSlotParts(text9, stringList[1], false, stringList[2]);
  505. goto IL_13C4;
  506. }
  507. if (stringCom == "パーツnode表示")
  508. {
  509. body.SetVisibleNodeSlotParts(text9, stringList[1], true, stringList[2]);
  510. goto IL_13C4;
  511. }
  512. if (stringCom == "color")
  513. {
  514. string name = stringList[1];
  515. int matno = int.Parse(stringList[2]);
  516. string prop_name = stringList[3];
  517. Color col = new Color(float.Parse(stringList[4]) / 255f, float.Parse(stringList[5]) / 255f, float.Parse(stringList[6]) / 255f, float.Parse(stringList[7]) / 255f);
  518. body.ChangeCol(name, matno, prop_name, col);
  519. goto IL_13C4;
  520. }
  521. if (stringCom == "mancolor")
  522. {
  523. Color manColor = new Color(float.Parse(stringList[1]) / 255f, float.Parse(stringList[2]) / 255f, float.Parse(stringList[3]) / 255f, 1f);
  524. maid.ManColor = manColor;
  525. maid.ManColorUpdate();
  526. goto IL_13C4;
  527. }
  528. if (stringCom == "tex" || stringCom == "テクスチャ変更")
  529. {
  530. string text15 = stringList[1];
  531. int matno2 = int.Parse(stringList[2]);
  532. string prop_name2 = stringList[3];
  533. string filename = stringList[4];
  534. MaidParts.PARTS_COLOR parts_COLOR = MaidParts.PARTS_COLOR.NONE;
  535. if (stringList.Length == 6)
  536. {
  537. string text16 = stringList[5];
  538. try
  539. {
  540. parts_COLOR = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text16.ToUpper());
  541. }
  542. catch
  543. {
  544. NDebug.Assert("無限色IDがありません。" + text16, false);
  545. }
  546. }
  547. if (mp.idx == 61)
  548. {
  549. matno2 = 7;
  550. }
  551. body.ChangeTex(text15, matno2, prop_name2, filename, null, parts_COLOR);
  552. if (parts_COLOR != MaidParts.PARTS_COLOR.NONE)
  553. {
  554. maid.Parts.SetPartsColor(parts_COLOR, maid.Parts.GetPartsColor(parts_COLOR));
  555. }
  556. if ((text9 == "skin" || text9 == "haircolor") && !flag)
  557. {
  558. body.RestoreShader(text15);
  559. goto IL_BC7;
  560. }
  561. goto IL_BC7;
  562. IL_BC7:
  563. goto IL_13C4;
  564. }
  565. if (stringCom == "prop")
  566. {
  567. string tag2 = stringList[1];
  568. string s = stringList[2];
  569. maid.SetProp(tag2, int.Parse(s), false);
  570. goto IL_13C4;
  571. }
  572. if (stringCom == "テクスチャ乗算")
  573. {
  574. goto IL_13C4;
  575. }
  576. if (stringCom == "テクスチャ合成")
  577. {
  578. if (stringList.Length != 7)
  579. {
  580. NDebug.Assert("テクスチャ合成 の引数が不正です。" + stringList.Length, false);
  581. }
  582. if ((text9 == "accTatoo" || text9 == "hokuro") && !text.Contains("_del"))
  583. {
  584. body.MulTexSet(stringList[1], int.Parse(stringList[2]), stringList[3], int.Parse(stringList[4]), stringList[5], (GameUty.SystemMaterial)Enum.Parse(typeof(GameUty.SystemMaterial), stringList[6]), true, 0, 0, 0f, 0f, true, f_SubProp, 1f, 1024);
  585. goto IL_D2A;
  586. }
  587. body.MulTexSet(stringList[1], int.Parse(stringList[2]), stringList[3], int.Parse(stringList[4]), stringList[5], (GameUty.SystemMaterial)Enum.Parse(typeof(GameUty.SystemMaterial), stringList[6]), false, 0, 0, 0f, 0f, false, null, 1f, 1024);
  588. goto IL_D2A;
  589. IL_D2A:
  590. goto IL_13C4;
  591. }
  592. if (stringCom == "テクスチャセット合成")
  593. {
  594. if (stringList.Length != 7)
  595. {
  596. NDebug.Assert("テクスチャセット合成 の引数が不正です。" + stringList.Length, false);
  597. }
  598. body.MulTexSet(stringList[1], int.Parse(stringList[2]), stringList[3], int.Parse(stringList[4]), stringList[5], (GameUty.SystemMaterial)Enum.Parse(typeof(GameUty.SystemMaterial), stringList[6]), true, 0, 0, 0f, 0f, true, null, 1f, 1024);
  599. goto IL_13C4;
  600. }
  601. if (stringCom == "マテリアル変更")
  602. {
  603. string f_strSlotName = stringList[1];
  604. int f_nMatNo = int.Parse(stringList[2]);
  605. string f_strFileName = stringList[3];
  606. body.ChangeMaterial(f_strSlotName, f_nMatNo, f_strFileName);
  607. goto IL_13C4;
  608. }
  609. if (stringCom == "shader")
  610. {
  611. string f_strSlotName2 = stringList[1];
  612. int f_nMatNo2 = int.Parse(stringList[2]);
  613. string f_strShaderFileName = stringList[3];
  614. body.ChangeShader(f_strSlotName2, f_nMatNo2, f_strShaderFileName);
  615. flag = true;
  616. goto IL_13C4;
  617. }
  618. if (stringCom == "アタッチポイントの設定")
  619. {
  620. if (stringList.Length < 5)
  621. {
  622. Debug.LogError("アタッチポイントの設定引数の数が不正です。 " + text7 + " " + text3);
  623. goto IL_EED;
  624. }
  625. Vector3 v = new Vector3(float.Parse(stringList[2]), float.Parse(stringList[3]), float.Parse(stringList[4]));
  626. Quaternion q = Quaternion.identity;
  627. if (stringList.Length == 8)
  628. {
  629. q = Quaternion.Euler(float.Parse(stringList[5]), float.Parse(stringList[6]), float.Parse(stringList[7]));
  630. }
  631. else
  632. {
  633. Debug.LogError("アタッチポイントの設定引数に角度指定がありません。 " + text7 + " " + text3);
  634. }
  635. body.SetAttachPoint(slotname, stringList[1], v, q, f_bTemp);
  636. goto IL_EED;
  637. IL_EED:
  638. goto IL_13C4;
  639. }
  640. if (stringCom == "blendset")
  641. {
  642. string blendSetName = stringList[1];
  643. int num4 = (stringList.Length - 2) / 2;
  644. body.Face.morph.NewBlendSet(blendSetName);
  645. for (int j = 0; j < num4; j++)
  646. {
  647. string tag3 = stringList[2 + j * 2].ToLower();
  648. float val2 = float.Parse(stringList[3 + j * 2]);
  649. body.Face.morph.SetValueBlendSet(blendSetName, tag3, val2);
  650. }
  651. goto IL_13C4;
  652. }
  653. if (stringCom == "paramset")
  654. {
  655. body.Face.NewParamSet(text7);
  656. goto IL_13C4;
  657. }
  658. if (stringCom == "commenttype")
  659. {
  660. if (!maid.status.partsDic.ContainsKey(stringList[1]))
  661. {
  662. maid.status.partsDic.Add(stringList[1], string.Empty);
  663. }
  664. maid.status.partsDic[stringList[1]] = stringList[2];
  665. goto IL_13C4;
  666. }
  667. if (stringCom == "useredit")
  668. {
  669. if (stringList[2].ToLower() == "material")
  670. {
  671. body.SetMaterialProperty(text9, stringList[3], int.Parse(stringList[4]), stringList[5], stringList[6], stringList[7], false);
  672. goto IL_1045;
  673. }
  674. goto IL_1045;
  675. IL_1045:
  676. goto IL_13C4;
  677. }
  678. if (stringCom == "bonemorph")
  679. {
  680. if (9 > stringList.Length || stringList.Length > 10)
  681. {
  682. Debug.LogError("BoneMorpの設定引数の数が不正です。 " + text7 + " " + text3);
  683. }
  684. if (stringList.Length == 9)
  685. {
  686. body.bonemorph.ChangeMorphPosValue(stringList[1], stringList[2], new Vector3(float.Parse(stringList[3]), float.Parse(stringList[4]), float.Parse(stringList[5])), new Vector3(float.Parse(stringList[6]), float.Parse(stringList[7]), float.Parse(stringList[8])));
  687. goto IL_120B;
  688. }
  689. string text17 = stringList[1].ToLower();
  690. string strPropName = stringList[2];
  691. string f_strBoneName = stringList[3];
  692. Vector3 f_fAddMin = new Vector3(float.Parse(stringList[4]), float.Parse(stringList[5]), float.Parse(stringList[6]));
  693. Vector3 f_fAddMax = new Vector3(float.Parse(stringList[7]), float.Parse(stringList[8]), float.Parse(stringList[9]));
  694. if (text17 != null)
  695. {
  696. if (text17 == "pos")
  697. {
  698. body.bonemorph.ChangeMorphPosValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax);
  699. goto IL_120B;
  700. }
  701. if (text17 == "rot")
  702. {
  703. body.bonemorph.ChangeMorphRotatioValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax);
  704. goto IL_120B;
  705. }
  706. if (text17 == "scl")
  707. {
  708. body.bonemorph.ChangeMorphSclValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax);
  709. goto IL_120B;
  710. }
  711. }
  712. Debug.LogError(string.Concat(new string[]
  713. {
  714. "BoneMorpのタイプ指定が不正です[",
  715. text17,
  716. "]\n",
  717. text7,
  718. " ",
  719. text3
  720. }));
  721. goto IL_120B;
  722. IL_120B:
  723. goto IL_13C4;
  724. }
  725. if (stringCom == "length")
  726. {
  727. if (stringList.Length != 11)
  728. {
  729. Debug.LogError("lengthの設定引数の数が不正です。 " + text7 + " " + text3);
  730. }
  731. body.SetHairLengthDataList(stringList[1], stringList[2], stringList[3], stringList[4], new Vector3(float.Parse(stringList[5]), float.Parse(stringList[6]), float.Parse(stringList[7])), new Vector3(float.Parse(stringList[8]), float.Parse(stringList[9]), float.Parse(stringList[10])));
  732. goto IL_13C4;
  733. }
  734. if (stringCom == "anime")
  735. {
  736. if (stringList.Length < 3)
  737. {
  738. Debug.LogError("animeの設定引数の数が不正です。 " + text7 + " " + text3);
  739. }
  740. TBody.SlotID f_slot = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), stringList[1], true);
  741. body.ItemAnimationLoad(f_slot, stringList[2]);
  742. bool f_bLoop = false;
  743. if (3 < stringList.Length)
  744. {
  745. f_bLoop = (stringList[3] == "loop");
  746. }
  747. body.ItemAnimationPlay(f_slot, stringList[2], f_bLoop);
  748. goto IL_13C4;
  749. }
  750. if (stringCom == "param2")
  751. {
  752. if (stringList.Length == 4)
  753. {
  754. string slotname4 = stringList[1];
  755. body.GetSlot(slotname4).SetParam2(stringList[2], stringList[3]);
  756. goto IL_137E;
  757. }
  758. Debug.LogError("param2の設定引数の数が不正です。 " + text7 + " " + text3);
  759. goto IL_137E;
  760. IL_137E:
  761. goto IL_13C4;
  762. }
  763. if (stringCom == "animematerial")
  764. {
  765. TBody.SlotID f_slot2 = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), stringList[1], true);
  766. string s2 = stringList[2];
  767. body.MaterialAnimatorAdd(f_slot2, int.Parse(s2));
  768. goto IL_13C4;
  769. }
  770. goto IL_13C4;
  771. IL_13C4:
  772. goto IL_1447;
  773. }
  774. catch (Exception ex)
  775. {
  776. Debug.LogError(string.Concat(new string[]
  777. {
  778. "Exception ",
  779. Path.GetFileName(text),
  780. " 現在処理中だった行 = ",
  781. text7,
  782. " 以前の行 = ",
  783. text8,
  784. " ",
  785. ex.Message,
  786. "StackTrace:\n",
  787. ex.StackTrace
  788. }));
  789. NDebug.Assert("メニューファイル処理中にエラーが発生しました。" + Path.GetFileName(text), true);
  790. goto IL_1447;
  791. }
  792. IL_1447:
  793. goto IL_102;
  794. }
  795. list.Sort((Menu.LastParam a, Menu.LastParam b) => a.nOrder - a.nOrder);
  796. for (int k = 0; k < list.Count; k++)
  797. {
  798. Menu.LastParam lastParam = list[k];
  799. if (lastParam.strComm == "アイテムパラメータ")
  800. {
  801. TBodySkin slot6 = body.GetSlot(lastParam.aryArgs[0]);
  802. slot6.SetParam(lastParam.aryArgs[1], lastParam.aryArgs[2]);
  803. }
  804. }
  805. binaryReader.Close();
  806. binaryReader = null;
  807. }
  808. public static void SetMaidItemTemp(Maid maid, string filename, bool f_bTemp = false)
  809. {
  810. byte[] buffer = null;
  811. try
  812. {
  813. using (AFileBase afileBase = GameUty.FileOpen(filename, null))
  814. {
  815. if (!afileBase.IsValid())
  816. {
  817. NDebug.Assert("メニューファイルが見つかりません。" + filename, false);
  818. }
  819. buffer = afileBase.ReadAll();
  820. }
  821. }
  822. catch (Exception ex)
  823. {
  824. Debug.LogError("ProcScriptBin/SetMaidItemTemp アイテムメニューファイルが読み込めませんでした。 : " + filename + " : " + ex.Message);
  825. }
  826. BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8);
  827. string text = binaryReader.ReadString();
  828. NDebug.Assert(text == "CM3D2_MENU", "ProcScriptBin/SetMaidItemTemp 例外 : " + filename + " のヘッダーが不正です。" + text);
  829. int num = binaryReader.ReadInt32();
  830. string text2 = binaryReader.ReadString();
  831. string text3 = binaryReader.ReadString();
  832. string text4 = binaryReader.ReadString();
  833. if (text4 == "acctatoo")
  834. {
  835. maid.DelProp(MPN.acctatoo, false);
  836. maid.SetSubProp(MPN.acctatoo, 0, filename, 0);
  837. }
  838. else if (text4 == "hokuro")
  839. {
  840. maid.DelProp(MPN.hokuro, false);
  841. maid.SetSubProp(MPN.hokuro, 0, filename, 0);
  842. }
  843. else
  844. {
  845. maid.SetProp(text4, filename, 0, f_bTemp, false);
  846. }
  847. }
  848. public static bool ExportModScript(Maid maid, string filename, bool f_bTemp = false)
  849. {
  850. byte[] cd = null;
  851. try
  852. {
  853. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(filename))
  854. {
  855. if (!afileBase.IsValid())
  856. {
  857. Debug.LogWarning("アイテムメニューファイルが見つかりません。" + filename);
  858. return false;
  859. }
  860. cd = afileBase.ReadAll();
  861. }
  862. }
  863. catch (Exception ex)
  864. {
  865. Debug.LogError("ExportModScript アイテムメニューファイルが読み込めませんでした。 : " + filename + " : " + ex.Message);
  866. }
  867. string fullPath = Path.GetFullPath(".\\");
  868. string text = fullPath + "ModExport";
  869. if (!Directory.Exists(text))
  870. {
  871. Directory.CreateDirectory(text);
  872. }
  873. string text2 = "mod_" + Path.GetFileNameWithoutExtension(filename);
  874. text2 = text2.Trim();
  875. text = text + "\\" + text2;
  876. if (!Directory.Exists(text))
  877. {
  878. Directory.CreateDirectory(text);
  879. }
  880. StreamWriter streamWriter = new StreamWriter(text + "\\" + text2 + ".txt", false, Encoding.UTF8);
  881. streamWriter.WriteLine("出力バージョン\t" + 1240);
  882. streamWriter.WriteLine("基本アイテム\t" + filename.Replace(" ", ":"));
  883. try
  884. {
  885. Menu.ExportModScript(maid, cd, streamWriter, text + "\\" + text2, f_bTemp);
  886. NUty.WinMessageBox(NUty.GetWindowHandle(), string.Concat(new string[]
  887. {
  888. "MODテンプレート出力完了\n",
  889. text,
  890. "\\",
  891. text2,
  892. ".txt"
  893. }), "MOD Compile Completed", 0);
  894. }
  895. catch (Exception ex2)
  896. {
  897. Debug.LogError("ExportModScript 例外 : " + filename + " : " + ex2.Message);
  898. }
  899. finally
  900. {
  901. streamWriter.Close();
  902. streamWriter.Dispose();
  903. streamWriter = null;
  904. }
  905. return true;
  906. }
  907. public static void ExportModScript(Maid maid, byte[] cd, StreamWriter sw, string filename, bool f_bTemp = false)
  908. {
  909. TBody body = maid.body0;
  910. List<Menu.LastParam> list = new List<Menu.LastParam>();
  911. BinaryReader binaryReader = new BinaryReader(new MemoryStream(cd), Encoding.UTF8);
  912. string text = binaryReader.ReadString();
  913. NDebug.Assert(text == "CM3D2_MENU", "ExportModScript 例外 : ヘッダーファイルが不正です。" + text);
  914. int num = binaryReader.ReadInt32();
  915. string path = binaryReader.ReadString();
  916. string str = binaryReader.ReadString();
  917. sw.WriteLine("アイテム名\t" + str);
  918. string str2 = binaryReader.ReadString();
  919. sw.WriteLine("カテゴリ名\t" + str2);
  920. string text2 = binaryReader.ReadString();
  921. sw.WriteLine("説明\t" + text2.Replace("\n", "《改行》"));
  922. sw.WriteLine("アイコン\t" + Path.GetFileName(filename + ".png"));
  923. long num2 = (long)binaryReader.ReadInt32();
  924. bool flag = false;
  925. List<string> list2 = new List<string>();
  926. string text3 = string.Empty;
  927. string text4 = string.Empty;
  928. string empty = string.Empty;
  929. string empty2 = string.Empty;
  930. try
  931. {
  932. for (;;)
  933. {
  934. int num3 = (int)binaryReader.ReadByte();
  935. text4 = text3;
  936. text3 = string.Empty;
  937. if (num3 == 0)
  938. {
  939. break;
  940. }
  941. for (int i = 0; i < num3; i++)
  942. {
  943. text3 = text3 + "\"" + binaryReader.ReadString() + "\" ";
  944. }
  945. if (!(text3 == string.Empty))
  946. {
  947. string stringCom = UTY.GetStringCom(text3);
  948. string[] stringList = UTY.GetStringList(text3);
  949. if (stringCom == "end")
  950. {
  951. break;
  952. }
  953. if (!(stringCom == "name"))
  954. {
  955. if (stringCom == "icon" || stringCom == "icons")
  956. {
  957. string f_strFileName = stringList[1];
  958. Texture2D texture2D = ImportCM.CreateTexture(f_strFileName);
  959. if (texture2D != null)
  960. {
  961. UTY.SaveImage(texture2D, filename + ".png");
  962. }
  963. }
  964. else if (stringCom == "additem")
  965. {
  966. sw.WriteLine("アイテム変更");
  967. string text5 = empty;
  968. if (stringList.Length > 1)
  969. {
  970. text5 = stringList[2];
  971. }
  972. list2.Add(text5);
  973. sw.WriteLine("\tスロット名\t" + text5);
  974. TBodySkin slot = maid.body0.GetSlot(text5);
  975. foreach (Transform transform in slot.obj.GetComponentsInChildren<Transform>(true))
  976. {
  977. Renderer component = transform.GetComponent<Renderer>();
  978. if (!(component == null) && component.materials != null)
  979. {
  980. Material[] materials = component.materials;
  981. for (int k = 0; k < materials.Length; k++)
  982. {
  983. Material f_mat = materials[k];
  984. sw.WriteLine("\t\tマテリアル番号\t" + k);
  985. Menu.ModMaterial(f_mat, sw);
  986. }
  987. }
  988. }
  989. }
  990. else if (!(stringCom == "color"))
  991. {
  992. if (stringCom == "tex" || stringCom == "テクスチャ変更")
  993. {
  994. string text6 = stringList[1];
  995. int num4 = int.Parse(stringList[2]);
  996. string str3 = stringList[3];
  997. string text7 = stringList[4];
  998. string text8 = (6 > stringList.Length) ? null : stringList[5];
  999. if (!list2.Contains(text6))
  1000. {
  1001. string text9 = "テクスチャ変更";
  1002. text9 = text9 + "\t" + text6;
  1003. text9 = text9 + "\t" + num4;
  1004. text9 = text9 + "\t" + str3;
  1005. text9 = text9 + "\t" + text7;
  1006. if (!string.IsNullOrEmpty(text8))
  1007. {
  1008. text9 = text9 + "\t" + text8;
  1009. }
  1010. if (text7.Contains("*"))
  1011. {
  1012. string text10 = string.Empty;
  1013. TBodySkin slot2 = maid.body0.GetSlot(text6);
  1014. if (slot2 != null)
  1015. {
  1016. text10 += "参考)出力時のモデル名は ";
  1017. text10 += Path.GetFileNameWithoutExtension(slot2.m_strModelFileName);
  1018. text10 += " です。";
  1019. }
  1020. sw.WriteLine("// * の部分は現在装着されているモデル名に置換されます。" + text10);
  1021. }
  1022. if (!string.IsNullOrEmpty(text8) && !flag)
  1023. {
  1024. string text11 = "// 無限色ID群 ";
  1025. IEnumerator enumerator = Enum.GetValues(typeof(MaidParts.PARTS_COLOR)).GetEnumerator();
  1026. try
  1027. {
  1028. while (enumerator.MoveNext())
  1029. {
  1030. object obj = enumerator.Current;
  1031. text11 = text11 + ((MaidParts.PARTS_COLOR)obj).ToString() + " ";
  1032. }
  1033. }
  1034. finally
  1035. {
  1036. IDisposable disposable;
  1037. if ((disposable = (enumerator as IDisposable)) != null)
  1038. {
  1039. disposable.Dispose();
  1040. }
  1041. }
  1042. sw.WriteLine(text11);
  1043. flag = true;
  1044. }
  1045. sw.WriteLine(text9);
  1046. }
  1047. }
  1048. else if (stringCom == "テクスチャ合成")
  1049. {
  1050. string item = stringList[1];
  1051. int num5 = int.Parse(stringList[2]);
  1052. string text12 = stringList[3];
  1053. string text13 = stringList[4];
  1054. if (!list2.Contains(item))
  1055. {
  1056. }
  1057. }
  1058. else if (stringCom == "マテリアル変更")
  1059. {
  1060. string text14 = stringList[1];
  1061. int num6 = int.Parse(stringList[2]);
  1062. string text15 = stringList[3];
  1063. if (!list2.Contains(text14))
  1064. {
  1065. sw.WriteLine("マテリアル変更");
  1066. sw.WriteLine("\tスロット名\t" + text14);
  1067. TBodySkin slot3 = maid.body0.GetSlot(text14);
  1068. foreach (Transform transform2 in slot3.obj.GetComponentsInChildren<Transform>(true))
  1069. {
  1070. Renderer component2 = transform2.GetComponent<Renderer>();
  1071. if (!(component2 == null) && component2.materials != null)
  1072. {
  1073. Material[] materials2 = component2.materials;
  1074. for (int m = 0; m < materials2.Length; m++)
  1075. {
  1076. Material f_mat2 = materials2[m];
  1077. sw.WriteLine("\t\tマテリアル番号\t" + m);
  1078. Menu.ModMaterial(f_mat2, sw);
  1079. }
  1080. }
  1081. }
  1082. }
  1083. }
  1084. else if (stringCom == "color_set")
  1085. {
  1086. if (stringList.Length >= 3)
  1087. {
  1088. string text16 = stringList[2];
  1089. text16 = "mod_" + Path.GetFileNameWithoutExtension(text16) + ".mod";
  1090. sw.WriteLine("色セット\t" + stringList[1] + "\t" + text16);
  1091. }
  1092. else
  1093. {
  1094. sw.WriteLine("色セット\t" + stringList[1]);
  1095. }
  1096. MPN f_mpn = (MPN)Enum.Parse(typeof(MPN), stringList[1].ToLower());
  1097. maid.ExportModBaseMenu(f_mpn);
  1098. }
  1099. }
  1100. }
  1101. }
  1102. }
  1103. }
  1104. catch (Exception ex)
  1105. {
  1106. Debug.LogError(string.Concat(new string[]
  1107. {
  1108. "Exception ",
  1109. Path.GetFileName(path),
  1110. " 現在処理中だった行 = ",
  1111. text3,
  1112. " 以前の行 = ",
  1113. text4,
  1114. " ",
  1115. ex.Message,
  1116. "StackTrace:\n",
  1117. ex.StackTrace
  1118. }));
  1119. NDebug.Assert("メニューファイル処理中にエラーが発生しました。" + Path.GetFileName(path), false);
  1120. if (binaryReader != null)
  1121. {
  1122. binaryReader.Close();
  1123. binaryReader = null;
  1124. }
  1125. throw ex;
  1126. }
  1127. if (binaryReader != null)
  1128. {
  1129. binaryReader.Close();
  1130. binaryReader = null;
  1131. }
  1132. }
  1133. public static string[] NeedTextureWildCard(string f_strTexName)
  1134. {
  1135. string[] array;
  1136. if (f_strTexName.Contains("*"))
  1137. {
  1138. string strTexName = f_strTexName;
  1139. strTexName = strTexName.Replace("*", ".*");
  1140. if (Menu.m_strAllTexInFileSys == null)
  1141. {
  1142. Menu.m_strAllTexInFileSys = GameUty.FileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFile);
  1143. }
  1144. array = Array.FindAll<string>(Menu.m_strAllTexInFileSys, (string i) => new Regex(strTexName).IsMatch(i));
  1145. array = Array.FindAll<string>(array, (string i) => new Regex("^((?!_i_).)*$").IsMatch(i));
  1146. IEnumerable<string> source = array;
  1147. if (Menu.<>f__mg$cache0 == null)
  1148. {
  1149. Menu.<>f__mg$cache0 = new Func<string, string>(Path.GetFileName);
  1150. }
  1151. array = source.Select(Menu.<>f__mg$cache0).ToArray<string>();
  1152. string strMatchGroup = strTexName.Replace(".*", "(?<WILD>.*)");
  1153. array = array.Select(delegate(string i)
  1154. {
  1155. Match match = new Regex(strMatchGroup).Match(i);
  1156. if (match.Success)
  1157. {
  1158. return match.Groups["WILD"].Value;
  1159. }
  1160. return i;
  1161. }).ToArray<string>();
  1162. }
  1163. else
  1164. {
  1165. array = new string[]
  1166. {
  1167. Path.GetFileName(f_strTexName)
  1168. };
  1169. }
  1170. return array;
  1171. }
  1172. private static void ModMaterial(Material f_mat, StreamWriter f_sw)
  1173. {
  1174. for (int i = 0; i < Menu.material_properties.GetLength(0); i++)
  1175. {
  1176. if (f_mat.HasProperty(Menu.material_properties[i, 0]))
  1177. {
  1178. if (Menu.material_properties[i, 1] == "tex")
  1179. {
  1180. Texture texture = f_mat.GetTexture(Menu.material_properties[i, 0]);
  1181. f_sw.WriteLine("\t\t\tテクスチャ設定\t" + Menu.material_properties[i, 0] + "\t" + texture.name);
  1182. }
  1183. else if (Menu.material_properties[i, 1] == "col")
  1184. {
  1185. Color color = f_mat.GetColor(Menu.material_properties[i, 0]);
  1186. f_sw.WriteLine(string.Concat(new object[]
  1187. {
  1188. "\t\t\t色設定\t",
  1189. Menu.material_properties[i, 0],
  1190. "\t",
  1191. (int)(255f * color.r),
  1192. "\t",
  1193. (int)(255f * color.g),
  1194. "\t",
  1195. (int)(255f * color.b),
  1196. "\t",
  1197. (int)(255f * color.a)
  1198. }));
  1199. }
  1200. else if (Menu.material_properties[i, 1] == "f")
  1201. {
  1202. float @float = f_mat.GetFloat(Menu.material_properties[i, 0]);
  1203. f_sw.WriteLine(string.Concat(new object[]
  1204. {
  1205. "\t\t\t数値設定\t",
  1206. Menu.material_properties[i, 0],
  1207. "\t",
  1208. @float
  1209. }));
  1210. }
  1211. }
  1212. }
  1213. }
  1214. private static string GetBaseItemFromMod(string f_strModMenu)
  1215. {
  1216. string empty = string.Empty;
  1217. FileStream fileStream = new FileStream(f_strModMenu, FileMode.Open);
  1218. if (fileStream == null)
  1219. {
  1220. return string.Empty;
  1221. }
  1222. BinaryReader binaryReader = new BinaryReader(fileStream);
  1223. string a = binaryReader.ReadString();
  1224. NDebug.Assert(a == "CM3D2_MOD", "セーブデータファイルのヘッダーが不正です。_MOD");
  1225. int num = binaryReader.ReadInt32();
  1226. string text = binaryReader.ReadString();
  1227. string text2 = binaryReader.ReadString();
  1228. text2 = text2.Replace(":", " ");
  1229. string text3 = binaryReader.ReadString();
  1230. string text4 = binaryReader.ReadString();
  1231. string text5 = binaryReader.ReadString();
  1232. binaryReader.Close();
  1233. fileStream.Close();
  1234. fileStream.Dispose();
  1235. return text2;
  1236. }
  1237. private static void ProcModScriptBin(Maid maid, byte[] cd, string filename, bool f_bTemp = false)
  1238. {
  1239. BinaryReader binaryReader = new BinaryReader(new MemoryStream(cd), Encoding.UTF8);
  1240. string text = binaryReader.ReadString();
  1241. NDebug.Assert(text == "CM3D2_MOD", "ProcModScriptBin 例外 : ヘッダーファイルが不正です。" + text);
  1242. int num = binaryReader.ReadInt32();
  1243. string text2 = binaryReader.ReadString();
  1244. string text3 = binaryReader.ReadString();
  1245. string text4 = binaryReader.ReadString();
  1246. string text5 = binaryReader.ReadString();
  1247. string text6 = binaryReader.ReadString();
  1248. string text7 = binaryReader.ReadString();
  1249. MPN mpn = MPN.null_mpn;
  1250. try
  1251. {
  1252. mpn = (MPN)Enum.Parse(typeof(MPN), text7);
  1253. }
  1254. catch
  1255. {
  1256. NDebug.Assert("カテゴリがありません。" + text7, false);
  1257. }
  1258. string text8 = string.Empty;
  1259. if (mpn != MPN.null_mpn)
  1260. {
  1261. text8 = binaryReader.ReadString();
  1262. }
  1263. string s = binaryReader.ReadString();
  1264. int num2 = binaryReader.ReadInt32();
  1265. Dictionary<string, byte[]> dictionary = new Dictionary<string, byte[]>();
  1266. for (int i = 0; i < num2; i++)
  1267. {
  1268. string key = binaryReader.ReadString();
  1269. int count = binaryReader.ReadInt32();
  1270. byte[] value = binaryReader.ReadBytes(count);
  1271. dictionary.Add(key, value);
  1272. }
  1273. binaryReader.Close();
  1274. binaryReader = null;
  1275. using (StringReader stringReader = new StringReader(s))
  1276. {
  1277. Menu.IMode mode = Menu.IMode.Non;
  1278. string slotname = string.Empty;
  1279. int num3 = 0;
  1280. TBodySkin tbodySkin = null;
  1281. Material material = null;
  1282. string text9;
  1283. while ((text9 = stringReader.ReadLine()) != null)
  1284. {
  1285. string[] array = text9.Split(new char[]
  1286. {
  1287. '\t',
  1288. ' '
  1289. }, StringSplitOptions.RemoveEmptyEntries);
  1290. if (array[0] == "アイテム変更" || array[0] == "マテリアル変更")
  1291. {
  1292. mode = Menu.IMode.ItemChange;
  1293. }
  1294. else if (array[0] == "テクスチャ変更")
  1295. {
  1296. mode = Menu.IMode.TexChange;
  1297. }
  1298. if (mode == Menu.IMode.ItemChange)
  1299. {
  1300. if (array[0] == "スロット名")
  1301. {
  1302. slotname = array[1];
  1303. tbodySkin = maid.body0.GetSlot(slotname);
  1304. }
  1305. if (tbodySkin != null)
  1306. {
  1307. if (array[0] == "マテリアル番号")
  1308. {
  1309. num3 = int.Parse(array[1]);
  1310. foreach (Transform transform in tbodySkin.obj.GetComponentsInChildren<Transform>(true))
  1311. {
  1312. Renderer component = transform.GetComponent<Renderer>();
  1313. if (!(component == null) && component.materials != null)
  1314. {
  1315. Material[] materials = component.materials;
  1316. for (int k = 0; k < materials.Length; k++)
  1317. {
  1318. if (k == num3)
  1319. {
  1320. material = materials[k];
  1321. break;
  1322. }
  1323. }
  1324. }
  1325. }
  1326. }
  1327. if (material != null)
  1328. {
  1329. if (array[0] == "テクスチャ設定")
  1330. {
  1331. maid.body0.ChangeTex(slotname, num3, array[1], array[2].ToLower(), dictionary, MaidParts.PARTS_COLOR.NONE);
  1332. }
  1333. else if (array[0] == "色設定")
  1334. {
  1335. material.SetColor(array[1], new Color(float.Parse(array[2]) / 255f, float.Parse(array[3]) / 255f, float.Parse(array[4]) / 255f, float.Parse(array[5]) / 255f));
  1336. }
  1337. else if (array[0] == "数値設定")
  1338. {
  1339. material.SetFloat(array[1], float.Parse(array[2]));
  1340. }
  1341. }
  1342. }
  1343. }
  1344. else if (mode == Menu.IMode.TexChange)
  1345. {
  1346. MaidParts.PARTS_COLOR parts_COLOR = MaidParts.PARTS_COLOR.NONE;
  1347. if (array.Length == 6)
  1348. {
  1349. string text10 = array[5];
  1350. try
  1351. {
  1352. parts_COLOR = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text10.ToUpper());
  1353. }
  1354. catch
  1355. {
  1356. NDebug.Assert("無限色IDがありません。" + text10, false);
  1357. }
  1358. }
  1359. maid.body0.ChangeTex(array[1], int.Parse(array[2]), array[3], array[4].ToLower(), dictionary, parts_COLOR);
  1360. if (parts_COLOR != MaidParts.PARTS_COLOR.NONE)
  1361. {
  1362. maid.Parts.SetPartsColor(parts_COLOR, maid.Parts.GetPartsColor(parts_COLOR));
  1363. }
  1364. }
  1365. }
  1366. }
  1367. }
  1368. // Note: this type is marked as 'beforefieldinit'.
  1369. static Menu()
  1370. {
  1371. string[,] array = new string[31, 2];
  1372. array[0, 0] = "_MainTex";
  1373. array[0, 1] = "tex";
  1374. array[1, 0] = "_BumpMap";
  1375. array[1, 1] = "tex";
  1376. array[2, 0] = "_ToonRamp";
  1377. array[2, 1] = "tex";
  1378. array[3, 0] = "_ShadowTex";
  1379. array[3, 1] = "tex";
  1380. array[4, 0] = "_ShadowRateToon";
  1381. array[4, 1] = "tex";
  1382. array[5, 0] = "_SpecularTex";
  1383. array[5, 1] = "tex";
  1384. array[6, 0] = "_AnisoTex";
  1385. array[6, 1] = "tex";
  1386. array[7, 0] = "_RenderTex";
  1387. array[7, 1] = "tex";
  1388. array[8, 0] = "_HiTex";
  1389. array[8, 1] = "tex";
  1390. array[9, 0] = "_OutlineTex";
  1391. array[9, 1] = "tex";
  1392. array[10, 0] = "_OutlineToonRamp";
  1393. array[10, 1] = "tex";
  1394. array[11, 0] = "_Color";
  1395. array[11, 1] = "col";
  1396. array[12, 0] = "_ShadowColor";
  1397. array[12, 1] = "col";
  1398. array[13, 0] = "_RimColor";
  1399. array[13, 1] = "col";
  1400. array[14, 0] = "_SpecColor";
  1401. array[14, 1] = "col";
  1402. array[15, 0] = "_Emission";
  1403. array[15, 1] = "col";
  1404. array[16, 0] = "_ReflectColor";
  1405. array[16, 1] = "col";
  1406. array[17, 0] = "_OutlineColor";
  1407. array[17, 1] = "col";
  1408. array[18, 0] = "_MyLightColor0";
  1409. array[18, 1] = "col";
  1410. array[19, 0] = "_MyLightColor1";
  1411. array[19, 1] = "col";
  1412. array[20, 0] = "_TintColor";
  1413. array[20, 1] = "col";
  1414. array[21, 0] = "_ShadowColor";
  1415. array[21, 1] = "col";
  1416. array[22, 0] = "_Shininess";
  1417. array[22, 1] = "f";
  1418. array[23, 0] = "_FurLength";
  1419. array[23, 1] = "f";
  1420. array[24, 0] = "_OutlineWidth";
  1421. array[24, 1] = "f";
  1422. array[25, 0] = "_Cutoff";
  1423. array[25, 1] = "f";
  1424. array[26, 0] = "_AnisoOffset";
  1425. array[26, 1] = "f";
  1426. array[27, 0] = "_RimPower";
  1427. array[27, 1] = "f";
  1428. array[28, 0] = "_RimShift";
  1429. array[28, 1] = "f";
  1430. array[29, 0] = "_HiRate";
  1431. array[29, 1] = "f";
  1432. array[30, 0] = "_HiPow";
  1433. array[30, 1] = "f";
  1434. Menu.material_properties = array;
  1435. }
  1436. public static SortedDictionary<int, SortedDictionary<string, string>> m_dicResourceRef = new SortedDictionary<int, SortedDictionary<string, string>>();
  1437. private static string[] m_strAllTexInFileSys = null;
  1438. private static string[,] material_properties;
  1439. [CompilerGenerated]
  1440. private static Func<string, string> <>f__mg$cache0;
  1441. private class LastParam
  1442. {
  1443. public LastParam(int f_nOrder, string f_strComm, params string[] f_argArgs)
  1444. {
  1445. this.nOrder = f_nOrder;
  1446. this.strComm = f_strComm;
  1447. this.aryArgs = new string[f_argArgs.Length];
  1448. f_argArgs.CopyTo(this.aryArgs, 0);
  1449. }
  1450. public int nOrder;
  1451. public string strComm = string.Empty;
  1452. public string[] aryArgs;
  1453. }
  1454. private enum IMode
  1455. {
  1456. Non,
  1457. ItemChange,
  1458. TexChange
  1459. }
  1460. }