Menu.cs 45 KB

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