GameUty.cs 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7. using I2.Loc;
  8. using UnityEngine;
  9. using wf;
  10. public class GameUty
  11. {
  12. public static AFileSystemBase FileSystem
  13. {
  14. get
  15. {
  16. return GameUty.m_FileSystem;
  17. }
  18. }
  19. public static AFileSystemBase FileSystemOld
  20. {
  21. get
  22. {
  23. return GameUty.m_FileSystemOld;
  24. }
  25. }
  26. public static AFileSystemBase FileSystemMod
  27. {
  28. get
  29. {
  30. return GameUty.m_ModFileSystem;
  31. }
  32. }
  33. public static bool IsEnabledCompatibilityMode
  34. {
  35. get
  36. {
  37. return 0 < GameUty.PathListOld.Count;
  38. }
  39. }
  40. public static bool supportMultiLanguage
  41. {
  42. get
  43. {
  44. return false;
  45. }
  46. }
  47. public static string[] MenuFiles
  48. {
  49. get
  50. {
  51. return GameUty.m_aryMenuFiles;
  52. }
  53. }
  54. public static string[] ModOnlysMenuFiles
  55. {
  56. get
  57. {
  58. return GameUty.m_aryModOnlysMenuFiles;
  59. }
  60. }
  61. public static Dictionary<int, string> RidMenuDic
  62. {
  63. get
  64. {
  65. return GameUty.rid_menu_dic_;
  66. }
  67. }
  68. public static Dictionary<string, AFileSystemBase> BgFiles { get; private set; }
  69. public static float MillisecondToSecond(int millisecond)
  70. {
  71. return (float)millisecond / 1000f;
  72. }
  73. public static Material GetSystemMaterial(GameUty.SystemMaterial f_mat)
  74. {
  75. Material material = GameUty.m_matSystem[(int)f_mat];
  76. if (material == null)
  77. {
  78. UnityEngine.Object original = Resources.Load(GameUty.m_strSystemMaterialName[(int)f_mat]);
  79. material = (UnityEngine.Object.Instantiate(original) as Material);
  80. GameUty.m_matSystem[(int)f_mat] = material;
  81. }
  82. return material;
  83. }
  84. public static GameObject LoadAssetBundle(string file_name)
  85. {
  86. if (GameUty.FileSystem == null || !GameUty.FileSystem.IsExistentFile(file_name))
  87. {
  88. return null;
  89. }
  90. UnityEngine.Object original = null;
  91. if (!GameUty.asset_bundle_dic.ContainsKey(file_name))
  92. {
  93. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(file_name))
  94. {
  95. AssetBundle assetBundle = AssetBundle.LoadFromMemory(afileBase.ReadAll());
  96. if (assetBundle.mainAsset != null)
  97. {
  98. original = assetBundle.mainAsset;
  99. }
  100. else
  101. {
  102. original = assetBundle.LoadAllAssets<GameObject>()[0];
  103. }
  104. GameUty.asset_bundle_dic.Add(file_name, assetBundle);
  105. }
  106. }
  107. else
  108. {
  109. original = GameUty.asset_bundle_dic[file_name].mainAsset;
  110. }
  111. GameObject gameObject = UnityEngine.Object.Instantiate(original) as GameObject;
  112. gameObject.name = gameObject.name.Replace("(Clone)", string.Empty);
  113. return gameObject;
  114. }
  115. public static void DeviceInitialize()
  116. {
  117. }
  118. public static void Init()
  119. {
  120. GameUty.m_FileSystem = new FileSystemArchive();
  121. GameUty.m_FileSystemOld = new FileSystemArchive();
  122. GameUty.PathListOld = new List<string>();
  123. if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path))
  124. {
  125. GameUty.PathListOld = GameUty.ReadAutoPathFile("[2.0]", GameMain.Instance.CMSystem.CM3D2Path + "\\GameData\\paths.dat");
  126. if (GameUty.PathListOld == null)
  127. {
  128. GameUty.PathListOld = new List<string>();
  129. }
  130. }
  131. GameUty.UpdateFileSystemPath();
  132. GameUty.UpdateFileSystemPathOld();
  133. PluginData.CreateData(GameUty.m_FileSystem, (!GameUty.IsEnabledCompatibilityMode) ? null : GameUty.m_FileSystemOld);
  134. Debug.Log("■■■■■■■■ Plugin Check ■■■■■■■■");
  135. foreach (string text in PluginData.GetAllUniqueNames())
  136. {
  137. Debug.Log(string.Concat(new string[]
  138. {
  139. "[",
  140. PluginData.uniqueNameToId(text).ToString(),
  141. "]",
  142. text,
  143. " : ",
  144. (!PluginData.IsEnabled(text)) ? "×" : "○"
  145. }));
  146. }
  147. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  148. }
  149. public static void Finish()
  150. {
  151. foreach (KeyValuePair<string, AssetBundle> keyValuePair in GameUty.asset_bundle_dic)
  152. {
  153. keyValuePair.Value.Unload(true);
  154. }
  155. GameUty.asset_bundle_dic.Clear();
  156. GameUty.m_FileSystem.Dispose();
  157. GameUty.m_FileSystem = null;
  158. if (GameUty.m_FileSystemOld != null)
  159. {
  160. GameUty.m_FileSystemOld.Dispose();
  161. GameUty.m_FileSystemOld = null;
  162. }
  163. if (GameUty.m_ModFileSystem != null)
  164. {
  165. GameUty.m_ModFileSystem.Dispose();
  166. GameUty.m_ModFileSystem = null;
  167. }
  168. }
  169. public static Dictionary<string, HashSet<string>> GetGameDataResourceList(string gameDataPath)
  170. {
  171. string[] array = new string[]
  172. {
  173. "script_cbl",
  174. "motion_cbl",
  175. "voice_cbl"
  176. };
  177. int length = (gameDataPath + "\\").Length;
  178. string[] directories = Directory.GetDirectories(gameDataPath);
  179. Dictionary<string, HashSet<string>> dictionary = new Dictionary<string, HashSet<string>>();
  180. for (int i = 0; i < directories.Length; i++)
  181. {
  182. string text = directories[i].Substring(length, directories[i].Length - length).ToLower();
  183. int startIndex = 0;
  184. foreach (string text2 in array)
  185. {
  186. if (text.IndexOf(text2) == 0)
  187. {
  188. startIndex = text2.Length;
  189. break;
  190. }
  191. }
  192. int num = text.IndexOf('_', startIndex);
  193. if (0 <= num)
  194. {
  195. string text3 = text.Substring(0, num);
  196. if (!string.IsNullOrEmpty(text3))
  197. {
  198. string text4 = text.Substring(text3.Length + 1, text.Length - (text3.Length + 1));
  199. if (!string.IsNullOrEmpty(text4))
  200. {
  201. if (!dictionary.ContainsKey(text3))
  202. {
  203. dictionary.Add(text3, new HashSet<string>());
  204. }
  205. if (!dictionary[text3].Contains(text4))
  206. {
  207. dictionary[text3].Add(text4);
  208. }
  209. else
  210. {
  211. Debug.LogWarning(text3 + "_" + text4 + "は既にリストに存在します");
  212. }
  213. }
  214. }
  215. }
  216. else if (!dictionary.ContainsKey(text))
  217. {
  218. dictionary.Add(text, new HashSet<string>());
  219. }
  220. else
  221. {
  222. Debug.LogWarning(text + "は既にリストに存在します");
  223. }
  224. }
  225. return dictionary;
  226. }
  227. public static List<string> ReadAutoPathFile(string uniqueName, string filePath)
  228. {
  229. if (!File.Exists(filePath))
  230. {
  231. return null;
  232. }
  233. List<string> list = new List<string>();
  234. using (FileStream fileStream = new FileStream(filePath, FileMode.Open))
  235. {
  236. using (BinaryReader binaryReader = new BinaryReader(fileStream))
  237. {
  238. string a = binaryReader.ReadString();
  239. NDebug.Assert(a == "CM3D2_PATHS", "パスファイルのヘッダーが不正です。");
  240. int num = binaryReader.ReadInt32();
  241. int num2 = binaryReader.ReadInt32();
  242. for (int i = 0; i < num2; i++)
  243. {
  244. string item = binaryReader.ReadString();
  245. list.Add(item);
  246. }
  247. }
  248. }
  249. return list;
  250. }
  251. public static void UpdateFileSystemPath()
  252. {
  253. string fullPath = Path.GetFullPath(".\\");
  254. string gameDataPath = "GameData";
  255. int check_ver_no = 3;
  256. Func<string, bool> AddFolderOrArchive = delegate(string name)
  257. {
  258. bool flag3 = GameUty.m_FileSystem.AddArchive(gameDataPath + "\\" + name + ".arc");
  259. if (flag3)
  260. {
  261. Debug.Log(string.Concat(new string[]
  262. {
  263. "[",
  264. gameDataPath,
  265. "\\",
  266. name,
  267. ".arc]を読み込みました"
  268. }));
  269. }
  270. return flag3;
  271. };
  272. HashSet<string> addedLegacyArchives = new HashSet<string>();
  273. Action<string> action = delegate(string name)
  274. {
  275. foreach (string text28 in GameUty.PathList)
  276. {
  277. string text29 = name + "_" + text28;
  278. bool flag3 = AddFolderOrArchive(text29);
  279. if (flag3 && !addedLegacyArchives.Contains(text29))
  280. {
  281. addedLegacyArchives.Add(text29);
  282. }
  283. if (flag3)
  284. {
  285. if (name == "csv")
  286. {
  287. GameUty.ExistCsvPathList.Add(text28);
  288. }
  289. for (int num14 = 2; num14 <= check_ver_no; num14++)
  290. {
  291. AddFolderOrArchive(text29 + "_" + num14);
  292. }
  293. }
  294. }
  295. };
  296. Action<string> action2 = delegate(string name)
  297. {
  298. foreach (string text28 in GameUty.PathList)
  299. {
  300. string text29 = name + "_" + text28;
  301. bool flag3 = AddFolderOrArchive(text29);
  302. if (!flag3 && addedLegacyArchives.Contains(text29))
  303. {
  304. flag3 = true;
  305. }
  306. if (flag3)
  307. {
  308. if (name == "csv")
  309. {
  310. GameUty.ExistCsvPathList.Add(text28);
  311. }
  312. for (int num14 = 2; num14 <= check_ver_no; num14++)
  313. {
  314. AddFolderOrArchive(string.Concat(new object[]
  315. {
  316. name,
  317. "_",
  318. text28,
  319. "_",
  320. num14
  321. }));
  322. }
  323. }
  324. }
  325. };
  326. Action<string> action3 = delegate(string name)
  327. {
  328. foreach (string text28 in GameUty.PathList)
  329. {
  330. if (AddFolderOrArchive(name + "_" + text28))
  331. {
  332. if (name == "csv")
  333. {
  334. GameUty.ExistCsvPathList.Add(text28);
  335. }
  336. for (int num14 = 2; num14 <= check_ver_no; num14++)
  337. {
  338. AddFolderOrArchive(string.Concat(new object[]
  339. {
  340. name,
  341. "_",
  342. text28,
  343. "_",
  344. num14
  345. }));
  346. }
  347. }
  348. }
  349. };
  350. string str = string.Empty;
  351. str = "必用アーカイブがありません。GameData\\";
  352. StopWatch stopWatch = new StopWatch();
  353. Debug.Log("IsEnabledCompatibilityMode:" + GameUty.IsEnabledCompatibilityMode.ToString());
  354. string text = "カスタムオーダーメイド3D 2";
  355. string str2 = "カスタムメイド3D 2";
  356. Debug.Log(string.Concat(new string[]
  357. {
  358. text,
  359. " GameVersion ",
  360. GameUty.GetGameVersionText(),
  361. "(BuildVersion : ",
  362. GameUty.GetBuildVersionText(),
  363. ")"
  364. }));
  365. if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path))
  366. {
  367. Debug.Log(str2 + " GameVersion " + GameUty.GetLegacyGameVersionText());
  368. }
  369. if (GameUty.IsEnabledCompatibilityMode)
  370. {
  371. Debug.Log("■■■■■■■■ Archive Log[2.0] (CM3D2 GameData) ■■■■■■■■");
  372. GameUty.m_FileSystem.SetBaseDirectory(GameMain.Instance.CMSystem.CM3D2Path);
  373. GameUty.PathList = GameUty.PathListOld;
  374. AddFolderOrArchive("material");
  375. foreach (string text2 in GameUty.PathListOld)
  376. {
  377. string str3 = "material";
  378. if (text2 == "denkigai2015wTowelR")
  379. {
  380. AddFolderOrArchive(str3 + "_denkigai2015wTowel");
  381. }
  382. string text3 = str3 + "_" + text2;
  383. bool flag = AddFolderOrArchive(text3);
  384. if (flag && !addedLegacyArchives.Contains(text3))
  385. {
  386. addedLegacyArchives.Add(text3);
  387. }
  388. if (flag)
  389. {
  390. for (int i2 = 2; i2 <= check_ver_no; i2++)
  391. {
  392. AddFolderOrArchive(text3 + "_" + i2);
  393. }
  394. }
  395. }
  396. AddFolderOrArchive("material2");
  397. AddFolderOrArchive("menu");
  398. action("menu");
  399. AddFolderOrArchive("menu2");
  400. AddFolderOrArchive("model");
  401. action("model");
  402. AddFolderOrArchive("model2");
  403. AddFolderOrArchive("texture");
  404. action("texture");
  405. AddFolderOrArchive("texture2");
  406. AddFolderOrArchive("texture3");
  407. AddFolderOrArchive("prioritymaterial");
  408. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  409. }
  410. Debug.Log("■■■■■■■■ Archive Log[2.1 Compatibility] (GameData_20) ■■■■■■■■");
  411. gameDataPath = "GameData_20";
  412. GameUty.m_FileSystem.SetBaseDirectory(fullPath);
  413. if (GameUty.IsEnabledCompatibilityMode)
  414. {
  415. GameUty.m_FileSystem.AddPatchDecryptPreferredSearchDirectory(GameMain.Instance.CMSystem.CM3D2Path + "\\GameData");
  416. }
  417. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1Compatibility]", fullPath + gameDataPath + "\\paths.dat");
  418. if (GameUty.PathList != null && 0 < GameUty.PathList.Count)
  419. {
  420. foreach (string text4 in GameUty.PathList)
  421. {
  422. string text5 = "material";
  423. if (text4 == "denkigai2015wTowelR")
  424. {
  425. AddFolderOrArchive(text5 + "_denkigai2015wTowel");
  426. }
  427. string text6 = text5 + "_" + text4;
  428. bool flag2 = AddFolderOrArchive(text6);
  429. if (!flag2 && addedLegacyArchives.Contains(text6))
  430. {
  431. flag2 = true;
  432. }
  433. if (flag2)
  434. {
  435. for (int j = 2; j <= check_ver_no; j++)
  436. {
  437. AddFolderOrArchive(string.Concat(new object[]
  438. {
  439. text5,
  440. "_",
  441. text4,
  442. "_",
  443. j
  444. }));
  445. }
  446. }
  447. }
  448. action2("menu");
  449. action2("model");
  450. action2("texture");
  451. AddFolderOrArchive("prioritymaterial");
  452. List<string> pathList = GameUty.PathList;
  453. GameUty.PathList = new List<string>();
  454. GameUty.PathList.Add("vp001");
  455. action2("bg");
  456. action2("motion");
  457. GameUty.PathList = pathList;
  458. }
  459. GameUty.m_FileSystem.ClearPatchDecryptPreferredSearchDirectory();
  460. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  461. Debug.Log("■■■■■■■■ Archive Log[2.1] (GameData) ■■■■■■■■");
  462. gameDataPath = "GameData";
  463. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1]", fullPath + gameDataPath + "\\paths.dat");
  464. if (GameUty.PathList == null)
  465. {
  466. GameUty.PathList = new List<string>();
  467. NDebug.Assert("paths.datを読み込めませんでした", false);
  468. }
  469. AddFolderOrArchive("csv");
  470. foreach (string text7 in GameUty.PathList)
  471. {
  472. string text8 = "csv";
  473. if (AddFolderOrArchive(text8 + "_" + text7))
  474. {
  475. for (int k = 2; k <= check_ver_no; k++)
  476. {
  477. AddFolderOrArchive(string.Concat(new object[]
  478. {
  479. text8,
  480. "_",
  481. text7,
  482. "_",
  483. k
  484. }));
  485. }
  486. }
  487. }
  488. AddFolderOrArchive("prioritymaterial");
  489. NDebug.Assert(AddFolderOrArchive("motion"), str + "motion");
  490. foreach (string text9 in GameUty.PathList)
  491. {
  492. string text10 = "motion";
  493. if (AddFolderOrArchive(text10 + "_" + text9))
  494. {
  495. for (int l = 2; l <= check_ver_no; l++)
  496. {
  497. AddFolderOrArchive(string.Concat(new object[]
  498. {
  499. text10,
  500. "_",
  501. text9,
  502. "_",
  503. l
  504. }));
  505. }
  506. }
  507. }
  508. AddFolderOrArchive("motion2");
  509. NDebug.Assert(AddFolderOrArchive("script"), str + "script");
  510. foreach (string text11 in GameUty.PathList)
  511. {
  512. string text12 = "script";
  513. if (AddFolderOrArchive(text12 + "_" + text11))
  514. {
  515. for (int m = 2; m <= check_ver_no; m++)
  516. {
  517. AddFolderOrArchive(string.Concat(new object[]
  518. {
  519. text12,
  520. "_",
  521. text11,
  522. "_",
  523. m
  524. }));
  525. }
  526. }
  527. }
  528. AddFolderOrArchive("script_share");
  529. foreach (string text13 in GameUty.PathList)
  530. {
  531. string text14 = "script_share";
  532. if (AddFolderOrArchive(text14 + "_" + text13))
  533. {
  534. for (int n = 2; n <= check_ver_no; n++)
  535. {
  536. AddFolderOrArchive(string.Concat(new object[]
  537. {
  538. text14,
  539. "_",
  540. text13,
  541. "_",
  542. n
  543. }));
  544. }
  545. }
  546. }
  547. AddFolderOrArchive("script_share2");
  548. NDebug.Assert(AddFolderOrArchive("sound"), str + "sound");
  549. foreach (string text15 in GameUty.PathList)
  550. {
  551. string text16 = "sound";
  552. if (AddFolderOrArchive(text16 + "_" + text15))
  553. {
  554. for (int num = 2; num <= check_ver_no; num++)
  555. {
  556. AddFolderOrArchive(string.Concat(new object[]
  557. {
  558. text16,
  559. "_",
  560. text15,
  561. "_",
  562. num
  563. }));
  564. }
  565. }
  566. }
  567. AddFolderOrArchive("sound2");
  568. NDebug.Assert(AddFolderOrArchive("system"), str + "system");
  569. foreach (string text17 in GameUty.PathList)
  570. {
  571. string text18 = "system";
  572. if (AddFolderOrArchive(text18 + "_" + text17))
  573. {
  574. for (int num2 = 2; num2 <= check_ver_no; num2++)
  575. {
  576. AddFolderOrArchive(string.Concat(new object[]
  577. {
  578. text18,
  579. "_",
  580. text17,
  581. "_",
  582. num2
  583. }));
  584. }
  585. }
  586. }
  587. AddFolderOrArchive("system2");
  588. AddFolderOrArchive("language");
  589. foreach (string text19 in GameUty.PathList)
  590. {
  591. string text20 = "language";
  592. if (AddFolderOrArchive(text20 + "_" + text19))
  593. {
  594. for (int num3 = 2; num3 <= check_ver_no; num3++)
  595. {
  596. AddFolderOrArchive(string.Concat(new object[]
  597. {
  598. text20,
  599. "_",
  600. text19,
  601. "_",
  602. num3
  603. }));
  604. }
  605. }
  606. }
  607. foreach (string text21 in GameUty.PathList)
  608. {
  609. string text22 = "bg";
  610. if (AddFolderOrArchive(text22 + "_" + text21))
  611. {
  612. for (int num4 = 2; num4 <= check_ver_no; num4++)
  613. {
  614. AddFolderOrArchive(string.Concat(new object[]
  615. {
  616. text22,
  617. "_",
  618. text21,
  619. "_",
  620. num4
  621. }));
  622. }
  623. }
  624. }
  625. AddFolderOrArchive("voice");
  626. for (int num5 = 0; num5 < 25; num5++)
  627. {
  628. string arg = "voice";
  629. string arg2 = arg + "_" + (char)(97 + num5);
  630. AddFolderOrArchive(arg2);
  631. }
  632. foreach (string text23 in GameUty.PathList)
  633. {
  634. string text24 = "voice";
  635. if (AddFolderOrArchive(text24 + "_" + text23))
  636. {
  637. for (int num6 = 2; num6 <= check_ver_no; num6++)
  638. {
  639. AddFolderOrArchive(string.Concat(new object[]
  640. {
  641. text24,
  642. "_",
  643. text23,
  644. "_",
  645. num6
  646. }));
  647. }
  648. }
  649. }
  650. for (int num7 = 2; num7 <= check_ver_no; num7++)
  651. {
  652. string arg3 = "voice";
  653. AddFolderOrArchive(arg3 + num7);
  654. }
  655. string text25 = "parts";
  656. NDebug.Assert(AddFolderOrArchive(text25), str + text25);
  657. foreach (string text26 in GameUty.PathList)
  658. {
  659. if (AddFolderOrArchive(text25 + "_" + text26))
  660. {
  661. for (int num8 = 2; num8 <= check_ver_no; num8++)
  662. {
  663. AddFolderOrArchive(string.Concat(new object[]
  664. {
  665. text25,
  666. "_",
  667. text26,
  668. "_",
  669. num8
  670. }));
  671. }
  672. }
  673. }
  674. AddFolderOrArchive("parts2");
  675. Debug.Log("■■■■■■■■■■■■■■■■■■■■" + stopWatch.Stop().ToString() + " ms");
  676. GameUty.m_FileSystem.AddAutoPathForAllFolder();
  677. GameUty.BgFiles = new Dictionary<string, AFileSystemBase>();
  678. string[] list = GameUty.m_FileSystem.GetList("bg", AFileSystemBase.ListType.AllFile);
  679. if (list != null && 0 < list.Length)
  680. {
  681. foreach (string path in list)
  682. {
  683. string fileName = Path.GetFileName(path);
  684. if (!(Path.GetExtension(fileName) != ".asset_bg") && !GameUty.BgFiles.ContainsKey(fileName))
  685. {
  686. GameUty.BgFiles.Add(fileName, GameUty.m_FileSystem);
  687. }
  688. }
  689. }
  690. if (GameUty.supportMultiLanguage)
  691. {
  692. list = GameUty.m_FileSystem.GetList("languagesource", AFileSystemBase.ListType.AllFile);
  693. if (list != null && 0 < list.Length)
  694. {
  695. foreach (string path2 in list)
  696. {
  697. string fileName2 = Path.GetFileName(path2);
  698. if (!(Path.GetExtension(fileName2) != ".asset_language"))
  699. {
  700. if (GameUty.supportMultiLanguage || (!(fileName2 == "parts.asset_language") && !(fileName2 == "yotogi.asset_language")))
  701. {
  702. using (AFileBase afileBase = GameUty.m_FileSystem.FileOpen(fileName2))
  703. {
  704. AssetBundle assetBundle = AssetBundle.LoadFromMemory(afileBase.ReadAll());
  705. LanguageSource languageSource = UnityEngine.Object.Instantiate<LanguageSource>(assetBundle.LoadAllAssets<GameObject>()[0].GetComponent<LanguageSource>());
  706. if (GameMain.Instance.transform.Find("Language") == null)
  707. {
  708. new GameObject("Language").transform.SetParent(GameMain.Instance.transform);
  709. }
  710. languageSource.transform.SetParent(GameMain.Instance.transform.Find("Language"));
  711. assetBundle.Unload(true);
  712. }
  713. }
  714. }
  715. }
  716. }
  717. foreach (LanguageSource languageSource2 in LocalizationManager.Sources)
  718. {
  719. languageSource2.LoadAllLanguages(false);
  720. }
  721. }
  722. if (Directory.Exists(fullPath + "Mod"))
  723. {
  724. GameUty.m_ModFileSystem = new FileSystemWindows();
  725. GameUty.m_ModFileSystem.SetBaseDirectory(fullPath);
  726. GameUty.m_ModFileSystem.AddFolder("Mod");
  727. string[] list2 = GameUty.m_ModFileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFolder);
  728. foreach (string text27 in list2)
  729. {
  730. if (!GameUty.m_ModFileSystem.AddAutoPath(text27))
  731. {
  732. Debug.Log("m_ModFileSystemのAddAutoPathには既に " + text27 + " がありました。");
  733. }
  734. }
  735. }
  736. string[] fileListAtExtension = GameUty.m_FileSystem.GetFileListAtExtension(".menu");
  737. List<string> list3 = new List<string>();
  738. foreach (string path3 in fileListAtExtension)
  739. {
  740. list3.Add(Path.GetFileName(path3));
  741. }
  742. GameUty.m_aryMenuFiles = list3.ToArray();
  743. if (GameUty.m_ModFileSystem != null)
  744. {
  745. string[] list4 = GameUty.m_ModFileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFile);
  746. GameUty.m_aryModOnlysMenuFiles = Array.FindAll<string>(list4, (string i) => new Regex(".*\\.menu$").IsMatch(i));
  747. GameUty.m_aryMenuFiles = GameUty.m_aryMenuFiles.Concat(GameUty.m_aryModOnlysMenuFiles).ToArray<string>();
  748. }
  749. if (GameUty.m_aryModOnlysMenuFiles != null && GameUty.m_aryModOnlysMenuFiles.Length != 0)
  750. {
  751. GameUty.ModPriorityToModFolderInfo = string.Empty;
  752. Debug.Log(GameUty.ModPriorityToModFolderInfo + "■MOD有り。MODフォルダ優先モード" + GameUty.ModPriorityToModFolder.ToString());
  753. }
  754. if (GameUty.rid_menu_dic_.Count == 0)
  755. {
  756. string[] menuFiles = GameUty.MenuFiles;
  757. GameUty.rid_menu_dic_ = new Dictionary<int, string>();
  758. for (int num13 = 0; num13 < menuFiles.Length; num13++)
  759. {
  760. string fileName3 = Path.GetFileName(menuFiles[num13]);
  761. int hashCode = fileName3.ToLower().GetHashCode();
  762. if (!GameUty.rid_menu_dic_.ContainsKey(hashCode))
  763. {
  764. GameUty.rid_menu_dic_.Add(hashCode, fileName3);
  765. }
  766. else
  767. {
  768. NDebug.Assert(fileName3 == GameUty.rid_menu_dic_[hashCode], string.Concat(new string[]
  769. {
  770. "[",
  771. fileName3,
  772. "]と[",
  773. GameUty.rid_menu_dic_[hashCode],
  774. "]は同じハッシュキーです"
  775. }));
  776. }
  777. }
  778. }
  779. }
  780. public static void UpdateFileSystemPathOld()
  781. {
  782. if (!GameUty.IsEnabledCompatibilityMode)
  783. {
  784. return;
  785. }
  786. FileSystemArchive fileSystem = GameUty.m_FileSystemOld;
  787. Debug.Log("■■■■■■■■ Archive Log[Legacy]■■■■■■■■");
  788. Func<string, bool> AddFolderOrArchive = delegate(string name)
  789. {
  790. bool flag = fileSystem.AddArchive("GameData\\" + name + ".arc");
  791. if (flag)
  792. {
  793. Debug.Log("[GameData\\" + name + ".arc]を読み込みました");
  794. }
  795. return flag;
  796. };
  797. int check_ver_no = 3;
  798. Action<string> action = delegate(string name)
  799. {
  800. foreach (string text2 in GameUty.PathListOld)
  801. {
  802. if (AddFolderOrArchive(name + "_" + text2))
  803. {
  804. if (name == "csv")
  805. {
  806. GameUty.ExistCsvPathListOld.Add(text2);
  807. }
  808. for (int m = 2; m <= check_ver_no; m++)
  809. {
  810. AddFolderOrArchive(string.Concat(new object[]
  811. {
  812. name,
  813. "_",
  814. text2,
  815. "_",
  816. m
  817. }));
  818. }
  819. }
  820. }
  821. };
  822. fileSystem.SetBaseDirectory(GameMain.Instance.CMSystem.CM3D2Path);
  823. AddFolderOrArchive("csv");
  824. action("csv");
  825. AddFolderOrArchive("motion");
  826. action("motion");
  827. AddFolderOrArchive("motion2");
  828. AddFolderOrArchive("script");
  829. action("script");
  830. action("script_share");
  831. AddFolderOrArchive("script_share2");
  832. AddFolderOrArchive("sound");
  833. action("sound");
  834. AddFolderOrArchive("sound2");
  835. AddFolderOrArchive("texture");
  836. action("texture");
  837. AddFolderOrArchive("texture2");
  838. AddFolderOrArchive("texture3");
  839. AddFolderOrArchive("system");
  840. action("system");
  841. action("bg");
  842. AddFolderOrArchive("voice");
  843. AddFolderOrArchive("voice_a");
  844. AddFolderOrArchive("voice_b");
  845. AddFolderOrArchive("voice_c");
  846. foreach (string str in GameUty.PathListOld)
  847. {
  848. string str2 = "voice";
  849. string text = str2 + "_" + str;
  850. if (AddFolderOrArchive(text))
  851. {
  852. for (int i = 2; i <= check_ver_no; i++)
  853. {
  854. AddFolderOrArchive(text + "_" + i);
  855. }
  856. }
  857. text = str2 + "_" + str + "a";
  858. if (AddFolderOrArchive(text))
  859. {
  860. for (int j = 2; j <= check_ver_no; j++)
  861. {
  862. AddFolderOrArchive(text + "_" + j);
  863. }
  864. }
  865. text = str2 + "_" + str + "b";
  866. if (AddFolderOrArchive(text))
  867. {
  868. for (int k = 2; k <= check_ver_no; k++)
  869. {
  870. AddFolderOrArchive(text + "_" + k);
  871. }
  872. }
  873. }
  874. AddFolderOrArchive("voice2");
  875. AddFolderOrArchive("voice3");
  876. fileSystem.AddAutoPathForAllFolder();
  877. string[] list = fileSystem.GetList("bg", AFileSystemBase.ListType.AllFile);
  878. if (list != null && 0 < list.Length)
  879. {
  880. foreach (string path in list)
  881. {
  882. string fileName = Path.GetFileName(path);
  883. if (!(Path.GetExtension(fileName) != ".asset_bg") && !GameUty.BgFiles.ContainsKey(fileName))
  884. {
  885. GameUty.BgFiles.Add(fileName, fileSystem);
  886. }
  887. }
  888. }
  889. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  890. }
  891. public static AFileBase FileOpen(string fileName, AFileSystemBase priorityFileSystem = null)
  892. {
  893. if (priorityFileSystem == null)
  894. {
  895. priorityFileSystem = GameUty.m_FileSystem;
  896. }
  897. AFileSystemBase[] array;
  898. if (GameUty.ModPriorityToModFolder)
  899. {
  900. array = new AFileSystemBase[]
  901. {
  902. GameUty.m_ModFileSystem,
  903. priorityFileSystem
  904. };
  905. }
  906. else
  907. {
  908. array = new AFileSystemBase[]
  909. {
  910. priorityFileSystem,
  911. GameUty.m_ModFileSystem
  912. };
  913. }
  914. AFileBase result = null;
  915. foreach (AFileSystemBase afileSystemBase in array)
  916. {
  917. if (afileSystemBase != null && afileSystemBase.IsExistentFile(fileName))
  918. {
  919. result = afileSystemBase.FileOpen(fileName);
  920. break;
  921. }
  922. }
  923. return result;
  924. }
  925. public static bool IsExistFile(string fileName, AFileSystemBase priorityFileSystem = null)
  926. {
  927. if (priorityFileSystem == null)
  928. {
  929. priorityFileSystem = GameUty.m_FileSystem;
  930. }
  931. AFileSystemBase[] array;
  932. if (GameUty.ModPriorityToModFolder)
  933. {
  934. array = new AFileSystemBase[]
  935. {
  936. GameUty.m_ModFileSystem,
  937. priorityFileSystem
  938. };
  939. }
  940. else
  941. {
  942. array = new AFileSystemBase[]
  943. {
  944. priorityFileSystem,
  945. GameUty.m_ModFileSystem
  946. };
  947. }
  948. foreach (AFileSystemBase afileSystemBase in array)
  949. {
  950. if (afileSystemBase != null && afileSystemBase.IsExistentFile(fileName))
  951. {
  952. return true;
  953. }
  954. }
  955. return false;
  956. }
  957. public static string GetBuildVersionText()
  958. {
  959. int num = 1230;
  960. return (num >= 1000) ? ((float)num / 1000f).ToString("F2") : ((float)num / 100f).ToString("F2");
  961. }
  962. public static string GetGameVersionText()
  963. {
  964. string text = "COM3D2x64.exe";
  965. int num = 1230;
  966. string path = Path.GetFullPath(".\\") + "update.lst";
  967. string[] array = new string[0];
  968. if (File.Exists(path))
  969. {
  970. try
  971. {
  972. array = File.ReadAllLines(path, Encoding.GetEncoding("utf-8"));
  973. }
  974. catch (Exception ex)
  975. {
  976. Debug.LogError(ex.Message);
  977. array = new string[0];
  978. }
  979. }
  980. foreach (string text2 in array)
  981. {
  982. if (!string.IsNullOrEmpty(text2))
  983. {
  984. string[] array3 = text2.Split(new char[]
  985. {
  986. ','
  987. });
  988. if (array3 != null && array3.Length == 2 && array3[0].Trim().ToLower() == text.ToLower())
  989. {
  990. int.TryParse(array3[1].Trim(), out num);
  991. break;
  992. }
  993. }
  994. }
  995. string text3 = (num >= 1000) ? ((float)num / 1000f).ToString("F3") : ((float)num / 100f).ToString("F3");
  996. if (text3.Length == 5)
  997. {
  998. text3 = text3.Insert(4, ".");
  999. }
  1000. return text3;
  1001. }
  1002. public static string GetLegacyGameVersionText()
  1003. {
  1004. if (!GameUty.IsEnabledCompatibilityMode)
  1005. {
  1006. return "0.0";
  1007. }
  1008. string text = "CM3D2x64.exe";
  1009. string path = GameMain.Instance.CMSystem.CM3D2Path + "\\update.lst";
  1010. string[] array = new string[0];
  1011. if (File.Exists(path))
  1012. {
  1013. try
  1014. {
  1015. array = File.ReadAllLines(path, Encoding.GetEncoding("utf-8"));
  1016. }
  1017. catch (Exception ex)
  1018. {
  1019. Debug.LogError(ex.Message);
  1020. array = new string[0];
  1021. }
  1022. }
  1023. int num = 0;
  1024. foreach (string text2 in array)
  1025. {
  1026. if (!string.IsNullOrEmpty(text2))
  1027. {
  1028. string[] array3 = text2.Split(new char[]
  1029. {
  1030. ','
  1031. });
  1032. if (array3 != null && array3.Length == 2 && array3 != null && array3.Length == 2 && array3[0].Trim().ToLower() == text.ToLower())
  1033. {
  1034. int.TryParse(array3[1].Trim(), out num);
  1035. break;
  1036. }
  1037. }
  1038. }
  1039. string text3 = (num >= 1000) ? ((float)num / 1000f).ToString("F3") : ((float)num / 100f).ToString("F3");
  1040. if (text3.Length == 5)
  1041. {
  1042. text3 = text3.Insert(4, ".");
  1043. }
  1044. return text3;
  1045. }
  1046. private static FileSystemArchive m_FileSystem = null;
  1047. private static FileSystemArchive m_FileSystemOld = null;
  1048. private static FileSystemWindows m_ModFileSystem = null;
  1049. public static List<string> PathList = new List<string>();
  1050. public static List<string> ExistCsvPathList = new List<string>();
  1051. public static List<string> PathListOld = new List<string>();
  1052. public static List<string> ExistCsvPathListOld = new List<string>();
  1053. private static string[] m_aryMenuFiles = null;
  1054. private static string[] m_aryModOnlysMenuFiles = new string[0];
  1055. private static Dictionary<int, string> rid_menu_dic_ = new Dictionary<int, string>();
  1056. private static Dictionary<string, AssetBundle> asset_bundle_dic = new Dictionary<string, AssetBundle>();
  1057. private static string ModPriorityToModFolderInfo = "以下のフラグをtrueにするとMODフォルダのファイルが優先されるが、モザイクも安易に外すことが可能になる為に現在はオミット。";
  1058. public static bool ModPriorityToModFolder = false;
  1059. private static string[] m_strSystemMaterialName = new string[]
  1060. {
  1061. "System/Material/2dAlpha",
  1062. "System/Material/2dMultiply",
  1063. "System/Material/InfinityColor",
  1064. "System/Material/TexTo8bitTex"
  1065. };
  1066. private static Material[] m_matSystem = new Material[4];
  1067. public enum SystemMaterial
  1068. {
  1069. Alpha,
  1070. Multiply,
  1071. InfinityColor,
  1072. TexTo8bitTex,
  1073. Max
  1074. }
  1075. }