GameUty.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using I2.Loc;
  7. using UnityEngine;
  8. using wf;
  9. public class GameUty
  10. {
  11. public static AFileSystemBase FileSystem
  12. {
  13. get
  14. {
  15. return GameUty.m_FileSystem;
  16. }
  17. }
  18. public static AFileSystemBase FileSystemOld
  19. {
  20. get
  21. {
  22. return GameUty.m_FileSystemOld;
  23. }
  24. }
  25. public static AFileSystemBase FileSystemMod
  26. {
  27. get
  28. {
  29. return GameUty.m_ModFileSystem;
  30. }
  31. }
  32. public static bool IsEnabledCompatibilityMode
  33. {
  34. get
  35. {
  36. return 0 < GameUty.PathListOld.Count && Product.type == Product.Type.JpAdult;
  37. }
  38. }
  39. public static HashSet<string> loadArchiveList { get; private set; }
  40. public static string[] MenuFiles
  41. {
  42. get
  43. {
  44. return GameUty.m_aryMenuFiles;
  45. }
  46. }
  47. public static string[] ModOnlysMenuFiles
  48. {
  49. get
  50. {
  51. return GameUty.m_aryModOnlysMenuFiles;
  52. }
  53. }
  54. public static Dictionary<int, string> RidMenuDic
  55. {
  56. get
  57. {
  58. return GameUty.rid_menu_dic_;
  59. }
  60. }
  61. public static Dictionary<string, AFileSystemBase> BgFiles { get; private set; }
  62. public static float MillisecondToSecond(int millisecond)
  63. {
  64. return (float)millisecond / 1000f;
  65. }
  66. public static Material GetSystemMaterial(GameUty.SystemMaterial f_mat)
  67. {
  68. Material material = GameUty.m_matSystem[(int)f_mat];
  69. if (material == null)
  70. {
  71. UnityEngine.Object original = Resources.Load(GameUty.m_strSystemMaterialName[(int)f_mat]);
  72. material = (UnityEngine.Object.Instantiate(original) as Material);
  73. GameUty.m_matSystem[(int)f_mat] = material;
  74. }
  75. return material;
  76. }
  77. public static GameObject LoadAssetBundle(string file_name)
  78. {
  79. if (GameUty.FileSystem == null || !GameUty.FileSystem.IsExistentFile(file_name))
  80. {
  81. return null;
  82. }
  83. UnityEngine.Object original = null;
  84. if (!GameUty.asset_bundle_dic.ContainsKey(file_name))
  85. {
  86. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(file_name))
  87. {
  88. AssetBundle assetBundle = AssetBundle.LoadFromMemory(afileBase.ReadAll());
  89. if (assetBundle.mainAsset != null)
  90. {
  91. original = assetBundle.mainAsset;
  92. }
  93. else
  94. {
  95. original = assetBundle.LoadAllAssets<GameObject>()[0];
  96. }
  97. GameUty.asset_bundle_dic.Add(file_name, assetBundle);
  98. }
  99. }
  100. else
  101. {
  102. original = GameUty.asset_bundle_dic[file_name].mainAsset;
  103. }
  104. GameObject gameObject = UnityEngine.Object.Instantiate(original) as GameObject;
  105. gameObject.name = gameObject.name.Replace("(Clone)", string.Empty);
  106. return gameObject;
  107. }
  108. public static void DeviceInitialize()
  109. {
  110. }
  111. public static void Init()
  112. {
  113. GameUty.m_FileSystem = new FileSystemArchive();
  114. GameUty.m_FileSystemOld = new FileSystemArchive();
  115. GameUty.loadArchiveList = new HashSet<string>();
  116. GameUty.PathListOld = new List<string>();
  117. if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path))
  118. {
  119. GameUty.PathListOld = GameUty.ReadAutoPathFile("[2.0]", GameMain.Instance.CMSystem.CM3D2Path + "\\GameData\\paths.dat");
  120. if (GameUty.PathListOld == null)
  121. {
  122. GameUty.PathListOld = new List<string>();
  123. }
  124. }
  125. GameUty.UpdateFileSystemPath();
  126. GameUty.UpdateFileSystemPathOld();
  127. PluginData.CreateData(GameUty.m_FileSystem, (!GameUty.IsEnabledCompatibilityMode) ? null : GameUty.m_FileSystemOld);
  128. Debug.Log("■■■■■■■■ Plugin Check ■■■■■■■■");
  129. foreach (string text in PluginData.GetAllUniqueNames())
  130. {
  131. Debug.Log(string.Concat(new string[]
  132. {
  133. "[",
  134. PluginData.uniqueNameToId(text).ToString(),
  135. "]",
  136. text,
  137. " : ",
  138. (!PluginData.IsEnabled(text)) ? "×" : "○"
  139. }));
  140. }
  141. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  142. string windowTitel = Product.windowTitel;
  143. if (!string.IsNullOrEmpty(windowTitel))
  144. {
  145. DllBase.Win32.SetWindowText(DllBase.Win32.GetActiveWindow(), windowTitel);
  146. }
  147. }
  148. public static void Finish()
  149. {
  150. foreach (KeyValuePair<string, AssetBundle> keyValuePair in GameUty.asset_bundle_dic)
  151. {
  152. keyValuePair.Value.Unload(true);
  153. }
  154. GameUty.asset_bundle_dic.Clear();
  155. GameUty.m_FileSystem.Dispose();
  156. GameUty.m_FileSystem = null;
  157. if (GameUty.m_FileSystemOld != null)
  158. {
  159. GameUty.m_FileSystemOld.Dispose();
  160. GameUty.m_FileSystemOld = null;
  161. }
  162. if (GameUty.m_ModFileSystem != null)
  163. {
  164. GameUty.m_ModFileSystem.Dispose();
  165. GameUty.m_ModFileSystem = null;
  166. }
  167. }
  168. public static Dictionary<string, HashSet<string>> GetGameDataResourceList(string gameDataPath)
  169. {
  170. string[] array = new string[]
  171. {
  172. "script_cbl",
  173. "motion_cbl",
  174. "voice_cbl"
  175. };
  176. int length = (gameDataPath + "\\").Length;
  177. string[] directories = Directory.GetDirectories(gameDataPath);
  178. Dictionary<string, HashSet<string>> dictionary = new Dictionary<string, HashSet<string>>();
  179. for (int i = 0; i < directories.Length; i++)
  180. {
  181. string text = directories[i].Substring(length, directories[i].Length - length).ToLower();
  182. int startIndex = 0;
  183. foreach (string text2 in array)
  184. {
  185. if (text.IndexOf(text2) == 0)
  186. {
  187. startIndex = text2.Length;
  188. break;
  189. }
  190. }
  191. int num = text.IndexOf('_', startIndex);
  192. if (0 <= num)
  193. {
  194. string text3 = text.Substring(0, num);
  195. if (!string.IsNullOrEmpty(text3))
  196. {
  197. string text4 = text.Substring(text3.Length + 1, text.Length - (text3.Length + 1));
  198. if (!string.IsNullOrEmpty(text4))
  199. {
  200. if (!dictionary.ContainsKey(text3))
  201. {
  202. dictionary.Add(text3, new HashSet<string>());
  203. }
  204. if (!dictionary[text3].Contains(text4))
  205. {
  206. dictionary[text3].Add(text4);
  207. }
  208. else
  209. {
  210. Debug.LogWarning(text3 + "_" + text4 + "は既にリストに存在します");
  211. }
  212. }
  213. }
  214. }
  215. else if (!dictionary.ContainsKey(text))
  216. {
  217. dictionary.Add(text, new HashSet<string>());
  218. }
  219. else
  220. {
  221. Debug.LogWarning(text + "は既にリストに存在します");
  222. }
  223. }
  224. return dictionary;
  225. }
  226. public static List<string> ReadAutoPathFile(string uniqueName, string filePath)
  227. {
  228. if (!File.Exists(filePath))
  229. {
  230. return null;
  231. }
  232. List<string> list = new List<string>();
  233. using (FileStream fileStream = new FileStream(filePath, FileMode.Open))
  234. {
  235. using (BinaryReader binaryReader = new BinaryReader(fileStream))
  236. {
  237. string a = binaryReader.ReadString();
  238. NDebug.Assert(a == "CM3D2_PATHS", "パスファイルのヘッダーが不正です。");
  239. int num = binaryReader.ReadInt32();
  240. int num2 = binaryReader.ReadInt32();
  241. for (int i = 0; i < num2; i++)
  242. {
  243. string item = binaryReader.ReadString();
  244. list.Add(item);
  245. }
  246. }
  247. }
  248. return list;
  249. }
  250. public static void UpdateFileSystemPath()
  251. {
  252. string text = UTY.gameProjectPath + "\\";
  253. string gameDataPath = "GameData";
  254. int check_ver_no = 3;
  255. Func<string, bool> AddFolderOrArchive = delegate(string name)
  256. {
  257. bool flag4 = GameUty.m_FileSystem.AddArchive(gameDataPath + "\\" + name + ".arc");
  258. if (flag4)
  259. {
  260. Debug.Log(string.Concat(new string[]
  261. {
  262. "[",
  263. gameDataPath,
  264. "\\",
  265. name,
  266. ".arc]を読み込みました"
  267. }));
  268. }
  269. if (flag4)
  270. {
  271. GameUty.loadArchiveList.Add(name.ToLower());
  272. }
  273. return flag4;
  274. };
  275. HashSet<string> addedLegacyArchives = new HashSet<string>();
  276. Action<string> action = delegate(string name)
  277. {
  278. foreach (string text32 in GameUty.PathList)
  279. {
  280. string text33 = name + "_" + text32;
  281. bool flag4 = AddFolderOrArchive(text33);
  282. if (flag4 && !addedLegacyArchives.Contains(text33))
  283. {
  284. addedLegacyArchives.Add(text33);
  285. }
  286. if (flag4)
  287. {
  288. if (name == "csv")
  289. {
  290. GameUty.ExistCsvPathList.Add(text32);
  291. }
  292. for (int num15 = 2; num15 <= check_ver_no; num15++)
  293. {
  294. AddFolderOrArchive(text33 + "_" + num15);
  295. }
  296. }
  297. }
  298. };
  299. Action<string> action2 = delegate(string name)
  300. {
  301. foreach (string text32 in GameUty.PathList)
  302. {
  303. string text33 = name + "_" + text32;
  304. bool flag4 = AddFolderOrArchive(text33);
  305. if (!flag4 && addedLegacyArchives.Contains(text33))
  306. {
  307. flag4 = true;
  308. }
  309. if (flag4)
  310. {
  311. if (name == "csv")
  312. {
  313. GameUty.ExistCsvPathList.Add(text32);
  314. }
  315. for (int num15 = 2; num15 <= check_ver_no; num15++)
  316. {
  317. AddFolderOrArchive(string.Concat(new object[]
  318. {
  319. name,
  320. "_",
  321. text32,
  322. "_",
  323. num15
  324. }));
  325. }
  326. }
  327. }
  328. };
  329. Action<string> action3 = delegate(string name)
  330. {
  331. foreach (string text32 in GameUty.PathList)
  332. {
  333. if (AddFolderOrArchive(name + "_" + text32))
  334. {
  335. if (name == "csv")
  336. {
  337. GameUty.ExistCsvPathList.Add(text32);
  338. }
  339. for (int num15 = 2; num15 <= check_ver_no; num15++)
  340. {
  341. AddFolderOrArchive(string.Concat(new object[]
  342. {
  343. name,
  344. "_",
  345. text32,
  346. "_",
  347. num15
  348. }));
  349. }
  350. }
  351. }
  352. };
  353. string str = string.Empty;
  354. str = "必用アーカイブがありません。GameData\\";
  355. GameUty.m_FileSystem.SetBaseDirectory(text);
  356. AddFolderOrArchive("product");
  357. Product.Initialize(GameUty.m_FileSystem);
  358. Debug.Log("IsEnabledCompatibilityMode:" + GameUty.IsEnabledCompatibilityMode.ToString());
  359. string gameTitle = Product.gameTitle;
  360. string str2 = "カスタムメイド3D 2";
  361. Debug.Log(string.Concat(new string[]
  362. {
  363. gameTitle,
  364. " GameVersion ",
  365. GameUty.GetGameVersionText(),
  366. "(BuildVersion : ",
  367. GameUty.GetBuildVersionText(),
  368. ")"
  369. }));
  370. if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path))
  371. {
  372. Debug.Log(str2 + " GameVersion " + GameUty.GetLegacyGameVersionText());
  373. }
  374. if (Product.type != Product.Type.JpAdult)
  375. {
  376. GameUty.UpdateFileSystemPathToNewProduct();
  377. }
  378. else
  379. {
  380. StopWatch stopWatch = new StopWatch();
  381. if (GameUty.IsEnabledCompatibilityMode)
  382. {
  383. Debug.Log("■■■■■■■■ Archive Log[2.0] (CM3D2 GameData) ■■■■■■■■");
  384. GameUty.m_FileSystem.SetBaseDirectory(GameMain.Instance.CMSystem.CM3D2Path);
  385. GameUty.PathList = GameUty.PathListOld;
  386. AddFolderOrArchive("material");
  387. foreach (string text2 in GameUty.PathListOld)
  388. {
  389. string str3 = "material";
  390. if (text2 == "denkigai2015wTowelR")
  391. {
  392. AddFolderOrArchive(str3 + "_denkigai2015wTowel");
  393. }
  394. string text3 = str3 + "_" + text2;
  395. bool flag = AddFolderOrArchive(text3);
  396. if (flag && !addedLegacyArchives.Contains(text3))
  397. {
  398. addedLegacyArchives.Add(text3);
  399. }
  400. if (flag)
  401. {
  402. for (int i2 = 2; i2 <= check_ver_no; i2++)
  403. {
  404. AddFolderOrArchive(text3 + "_" + i2);
  405. }
  406. }
  407. }
  408. AddFolderOrArchive("material2");
  409. AddFolderOrArchive("menu");
  410. action("menu");
  411. AddFolderOrArchive("menu2");
  412. AddFolderOrArchive("model");
  413. action("model");
  414. AddFolderOrArchive("model2");
  415. AddFolderOrArchive("texture");
  416. action("texture");
  417. AddFolderOrArchive("texture2");
  418. AddFolderOrArchive("texture3");
  419. AddFolderOrArchive("prioritymaterial");
  420. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  421. }
  422. Debug.Log("■■■■■■■■ Archive Log[2.1 Compatibility] (GameData_20) ■■■■■■■■");
  423. gameDataPath = "GameData_20";
  424. GameUty.m_FileSystem.SetBaseDirectory(text);
  425. if (GameUty.IsEnabledCompatibilityMode)
  426. {
  427. GameUty.m_FileSystem.AddPatchDecryptPreferredSearchDirectory(GameMain.Instance.CMSystem.CM3D2Path + "\\GameData");
  428. }
  429. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1Compatibility]", text + gameDataPath + "\\paths.dat");
  430. if (GameUty.PathList != null && 0 < GameUty.PathList.Count)
  431. {
  432. foreach (string text4 in GameUty.PathList)
  433. {
  434. string text5 = "material";
  435. if (text4 == "denkigai2015wTowelR")
  436. {
  437. AddFolderOrArchive(text5 + "_denkigai2015wTowel");
  438. }
  439. string text6 = text5 + "_" + text4;
  440. bool flag2 = AddFolderOrArchive(text6);
  441. if (!flag2 && addedLegacyArchives.Contains(text6))
  442. {
  443. flag2 = true;
  444. }
  445. if (flag2)
  446. {
  447. for (int j = 2; j <= check_ver_no; j++)
  448. {
  449. AddFolderOrArchive(string.Concat(new object[]
  450. {
  451. text5,
  452. "_",
  453. text4,
  454. "_",
  455. j
  456. }));
  457. }
  458. }
  459. }
  460. action2("menu");
  461. action2("model");
  462. action2("texture");
  463. AddFolderOrArchive("prioritymaterial");
  464. List<string> pathList = GameUty.PathList;
  465. GameUty.PathList = new List<string>();
  466. GameUty.PathList.Add("vp001");
  467. action2("bg");
  468. action2("motion");
  469. GameUty.PathList = pathList;
  470. }
  471. GameUty.m_FileSystem.ClearPatchDecryptPreferredSearchDirectory();
  472. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  473. Debug.Log("■■■■■■■■ Archive Log[2.1] (GameData) ■■■■■■■■");
  474. gameDataPath = "GameData";
  475. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1]", text + gameDataPath + "\\paths.dat");
  476. if (GameUty.PathList == null)
  477. {
  478. GameUty.PathList = new List<string>();
  479. NDebug.Assert("paths.datを読み込めませんでした", false);
  480. }
  481. GameUty.PathList.Add("jp");
  482. AddFolderOrArchive("csv");
  483. foreach (string text7 in GameUty.PathList)
  484. {
  485. string text8 = "csv";
  486. if (AddFolderOrArchive(text8 + "_" + text7))
  487. {
  488. for (int k = 2; k <= check_ver_no; k++)
  489. {
  490. AddFolderOrArchive(string.Concat(new object[]
  491. {
  492. text8,
  493. "_",
  494. text7,
  495. "_",
  496. k
  497. }));
  498. }
  499. }
  500. }
  501. AddFolderOrArchive("prioritymaterial");
  502. NDebug.Assert(AddFolderOrArchive("motion"), str + "motion");
  503. foreach (string text9 in GameUty.PathList)
  504. {
  505. string text10 = "motion";
  506. if (AddFolderOrArchive(text10 + "_" + text9))
  507. {
  508. for (int l = 2; l <= check_ver_no; l++)
  509. {
  510. AddFolderOrArchive(string.Concat(new object[]
  511. {
  512. text10,
  513. "_",
  514. text9,
  515. "_",
  516. l
  517. }));
  518. }
  519. }
  520. }
  521. AddFolderOrArchive("motion2");
  522. NDebug.Assert(AddFolderOrArchive("script"), str + "script");
  523. foreach (string text11 in GameUty.PathList)
  524. {
  525. string text12 = "script";
  526. if (AddFolderOrArchive(text12 + "_" + text11))
  527. {
  528. for (int m = 2; m <= check_ver_no; m++)
  529. {
  530. AddFolderOrArchive(string.Concat(new object[]
  531. {
  532. text12,
  533. "_",
  534. text11,
  535. "_",
  536. m
  537. }));
  538. }
  539. }
  540. }
  541. AddFolderOrArchive("script_share");
  542. foreach (string text13 in GameUty.PathList)
  543. {
  544. string text14 = "script_share";
  545. if (AddFolderOrArchive(text14 + "_" + text13))
  546. {
  547. for (int n = 2; n <= check_ver_no; n++)
  548. {
  549. AddFolderOrArchive(string.Concat(new object[]
  550. {
  551. text14,
  552. "_",
  553. text13,
  554. "_",
  555. n
  556. }));
  557. }
  558. }
  559. }
  560. AddFolderOrArchive("script_share2");
  561. NDebug.Assert(AddFolderOrArchive("sound"), str + "sound");
  562. foreach (string text15 in GameUty.PathList)
  563. {
  564. string text16 = "sound";
  565. if (AddFolderOrArchive(text16 + "_" + text15))
  566. {
  567. for (int num = 2; num <= check_ver_no; num++)
  568. {
  569. AddFolderOrArchive(string.Concat(new object[]
  570. {
  571. text16,
  572. "_",
  573. text15,
  574. "_",
  575. num
  576. }));
  577. }
  578. }
  579. }
  580. AddFolderOrArchive("sound2");
  581. NDebug.Assert(AddFolderOrArchive("system"), str + "system");
  582. foreach (string text17 in GameUty.PathList)
  583. {
  584. string text18 = "system";
  585. if (AddFolderOrArchive(text18 + "_" + text17))
  586. {
  587. for (int num2 = 2; num2 <= check_ver_no; num2++)
  588. {
  589. AddFolderOrArchive(string.Concat(new object[]
  590. {
  591. text18,
  592. "_",
  593. text17,
  594. "_",
  595. num2
  596. }));
  597. }
  598. }
  599. }
  600. AddFolderOrArchive("system2");
  601. AddFolderOrArchive("language");
  602. foreach (string text19 in GameUty.PathList)
  603. {
  604. string text20 = "language";
  605. if (AddFolderOrArchive(text20 + "_" + text19))
  606. {
  607. for (int num3 = 2; num3 <= check_ver_no; num3++)
  608. {
  609. AddFolderOrArchive(string.Concat(new object[]
  610. {
  611. text20,
  612. "_",
  613. text19,
  614. "_",
  615. num3
  616. }));
  617. }
  618. }
  619. }
  620. foreach (string text21 in GameUty.PathList)
  621. {
  622. string text22 = "bg";
  623. if (AddFolderOrArchive(text22 + "_" + text21))
  624. {
  625. for (int num4 = 2; num4 <= check_ver_no; num4++)
  626. {
  627. AddFolderOrArchive(string.Concat(new object[]
  628. {
  629. text22,
  630. "_",
  631. text21,
  632. "_",
  633. num4
  634. }));
  635. }
  636. }
  637. }
  638. if (Product.isEnglish && !Product.isPublic)
  639. {
  640. string text23 = "bg-en";
  641. NDebug.Assert(AddFolderOrArchive(text23), str + text23);
  642. foreach (string text24 in GameUty.PathList)
  643. {
  644. if (AddFolderOrArchive(text23 + "_" + text24))
  645. {
  646. for (int num5 = 2; num5 <= check_ver_no; num5++)
  647. {
  648. AddFolderOrArchive(string.Concat(new object[]
  649. {
  650. text23,
  651. "_",
  652. text24,
  653. "_",
  654. num5
  655. }));
  656. }
  657. }
  658. }
  659. AddFolderOrArchive("bg-en2");
  660. }
  661. AddFolderOrArchive("voice");
  662. for (int num6 = 0; num6 < 25; num6++)
  663. {
  664. string arg = "voice";
  665. string arg2 = arg + "_" + (char)(97 + num6);
  666. AddFolderOrArchive(arg2);
  667. }
  668. foreach (string text25 in GameUty.PathList)
  669. {
  670. string text26 = "voice";
  671. if (AddFolderOrArchive(text26 + "_" + text25))
  672. {
  673. for (int num7 = 2; num7 <= check_ver_no; num7++)
  674. {
  675. AddFolderOrArchive(string.Concat(new object[]
  676. {
  677. text26,
  678. "_",
  679. text25,
  680. "_",
  681. num7
  682. }));
  683. }
  684. }
  685. }
  686. for (int num8 = 2; num8 <= check_ver_no; num8++)
  687. {
  688. string arg3 = "voice";
  689. AddFolderOrArchive(arg3 + num8);
  690. }
  691. string text27 = "parts";
  692. NDebug.Assert(AddFolderOrArchive(text27), str + text27);
  693. foreach (string text28 in GameUty.PathList)
  694. {
  695. if (Product.isJapan && !Product.isPublic)
  696. {
  697. string text29 = "parts_cw005cloth4.arc";
  698. string path = "parts_cw005cloth4_2.arc";
  699. if (string.Equals(text27 + "_" + text28, Path.GetFileNameWithoutExtension(text29), StringComparison.OrdinalIgnoreCase))
  700. {
  701. string text30 = Path.Combine(UTY.gameDataPath, text29);
  702. if (File.Exists(text30) && File.Exists(Path.Combine(UTY.gameDataPath, path)))
  703. {
  704. byte[] bytes = Resources.Load<TextAsset>(Path.Combine("System", text29)).bytes;
  705. if (new FileInfo(text30).Length > (long)bytes.Length)
  706. {
  707. FileSystemArchive fileSystemArchive = new FileSystemArchive();
  708. fileSystemArchive.SetBaseDirectory(text);
  709. fileSystemArchive.AddArchive(Path.Combine(gameDataPath, text29));
  710. fileSystemArchive.AddArchive(Path.Combine(gameDataPath, path));
  711. fileSystemArchive.Dispose();
  712. bool flag3 = true;
  713. using (FileStream fileStream = File.OpenRead(Path.Combine(UTY.gameDataPath, path)))
  714. {
  715. using (BinaryReader binaryReader = new BinaryReader(fileStream))
  716. {
  717. foreach (int num10 in new int[]
  718. {
  719. 119,
  720. 97,
  721. 114,
  722. 99
  723. })
  724. {
  725. byte b = binaryReader.ReadByte();
  726. if ((int)b != num10)
  727. {
  728. flag3 = false;
  729. break;
  730. }
  731. }
  732. }
  733. }
  734. if (flag3)
  735. {
  736. File.Delete(text30);
  737. File.WriteAllBytes(text30, bytes);
  738. }
  739. }
  740. }
  741. }
  742. }
  743. if (AddFolderOrArchive(text27 + "_" + text28))
  744. {
  745. for (int num11 = 2; num11 <= check_ver_no; num11++)
  746. {
  747. AddFolderOrArchive(string.Concat(new object[]
  748. {
  749. text27,
  750. "_",
  751. text28,
  752. "_",
  753. num11
  754. }));
  755. }
  756. }
  757. }
  758. AddFolderOrArchive("parts2");
  759. Debug.Log("■■■■■■■■■■■■■■■■■■■■" + stopWatch.Stop().ToString() + " ms");
  760. }
  761. GameUty.m_FileSystem.AddAutoPathForAllFolder(true);
  762. while (!GameUty.m_FileSystem.IsFinishedAddAutoPathJob(true))
  763. {
  764. }
  765. GameUty.m_FileSystem.ReleaseAddAutoPathJob();
  766. if (Product.isPublic && !GameUty.m_FileSystem.IsExistentFile("21C399027026.dat"))
  767. {
  768. NDebug.MessageBox("Error", Product.type.ToString() + " : 21C399027026.dat");
  769. Application.Quit();
  770. return;
  771. }
  772. GameUty.BgFiles = new Dictionary<string, AFileSystemBase>();
  773. string[] list = GameUty.m_FileSystem.GetList("bg", AFileSystemBase.ListType.AllFile);
  774. if (list != null && 0 < list.Length)
  775. {
  776. foreach (string path2 in list)
  777. {
  778. string fileName = Path.GetFileName(path2);
  779. if (!(Path.GetExtension(fileName) != ".asset_bg") && !GameUty.BgFiles.ContainsKey(fileName))
  780. {
  781. GameUty.BgFiles.Add(fileName, GameUty.m_FileSystem);
  782. }
  783. }
  784. }
  785. if (Product.supportMultiLanguage)
  786. {
  787. list = GameUty.m_FileSystem.GetList("language", AFileSystemBase.ListType.AllFile);
  788. if (list != null && 0 < list.Length)
  789. {
  790. foreach (string path3 in list)
  791. {
  792. string fileName2 = Path.GetFileName(path3);
  793. if (!(Path.GetExtension(fileName2) != ".asset_language"))
  794. {
  795. using (AFileBase afileBase = GameUty.m_FileSystem.FileOpen(fileName2))
  796. {
  797. AssetBundle assetBundle = AssetBundle.LoadFromMemory(afileBase.ReadAll());
  798. LanguageSource languageSource = UnityEngine.Object.Instantiate<LanguageSource>(assetBundle.LoadAllAssets<GameObject>()[0].GetComponent<LanguageSource>());
  799. if (GameMain.Instance.transform.Find("Language") == null)
  800. {
  801. new GameObject("Language").transform.SetParent(GameMain.Instance.transform);
  802. }
  803. languageSource.transform.SetParent(GameMain.Instance.transform.Find("Language"));
  804. assetBundle.Unload(true);
  805. }
  806. }
  807. }
  808. }
  809. foreach (LanguageSource languageSource2 in LocalizationManager.Sources)
  810. {
  811. languageSource2.LoadAllLanguages(false);
  812. }
  813. }
  814. if (Directory.Exists(text + "Mod"))
  815. {
  816. GameUty.m_ModFileSystem = new FileSystemWindows();
  817. GameUty.m_ModFileSystem.SetBaseDirectory(text);
  818. GameUty.m_ModFileSystem.AddFolder("Mod");
  819. string[] list2 = GameUty.m_ModFileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFolder);
  820. foreach (string text31 in list2)
  821. {
  822. if (!GameUty.m_ModFileSystem.AddAutoPath(text31))
  823. {
  824. Debug.Log("m_ModFileSystemのAddAutoPathには既に " + text31 + " がありました。");
  825. }
  826. }
  827. }
  828. if (GameUty.m_ModFileSystem != null)
  829. {
  830. string[] list3 = GameUty.m_ModFileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFile);
  831. GameUty.m_aryModOnlysMenuFiles = Array.FindAll<string>(list3, (string i) => new Regex(".*\\.menu$").IsMatch(i));
  832. }
  833. if (GameUty.m_aryModOnlysMenuFiles != null && GameUty.m_aryModOnlysMenuFiles.Length != 0)
  834. {
  835. GameUty.ModPriorityToModFolderInfo = string.Empty;
  836. Debug.Log(GameUty.ModPriorityToModFolderInfo + "■MOD有り。MODフォルダ優先モード" + GameUty.ModPriorityToModFolder.ToString());
  837. }
  838. }
  839. public static void UpdateFileSystemPathToNewProduct()
  840. {
  841. string text = UTY.gameProjectPath + "\\";
  842. string gameDataPath = "GameData";
  843. string str = string.Empty;
  844. str = "必用アーカイブがありません。GameData" + Product.gameDataPath + "\\";
  845. int check_ver_no = 3;
  846. Func<string, bool> AddFolderOrArchive = delegate(string name)
  847. {
  848. string gameDataPath = gameDataPath;
  849. bool flag2 = GameUty.m_FileSystem.AddArchive(gameDataPath + "\\" + name + ".arc");
  850. if (flag2)
  851. {
  852. Debug.Log(string.Concat(new string[]
  853. {
  854. "[",
  855. gameDataPath,
  856. "\\",
  857. name,
  858. ".arc]を読み込みました"
  859. }));
  860. }
  861. if (flag2)
  862. {
  863. GameUty.loadArchiveList.Add(name.ToLower());
  864. }
  865. return flag2;
  866. };
  867. Action<string> action = delegate(string name)
  868. {
  869. foreach (string text28 in GameUty.PathList)
  870. {
  871. string arg5 = name + "_" + text28;
  872. bool flag2 = AddFolderOrArchive(arg5);
  873. if (flag2)
  874. {
  875. if (name == "csv")
  876. {
  877. GameUty.ExistCsvPathList.Add(text28);
  878. }
  879. for (int num10 = 2; num10 <= check_ver_no; num10++)
  880. {
  881. AddFolderOrArchive(string.Concat(new object[]
  882. {
  883. name,
  884. "_",
  885. text28,
  886. "_",
  887. num10
  888. }));
  889. }
  890. }
  891. }
  892. };
  893. Action<string> action2 = delegate(string name)
  894. {
  895. foreach (string text28 in GameUty.PathList)
  896. {
  897. if (AddFolderOrArchive(name + "_" + text28))
  898. {
  899. if (name == "csv")
  900. {
  901. GameUty.ExistCsvPathList.Add(text28);
  902. }
  903. for (int num10 = 2; num10 <= check_ver_no; num10++)
  904. {
  905. AddFolderOrArchive(string.Concat(new object[]
  906. {
  907. name,
  908. "_",
  909. text28,
  910. "_",
  911. num10
  912. }));
  913. }
  914. }
  915. }
  916. };
  917. StopWatch stopWatch = new StopWatch();
  918. Debug.Log("■■■■■■■■ Archive Log[2.1 Compatibility] (GameData_20) ■■■■■■■■");
  919. gameDataPath = "GameData_20";
  920. GameUty.m_FileSystem.SetBaseDirectory(text);
  921. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1Compatibility]", text + gameDataPath + "\\paths.dat");
  922. if (GameUty.PathList != null && 0 < GameUty.PathList.Count)
  923. {
  924. foreach (string text2 in GameUty.PathList)
  925. {
  926. string text3 = "material";
  927. if (text2 == "denkigai2015wTowelR")
  928. {
  929. AddFolderOrArchive(text3 + "_denkigai2015wTowel");
  930. }
  931. string arg = text3 + "_" + text2;
  932. bool flag = AddFolderOrArchive(arg);
  933. if (flag)
  934. {
  935. for (int i = 2; i <= check_ver_no; i++)
  936. {
  937. AddFolderOrArchive(string.Concat(new object[]
  938. {
  939. text3,
  940. "_",
  941. text2,
  942. "_",
  943. i
  944. }));
  945. }
  946. }
  947. }
  948. action("menu");
  949. action("model");
  950. action("texture");
  951. AddFolderOrArchive("prioritymaterial");
  952. List<string> pathList = GameUty.PathList;
  953. GameUty.PathList = new List<string>();
  954. GameUty.PathList.Add("vp001");
  955. action("bg");
  956. action("motion");
  957. GameUty.PathList = pathList;
  958. }
  959. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  960. Debug.Log("■■■■■■■■ Archive Log[2.1] (GameData) ■■■■■■■■");
  961. gameDataPath = "GameData";
  962. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1]", text + gameDataPath + "\\paths.dat");
  963. if (GameUty.PathList == null)
  964. {
  965. GameUty.PathList = new List<string>();
  966. NDebug.Assert("paths.datを読み込めませんでした", false);
  967. }
  968. GameUty.PathList.Add(Product.gameDataPath.Replace("_", string.Empty));
  969. AddFolderOrArchive("csv");
  970. foreach (string text4 in GameUty.PathList)
  971. {
  972. string text5 = "csv";
  973. if (AddFolderOrArchive(text5 + "_" + text4))
  974. {
  975. for (int j = 2; j <= check_ver_no; j++)
  976. {
  977. AddFolderOrArchive(string.Concat(new object[]
  978. {
  979. text5,
  980. "_",
  981. text4,
  982. "_",
  983. j
  984. }));
  985. }
  986. }
  987. }
  988. AddFolderOrArchive("prioritymaterial");
  989. NDebug.Assert(AddFolderOrArchive("motion"), str + "motion");
  990. foreach (string text6 in GameUty.PathList)
  991. {
  992. string text7 = "motion";
  993. if (AddFolderOrArchive(text7 + "_" + text6))
  994. {
  995. for (int k = 2; k <= check_ver_no; k++)
  996. {
  997. AddFolderOrArchive(string.Concat(new object[]
  998. {
  999. text7,
  1000. "_",
  1001. text6,
  1002. "_",
  1003. k
  1004. }));
  1005. }
  1006. }
  1007. }
  1008. AddFolderOrArchive("motion2");
  1009. NDebug.Assert(AddFolderOrArchive("script"), str + "script");
  1010. foreach (string text8 in GameUty.PathList)
  1011. {
  1012. string text9 = "script";
  1013. if (AddFolderOrArchive(text9 + "_" + text8))
  1014. {
  1015. for (int l = 2; l <= check_ver_no; l++)
  1016. {
  1017. AddFolderOrArchive(string.Concat(new object[]
  1018. {
  1019. text9,
  1020. "_",
  1021. text8,
  1022. "_",
  1023. l
  1024. }));
  1025. }
  1026. }
  1027. }
  1028. AddFolderOrArchive("script_share");
  1029. foreach (string text10 in GameUty.PathList)
  1030. {
  1031. string text11 = "script_share";
  1032. if (AddFolderOrArchive(text11 + "_" + text10))
  1033. {
  1034. for (int m = 2; m <= check_ver_no; m++)
  1035. {
  1036. AddFolderOrArchive(string.Concat(new object[]
  1037. {
  1038. text11,
  1039. "_",
  1040. text10,
  1041. "_",
  1042. m
  1043. }));
  1044. }
  1045. }
  1046. }
  1047. AddFolderOrArchive("script_share2");
  1048. NDebug.Assert(AddFolderOrArchive("sound"), str + "sound");
  1049. foreach (string text12 in GameUty.PathList)
  1050. {
  1051. string text13 = "sound";
  1052. if (AddFolderOrArchive(text13 + "_" + text12))
  1053. {
  1054. for (int n = 2; n <= check_ver_no; n++)
  1055. {
  1056. AddFolderOrArchive(string.Concat(new object[]
  1057. {
  1058. text13,
  1059. "_",
  1060. text12,
  1061. "_",
  1062. n
  1063. }));
  1064. }
  1065. }
  1066. }
  1067. AddFolderOrArchive("sound2");
  1068. NDebug.Assert(AddFolderOrArchive("system"), str + "system");
  1069. foreach (string text14 in GameUty.PathList)
  1070. {
  1071. string text15 = "system";
  1072. if (AddFolderOrArchive(text15 + "_" + text14))
  1073. {
  1074. for (int num = 2; num <= check_ver_no; num++)
  1075. {
  1076. AddFolderOrArchive(string.Concat(new object[]
  1077. {
  1078. text15,
  1079. "_",
  1080. text14,
  1081. "_",
  1082. num
  1083. }));
  1084. }
  1085. }
  1086. }
  1087. AddFolderOrArchive("system2");
  1088. AddFolderOrArchive("language");
  1089. foreach (string text16 in GameUty.PathList)
  1090. {
  1091. string text17 = "language";
  1092. if (AddFolderOrArchive(text17 + "_" + text16))
  1093. {
  1094. for (int num2 = 2; num2 <= check_ver_no; num2++)
  1095. {
  1096. AddFolderOrArchive(string.Concat(new object[]
  1097. {
  1098. text17,
  1099. "_",
  1100. text16,
  1101. "_",
  1102. num2
  1103. }));
  1104. }
  1105. }
  1106. }
  1107. foreach (string text18 in GameUty.PathList)
  1108. {
  1109. string text19 = "bg";
  1110. if (AddFolderOrArchive(text19 + "_" + text18))
  1111. {
  1112. for (int num3 = 2; num3 <= check_ver_no; num3++)
  1113. {
  1114. AddFolderOrArchive(string.Concat(new object[]
  1115. {
  1116. text19,
  1117. "_",
  1118. text18,
  1119. "_",
  1120. num3
  1121. }));
  1122. }
  1123. }
  1124. }
  1125. if (Product.isEnglish && !Product.isPublic)
  1126. {
  1127. string text20 = "bg-en";
  1128. NDebug.Assert(AddFolderOrArchive(text20), str + text20);
  1129. foreach (string text21 in GameUty.PathList)
  1130. {
  1131. if (AddFolderOrArchive(text20 + "_" + text21))
  1132. {
  1133. for (int num4 = 2; num4 <= check_ver_no; num4++)
  1134. {
  1135. AddFolderOrArchive(string.Concat(new object[]
  1136. {
  1137. text20,
  1138. "_",
  1139. text21,
  1140. "_",
  1141. num4
  1142. }));
  1143. }
  1144. }
  1145. }
  1146. AddFolderOrArchive("bg-en2");
  1147. }
  1148. AddFolderOrArchive("voice");
  1149. for (int num5 = 0; num5 < 25; num5++)
  1150. {
  1151. string arg2 = "voice";
  1152. string arg3 = arg2 + "_" + (char)(97 + num5);
  1153. AddFolderOrArchive(arg3);
  1154. }
  1155. foreach (string text22 in GameUty.PathList)
  1156. {
  1157. string text23 = "voice";
  1158. if (AddFolderOrArchive(text23 + "_" + text22))
  1159. {
  1160. for (int num6 = 2; num6 <= check_ver_no; num6++)
  1161. {
  1162. AddFolderOrArchive(string.Concat(new object[]
  1163. {
  1164. text23,
  1165. "_",
  1166. text22,
  1167. "_",
  1168. num6
  1169. }));
  1170. }
  1171. }
  1172. }
  1173. for (int num7 = 2; num7 <= check_ver_no; num7++)
  1174. {
  1175. string arg4 = "voice";
  1176. AddFolderOrArchive(arg4 + num7);
  1177. }
  1178. string text24 = "parts";
  1179. NDebug.Assert(AddFolderOrArchive(text24), str + text24);
  1180. foreach (string text25 in GameUty.PathList)
  1181. {
  1182. if (AddFolderOrArchive(text24 + "_" + text25))
  1183. {
  1184. for (int num8 = 2; num8 <= check_ver_no; num8++)
  1185. {
  1186. AddFolderOrArchive(string.Concat(new object[]
  1187. {
  1188. text24,
  1189. "_",
  1190. text25,
  1191. "_",
  1192. num8
  1193. }));
  1194. }
  1195. }
  1196. }
  1197. AddFolderOrArchive("parts2");
  1198. if (Product.isEnglish && !Product.isPublic)
  1199. {
  1200. string text26 = "parts-en";
  1201. NDebug.Assert(AddFolderOrArchive(text26), str + text26);
  1202. foreach (string text27 in GameUty.PathList)
  1203. {
  1204. if (AddFolderOrArchive(text26 + "_" + text27))
  1205. {
  1206. for (int num9 = 2; num9 <= check_ver_no; num9++)
  1207. {
  1208. AddFolderOrArchive(string.Concat(new object[]
  1209. {
  1210. text26,
  1211. "_",
  1212. text27,
  1213. "_",
  1214. num9
  1215. }));
  1216. }
  1217. }
  1218. }
  1219. AddFolderOrArchive("parts-en2");
  1220. }
  1221. Debug.Log("■■■■■■■■■■■■■■■■■■■■" + stopWatch.Stop().ToString() + " ms");
  1222. }
  1223. public static void UpdateFileSystemPathOld()
  1224. {
  1225. if (!GameUty.IsEnabledCompatibilityMode)
  1226. {
  1227. return;
  1228. }
  1229. FileSystemArchive fileSystem = GameUty.m_FileSystemOld;
  1230. Debug.Log("■■■■■■■■ Archive Log[Legacy]■■■■■■■■");
  1231. Func<string, bool> AddFolderOrArchive = delegate(string name)
  1232. {
  1233. bool flag = fileSystem.AddArchive("GameData\\" + name + ".arc");
  1234. if (flag)
  1235. {
  1236. Debug.Log("[GameData\\" + name + ".arc]を読み込みました");
  1237. }
  1238. return flag;
  1239. };
  1240. int check_ver_no = 3;
  1241. Action<string> action = delegate(string name)
  1242. {
  1243. foreach (string text2 in GameUty.PathListOld)
  1244. {
  1245. if (AddFolderOrArchive(name + "_" + text2))
  1246. {
  1247. if (name == "csv")
  1248. {
  1249. GameUty.ExistCsvPathListOld.Add(text2);
  1250. }
  1251. for (int m = 2; m <= check_ver_no; m++)
  1252. {
  1253. AddFolderOrArchive(string.Concat(new object[]
  1254. {
  1255. name,
  1256. "_",
  1257. text2,
  1258. "_",
  1259. m
  1260. }));
  1261. }
  1262. }
  1263. }
  1264. };
  1265. fileSystem.SetBaseDirectory(GameMain.Instance.CMSystem.CM3D2Path);
  1266. AddFolderOrArchive("csv");
  1267. action("csv");
  1268. AddFolderOrArchive("motion");
  1269. action("motion");
  1270. AddFolderOrArchive("motion2");
  1271. AddFolderOrArchive("script");
  1272. action("script");
  1273. action("script_share");
  1274. AddFolderOrArchive("script_share2");
  1275. AddFolderOrArchive("sound");
  1276. action("sound");
  1277. AddFolderOrArchive("sound2");
  1278. AddFolderOrArchive("texture");
  1279. action("texture");
  1280. AddFolderOrArchive("texture2");
  1281. AddFolderOrArchive("texture3");
  1282. AddFolderOrArchive("system");
  1283. action("system");
  1284. action("bg");
  1285. AddFolderOrArchive("voice");
  1286. AddFolderOrArchive("voice_a");
  1287. AddFolderOrArchive("voice_b");
  1288. AddFolderOrArchive("voice_c");
  1289. foreach (string str in GameUty.PathListOld)
  1290. {
  1291. string str2 = "voice";
  1292. string text = str2 + "_" + str;
  1293. if (AddFolderOrArchive(text))
  1294. {
  1295. for (int i = 2; i <= check_ver_no; i++)
  1296. {
  1297. AddFolderOrArchive(text + "_" + i);
  1298. }
  1299. }
  1300. text = str2 + "_" + str + "a";
  1301. if (AddFolderOrArchive(text))
  1302. {
  1303. for (int j = 2; j <= check_ver_no; j++)
  1304. {
  1305. AddFolderOrArchive(text + "_" + j);
  1306. }
  1307. }
  1308. text = str2 + "_" + str + "b";
  1309. if (AddFolderOrArchive(text))
  1310. {
  1311. for (int k = 2; k <= check_ver_no; k++)
  1312. {
  1313. AddFolderOrArchive(text + "_" + k);
  1314. }
  1315. }
  1316. }
  1317. AddFolderOrArchive("voice2");
  1318. AddFolderOrArchive("voice3");
  1319. fileSystem.AddAutoPathForAllFolder(true);
  1320. while (!fileSystem.IsFinishedAddAutoPathJob(true))
  1321. {
  1322. }
  1323. fileSystem.ReleaseAddAutoPathJob();
  1324. string[] list = fileSystem.GetList("bg", AFileSystemBase.ListType.AllFile);
  1325. if (list != null && 0 < list.Length)
  1326. {
  1327. foreach (string path in list)
  1328. {
  1329. string fileName = Path.GetFileName(path);
  1330. if (!(Path.GetExtension(fileName) != ".asset_bg") && !GameUty.BgFiles.ContainsKey(fileName))
  1331. {
  1332. GameUty.BgFiles.Add(fileName, fileSystem);
  1333. }
  1334. }
  1335. }
  1336. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  1337. }
  1338. public static AFileBase FileOpen(string fileName, AFileSystemBase priorityFileSystem = null)
  1339. {
  1340. if (priorityFileSystem == null)
  1341. {
  1342. priorityFileSystem = GameUty.m_FileSystem;
  1343. }
  1344. AFileSystemBase[] array;
  1345. if (GameUty.ModPriorityToModFolder)
  1346. {
  1347. array = new AFileSystemBase[]
  1348. {
  1349. GameUty.m_ModFileSystem,
  1350. priorityFileSystem
  1351. };
  1352. }
  1353. else
  1354. {
  1355. array = new AFileSystemBase[]
  1356. {
  1357. priorityFileSystem,
  1358. GameUty.m_ModFileSystem
  1359. };
  1360. }
  1361. AFileBase result = null;
  1362. foreach (AFileSystemBase afileSystemBase in array)
  1363. {
  1364. if (afileSystemBase != null && afileSystemBase.IsExistentFile(fileName))
  1365. {
  1366. result = afileSystemBase.FileOpen(fileName);
  1367. break;
  1368. }
  1369. }
  1370. return result;
  1371. }
  1372. public static bool IsExistFile(string fileName, AFileSystemBase priorityFileSystem = null)
  1373. {
  1374. if (priorityFileSystem == null)
  1375. {
  1376. priorityFileSystem = GameUty.m_FileSystem;
  1377. }
  1378. AFileSystemBase[] array;
  1379. if (GameUty.ModPriorityToModFolder)
  1380. {
  1381. array = new AFileSystemBase[]
  1382. {
  1383. GameUty.m_ModFileSystem,
  1384. priorityFileSystem
  1385. };
  1386. }
  1387. else
  1388. {
  1389. array = new AFileSystemBase[]
  1390. {
  1391. priorityFileSystem,
  1392. GameUty.m_ModFileSystem
  1393. };
  1394. }
  1395. foreach (AFileSystemBase afileSystemBase in array)
  1396. {
  1397. if (afileSystemBase != null && afileSystemBase.IsExistentFile(fileName))
  1398. {
  1399. return true;
  1400. }
  1401. }
  1402. return false;
  1403. }
  1404. public static string GetBuildVersionText()
  1405. {
  1406. int num = 1510;
  1407. return (num >= 1000) ? ((float)num / 1000f).ToString("F2") : ((float)num / 100f).ToString("F2");
  1408. }
  1409. public static string GetGameVersionText()
  1410. {
  1411. string text = "COM3D2x64.exe";
  1412. int num = 1510;
  1413. string path = UTY.gameProjectPath + "\\update.lst";
  1414. string[] array = new string[0];
  1415. if (File.Exists(path))
  1416. {
  1417. try
  1418. {
  1419. array = File.ReadAllLines(path, Encoding.GetEncoding("utf-8"));
  1420. }
  1421. catch (Exception ex)
  1422. {
  1423. Debug.LogError(ex.Message);
  1424. array = new string[0];
  1425. }
  1426. }
  1427. foreach (string text2 in array)
  1428. {
  1429. if (!string.IsNullOrEmpty(text2))
  1430. {
  1431. string[] array3 = text2.Split(new char[]
  1432. {
  1433. ','
  1434. });
  1435. if (array3 != null && array3.Length == 2 && array3[0].Trim().ToLower() == text.ToLower())
  1436. {
  1437. int.TryParse(array3[1].Trim(), out num);
  1438. break;
  1439. }
  1440. }
  1441. }
  1442. string text3 = (num >= 1000) ? ((float)num / 1000f).ToString("F3") : ((float)num / 100f).ToString("F3");
  1443. if (text3.Length == 5)
  1444. {
  1445. text3 = text3.Insert(4, ".");
  1446. }
  1447. return text3;
  1448. }
  1449. public static string GetLegacyGameVersionText()
  1450. {
  1451. if (!GameUty.IsEnabledCompatibilityMode)
  1452. {
  1453. return "0.0";
  1454. }
  1455. string text = "CM3D2x64.exe";
  1456. string path = GameMain.Instance.CMSystem.CM3D2Path + "\\update.lst";
  1457. string[] array = new string[0];
  1458. if (File.Exists(path))
  1459. {
  1460. try
  1461. {
  1462. array = File.ReadAllLines(path, Encoding.GetEncoding("utf-8"));
  1463. }
  1464. catch (Exception ex)
  1465. {
  1466. Debug.LogError(ex.Message);
  1467. array = new string[0];
  1468. }
  1469. }
  1470. int num = 0;
  1471. foreach (string text2 in array)
  1472. {
  1473. if (!string.IsNullOrEmpty(text2))
  1474. {
  1475. string[] array3 = text2.Split(new char[]
  1476. {
  1477. ','
  1478. });
  1479. if (array3 != null && array3.Length == 2 && array3 != null && array3.Length == 2 && array3[0].Trim().ToLower() == text.ToLower())
  1480. {
  1481. int.TryParse(array3[1].Trim(), out num);
  1482. break;
  1483. }
  1484. }
  1485. }
  1486. string text3 = (num >= 1000) ? ((float)num / 1000f).ToString("F3") : ((float)num / 100f).ToString("F3");
  1487. if (text3.Length == 5)
  1488. {
  1489. text3 = text3.Insert(4, ".");
  1490. }
  1491. return text3;
  1492. }
  1493. private static FileSystemArchive m_FileSystem = null;
  1494. private static FileSystemArchive m_FileSystemOld = null;
  1495. private static FileSystemWindows m_ModFileSystem = null;
  1496. public static List<string> PathList = new List<string>();
  1497. public static List<string> ExistCsvPathList = new List<string>();
  1498. public static List<string> PathListOld = new List<string>();
  1499. public static List<string> ExistCsvPathListOld = new List<string>();
  1500. private static string[] m_aryMenuFiles = null;
  1501. private static string[] m_aryModOnlysMenuFiles = new string[0];
  1502. private static Dictionary<int, string> rid_menu_dic_ = new Dictionary<int, string>();
  1503. private static Dictionary<string, AssetBundle> asset_bundle_dic = new Dictionary<string, AssetBundle>();
  1504. private static string ModPriorityToModFolderInfo = "以下のフラグをtrueにするとMODフォルダのファイルが優先されるが、モザイクも安易に外すことが可能になる為に現在はオミット。";
  1505. public static bool ModPriorityToModFolder = false;
  1506. private static string[] m_strSystemMaterialName = new string[]
  1507. {
  1508. "System/Material/2dAlpha",
  1509. "System/Material/2dMultiply",
  1510. "System/Material/InfinityColor",
  1511. "System/Material/TexTo8bitTex"
  1512. };
  1513. private static Material[] m_matSystem = new Material[4];
  1514. public enum SystemMaterial
  1515. {
  1516. Alpha,
  1517. Multiply,
  1518. InfinityColor,
  1519. TexTo8bitTex,
  1520. Max
  1521. }
  1522. }