GameUty.cs 38 KB

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