Menu.cs 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018
  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 Scourt.Utility;
  10. using UnityEngine;
  11. public class Menu : MonoBehaviour
  12. {
  13. public static string[] GetModFiles()
  14. {
  15. string str = UTY.gameProjectPath + "\\";
  16. string path = str + "Mod";
  17. if (!Directory.Exists(path))
  18. {
  19. return null;
  20. }
  21. return Directory.GetFiles(path, "mod_*.mod", SearchOption.AllDirectories);
  22. }
  23. public static string GetModPathFileName(string f_strMenuFileName)
  24. {
  25. string[] modFiles = Menu.GetModFiles();
  26. if (modFiles == null)
  27. {
  28. NDebug.MessageBox("MODエラー", "MODフォルダが無いか、MODフォルダにMODファイルが1つもありません。\n" + f_strMenuFileName);
  29. return string.Empty;
  30. }
  31. string text = Array.Find<string>(modFiles, (string a) => Path.GetFileName(a).ToLower() == f_strMenuFileName.ToLower());
  32. if (string.IsNullOrEmpty(text))
  33. {
  34. NDebug.MessageBox("MODエラー", "MODフォルダにMODファイルが見つかりません。\n" + f_strMenuFileName);
  35. return string.Empty;
  36. }
  37. return text;
  38. }
  39. public static Menu.MenuHeader ReadMenuHeader(string fileName)
  40. {
  41. byte[] buffer = null;
  42. using (AFileBase afileBase = GameUty.FileOpen(fileName, null))
  43. {
  44. if (afileBase == null || !afileBase.IsValid())
  45. {
  46. Debug.LogError("アイテムメニューファイルが見つかりません。" + fileName);
  47. return null;
  48. }
  49. buffer = afileBase.ReadAll();
  50. }
  51. Menu.MenuHeader result;
  52. using (MemoryStream memoryStream = new MemoryStream(buffer))
  53. {
  54. BinaryReader br = new BinaryReader(memoryStream, Encoding.UTF8);
  55. Menu.MenuHeader menuHeader = new Menu.MenuHeader();
  56. if (!menuHeader.Deserialize(br))
  57. {
  58. result = null;
  59. }
  60. else
  61. {
  62. result = menuHeader;
  63. }
  64. }
  65. return result;
  66. }
  67. public static bool ProcScript(Maid maid, string filename, bool f_bTemp = false, SubProp f_SubProp = null)
  68. {
  69. return Menu.ProcScript(maid, new MaidProp
  70. {
  71. strFileName = filename,
  72. strTempFileName = filename
  73. }, f_bTemp, f_SubProp);
  74. }
  75. public static bool ProcScript(Maid maid, MaidProp mp, bool f_bTemp = false, SubProp f_SubProp = null)
  76. {
  77. string text;
  78. if (f_bTemp)
  79. {
  80. text = mp.strTempFileName;
  81. }
  82. else
  83. {
  84. text = mp.strFileName;
  85. }
  86. bool flag = false;
  87. string text2 = string.Empty;
  88. byte[] array = null;
  89. if (text.IndexOf("mod_") == 0)
  90. {
  91. flag = true;
  92. text2 = Menu.GetModPathFileName(text);
  93. if (string.IsNullOrEmpty(text2))
  94. {
  95. return false;
  96. }
  97. text = Menu.GetBaseItemFromMod(text2);
  98. try
  99. {
  100. using (FileStream fileStream = new FileStream(text2, FileMode.Open))
  101. {
  102. if (fileStream == null)
  103. {
  104. Debug.LogWarning("MODアイテムメニューファイルが見つかりません。" + text);
  105. return false;
  106. }
  107. array = new byte[fileStream.Length];
  108. fileStream.Read(array, 0, (int)fileStream.Length);
  109. }
  110. }
  111. catch (Exception ex)
  112. {
  113. Debug.LogError("ProcScript MODアイテムメニューファイルが読み込めませんでした。 : " + text + " : " + ex.Message);
  114. return false;
  115. }
  116. }
  117. byte[] cd = null;
  118. try
  119. {
  120. using (AFileBase afileBase = GameUty.FileOpen(text, null))
  121. {
  122. if (afileBase == null || !afileBase.IsValid())
  123. {
  124. Debug.LogError("アイテムメニューファイルが見つかりません。" + text);
  125. return false;
  126. }
  127. cd = afileBase.ReadAll();
  128. }
  129. }
  130. catch (Exception ex2)
  131. {
  132. Debug.LogError("ProcScript アイテムメニューファイルが読み込めませんでした。 : " + text + " : " + ex2.Message);
  133. return false;
  134. }
  135. Menu.ProcScriptBin(maid, cd, mp, f_bTemp, f_SubProp);
  136. if (flag)
  137. {
  138. Menu.ProcModScriptBin(maid, array, text2, mp, false);
  139. }
  140. return true;
  141. }
  142. private static void ProcScriptBin(Maid maid, byte[] cd, string filename, bool f_bTemp = false, SubProp f_SubProp = null)
  143. {
  144. Menu.ProcScriptBin(maid, cd, new MaidProp
  145. {
  146. strFileName = filename,
  147. strTempFileName = filename
  148. }, f_bTemp, f_SubProp);
  149. }
  150. private static void ProcScriptBin(Maid maid, byte[] cd, MaidProp mp, bool f_bTemp = false, SubProp f_SubProp = null)
  151. {
  152. string filename;
  153. if (f_bTemp)
  154. {
  155. filename = mp.strTempFileName;
  156. }
  157. else
  158. {
  159. filename = mp.strFileName;
  160. }
  161. Action<string> errorCallBack = delegate(string errorText)
  162. {
  163. NDebug.Assert(errorText + " : " + filename, false);
  164. };
  165. TBody body = maid.body0;
  166. if (mp.idx == 160 || mp.idx == 161 || mp.idx == 162 || mp.idx == 163)
  167. {
  168. TBodySkin slot = body.GetSlot(1);
  169. if (slot.PartsVersion < 110)
  170. {
  171. return;
  172. }
  173. }
  174. List<Menu.LastParam> list = new List<Menu.LastParam>();
  175. BinaryReader binaryReader = new BinaryReader(new MemoryStream(cd), Encoding.UTF8);
  176. string text = binaryReader.ReadString();
  177. NDebug.Assert(text == "CM3D2_MENU", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + text);
  178. int num = binaryReader.ReadInt32();
  179. string text2 = binaryReader.ReadString();
  180. string text3 = binaryReader.ReadString();
  181. string text4 = binaryReader.ReadString();
  182. string text5 = binaryReader.ReadString();
  183. long num2 = (long)binaryReader.ReadInt32();
  184. bool flag = false;
  185. string text6 = string.Empty;
  186. string text7 = string.Empty;
  187. string text8 = string.Empty;
  188. string text9 = string.Empty;
  189. int num3 = 100;
  190. bool flag2 = false;
  191. bool flag3 = false;
  192. bool flag4 = false;
  193. bool flag5 = false;
  194. int num4 = 0;
  195. HashSet<MPN> hashSet = new HashSet<MPN>();
  196. for (;;)
  197. {
  198. try
  199. {
  200. for (;;)
  201. {
  202. IL_142:
  203. int num5 = (int)binaryReader.ReadByte();
  204. text7 = text6;
  205. text6 = string.Empty;
  206. if (num5 == 0)
  207. {
  208. break;
  209. }
  210. for (int i = 0; i < num5; i++)
  211. {
  212. text6 = text6 + "\"" + binaryReader.ReadString() + "\" ";
  213. }
  214. if (!(text6 == string.Empty))
  215. {
  216. goto IL_1A9;
  217. }
  218. }
  219. break;
  220. IL_1A9:
  221. string stringCom = UTY.GetStringCom(text6);
  222. string[] stringList = UTY.GetStringList(text6);
  223. if (stringCom == "end")
  224. {
  225. break;
  226. }
  227. if (stringCom == "name")
  228. {
  229. goto IL_211D;
  230. }
  231. if (stringCom == "ver")
  232. {
  233. TBodySkin slot2 = body.GetSlot(stringList[1], num4);
  234. num3 = int.Parse(stringList[2]);
  235. goto IL_211D;
  236. }
  237. if (stringCom == "crc_exp")
  238. {
  239. flag2 = true;
  240. goto IL_211D;
  241. }
  242. if (stringCom == "crc_def_exp")
  243. {
  244. flag3 = true;
  245. goto IL_211D;
  246. }
  247. if (stringCom == "crc_target_slotno")
  248. {
  249. num4 = int.Parse(stringList[1]);
  250. goto IL_211D;
  251. }
  252. if (stringCom == "crc_part_hide_slot")
  253. {
  254. TBodySkin slot3 = body.GetSlot(stringList[1], num4);
  255. slot3.crcPartHideVisible = bool.Parse(stringList[2]);
  256. goto IL_211D;
  257. }
  258. if (stringCom == "crc_part_hide_move")
  259. {
  260. TBodySkin slot4 = body.GetSlot(stringList[1], num4);
  261. ImportCM.ImportSavedAttachDataGP03(stringList[2], slot4);
  262. goto IL_211D;
  263. }
  264. if (stringCom == "crc_mayu_front")
  265. {
  266. bool flag6 = bool.Parse(stringList[1]);
  267. maid.body0.SetMaterialProperty("mayu", "head", 3, "_ZTest2", "UnityEngine.Rendering.CompareFunction", (!flag6) ? "1" : "7", true);
  268. maid.body0.SetMaterialProperty("mayu", "head", 12, "_ZTest2", "UnityEngine.Rendering.CompareFunction", (!flag6) ? "1" : "7", true);
  269. goto IL_211D;
  270. }
  271. if (stringCom == "crc_mayu_alpha")
  272. {
  273. float num6 = float.Parse(stringList[1]);
  274. maid.body0.SetMaterialProperty("mayu", "head", 3, "_Color", "Color", "1.0:1.0:1.0:" + num6.ToString(), true);
  275. maid.body0.SetMaterialProperty("mayu", "head", 12, "_Color", "Color", "1.0:1.0:1.0:" + num6.ToString(), true);
  276. goto IL_211D;
  277. }
  278. if (stringCom == "parthidemove")
  279. {
  280. TBodySkin slot5 = body.GetSlot(stringList[4], num4);
  281. slot5.LoadOrNewAttachPoint(stringList[1]);
  282. goto IL_211D;
  283. }
  284. if (stringCom == "アイテム")
  285. {
  286. MPN mpn = Menu.SetMaidItemTemp(maid, stringList[1], f_bTemp);
  287. if (maid.IsCrcBody && stringList[1].Contains("_del") && mpn != MPN.null_mpn)
  288. {
  289. hashSet.Add(mpn);
  290. goto IL_46B;
  291. }
  292. goto IL_46B;
  293. IL_46B:
  294. goto IL_211D;
  295. }
  296. if (stringCom == "alldelmenu")
  297. {
  298. using (Dictionary<MPN, string>.Enumerator enumerator = CM3.dicDelItem.GetEnumerator())
  299. {
  300. while (enumerator.MoveNext())
  301. {
  302. KeyValuePair<MPN, string> keyValuePair = enumerator.Current;
  303. Menu.SetMaidItemTemp(maid, keyValuePair.Value, false);
  304. }
  305. goto IL_4CC;
  306. }
  307. IL_4CC:
  308. goto IL_211D;
  309. }
  310. if (stringCom == "アイテム条件")
  311. {
  312. string slotname = stringList[1];
  313. if (stringList[2] == "に何か")
  314. {
  315. bool flag7 = false;
  316. TBodySkin slot6 = body.GetSlot(slotname);
  317. if (stringList[3] == "有る")
  318. {
  319. if (slot6.obj != null)
  320. {
  321. flag7 = true;
  322. }
  323. }
  324. else if (stringList[3] == "無い")
  325. {
  326. if (slot6.obj == null)
  327. {
  328. flag7 = true;
  329. }
  330. }
  331. else
  332. {
  333. NDebug.Assert("アイテム条件が不正です。「有る」か「無い」かを指定してください。\n" + text6, false);
  334. }
  335. if (stringList[4] == "なら")
  336. {
  337. if (flag7)
  338. {
  339. Menu.SetMaidItemTemp(maid, stringList[5], f_bTemp);
  340. goto IL_59D;
  341. }
  342. goto IL_59D;
  343. IL_59D:
  344. goto IL_5B4;
  345. }
  346. NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text6, false);
  347. goto IL_5B4;
  348. IL_5B4:
  349. goto IL_6EA;
  350. }
  351. if (stringList[2] == "が")
  352. {
  353. bool flag8 = false;
  354. TBodySkin slot7 = body.GetSlot(slotname);
  355. if (slot7.m_strModelFileName == stringList[3])
  356. {
  357. flag8 = true;
  358. }
  359. if (stringList[4] == "なら")
  360. {
  361. if (flag8)
  362. {
  363. Menu.SetMaidItemTemp(maid, stringList[5], f_bTemp);
  364. goto IL_61A;
  365. }
  366. goto IL_61A;
  367. IL_61A:
  368. goto IL_631;
  369. }
  370. NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text6, false);
  371. goto IL_631;
  372. IL_631:
  373. goto IL_6EA;
  374. }
  375. if (!(stringList[2] == "のアイテムパラメータの"))
  376. {
  377. goto IL_6EA;
  378. }
  379. bool flag9 = false;
  380. TBodySkin slot8 = body.GetSlot(slotname);
  381. string param = slot8.GetParam(stringList[3].ToLower());
  382. if (stringList[4] == "が")
  383. {
  384. if (stringList[5].ToLower() == param)
  385. {
  386. flag9 = true;
  387. }
  388. }
  389. else
  390. {
  391. NDebug.Assert("アイテム条件が不正です。「が」が必要です。\n" + text6, false);
  392. }
  393. if (stringList[6] == "なら")
  394. {
  395. if (flag9)
  396. {
  397. Menu.SetMaidItemTemp(maid, stringList[7], f_bTemp);
  398. goto IL_6D3;
  399. }
  400. goto IL_6D3;
  401. IL_6D3:
  402. goto IL_6EA;
  403. }
  404. NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text6, false);
  405. goto IL_6EA;
  406. IL_6EA:
  407. goto IL_211D;
  408. }
  409. if (stringCom == "if")
  410. {
  411. if (stringList[1].IndexOf("maidprop[") == 0)
  412. {
  413. string value = stringList[1].Substring(9, stringList[1].Length - 9 - 1);
  414. MPN mpn2 = (MPN)Enum.Parse(typeof(MPN), value, false);
  415. MaidProp prop = maid.GetProp(mpn2);
  416. if (!(stringList[2] == "==") || !(stringList[3] == "nothing") || prop.nFileNameRID != 0 || !(stringList[4] == "?") || stringList[5].IndexOf("setprop[") != 0)
  417. {
  418. goto IL_86A;
  419. }
  420. string value2 = stringList[5].Substring(8, stringList[5].Length - 8 - 1);
  421. MPN idx = (MPN)Enum.Parse(typeof(MPN), value2, false);
  422. if (!(stringList[6] == "="))
  423. {
  424. goto IL_86A;
  425. }
  426. string text10;
  427. if (stringList[7].IndexOf("getprop[") == 0)
  428. {
  429. string value3 = stringList[7].Substring(8, stringList[7].Length - 8 - 1);
  430. MPN mpn3 = (MPN)Enum.Parse(typeof(MPN), value3, false);
  431. MaidProp prop2 = maid.GetProp(mpn3);
  432. text10 = prop2.strFileName;
  433. }
  434. else
  435. {
  436. text10 = stringList[7];
  437. }
  438. if (!string.IsNullOrEmpty(text10))
  439. {
  440. maid.SetProp(idx, text10, 0, false, false);
  441. goto IL_86A;
  442. }
  443. goto IL_86A;
  444. IL_86A:
  445. goto IL_94D;
  446. }
  447. if (stringList[1].IndexOf("slot[") != 0)
  448. {
  449. goto IL_94D;
  450. }
  451. string[] array = stringList[1].Split(new char[]
  452. {
  453. '.'
  454. });
  455. string value4 = array[0].Substring(5, array[0].Length - 5 - 1);
  456. TBody.SlotID f_nSlotNo = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), value4, true);
  457. TBodySkin slot9 = maid.body0.GetSlot((int)f_nSlotNo);
  458. if (2 > array.Length || !(array[1] == "ver") || !(stringList[2] == "<"))
  459. {
  460. goto IL_94D;
  461. }
  462. int num7 = int.Parse(stringList[3]);
  463. if (slot9.PartsVersion < num7 && stringList[4] == "?" && stringList[5] == "skip")
  464. {
  465. break;
  466. }
  467. goto IL_94D;
  468. IL_94D:
  469. goto IL_211D;
  470. }
  471. if (stringCom == "setprop")
  472. {
  473. if (stringList[1].IndexOf("setprop[") != 0)
  474. {
  475. goto IL_A37;
  476. }
  477. string value5 = stringList[1].Substring(8, stringList[1].Length - 8 - 1);
  478. MPN idx2 = (MPN)Enum.Parse(typeof(MPN), value5, true);
  479. if (!(stringList[2] == "="))
  480. {
  481. goto IL_A37;
  482. }
  483. string text11;
  484. if (stringList[3].IndexOf("getprop[") == 0)
  485. {
  486. string value6 = stringList[3].Substring(8, stringList[3].Length - 8 - 1);
  487. MPN mpn4 = (MPN)Enum.Parse(typeof(MPN), value6, true);
  488. MaidProp prop3 = maid.GetProp(mpn4);
  489. text11 = prop3.strFileName;
  490. }
  491. else
  492. {
  493. text11 = stringList[3];
  494. }
  495. if (!string.IsNullOrEmpty(text11))
  496. {
  497. maid.SetProp(idx2, text11, 0, false, false);
  498. goto IL_A37;
  499. }
  500. goto IL_A37;
  501. IL_A37:
  502. goto IL_211D;
  503. }
  504. if (stringCom == "アイテムパラメータ")
  505. {
  506. if (stringList.Length == 4)
  507. {
  508. string text12 = stringList[1];
  509. string text13 = stringList[2].ToLower();
  510. string text14 = stringList[3].ToLower();
  511. list.Add(new Menu.LastParam(0, stringCom, new string[]
  512. {
  513. text12,
  514. text13,
  515. text14
  516. }));
  517. goto IL_AAD;
  518. }
  519. Debug.LogError("アイテムパラメータ 命令の引数が不正です。SlotNameを明示的に指定しする必要があります。アイテムパラメータ <スロット名> <変数名> <値> の順です。" + text6);
  520. goto IL_AAD;
  521. IL_AAD:
  522. goto IL_211D;
  523. }
  524. if (stringCom == "半脱ぎ" || stringCom == "リソース参照")
  525. {
  526. string key;
  527. string value7;
  528. if (stringCom == "半脱ぎ")
  529. {
  530. key = "半脱ぎ";
  531. value7 = stringList[1];
  532. }
  533. else
  534. {
  535. key = stringList[1];
  536. value7 = stringList[2];
  537. }
  538. int hashCode = Path.GetFileName(filename.ToLower()).ToLower().GetHashCode();
  539. SortedDictionary<string, string> sortedDictionary;
  540. if (Menu.m_dicResourceRef.TryGetValue(hashCode, out sortedDictionary))
  541. {
  542. string empty = string.Empty;
  543. if (sortedDictionary.TryGetValue(key, out empty))
  544. {
  545. sortedDictionary[key] = value7;
  546. goto IL_B64;
  547. }
  548. sortedDictionary.Add(key, value7);
  549. goto IL_B64;
  550. IL_B64:
  551. goto IL_B89;
  552. }
  553. sortedDictionary = new SortedDictionary<string, string>();
  554. sortedDictionary.Add(key, value7);
  555. Menu.m_dicResourceRef.Add(hashCode, sortedDictionary);
  556. goto IL_B89;
  557. IL_B89:
  558. goto IL_211D;
  559. }
  560. if (stringCom == "set")
  561. {
  562. goto IL_211D;
  563. }
  564. if (stringCom == "setname")
  565. {
  566. goto IL_211D;
  567. }
  568. if (stringCom == "setslotitem")
  569. {
  570. string tag = stringList[1];
  571. uint val = uint.Parse(stringList[2]);
  572. maid.SetProp(tag, (int)val, false);
  573. goto IL_211D;
  574. }
  575. if (stringCom == "additem")
  576. {
  577. string text15 = text8;
  578. if (stringList.Length > 1)
  579. {
  580. text15 = stringList[2];
  581. }
  582. text9 = text15;
  583. if (text15 == "body")
  584. {
  585. body.LoadBody_R(stringList[1], maid, num3, flag2);
  586. }
  587. string attachSlot = string.Empty;
  588. string attachName = string.Empty;
  589. List<Tuple<TBody.SlotID, TBodySkin.SplitParam>> list2 = null;
  590. if (4 <= stringList.Length)
  591. {
  592. if (stringList[3] == "ボーンにアタッチ")
  593. {
  594. attachSlot = "ボーンにアタッチ";
  595. attachName = stringList[4];
  596. }
  597. else if (stringList[3] == "アタッチ")
  598. {
  599. attachSlot = stringList[4];
  600. attachName = stringList[5];
  601. }
  602. int num8 = Array.FindIndex<string>(stringList, (string a) => a.ToLower().IndexOf("split") == 0);
  603. if (num8 != -1)
  604. {
  605. string[] array2 = stringList[num8].Split(new char[]
  606. {
  607. ':'
  608. });
  609. string[] array3 = array2[1].Split(new char[]
  610. {
  611. '&'
  612. });
  613. foreach (string text16 in array3)
  614. {
  615. string[] array5 = text16.Split(new char[]
  616. {
  617. '='
  618. });
  619. if (list2 == null)
  620. {
  621. list2 = new List<Tuple<TBody.SlotID, TBodySkin.SplitParam>>();
  622. }
  623. TBody.SlotID item = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), array5[0], true);
  624. if (array5[1].Contains("<") || array5[1].Contains(">"))
  625. {
  626. string[] array6 = array5[1].Split(new char[]
  627. {
  628. '<',
  629. '>'
  630. });
  631. array6[0] = array6[0].ToLower();
  632. bool flag10 = false;
  633. if (array5[1].Contains("<"))
  634. {
  635. flag10 = true;
  636. }
  637. float pos = float.Parse(array6[1]);
  638. Vector3Int plane = default(Vector3Int);
  639. if (array6[0] == "x")
  640. {
  641. if (flag10)
  642. {
  643. plane.x = -1;
  644. }
  645. else
  646. {
  647. plane.x = 1;
  648. }
  649. }
  650. else if (array6[0] == "y")
  651. {
  652. if (flag10)
  653. {
  654. plane.y = -1;
  655. }
  656. else
  657. {
  658. plane.y = 1;
  659. }
  660. }
  661. else if (array6[0] == "z")
  662. {
  663. if (flag10)
  664. {
  665. plane.z = -1;
  666. }
  667. else
  668. {
  669. plane.z = 1;
  670. }
  671. }
  672. list2.Add(new Tuple<TBody.SlotID, TBodySkin.SplitParam>(item, new TBodySkin.SplitParam
  673. {
  674. plane = plane,
  675. pos = pos
  676. }));
  677. }
  678. else
  679. {
  680. list2.Add(new Tuple<TBody.SlotID, TBodySkin.SplitParam>(item, new TBodySkin.SplitParam
  681. {
  682. splitPartBone = array5[1].Split(new char[]
  683. {
  684. '|'
  685. })
  686. }));
  687. }
  688. }
  689. }
  690. }
  691. if (text15 == "handitemr")
  692. {
  693. attachSlot = "ボーンにアタッチ";
  694. attachName = "_IK_handR";
  695. }
  696. if (text15 == "handiteml")
  697. {
  698. attachSlot = "ボーンにアタッチ";
  699. attachName = "_IK_handL";
  700. }
  701. if (list2 != null)
  702. {
  703. List<TBody.SlotID> list3 = new List<TBody.SlotID>();
  704. for (int k = 0; k < list2.Count; k++)
  705. {
  706. Tuple<TBody.SlotID, TBodySkin.SplitParam> tuple = list2[k];
  707. if (k == 0)
  708. {
  709. tuple.Item2.pairSlotIds = list3;
  710. }
  711. else
  712. {
  713. list3.Add(tuple.Item1);
  714. }
  715. if (!flag2 || flag3 || string.Compare(text15, tuple.Item1.ToString(), true) == 0)
  716. {
  717. maid.body0.AddItem((MPN)Enum.Parse(typeof(MPN), text8, true), num4, tuple.Item1.ToString(), stringList[1], attachSlot, attachName, f_bTemp, num3, flag2, tuple.Item2);
  718. }
  719. }
  720. }
  721. else
  722. {
  723. body.AddItem((MPN)Enum.Parse(typeof(MPN), text8, true), num4, text15, stringList[1], attachSlot, attachName, f_bTemp, num3, flag2, null);
  724. }
  725. body.SetVisibleNodeSlot(text15, num4, true, "_ALL_");
  726. goto IL_211D;
  727. }
  728. if (stringCom == "nofloory")
  729. {
  730. TBody.SlotID i2 = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), stringList[1], true);
  731. body.goSlot[(int)i2].m_bHitFloorY = false;
  732. goto IL_211D;
  733. }
  734. if (stringCom == "saveitem")
  735. {
  736. text4 = stringList[1];
  737. goto IL_211D;
  738. }
  739. if (stringCom == "category")
  740. {
  741. text8 = stringList[1];
  742. flag4 = (text8 == "skin");
  743. flag5 = (text8 == "haircolor");
  744. goto IL_211D;
  745. }
  746. if (stringCom == "maskitem")
  747. {
  748. if (stringList.Length > 1)
  749. {
  750. string maskslot = stringList[1];
  751. body.AddMask(text8, num4, maskslot);
  752. goto IL_10EE;
  753. }
  754. goto IL_10EE;
  755. IL_10EE:
  756. goto IL_211D;
  757. }
  758. if (stringCom == "delitem")
  759. {
  760. string slotname2 = text8;
  761. if (stringList.Length > 1)
  762. {
  763. slotname2 = stringList[1];
  764. }
  765. body.DelItem((MPN)Enum.Parse(typeof(MPN), text8, true), slotname2);
  766. goto IL_211D;
  767. }
  768. if (stringCom == "node消去")
  769. {
  770. string slotname3 = text8;
  771. string text17;
  772. if (Menu.ParseParamEquale(stringList, 2).TryGetValue("slot", out text17))
  773. {
  774. slotname3 = text17;
  775. }
  776. body.SetVisibleNodeSlot(slotname3, num4, false, stringList[1]);
  777. goto IL_211D;
  778. }
  779. if (stringCom == "node表示")
  780. {
  781. string slotname4 = text8;
  782. string text18;
  783. if (Menu.ParseParamEquale(stringList, 2).TryGetValue("slot", out text18))
  784. {
  785. slotname4 = text18;
  786. }
  787. body.SetVisibleNodeSlot(slotname4, num4, true, stringList[1]);
  788. goto IL_211D;
  789. }
  790. if (stringCom == "パーツnode消去")
  791. {
  792. string slotname5 = text8;
  793. string text19;
  794. if (Menu.ParseParamEquale(stringList, 2).TryGetValue("slot", out text19))
  795. {
  796. slotname5 = text19;
  797. }
  798. body.SetVisibleNodeSlotParts(slotname5, num4, stringList[1], false, stringList[2]);
  799. goto IL_211D;
  800. }
  801. if (stringCom == "パーツnode表示")
  802. {
  803. string slotname6 = text8;
  804. string text20;
  805. if (Menu.ParseParamEquale(stringList, 2).TryGetValue("slot", out text20))
  806. {
  807. slotname6 = text20;
  808. }
  809. body.SetVisibleNodeSlotParts(slotname6, num4, stringList[1], true, stringList[2]);
  810. goto IL_211D;
  811. }
  812. if (stringCom == "mask消去")
  813. {
  814. TBody.SlotID slot10;
  815. Parse.TryParse<TBody.SlotID>(stringList[1], out slot10, errorCallBack);
  816. maid.body0.AddSkinMask(slot10, num4, stringList[2]);
  817. goto IL_211D;
  818. }
  819. if (stringCom == "color")
  820. {
  821. string name = stringList[1];
  822. int matno = int.Parse(stringList[2]);
  823. string prop_name = stringList[3];
  824. Color col = new Color(float.Parse(stringList[4]) / 255f, float.Parse(stringList[5]) / 255f, float.Parse(stringList[6]) / 255f, float.Parse(stringList[7]) / 255f);
  825. body.ChangeCol(name, matno, prop_name, col);
  826. goto IL_211D;
  827. }
  828. if (stringCom == "mancolor")
  829. {
  830. Color manColor = new Color(float.Parse(stringList[1]) / 255f, float.Parse(stringList[2]) / 255f, float.Parse(stringList[3]) / 255f, 1f);
  831. maid.ManColor = manColor;
  832. maid.ManColorUpdate();
  833. goto IL_211D;
  834. }
  835. if (stringCom == "tex" || stringCom == "テクスチャ変更")
  836. {
  837. string text21 = stringList[1];
  838. string[] array7 = stringList[2].Split(new char[]
  839. {
  840. '&'
  841. });
  842. int num9 = -1;
  843. if (2 <= array7.Length)
  844. {
  845. foreach (string text22 in array7)
  846. {
  847. string[] array9 = text22.Split(new char[]
  848. {
  849. '='
  850. });
  851. MPN mpn5 = (MPN)Enum.Parse(typeof(MPN), array9[0], true);
  852. if (mpn5 == (MPN)mp.idx)
  853. {
  854. int.TryParse(array9[1], out num9);
  855. break;
  856. }
  857. }
  858. if (num9 == -1)
  859. {
  860. NDebug.Assert("tex mat no error.", false);
  861. }
  862. }
  863. else
  864. {
  865. int.TryParse(array7[0], out num9);
  866. if (mp.idx == 160)
  867. {
  868. num9 = 7;
  869. }
  870. }
  871. string text23 = stringList[3];
  872. string filename2 = stringList[4];
  873. MaidParts.PARTS_COLOR parts_COLOR = MaidParts.PARTS_COLOR.NONE;
  874. if (stringList.Length == 6)
  875. {
  876. string text24 = stringList[5];
  877. try
  878. {
  879. parts_COLOR = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text24.ToUpper());
  880. }
  881. catch
  882. {
  883. NDebug.Assert("無限色IDがありません。" + text24, false);
  884. }
  885. }
  886. if (flag4 && parts_COLOR == MaidParts.PARTS_COLOR.SKIN)
  887. {
  888. if (text21 == "body" && num9 == 0 && text23.ToLower() == "_maintex")
  889. {
  890. body.ChangeShader(text21, num9, "CM3D2_Toony_Lighted_Outline_Tex");
  891. flag = true;
  892. body.ChangeTex(text21, 0, num9, "_OutlineTex", filename2, null, MaidParts.PARTS_COLOR.SKIN_OUTLINE);
  893. body.ChangeTex(text21, 0, num9, "_OutlineToonRamp", "toonBlackA1.tex", null, MaidParts.PARTS_COLOR.SKIN_OUTLINE);
  894. }
  895. else if (text21 == "head" && num9 == 5 && text23.ToLower() == "_maintex")
  896. {
  897. body.ChangeShader(text21, num9, "CM3D2_Toony_Lighted_Outline_Tex");
  898. flag = true;
  899. body.ChangeTex(text21, 0, num9, "_OutlineTex", filename2, null, MaidParts.PARTS_COLOR.SKIN_OUTLINE);
  900. body.ChangeTex(text21, 0, num9, "_OutlineToonRamp", "toonBlackA1.tex", null, MaidParts.PARTS_COLOR.SKIN_OUTLINE);
  901. }
  902. }
  903. if (Product.isEnglish && !Product.isPublic && flag4 && text21 == "body" && num9 == 0 && text23.ToLower() == "_maintex")
  904. {
  905. if (parts_COLOR == MaidParts.PARTS_COLOR.SKIN)
  906. {
  907. body.ChangeShader(text21, num9, "CM3D2_Toony_Lighted_Outline_Tex_Texwidth");
  908. }
  909. else
  910. {
  911. body.ChangeShader(text21, num9, "CM3D2_Toony_Lighted_Outline_Texwidth");
  912. }
  913. body.ChangeTex(text21, 0, num9, "_OutlineWidthTex", "skin_en_outline_width.tex", null, MaidParts.PARTS_COLOR.NONE);
  914. flag = true;
  915. }
  916. body.ChangeTex(text21, 0, num9, text23, filename2, null, parts_COLOR);
  917. if (parts_COLOR != MaidParts.PARTS_COLOR.NONE)
  918. {
  919. maid.Parts.SetPartsColor(parts_COLOR, maid.Parts.GetPartsColor(parts_COLOR));
  920. }
  921. if ((flag4 || flag5) && !flag)
  922. {
  923. body.RestoreShader(text21);
  924. goto IL_1683;
  925. }
  926. goto IL_1683;
  927. IL_1683:
  928. goto IL_211D;
  929. }
  930. if (stringCom == "prop")
  931. {
  932. string tag2 = stringList[1];
  933. string s = stringList[2];
  934. maid.SetProp(tag2, int.Parse(s), false);
  935. goto IL_211D;
  936. }
  937. if (stringCom == "テクスチャ乗算")
  938. {
  939. goto IL_211D;
  940. }
  941. if (stringCom == "テクスチャ合成")
  942. {
  943. if (stringList.Length != 7)
  944. {
  945. NDebug.Assert("テクスチャ合成 の引数が不正です。" + stringList.Length, false);
  946. }
  947. if ((text8 == "accTatoo" || text8 == "hokuro") && !filename.Contains("_del"))
  948. {
  949. 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);
  950. goto IL_17EB;
  951. }
  952. 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);
  953. goto IL_17EB;
  954. IL_17EB:
  955. goto IL_211D;
  956. }
  957. if (stringCom == "テクスチャセット合成")
  958. {
  959. if (stringList.Length != 7)
  960. {
  961. NDebug.Assert("テクスチャセット合成 の引数が不正です。" + stringList.Length, false);
  962. }
  963. 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);
  964. goto IL_211D;
  965. }
  966. if (stringCom == "マテリアル変更")
  967. {
  968. string f_strSlotName = stringList[1];
  969. int f_nMatNo = int.Parse(stringList[2]);
  970. string f_strFileName = stringList[3];
  971. body.ChangeMaterial(f_strSlotName, f_nMatNo, f_strFileName);
  972. goto IL_211D;
  973. }
  974. if (stringCom == "shader")
  975. {
  976. string f_strSlotName2 = stringList[1];
  977. int f_nMatNo2 = int.Parse(stringList[2]);
  978. string f_strShaderFileName = stringList[3];
  979. body.ChangeShader(f_strSlotName2, f_nMatNo2, f_strShaderFileName);
  980. flag = true;
  981. goto IL_211D;
  982. }
  983. if (stringCom == "アタッチポイントの設定")
  984. {
  985. if (stringList.Length < 5)
  986. {
  987. Debug.LogError("アタッチポイントの設定引数の数が不正です。 " + text6 + " " + text2);
  988. goto IL_19B0;
  989. }
  990. Vector3 v = new Vector3(float.Parse(stringList[2]), float.Parse(stringList[3]), float.Parse(stringList[4]));
  991. Quaternion q = Quaternion.identity;
  992. if (stringList.Length == 8)
  993. {
  994. q = Quaternion.Euler(float.Parse(stringList[5]), float.Parse(stringList[6]), float.Parse(stringList[7]));
  995. }
  996. else
  997. {
  998. Debug.LogError("アタッチポイントの設定引数に角度指定がありません。 " + text6 + " " + text2);
  999. }
  1000. body.SetAttachPoint(text9, num4, stringList[1], v, q, f_bTemp);
  1001. goto IL_19B0;
  1002. IL_19B0:
  1003. goto IL_211D;
  1004. }
  1005. if (stringCom == "blendset")
  1006. {
  1007. string blendSetName = stringList[1];
  1008. int num10 = (stringList.Length - 2) / 2;
  1009. body.Face.morph.NewBlendSet(blendSetName);
  1010. for (int m = 0; m < num10; m++)
  1011. {
  1012. string tag3 = stringList[2 + m * 2].ToLower();
  1013. float val2 = float.Parse(stringList[3 + m * 2]);
  1014. body.Face.morph.SetValueBlendSet(blendSetName, tag3, val2);
  1015. }
  1016. goto IL_211D;
  1017. }
  1018. if (stringCom == "paramset")
  1019. {
  1020. body.Face.NewParamSet(text6);
  1021. goto IL_211D;
  1022. }
  1023. if (stringCom == "commenttype")
  1024. {
  1025. if (!maid.status.partsDic.ContainsKey(stringList[1]))
  1026. {
  1027. maid.status.partsDic.Add(stringList[1], string.Empty);
  1028. }
  1029. maid.status.partsDic[stringList[1]] = stringList[2];
  1030. goto IL_211D;
  1031. }
  1032. if (stringCom == "useredit")
  1033. {
  1034. if (stringList[2].ToLower() == "material")
  1035. {
  1036. body.SetMaterialProperty(text8, stringList[3], int.Parse(stringList[4]), stringList[5], stringList[6], stringList[7], false);
  1037. goto IL_1B08;
  1038. }
  1039. goto IL_1B08;
  1040. IL_1B08:
  1041. goto IL_211D;
  1042. }
  1043. if (stringCom == "bonemorph")
  1044. {
  1045. if (9 > stringList.Length || stringList.Length > 10)
  1046. {
  1047. Debug.LogError("BoneMorpの設定引数の数が不正です。 " + text6 + " " + text2);
  1048. }
  1049. if (stringList.Length == 9)
  1050. {
  1051. 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])));
  1052. goto IL_1CCE;
  1053. }
  1054. string text25 = stringList[1].ToLower();
  1055. string strPropName = stringList[2];
  1056. string f_strBoneName = stringList[3];
  1057. Vector3 f_fAddMin = new Vector3(float.Parse(stringList[4]), float.Parse(stringList[5]), float.Parse(stringList[6]));
  1058. Vector3 f_fAddMax = new Vector3(float.Parse(stringList[7]), float.Parse(stringList[8]), float.Parse(stringList[9]));
  1059. if (text25 != null)
  1060. {
  1061. if (text25 == "pos")
  1062. {
  1063. body.bonemorph.ChangeMorphPosValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax);
  1064. goto IL_1CCE;
  1065. }
  1066. if (text25 == "rot")
  1067. {
  1068. body.bonemorph.ChangeMorphRotatioValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax);
  1069. goto IL_1CCE;
  1070. }
  1071. if (text25 == "scl")
  1072. {
  1073. body.bonemorph.ChangeMorphSclValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax);
  1074. goto IL_1CCE;
  1075. }
  1076. }
  1077. Debug.LogError(string.Concat(new string[]
  1078. {
  1079. "BoneMorpのタイプ指定が不正です[",
  1080. text25,
  1081. "]\n",
  1082. text6,
  1083. " ",
  1084. text2
  1085. }));
  1086. goto IL_1CCE;
  1087. IL_1CCE:
  1088. goto IL_211D;
  1089. }
  1090. if (stringCom == "length")
  1091. {
  1092. if (stringList.Length != 11)
  1093. {
  1094. Debug.LogError("lengthの設定引数の数が不正です。 " + text6 + " " + text2);
  1095. }
  1096. body.SetHairLengthDataList(stringList[1], 0, 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])));
  1097. goto IL_211D;
  1098. }
  1099. if (stringCom == "anime")
  1100. {
  1101. if (stringList.Length < 3)
  1102. {
  1103. Debug.LogError("animeの設定引数の数が不正です。 " + text6 + " " + text2);
  1104. }
  1105. TBody.SlotID f_slot = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), stringList[1], true);
  1106. body.ItemAnimationLoad(f_slot, stringList[2]);
  1107. bool f_bLoop = false;
  1108. if (3 < stringList.Length)
  1109. {
  1110. f_bLoop = (stringList[3] == "loop");
  1111. }
  1112. body.ItemAnimationPlay(f_slot, stringList[2], f_bLoop);
  1113. goto IL_211D;
  1114. }
  1115. if (stringCom == "param2")
  1116. {
  1117. if (stringList.Length == 4)
  1118. {
  1119. string slotname7 = stringList[1];
  1120. body.GetSlot(slotname7).SetParam2(stringList[2], stringList[3]);
  1121. goto IL_1E42;
  1122. }
  1123. Debug.LogError("param2の設定引数の数が不正です。 " + text6 + " " + text2);
  1124. goto IL_1E42;
  1125. IL_1E42:
  1126. goto IL_211D;
  1127. }
  1128. if (stringCom == "animematerial")
  1129. {
  1130. TBody.SlotID f_slot2 = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), stringList[1], true);
  1131. string s2 = stringList[2];
  1132. body.MaterialAnimatorAdd(f_slot2, int.Parse(s2));
  1133. goto IL_211D;
  1134. }
  1135. if (stringCom == "meshmorph")
  1136. {
  1137. string value8 = stringList[1];
  1138. string blendName = stringList[2];
  1139. string[] array10 = stringList[3].Split(new char[]
  1140. {
  1141. '='
  1142. });
  1143. int num11 = 0;
  1144. if (string.Compare(array10[0], "def", true) == 0)
  1145. {
  1146. num11 = int.Parse(array10[1]);
  1147. }
  1148. TMorphSkin.BaseBlendValue.Tag tag4 = (TMorphSkin.BaseBlendValue.Tag)Enum.Parse(typeof(TMorphSkin.BaseBlendValue.Tag), value8);
  1149. TBody.SlotID parentSlotId = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), text9);
  1150. maid.body0.AddBaseBlendValue(parentSlotId, tag4, blendName, (float)num11 * 0.01f);
  1151. goto IL_211D;
  1152. }
  1153. if (stringCom == "addbonemorph")
  1154. {
  1155. TBody.SlotID slotID;
  1156. Parse.TryParse<TBody.SlotID>(stringList[1], out slotID, errorCallBack);
  1157. string text26 = stringList[2];
  1158. NDebug.Assert(slotID == TBody.SlotID.wear && text26 == "裾", "AddBoneMorph is SlotID.wear and 裾 only.");
  1159. TBodySkin.MyBoneMorph myBoneMorph = null;
  1160. List<TBodySkin.MyBoneMorph> list4 = new List<TBodySkin.MyBoneMorph>();
  1161. for (int n = 3; n < stringList.Length; n++)
  1162. {
  1163. string text27 = stringList[n];
  1164. string[] array11 = text27.Split(new char[]
  1165. {
  1166. '='
  1167. });
  1168. if (array11.Length == 2)
  1169. {
  1170. string[] array12 = array11[1].Split(new char[]
  1171. {
  1172. '~'
  1173. });
  1174. Vector3 vector;
  1175. Parse.TryParse(array12[0], out vector, errorCallBack);
  1176. Vector3 vector2;
  1177. Parse.TryParse(array12[1], out vector2, errorCallBack);
  1178. if (string.Compare(array11[0], "pos", true) == 0)
  1179. {
  1180. myBoneMorph.usePos = true;
  1181. myBoneMorph.pos = vector;
  1182. myBoneMorph.pos2 = vector2;
  1183. }
  1184. else if (string.Compare(array11[0], "rot", true) == 0)
  1185. {
  1186. myBoneMorph.useRot = true;
  1187. myBoneMorph.rot = vector;
  1188. myBoneMorph.rot2 = vector2;
  1189. }
  1190. else if (string.Compare(array11[0], "scl", true) == 0)
  1191. {
  1192. myBoneMorph.useScl = true;
  1193. myBoneMorph.scl = vector;
  1194. myBoneMorph.scl2 = vector2;
  1195. }
  1196. else
  1197. {
  1198. Debug.LogError("AddBoneMorph Error can't parse trs type = " + array11[0]);
  1199. }
  1200. }
  1201. else
  1202. {
  1203. myBoneMorph = new TBodySkin.MyBoneMorph
  1204. {
  1205. name = text26,
  1206. targetBoneName = stringList[n]
  1207. };
  1208. list4.Add(myBoneMorph);
  1209. }
  1210. }
  1211. maid.body0.AddMyBoneMorph(slotID, text26, list4);
  1212. goto IL_211D;
  1213. }
  1214. if (stringCom == "乳首")
  1215. {
  1216. string text28 = stringList[1];
  1217. TBody.SlotID slotId;
  1218. Parse.TryParse<TBody.SlotID>(text9, out slotId, errorCallBack);
  1219. TBodySkin.CHIKUBI_STATE state;
  1220. Parse.TryParse<TBodySkin.CHIKUBI_STATE>(text28, out state, errorCallBack);
  1221. maid.body0.AddChikubiState(slotId, num4, state);
  1222. goto IL_211D;
  1223. }
  1224. goto IL_211D;
  1225. IL_211D:
  1226. goto IL_218D;
  1227. }
  1228. catch (Exception ex)
  1229. {
  1230. Debug.LogError(string.Concat(new string[]
  1231. {
  1232. "Exception ",
  1233. Path.GetFileName(filename),
  1234. " 現在処理中だった行 = ",
  1235. text6,
  1236. " 以前の行 = ",
  1237. text7,
  1238. " ",
  1239. ex.Message,
  1240. "StackTrace:\n",
  1241. ex.StackTrace
  1242. }));
  1243. throw ex;
  1244. }
  1245. IL_218D:
  1246. goto IL_142;
  1247. }
  1248. list.Sort((Menu.LastParam a, Menu.LastParam b) => a.nOrder - a.nOrder);
  1249. for (int num12 = 0; num12 < list.Count; num12++)
  1250. {
  1251. Menu.LastParam lastParam = list[num12];
  1252. if (lastParam.strComm == "アイテムパラメータ")
  1253. {
  1254. TBodySkin slot11 = body.GetSlot(lastParam.aryArgs[0]);
  1255. slot11.SetParam(lastParam.aryArgs[1], lastParam.aryArgs[2]);
  1256. }
  1257. }
  1258. if (maid.IsCrcBody && hashSet.Contains(MPN.acchat) && hashSet.Contains(MPN.headset))
  1259. {
  1260. Menu.SetMaidItemTemp(maid, CM3.dicDelItem[MPN.acchead], f_bTemp);
  1261. }
  1262. binaryReader.Close();
  1263. binaryReader = null;
  1264. }
  1265. private static Dictionary<string, string> ParseParamEquale(string[] args, int startIdx)
  1266. {
  1267. Dictionary<string, string> dictionary = new Dictionary<string, string>();
  1268. for (int i = startIdx; i < args.Length; i++)
  1269. {
  1270. string[] array = args[i].Split(new char[]
  1271. {
  1272. '='
  1273. });
  1274. if (array.Length == 2)
  1275. {
  1276. dictionary[array[0]] = array[1];
  1277. }
  1278. }
  1279. return dictionary;
  1280. }
  1281. public static MPN SetMaidItemTemp(Maid maid, string filename, bool f_bTemp = false)
  1282. {
  1283. byte[] buffer = null;
  1284. try
  1285. {
  1286. if (!GameUty.IsExistFile(filename, null))
  1287. {
  1288. return MPN.null_mpn;
  1289. }
  1290. using (AFileBase afileBase = GameUty.FileOpen(filename, null))
  1291. {
  1292. if (!afileBase.IsValid())
  1293. {
  1294. NDebug.Assert("メニューファイルが見つかりません。" + filename, false);
  1295. }
  1296. buffer = afileBase.ReadAll();
  1297. }
  1298. }
  1299. catch (Exception ex)
  1300. {
  1301. Debug.LogError("ProcScriptBin/SetMaidItemTemp アイテムメニューファイルが読み込めませんでした。 : " + filename + " : " + ex.Message);
  1302. }
  1303. BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8);
  1304. string text = binaryReader.ReadString();
  1305. NDebug.Assert(text == "CM3D2_MENU", "ProcScriptBin/SetMaidItemTemp 例外 : " + filename + " のヘッダーが不正です。" + text);
  1306. int num = binaryReader.ReadInt32();
  1307. string text2 = binaryReader.ReadString();
  1308. string text3 = binaryReader.ReadString();
  1309. string text4 = binaryReader.ReadString();
  1310. if (text4 == "acctatoo")
  1311. {
  1312. maid.DelProp(MPN.acctatoo, false);
  1313. maid.SetSubProp(MPN.acctatoo, 0, filename, 0);
  1314. }
  1315. else if (text4 == "hokuro")
  1316. {
  1317. maid.DelProp(MPN.hokuro, false);
  1318. maid.SetSubProp(MPN.hokuro, 0, filename, 0);
  1319. }
  1320. else
  1321. {
  1322. maid.SetProp(text4, filename, 0, f_bTemp, false);
  1323. }
  1324. MPN result = MPN.null_mpn;
  1325. try
  1326. {
  1327. result = (MPN)Enum.Parse(typeof(MPN), text4, true);
  1328. }
  1329. catch (Exception ex2)
  1330. {
  1331. }
  1332. return result;
  1333. }
  1334. public static bool ExportModScript(Maid maid, string filename, bool f_bTemp = false)
  1335. {
  1336. byte[] cd = null;
  1337. try
  1338. {
  1339. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(filename))
  1340. {
  1341. if (!afileBase.IsValid())
  1342. {
  1343. Debug.LogWarning("アイテムメニューファイルが見つかりません。" + filename);
  1344. return false;
  1345. }
  1346. cd = afileBase.ReadAll();
  1347. }
  1348. }
  1349. catch (Exception ex)
  1350. {
  1351. Debug.LogError("ExportModScript アイテムメニューファイルが読み込めませんでした。 : " + filename + " : " + ex.Message);
  1352. }
  1353. string str = UTY.gameProjectPath + "\\";
  1354. string text = str + "ModExport";
  1355. if (!Directory.Exists(text))
  1356. {
  1357. Directory.CreateDirectory(text);
  1358. }
  1359. string text2 = "mod_" + Path.GetFileNameWithoutExtension(filename);
  1360. text2 = text2.Trim();
  1361. text = text + "\\" + text2;
  1362. if (!Directory.Exists(text))
  1363. {
  1364. Directory.CreateDirectory(text);
  1365. }
  1366. StreamWriter streamWriter = new StreamWriter(text + "\\" + text2 + ".txt", false, Encoding.UTF8);
  1367. streamWriter.WriteLine("出力バージョン\t" + 1570);
  1368. streamWriter.WriteLine("基本アイテム\t" + filename.Replace(" ", ":"));
  1369. try
  1370. {
  1371. Menu.ExportModScript(maid, cd, streamWriter, text + "\\" + text2, f_bTemp);
  1372. NUty.WinMessageBox(NUty.GetWindowHandle(), string.Concat(new string[]
  1373. {
  1374. "MODテンプレート出力完了\n",
  1375. text,
  1376. "\\",
  1377. text2,
  1378. ".txt"
  1379. }), "MOD Compile Completed", 0);
  1380. }
  1381. catch (Exception ex2)
  1382. {
  1383. Debug.LogError("ExportModScript 例外 : " + filename + " : " + ex2.Message);
  1384. }
  1385. finally
  1386. {
  1387. streamWriter.Close();
  1388. streamWriter.Dispose();
  1389. streamWriter = null;
  1390. }
  1391. return true;
  1392. }
  1393. public static void ExportModScript(Maid maid, byte[] cd, StreamWriter sw, string filename, bool f_bTemp = false)
  1394. {
  1395. TBody body = maid.body0;
  1396. List<Menu.LastParam> list = new List<Menu.LastParam>();
  1397. BinaryReader binaryReader = new BinaryReader(new MemoryStream(cd), Encoding.UTF8);
  1398. string text = binaryReader.ReadString();
  1399. NDebug.Assert(text == "CM3D2_MENU", "ExportModScript 例外 : ヘッダーファイルが不正です。" + text);
  1400. int num = binaryReader.ReadInt32();
  1401. string path = binaryReader.ReadString();
  1402. string str = binaryReader.ReadString();
  1403. sw.WriteLine("アイテム名\t" + str);
  1404. string str2 = binaryReader.ReadString();
  1405. sw.WriteLine("カテゴリ名\t" + str2);
  1406. string text2 = binaryReader.ReadString();
  1407. sw.WriteLine("説明\t" + text2.Replace("\n", "《改行》"));
  1408. sw.WriteLine("アイコン\t" + Path.GetFileName(filename + ".png"));
  1409. long num2 = (long)binaryReader.ReadInt32();
  1410. bool flag = false;
  1411. List<string> list2 = new List<string>();
  1412. string text3 = string.Empty;
  1413. string text4 = string.Empty;
  1414. string empty = string.Empty;
  1415. string empty2 = string.Empty;
  1416. try
  1417. {
  1418. for (;;)
  1419. {
  1420. int num3 = (int)binaryReader.ReadByte();
  1421. text4 = text3;
  1422. text3 = string.Empty;
  1423. if (num3 == 0)
  1424. {
  1425. break;
  1426. }
  1427. for (int i = 0; i < num3; i++)
  1428. {
  1429. text3 = text3 + "\"" + binaryReader.ReadString() + "\" ";
  1430. }
  1431. if (!(text3 == string.Empty))
  1432. {
  1433. string stringCom = UTY.GetStringCom(text3);
  1434. string[] stringList = UTY.GetStringList(text3);
  1435. if (stringCom == "end")
  1436. {
  1437. break;
  1438. }
  1439. if (!(stringCom == "name"))
  1440. {
  1441. if (stringCom == "icon" || stringCom == "icons")
  1442. {
  1443. string f_strFileName = stringList[1];
  1444. Texture2D texture2D = ImportCM.CreateTexture(f_strFileName);
  1445. if (texture2D != null)
  1446. {
  1447. UTY.SaveImage(texture2D, filename + ".png");
  1448. }
  1449. }
  1450. else if (stringCom == "additem")
  1451. {
  1452. sw.WriteLine("アイテム変更");
  1453. string text5 = empty;
  1454. if (stringList.Length > 1)
  1455. {
  1456. text5 = stringList[2];
  1457. }
  1458. list2.Add(text5);
  1459. sw.WriteLine("\tスロット名\t" + text5);
  1460. TBodySkin slot = maid.body0.GetSlot(text5);
  1461. foreach (Transform transform in slot.obj.GetComponentsInChildren<Transform>(true))
  1462. {
  1463. Renderer component = transform.GetComponent<Renderer>();
  1464. if (!(component == null) && component.materials != null)
  1465. {
  1466. Material[] materials = component.materials;
  1467. for (int k = 0; k < materials.Length; k++)
  1468. {
  1469. Material f_mat = materials[k];
  1470. sw.WriteLine("\t\tマテリアル番号\t" + k);
  1471. Menu.ModMaterial(f_mat, sw);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. else if (!(stringCom == "color"))
  1477. {
  1478. if (stringCom == "tex" || stringCom == "テクスチャ変更")
  1479. {
  1480. string text6 = stringList[1];
  1481. int num4 = int.Parse(stringList[2]);
  1482. string str3 = stringList[3];
  1483. string text7 = stringList[4];
  1484. string text8 = (6 > stringList.Length) ? null : stringList[5];
  1485. if (!list2.Contains(text6))
  1486. {
  1487. string text9 = "テクスチャ変更";
  1488. text9 = text9 + "\t" + text6;
  1489. text9 = text9 + "\t" + num4;
  1490. text9 = text9 + "\t" + str3;
  1491. text9 = text9 + "\t" + text7;
  1492. if (!string.IsNullOrEmpty(text8))
  1493. {
  1494. text9 = text9 + "\t" + text8;
  1495. }
  1496. if (text7.Contains("*"))
  1497. {
  1498. string text10 = string.Empty;
  1499. TBodySkin slot2 = maid.body0.GetSlot(text6);
  1500. if (slot2 != null)
  1501. {
  1502. text10 += "参考)出力時のモデル名は ";
  1503. text10 += Path.GetFileNameWithoutExtension(slot2.m_strModelFileName);
  1504. text10 += " です。";
  1505. }
  1506. sw.WriteLine("// * の部分は現在装着されているモデル名に置換されます。" + text10);
  1507. }
  1508. if (!string.IsNullOrEmpty(text8) && !flag)
  1509. {
  1510. string text11 = "// 無限色ID群 ";
  1511. IEnumerator enumerator = Enum.GetValues(typeof(MaidParts.PARTS_COLOR)).GetEnumerator();
  1512. try
  1513. {
  1514. while (enumerator.MoveNext())
  1515. {
  1516. object obj = enumerator.Current;
  1517. text11 = text11 + ((MaidParts.PARTS_COLOR)obj).ToString() + " ";
  1518. }
  1519. }
  1520. finally
  1521. {
  1522. IDisposable disposable;
  1523. if ((disposable = (enumerator as IDisposable)) != null)
  1524. {
  1525. disposable.Dispose();
  1526. }
  1527. }
  1528. sw.WriteLine(text11);
  1529. flag = true;
  1530. }
  1531. sw.WriteLine(text9);
  1532. }
  1533. }
  1534. else if (stringCom == "テクスチャ合成")
  1535. {
  1536. string item = stringList[1];
  1537. int num5 = int.Parse(stringList[2]);
  1538. string text12 = stringList[3];
  1539. string text13 = stringList[4];
  1540. if (!list2.Contains(item))
  1541. {
  1542. }
  1543. }
  1544. else if (stringCom == "マテリアル変更")
  1545. {
  1546. string text14 = stringList[1];
  1547. int num6 = int.Parse(stringList[2]);
  1548. string text15 = stringList[3];
  1549. if (!list2.Contains(text14))
  1550. {
  1551. sw.WriteLine("マテリアル変更");
  1552. sw.WriteLine("\tスロット名\t" + text14);
  1553. TBodySkin slot3 = maid.body0.GetSlot(text14);
  1554. foreach (Transform transform2 in slot3.obj.GetComponentsInChildren<Transform>(true))
  1555. {
  1556. Renderer component2 = transform2.GetComponent<Renderer>();
  1557. if (!(component2 == null) && component2.materials != null)
  1558. {
  1559. Material[] materials2 = component2.materials;
  1560. for (int m = 0; m < materials2.Length; m++)
  1561. {
  1562. Material f_mat2 = materials2[m];
  1563. sw.WriteLine("\t\tマテリアル番号\t" + m);
  1564. Menu.ModMaterial(f_mat2, sw);
  1565. }
  1566. }
  1567. }
  1568. }
  1569. }
  1570. else if (stringCom == "color_set")
  1571. {
  1572. if (stringList.Length >= 3)
  1573. {
  1574. string text16 = stringList[2];
  1575. text16 = "mod_" + Path.GetFileNameWithoutExtension(text16) + ".mod";
  1576. sw.WriteLine("色セット\t" + stringList[1] + "\t" + text16);
  1577. }
  1578. else
  1579. {
  1580. sw.WriteLine("色セット\t" + stringList[1]);
  1581. }
  1582. MPN f_mpn = (MPN)Enum.Parse(typeof(MPN), stringList[1].ToLower());
  1583. maid.ExportModBaseMenu(f_mpn);
  1584. }
  1585. }
  1586. }
  1587. }
  1588. }
  1589. }
  1590. catch (Exception ex)
  1591. {
  1592. Debug.LogError(string.Concat(new string[]
  1593. {
  1594. "Exception ",
  1595. Path.GetFileName(path),
  1596. " 現在処理中だった行 = ",
  1597. text3,
  1598. " 以前の行 = ",
  1599. text4,
  1600. " ",
  1601. ex.Message,
  1602. "StackTrace:\n",
  1603. ex.StackTrace
  1604. }));
  1605. NDebug.Assert("メニューファイル処理中にエラーが発生しました。" + Path.GetFileName(path), false);
  1606. if (binaryReader != null)
  1607. {
  1608. binaryReader.Close();
  1609. binaryReader = null;
  1610. }
  1611. throw ex;
  1612. }
  1613. if (binaryReader != null)
  1614. {
  1615. binaryReader.Close();
  1616. binaryReader = null;
  1617. }
  1618. }
  1619. public static string[] NeedTextureWildCard(string f_strTexName)
  1620. {
  1621. string[] array;
  1622. if (f_strTexName.Contains("*"))
  1623. {
  1624. string strTexName = f_strTexName;
  1625. strTexName = strTexName.Replace("*", ".*");
  1626. if (Menu.m_strAllTexInFileSys == null)
  1627. {
  1628. Menu.m_strAllTexInFileSys = GameUty.FileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFile);
  1629. }
  1630. array = Array.FindAll<string>(Menu.m_strAllTexInFileSys, (string i) => new Regex(strTexName).IsMatch(i));
  1631. array = Array.FindAll<string>(array, (string i) => new Regex("^((?!_i_).)*$").IsMatch(i));
  1632. IEnumerable<string> source = array;
  1633. if (Menu.<>f__mg$cache0 == null)
  1634. {
  1635. Menu.<>f__mg$cache0 = new Func<string, string>(Path.GetFileName);
  1636. }
  1637. array = source.Select(Menu.<>f__mg$cache0).ToArray<string>();
  1638. string strMatchGroup = strTexName.Replace(".*", "(?<WILD>.*)");
  1639. array = array.Select(delegate(string i)
  1640. {
  1641. Match match = new Regex(strMatchGroup).Match(i);
  1642. if (match.Success)
  1643. {
  1644. return match.Groups["WILD"].Value;
  1645. }
  1646. return i;
  1647. }).ToArray<string>();
  1648. }
  1649. else
  1650. {
  1651. array = new string[]
  1652. {
  1653. Path.GetFileName(f_strTexName)
  1654. };
  1655. }
  1656. return array;
  1657. }
  1658. private static void ModMaterial(Material f_mat, StreamWriter f_sw)
  1659. {
  1660. for (int i = 0; i < Menu.material_properties.GetLength(0); i++)
  1661. {
  1662. if (f_mat.HasProperty(Menu.material_properties[i, 0]))
  1663. {
  1664. if (Menu.material_properties[i, 1] == "tex")
  1665. {
  1666. Texture texture = f_mat.GetTexture(Menu.material_properties[i, 0]);
  1667. f_sw.WriteLine("\t\t\tテクスチャ設定\t" + Menu.material_properties[i, 0] + "\t" + texture.name);
  1668. }
  1669. else if (Menu.material_properties[i, 1] == "col")
  1670. {
  1671. Color color = f_mat.GetColor(Menu.material_properties[i, 0]);
  1672. f_sw.WriteLine(string.Concat(new object[]
  1673. {
  1674. "\t\t\t色設定\t",
  1675. Menu.material_properties[i, 0],
  1676. "\t",
  1677. (int)(255f * color.r),
  1678. "\t",
  1679. (int)(255f * color.g),
  1680. "\t",
  1681. (int)(255f * color.b),
  1682. "\t",
  1683. (int)(255f * color.a)
  1684. }));
  1685. }
  1686. else if (Menu.material_properties[i, 1] == "f")
  1687. {
  1688. float @float = f_mat.GetFloat(Menu.material_properties[i, 0]);
  1689. f_sw.WriteLine(string.Concat(new object[]
  1690. {
  1691. "\t\t\t数値設定\t",
  1692. Menu.material_properties[i, 0],
  1693. "\t",
  1694. @float
  1695. }));
  1696. }
  1697. }
  1698. }
  1699. }
  1700. private static string GetBaseItemFromMod(string f_strModMenu)
  1701. {
  1702. string empty = string.Empty;
  1703. FileStream fileStream = new FileStream(f_strModMenu, FileMode.Open);
  1704. if (fileStream == null)
  1705. {
  1706. return string.Empty;
  1707. }
  1708. BinaryReader binaryReader = new BinaryReader(fileStream);
  1709. string a = binaryReader.ReadString();
  1710. NDebug.Assert(a == "CM3D2_MOD", "セーブデータファイルのヘッダーが不正です。_MOD");
  1711. int num = binaryReader.ReadInt32();
  1712. string text = binaryReader.ReadString();
  1713. string text2 = binaryReader.ReadString();
  1714. text2 = text2.Replace(":", " ");
  1715. string text3 = binaryReader.ReadString();
  1716. string text4 = binaryReader.ReadString();
  1717. string text5 = binaryReader.ReadString();
  1718. binaryReader.Close();
  1719. fileStream.Close();
  1720. fileStream.Dispose();
  1721. return text2;
  1722. }
  1723. private static void ProcModScriptBin(Maid maid, byte[] cd, string filename, bool f_bTemp = false)
  1724. {
  1725. Menu.ProcModScriptBin(maid, cd, filename, null, f_bTemp);
  1726. }
  1727. private static void ProcModScriptBin(Maid maid, byte[] cd, string filename, MaidProp mp, bool f_bTemp = false)
  1728. {
  1729. if (mp != null && maid.body0 != null && (mp.idx == 160 || mp.idx == 161 || mp.idx == 162 || mp.idx == 163))
  1730. {
  1731. TBodySkin slot = maid.body0.GetSlot(1);
  1732. if (slot.PartsVersion < 110)
  1733. {
  1734. return;
  1735. }
  1736. }
  1737. BinaryReader binaryReader = new BinaryReader(new MemoryStream(cd), Encoding.UTF8);
  1738. string text = binaryReader.ReadString();
  1739. NDebug.Assert(text == "CM3D2_MOD", "ProcModScriptBin 例外 : ヘッダーファイルが不正です。" + text);
  1740. int num = binaryReader.ReadInt32();
  1741. string text2 = binaryReader.ReadString();
  1742. string text3 = binaryReader.ReadString();
  1743. string text4 = binaryReader.ReadString();
  1744. string text5 = binaryReader.ReadString();
  1745. string text6 = binaryReader.ReadString();
  1746. string text7 = binaryReader.ReadString();
  1747. MPN mpn = MPN.null_mpn;
  1748. try
  1749. {
  1750. mpn = (MPN)Enum.Parse(typeof(MPN), text7);
  1751. }
  1752. catch
  1753. {
  1754. NDebug.Assert("カテゴリがありません。" + text7, false);
  1755. }
  1756. string text8 = string.Empty;
  1757. if (mpn != MPN.null_mpn)
  1758. {
  1759. text8 = binaryReader.ReadString();
  1760. }
  1761. string s = binaryReader.ReadString();
  1762. int num2 = binaryReader.ReadInt32();
  1763. Dictionary<string, byte[]> dictionary = new Dictionary<string, byte[]>();
  1764. for (int i = 0; i < num2; i++)
  1765. {
  1766. string key = binaryReader.ReadString();
  1767. int count = binaryReader.ReadInt32();
  1768. byte[] value = binaryReader.ReadBytes(count);
  1769. dictionary.Add(key, value);
  1770. }
  1771. binaryReader.Close();
  1772. binaryReader = null;
  1773. using (StringReader stringReader = new StringReader(s))
  1774. {
  1775. Menu.IMode mode = Menu.IMode.Non;
  1776. string slotname = string.Empty;
  1777. TBodySkin tbodySkin = null;
  1778. Material material = null;
  1779. int num3 = 0;
  1780. string text9;
  1781. while ((text9 = stringReader.ReadLine()) != null)
  1782. {
  1783. string[] array = text9.Split(new char[]
  1784. {
  1785. '\t',
  1786. ' '
  1787. }, StringSplitOptions.RemoveEmptyEntries);
  1788. if (array[0] == "アイテム変更" || array[0] == "マテリアル変更")
  1789. {
  1790. mode = Menu.IMode.ItemChange;
  1791. }
  1792. else if (array[0] == "テクスチャ変更")
  1793. {
  1794. mode = Menu.IMode.TexChange;
  1795. }
  1796. if (mode == Menu.IMode.ItemChange)
  1797. {
  1798. if (array[0] == "スロット名")
  1799. {
  1800. slotname = array[1];
  1801. tbodySkin = maid.body0.GetSlot(slotname);
  1802. }
  1803. if (tbodySkin != null)
  1804. {
  1805. if (array[0] == "マテリアル番号")
  1806. {
  1807. num3 = int.Parse(array[1]);
  1808. foreach (Transform transform in tbodySkin.obj.GetComponentsInChildren<Transform>(true))
  1809. {
  1810. Renderer component = transform.GetComponent<Renderer>();
  1811. if (!(component == null) && component.materials != null)
  1812. {
  1813. Material[] materials = component.materials;
  1814. for (int k = 0; k < materials.Length; k++)
  1815. {
  1816. if (k == num3)
  1817. {
  1818. material = materials[k];
  1819. break;
  1820. }
  1821. }
  1822. }
  1823. }
  1824. }
  1825. if (material != null)
  1826. {
  1827. if (array[0] == "テクスチャ設定")
  1828. {
  1829. maid.body0.ChangeTex(slotname, 0, num3, array[1], array[2].ToLower(), dictionary, MaidParts.PARTS_COLOR.NONE);
  1830. }
  1831. else if (array[0] == "色設定")
  1832. {
  1833. 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));
  1834. }
  1835. else if (array[0] == "数値設定")
  1836. {
  1837. material.SetFloat(array[1], float.Parse(array[2]));
  1838. }
  1839. }
  1840. }
  1841. }
  1842. else if (mode == Menu.IMode.TexChange)
  1843. {
  1844. MaidParts.PARTS_COLOR parts_COLOR = MaidParts.PARTS_COLOR.NONE;
  1845. if (array.Length == 6)
  1846. {
  1847. string text10 = array[5];
  1848. try
  1849. {
  1850. parts_COLOR = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text10.ToUpper());
  1851. }
  1852. catch
  1853. {
  1854. NDebug.Assert("無限色IDがありません。" + text10, false);
  1855. }
  1856. }
  1857. int matno = int.Parse(array[2]);
  1858. if (mp != null && mp.idx == 160)
  1859. {
  1860. matno = 7;
  1861. }
  1862. maid.body0.ChangeTex(array[1], 0, matno, array[3], array[4].ToLower(), dictionary, parts_COLOR);
  1863. if (parts_COLOR != MaidParts.PARTS_COLOR.NONE)
  1864. {
  1865. maid.Parts.SetPartsColor(parts_COLOR, maid.Parts.GetPartsColor(parts_COLOR));
  1866. }
  1867. }
  1868. }
  1869. }
  1870. }
  1871. // Note: this type is marked as 'beforefieldinit'.
  1872. static Menu()
  1873. {
  1874. string[,] array = new string[31, 2];
  1875. array[0, 0] = "_MainTex";
  1876. array[0, 1] = "tex";
  1877. array[1, 0] = "_BumpMap";
  1878. array[1, 1] = "tex";
  1879. array[2, 0] = "_ToonRamp";
  1880. array[2, 1] = "tex";
  1881. array[3, 0] = "_ShadowTex";
  1882. array[3, 1] = "tex";
  1883. array[4, 0] = "_ShadowRateToon";
  1884. array[4, 1] = "tex";
  1885. array[5, 0] = "_SpecularTex";
  1886. array[5, 1] = "tex";
  1887. array[6, 0] = "_AnisoTex";
  1888. array[6, 1] = "tex";
  1889. array[7, 0] = "_RenderTex";
  1890. array[7, 1] = "tex";
  1891. array[8, 0] = "_HiTex";
  1892. array[8, 1] = "tex";
  1893. array[9, 0] = "_OutlineTex";
  1894. array[9, 1] = "tex";
  1895. array[10, 0] = "_OutlineToonRamp";
  1896. array[10, 1] = "tex";
  1897. array[11, 0] = "_Color";
  1898. array[11, 1] = "col";
  1899. array[12, 0] = "_ShadowColor";
  1900. array[12, 1] = "col";
  1901. array[13, 0] = "_RimColor";
  1902. array[13, 1] = "col";
  1903. array[14, 0] = "_SpecColor";
  1904. array[14, 1] = "col";
  1905. array[15, 0] = "_Emission";
  1906. array[15, 1] = "col";
  1907. array[16, 0] = "_ReflectColor";
  1908. array[16, 1] = "col";
  1909. array[17, 0] = "_OutlineColor";
  1910. array[17, 1] = "col";
  1911. array[18, 0] = "_MyLightColor0";
  1912. array[18, 1] = "col";
  1913. array[19, 0] = "_MyLightColor1";
  1914. array[19, 1] = "col";
  1915. array[20, 0] = "_TintColor";
  1916. array[20, 1] = "col";
  1917. array[21, 0] = "_ShadowColor";
  1918. array[21, 1] = "col";
  1919. array[22, 0] = "_Shininess";
  1920. array[22, 1] = "f";
  1921. array[23, 0] = "_FurLength";
  1922. array[23, 1] = "f";
  1923. array[24, 0] = "_OutlineWidth";
  1924. array[24, 1] = "f";
  1925. array[25, 0] = "_Cutoff";
  1926. array[25, 1] = "f";
  1927. array[26, 0] = "_AnisoOffset";
  1928. array[26, 1] = "f";
  1929. array[27, 0] = "_RimPower";
  1930. array[27, 1] = "f";
  1931. array[28, 0] = "_RimShift";
  1932. array[28, 1] = "f";
  1933. array[29, 0] = "_HiRate";
  1934. array[29, 1] = "f";
  1935. array[30, 0] = "_HiPow";
  1936. array[30, 1] = "f";
  1937. Menu.material_properties = array;
  1938. }
  1939. public static SortedDictionary<int, SortedDictionary<string, string>> m_dicResourceRef = new SortedDictionary<int, SortedDictionary<string, string>>();
  1940. private static string[] m_strAllTexInFileSys = null;
  1941. private static string[,] material_properties;
  1942. [CompilerGenerated]
  1943. private static Func<string, string> <>f__mg$cache0;
  1944. public class MenuHeader
  1945. {
  1946. public bool Deserialize(BinaryReader br)
  1947. {
  1948. string a = br.ReadString();
  1949. if (!string.Equals(a, "CM3D2_MENU"))
  1950. {
  1951. Debug.LogError("ProcScriptBin 例外 : ヘッダーファイルが不正です。");
  1952. return false;
  1953. }
  1954. this.version = br.ReadInt32();
  1955. this.srcFileName = br.ReadString();
  1956. this.itemName = br.ReadString();
  1957. this.category = br.ReadString();
  1958. this.infoText = br.ReadString();
  1959. return true;
  1960. }
  1961. public int version;
  1962. public string srcFileName;
  1963. public string itemName;
  1964. public string category;
  1965. public string infoText;
  1966. }
  1967. private class LastParam
  1968. {
  1969. public LastParam(int f_nOrder, string f_strComm, params string[] f_argArgs)
  1970. {
  1971. this.nOrder = f_nOrder;
  1972. this.strComm = f_strComm;
  1973. this.aryArgs = new string[f_argArgs.Length];
  1974. f_argArgs.CopyTo(this.aryArgs, 0);
  1975. }
  1976. public int nOrder;
  1977. public string strComm = string.Empty;
  1978. public string[] aryArgs;
  1979. }
  1980. private enum IMode
  1981. {
  1982. Non,
  1983. ItemChange,
  1984. TexChange
  1985. }
  1986. }