GameUty.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7. using 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;
  37. }
  38. }
  39. public static string[] MenuFiles
  40. {
  41. get
  42. {
  43. return GameUty.m_aryMenuFiles;
  44. }
  45. }
  46. public static string[] ModOnlysMenuFiles
  47. {
  48. get
  49. {
  50. return GameUty.m_aryModOnlysMenuFiles;
  51. }
  52. }
  53. public static Dictionary<int, string> RidMenuDic
  54. {
  55. get
  56. {
  57. return GameUty.rid_menu_dic_;
  58. }
  59. }
  60. public static Dictionary<string, AFileSystemBase> BgFiles { get; private set; }
  61. public static float MillisecondToSecond(int millisecond)
  62. {
  63. return (float)millisecond / 1000f;
  64. }
  65. public static Material GetSystemMaterial(GameUty.SystemMaterial f_mat)
  66. {
  67. Material material = GameUty.m_matSystem[(int)f_mat];
  68. if (material == null)
  69. {
  70. UnityEngine.Object original = Resources.Load(GameUty.m_strSystemMaterialName[(int)f_mat]);
  71. material = (UnityEngine.Object.Instantiate(original) as Material);
  72. GameUty.m_matSystem[(int)f_mat] = material;
  73. }
  74. return material;
  75. }
  76. public static GameObject LoadAssetBundle(string file_name)
  77. {
  78. if (GameUty.FileSystem == null || !GameUty.FileSystem.IsExistentFile(file_name))
  79. {
  80. return null;
  81. }
  82. UnityEngine.Object original = null;
  83. if (!GameUty.asset_bundle_dic.ContainsKey(file_name))
  84. {
  85. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(file_name))
  86. {
  87. AssetBundle assetBundle = AssetBundle.LoadFromMemory(afileBase.ReadAll());
  88. if (assetBundle.mainAsset != null)
  89. {
  90. original = assetBundle.mainAsset;
  91. }
  92. else
  93. {
  94. original = assetBundle.LoadAllAssets<GameObject>()[0];
  95. }
  96. GameUty.asset_bundle_dic.Add(file_name, assetBundle);
  97. }
  98. }
  99. else
  100. {
  101. original = GameUty.asset_bundle_dic[file_name].mainAsset;
  102. }
  103. GameObject gameObject = UnityEngine.Object.Instantiate(original) as GameObject;
  104. gameObject.name = gameObject.name.Replace("(Clone)", string.Empty);
  105. return gameObject;
  106. }
  107. public static void DeviceInitialize()
  108. {
  109. }
  110. public static void Init()
  111. {
  112. GameUty.m_FileSystem = new FileSystemArchive();
  113. GameUty.m_FileSystemOld = new FileSystemArchive();
  114. GameUty.PathListOld = new List<string>();
  115. if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path))
  116. {
  117. GameUty.PathListOld = GameUty.ReadAutoPathFile("[2.0]", GameMain.Instance.CMSystem.CM3D2Path + "\\GameData\\paths.dat");
  118. if (GameUty.PathListOld == null)
  119. {
  120. GameUty.PathListOld = new List<string>();
  121. }
  122. }
  123. GameUty.UpdateFileSystemPath();
  124. GameUty.UpdateFileSystemPathOld();
  125. PluginData.CreateData(GameUty.m_FileSystem, (!GameUty.IsEnabledCompatibilityMode) ? null : GameUty.m_FileSystemOld);
  126. Debug.Log("■■■■■■■■ Plugin Check ■■■■■■■■");
  127. foreach (string text in PluginData.GetAllUniqueNames())
  128. {
  129. Debug.Log(string.Concat(new string[]
  130. {
  131. "[",
  132. PluginData.uniqueNameToId(text).ToString(),
  133. "]",
  134. text,
  135. " : ",
  136. (!PluginData.IsEnabled(text)) ? "×" : "○"
  137. }));
  138. }
  139. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  140. }
  141. public static void Finish()
  142. {
  143. foreach (KeyValuePair<string, AssetBundle> keyValuePair in GameUty.asset_bundle_dic)
  144. {
  145. keyValuePair.Value.Unload(true);
  146. }
  147. GameUty.asset_bundle_dic.Clear();
  148. GameUty.m_FileSystem.Dispose();
  149. GameUty.m_FileSystem = null;
  150. if (GameUty.m_FileSystemOld != null)
  151. {
  152. GameUty.m_FileSystemOld.Dispose();
  153. GameUty.m_FileSystemOld = null;
  154. }
  155. if (GameUty.m_ModFileSystem != null)
  156. {
  157. GameUty.m_ModFileSystem.Dispose();
  158. GameUty.m_ModFileSystem = null;
  159. }
  160. }
  161. public static Dictionary<string, HashSet<string>> GetGameDataResourceList(string gameDataPath)
  162. {
  163. string[] array = new string[]
  164. {
  165. "script_cbl",
  166. "motion_cbl",
  167. "voice_cbl"
  168. };
  169. int length = (gameDataPath + "\\").Length;
  170. string[] directories = Directory.GetDirectories(gameDataPath);
  171. Dictionary<string, HashSet<string>> dictionary = new Dictionary<string, HashSet<string>>();
  172. for (int i = 0; i < directories.Length; i++)
  173. {
  174. string text = directories[i].Substring(length, directories[i].Length - length).ToLower();
  175. int startIndex = 0;
  176. foreach (string text2 in array)
  177. {
  178. if (text.IndexOf(text2) == 0)
  179. {
  180. startIndex = text2.Length;
  181. break;
  182. }
  183. }
  184. int num = text.IndexOf('_', startIndex);
  185. if (0 <= num)
  186. {
  187. string text3 = text.Substring(0, num);
  188. if (!string.IsNullOrEmpty(text3))
  189. {
  190. string text4 = text.Substring(text3.Length + 1, text.Length - (text3.Length + 1));
  191. if (!string.IsNullOrEmpty(text4))
  192. {
  193. if (!dictionary.ContainsKey(text3))
  194. {
  195. dictionary.Add(text3, new HashSet<string>());
  196. }
  197. if (!dictionary[text3].Contains(text4))
  198. {
  199. dictionary[text3].Add(text4);
  200. }
  201. else
  202. {
  203. Debug.LogWarning(text3 + "_" + text4 + "は既にリストに存在します");
  204. }
  205. }
  206. }
  207. }
  208. else if (!dictionary.ContainsKey(text))
  209. {
  210. dictionary.Add(text, new HashSet<string>());
  211. }
  212. else
  213. {
  214. Debug.LogWarning(text + "は既にリストに存在します");
  215. }
  216. }
  217. return dictionary;
  218. }
  219. public static List<string> ReadAutoPathFile(string uniqueName, string filePath)
  220. {
  221. if (!File.Exists(filePath))
  222. {
  223. return null;
  224. }
  225. List<string> list = new List<string>();
  226. using (FileStream fileStream = new FileStream(filePath, FileMode.Open))
  227. {
  228. using (BinaryReader binaryReader = new BinaryReader(fileStream))
  229. {
  230. string a = binaryReader.ReadString();
  231. NDebug.Assert(a == "CM3D2_PATHS", "パスファイルのヘッダーが不正です。");
  232. int num = binaryReader.ReadInt32();
  233. int num2 = binaryReader.ReadInt32();
  234. for (int i = 0; i < num2; i++)
  235. {
  236. string item = binaryReader.ReadString();
  237. list.Add(item);
  238. }
  239. }
  240. }
  241. return list;
  242. }
  243. public static void UpdateFileSystemPath()
  244. {
  245. string fullPath = Path.GetFullPath(".\\");
  246. string gameDataPath = "GameData";
  247. int check_ver_no = 3;
  248. Func<string, bool> AddFolderOrArchive = delegate(string name)
  249. {
  250. bool flag3 = GameUty.m_FileSystem.AddArchive(gameDataPath + "\\" + name + ".arc");
  251. if (flag3)
  252. {
  253. Debug.Log(string.Concat(new string[]
  254. {
  255. "[",
  256. gameDataPath,
  257. "\\",
  258. name,
  259. ".arc]を読み込みました"
  260. }));
  261. }
  262. return flag3;
  263. };
  264. HashSet<string> addedLegacyArchives = new HashSet<string>();
  265. int m;
  266. Action<string> action = delegate(string name)
  267. {
  268. foreach (string text7 in GameUty.PathList)
  269. {
  270. string text8 = name + "_" + text7;
  271. bool flag3 = AddFolderOrArchive(text8);
  272. if (flag3 && !addedLegacyArchives.Contains(text8))
  273. {
  274. addedLegacyArchives.Add(text8);
  275. }
  276. if (flag3)
  277. {
  278. if (name == "csv")
  279. {
  280. GameUty.ExistCsvPathList.Add(text7);
  281. }
  282. for (int m = 2; m <= check_ver_no; m++)
  283. {
  284. AddFolderOrArchive(text8 + "_" + m);
  285. }
  286. }
  287. }
  288. };
  289. Action<string> action2 = delegate(string name)
  290. {
  291. foreach (string text7 in GameUty.PathList)
  292. {
  293. string text8 = name + "_" + text7;
  294. bool flag3 = AddFolderOrArchive(text8);
  295. if (!flag3 && addedLegacyArchives.Contains(text8))
  296. {
  297. flag3 = true;
  298. }
  299. if (flag3)
  300. {
  301. if (name == "csv")
  302. {
  303. GameUty.ExistCsvPathList.Add(text7);
  304. }
  305. for (int m = 2; m <= check_ver_no; m++)
  306. {
  307. AddFolderOrArchive(string.Concat(new object[]
  308. {
  309. name,
  310. "_",
  311. text7,
  312. "_",
  313. m
  314. }));
  315. }
  316. }
  317. }
  318. };
  319. Action<string> action3 = delegate(string name)
  320. {
  321. foreach (string text7 in GameUty.PathList)
  322. {
  323. if (AddFolderOrArchive(name + "_" + text7))
  324. {
  325. if (name == "csv")
  326. {
  327. GameUty.ExistCsvPathList.Add(text7);
  328. }
  329. for (int m = 2; m <= check_ver_no; m++)
  330. {
  331. AddFolderOrArchive(string.Concat(new object[]
  332. {
  333. name,
  334. "_",
  335. text7,
  336. "_",
  337. m
  338. }));
  339. }
  340. }
  341. }
  342. };
  343. string common_error_text = string.Empty;
  344. common_error_text = "必用アーカイブがありません。GameData\\";
  345. StopWatch stopWatch = new StopWatch();
  346. Debug.Log("IsEnabledCompatibilityMode:" + GameUty.IsEnabledCompatibilityMode.ToString());
  347. string text = "カスタムオーダーメイド3D 2";
  348. string str = "カスタムメイド3D 2";
  349. text += " 翻訳評価版";
  350. Debug.Log(string.Concat(new string[]
  351. {
  352. text,
  353. " GameVersion ",
  354. GameUty.GetGameVersionText(),
  355. "(BuildVersion : ",
  356. GameUty.GetBuildVersionText(),
  357. ")"
  358. }));
  359. if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path))
  360. {
  361. Debug.Log(str + " GameVersion " + GameUty.GetLegacyGameVersionText());
  362. }
  363. if (GameUty.IsEnabledCompatibilityMode)
  364. {
  365. Debug.Log("■■■■■■■■ Archive Log[2.0] (CM3D2 GameData) ■■■■■■■■");
  366. GameUty.m_FileSystem.SetBaseDirectory(GameMain.Instance.CMSystem.CM3D2Path);
  367. GameUty.PathList = GameUty.PathListOld;
  368. AddFolderOrArchive("material");
  369. foreach (string text2 in GameUty.PathListOld)
  370. {
  371. string str2 = "material";
  372. if (text2 == "denkigai2015wTowelR")
  373. {
  374. AddFolderOrArchive(str2 + "_denkigai2015wTowel");
  375. }
  376. string text3 = str2 + "_" + text2;
  377. bool flag = AddFolderOrArchive(text3);
  378. if (flag && !addedLegacyArchives.Contains(text3))
  379. {
  380. addedLegacyArchives.Add(text3);
  381. }
  382. if (flag)
  383. {
  384. for (m = 2; m <= check_ver_no; m++)
  385. {
  386. AddFolderOrArchive(text3 + "_" + m);
  387. }
  388. }
  389. }
  390. AddFolderOrArchive("material2");
  391. AddFolderOrArchive("menu");
  392. action("menu");
  393. AddFolderOrArchive("menu2");
  394. AddFolderOrArchive("model");
  395. action("model");
  396. AddFolderOrArchive("model2");
  397. AddFolderOrArchive("texture");
  398. action("texture");
  399. AddFolderOrArchive("texture2");
  400. AddFolderOrArchive("texture3");
  401. AddFolderOrArchive("prioritymaterial");
  402. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  403. }
  404. Debug.Log("■■■■■■■■ Archive Log[2.1 Compatibility] (GameData_20) ■■■■■■■■");
  405. gameDataPath = "GameData_20";
  406. GameUty.m_FileSystem.SetBaseDirectory(fullPath);
  407. if (GameUty.IsEnabledCompatibilityMode)
  408. {
  409. GameUty.m_FileSystem.AddPatchDecryptPreferredSearchDirectory(GameMain.Instance.CMSystem.CM3D2Path + "\\GameData");
  410. }
  411. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1Compatibility]", fullPath + gameDataPath + "\\paths.dat");
  412. if (GameUty.PathList != null && 0 < GameUty.PathList.Count)
  413. {
  414. foreach (string text4 in GameUty.PathList)
  415. {
  416. string text5 = "material";
  417. if (text4 == "denkigai2015wTowelR")
  418. {
  419. AddFolderOrArchive(text5 + "_denkigai2015wTowel");
  420. }
  421. string text6 = text5 + "_" + text4;
  422. bool flag2 = AddFolderOrArchive(text6);
  423. if (!flag2 && addedLegacyArchives.Contains(text6))
  424. {
  425. flag2 = true;
  426. }
  427. if (flag2)
  428. {
  429. for (int j = 2; j <= check_ver_no; j++)
  430. {
  431. AddFolderOrArchive(string.Concat(new object[]
  432. {
  433. text5,
  434. "_",
  435. text4,
  436. "_",
  437. j
  438. }));
  439. }
  440. }
  441. }
  442. action2("menu");
  443. action2("model");
  444. action2("texture");
  445. AddFolderOrArchive("prioritymaterial");
  446. }
  447. GameUty.m_FileSystem.ClearPatchDecryptPreferredSearchDirectory();
  448. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  449. Debug.Log("■■■■■■■■ Archive Log[2.1] (GameData) ■■■■■■■■");
  450. gameDataPath = "GameData";
  451. GameUty.PathList = GameUty.ReadAutoPathFile("[2.1]", fullPath + gameDataPath + "\\paths.dat");
  452. if (GameUty.PathList == null)
  453. {
  454. GameUty.PathList = new List<string>();
  455. NDebug.Assert("paths.datを読み込めませんでした", false);
  456. }
  457. NDebug.Assert(AddFolderOrArchive("prioritymaterial"), () => common_error_text + "prioritymaterial");
  458. NDebug.Assert(AddFolderOrArchive("script_en_try"), () => common_error_text + "script_en_try");
  459. NDebug.Assert(AddFolderOrArchive("csv_en_try"), () => common_error_text + "csv_en_try");
  460. NDebug.Assert(AddFolderOrArchive("motion_try"), () => common_error_text + "motion_try");
  461. NDebug.Assert(AddFolderOrArchive("sound_try"), () => common_error_text + "sound_try");
  462. NDebug.Assert(AddFolderOrArchive("system"), () => common_error_text + "system");
  463. NDebug.Assert(AddFolderOrArchive("system2"), () => common_error_text + "system2");
  464. NDebug.Assert(AddFolderOrArchive("voice_try"), () => common_error_text + "voice_try");
  465. NDebug.Assert(AddFolderOrArchive("parts_try"), () => common_error_text + "parts_try");
  466. GameUty.m_FileSystem.AddAutoPathForAllFolder();
  467. GameUty.BgFiles = new Dictionary<string, AFileSystemBase>();
  468. string[] fileListAtExtension = GameUty.m_FileSystem.GetFileListAtExtension(".menu");
  469. List<string> list = new List<string>();
  470. foreach (string path in fileListAtExtension)
  471. {
  472. list.Add(Path.GetFileName(path));
  473. }
  474. GameUty.m_aryMenuFiles = list.ToArray();
  475. if (GameUty.m_ModFileSystem != null)
  476. {
  477. string[] list2 = GameUty.m_ModFileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFile);
  478. GameUty.m_aryModOnlysMenuFiles = Array.FindAll<string>(list2, (string i) => new Regex(".*\\.menu$").IsMatch(i));
  479. GameUty.m_aryMenuFiles = GameUty.m_aryMenuFiles.Concat(GameUty.m_aryModOnlysMenuFiles).ToArray<string>();
  480. }
  481. if (GameUty.m_aryModOnlysMenuFiles != null && GameUty.m_aryModOnlysMenuFiles.Length != 0)
  482. {
  483. GameUty.ModPriorityToModFolderInfo = string.Empty;
  484. Debug.Log(GameUty.ModPriorityToModFolderInfo + "■MOD有り。MODフォルダ優先モード" + GameUty.ModPriorityToModFolder.ToString());
  485. }
  486. if (GameUty.rid_menu_dic_.Count == 0)
  487. {
  488. string[] menuFiles = GameUty.MenuFiles;
  489. GameUty.rid_menu_dic_ = new Dictionary<int, string>();
  490. for (int l = 0; l < menuFiles.Length; l++)
  491. {
  492. string fileName = Path.GetFileName(menuFiles[l]);
  493. int hashCode = fileName.ToLower().GetHashCode();
  494. if (!GameUty.rid_menu_dic_.ContainsKey(hashCode))
  495. {
  496. GameUty.rid_menu_dic_.Add(hashCode, fileName);
  497. }
  498. else
  499. {
  500. NDebug.Assert(fileName == GameUty.rid_menu_dic_[hashCode], string.Concat(new string[]
  501. {
  502. "[",
  503. fileName,
  504. "]と[",
  505. GameUty.rid_menu_dic_[hashCode],
  506. "]は同じハッシュキーです"
  507. }));
  508. }
  509. }
  510. }
  511. }
  512. public static void UpdateFileSystemPathOld()
  513. {
  514. if (!GameUty.IsEnabledCompatibilityMode)
  515. {
  516. return;
  517. }
  518. FileSystemArchive fileSystem = GameUty.m_FileSystemOld;
  519. Debug.Log("■■■■■■■■ Archive Log[Legacy]■■■■■■■■");
  520. Func<string, bool> AddFolderOrArchive = delegate(string name)
  521. {
  522. bool flag = fileSystem.AddArchive("GameData\\" + name + ".arc");
  523. if (flag)
  524. {
  525. Debug.Log("[GameData\\" + name + ".arc]を読み込みました");
  526. }
  527. return flag;
  528. };
  529. int check_ver_no = 3;
  530. Action<string> action = delegate(string name)
  531. {
  532. foreach (string text2 in GameUty.PathListOld)
  533. {
  534. if (AddFolderOrArchive(name + "_" + text2))
  535. {
  536. if (name == "csv")
  537. {
  538. GameUty.ExistCsvPathListOld.Add(text2);
  539. }
  540. for (int m = 2; m <= check_ver_no; m++)
  541. {
  542. AddFolderOrArchive(string.Concat(new object[]
  543. {
  544. name,
  545. "_",
  546. text2,
  547. "_",
  548. m
  549. }));
  550. }
  551. }
  552. }
  553. };
  554. fileSystem.SetBaseDirectory(GameMain.Instance.CMSystem.CM3D2Path);
  555. AddFolderOrArchive("csv");
  556. action("csv");
  557. AddFolderOrArchive("motion");
  558. action("motion");
  559. AddFolderOrArchive("motion2");
  560. AddFolderOrArchive("script");
  561. action("script");
  562. action("script_share");
  563. AddFolderOrArchive("script_share2");
  564. AddFolderOrArchive("sound");
  565. action("sound");
  566. AddFolderOrArchive("sound2");
  567. AddFolderOrArchive("texture");
  568. action("texture");
  569. AddFolderOrArchive("texture2");
  570. AddFolderOrArchive("texture3");
  571. AddFolderOrArchive("system");
  572. action("system");
  573. action("bg");
  574. AddFolderOrArchive("voice");
  575. AddFolderOrArchive("voice_a");
  576. AddFolderOrArchive("voice_b");
  577. AddFolderOrArchive("voice_c");
  578. foreach (string str in GameUty.PathListOld)
  579. {
  580. string str2 = "voice";
  581. string text = str2 + "_" + str;
  582. if (AddFolderOrArchive(text))
  583. {
  584. for (int i = 2; i <= check_ver_no; i++)
  585. {
  586. AddFolderOrArchive(text + "_" + i);
  587. }
  588. }
  589. text = str2 + "_" + str + "a";
  590. if (AddFolderOrArchive(text))
  591. {
  592. for (int j = 2; j <= check_ver_no; j++)
  593. {
  594. AddFolderOrArchive(text + "_" + j);
  595. }
  596. }
  597. text = str2 + "_" + str + "b";
  598. if (AddFolderOrArchive(text))
  599. {
  600. for (int k = 2; k <= check_ver_no; k++)
  601. {
  602. AddFolderOrArchive(text + "_" + k);
  603. }
  604. }
  605. }
  606. AddFolderOrArchive("voice2");
  607. AddFolderOrArchive("voice3");
  608. fileSystem.AddAutoPathForAllFolder();
  609. string[] list = fileSystem.GetList("bg", AFileSystemBase.ListType.AllFile);
  610. if (list != null && 0 < list.Length)
  611. {
  612. foreach (string path in list)
  613. {
  614. string fileName = Path.GetFileName(path);
  615. if (!(Path.GetExtension(fileName) != ".asset_bg") && !GameUty.BgFiles.ContainsKey(fileName))
  616. {
  617. GameUty.BgFiles.Add(fileName, fileSystem);
  618. }
  619. }
  620. }
  621. Debug.Log("■■■■■■■■■■■■■■■■■■■■");
  622. }
  623. public static AFileBase FileOpen(string fileName, AFileSystemBase priorityFileSystem = null)
  624. {
  625. if (priorityFileSystem == null)
  626. {
  627. priorityFileSystem = GameUty.m_FileSystem;
  628. }
  629. AFileSystemBase[] array;
  630. if (GameUty.ModPriorityToModFolder)
  631. {
  632. array = new AFileSystemBase[]
  633. {
  634. GameUty.m_ModFileSystem,
  635. priorityFileSystem
  636. };
  637. }
  638. else
  639. {
  640. array = new AFileSystemBase[]
  641. {
  642. priorityFileSystem,
  643. GameUty.m_ModFileSystem
  644. };
  645. }
  646. AFileBase result = null;
  647. foreach (AFileSystemBase afileSystemBase in array)
  648. {
  649. if (afileSystemBase != null && afileSystemBase.IsExistentFile(fileName))
  650. {
  651. result = afileSystemBase.FileOpen(fileName);
  652. break;
  653. }
  654. }
  655. return result;
  656. }
  657. public static bool IsExistFile(string fileName, AFileSystemBase priorityFileSystem = null)
  658. {
  659. if (priorityFileSystem == null)
  660. {
  661. priorityFileSystem = GameUty.m_FileSystem;
  662. }
  663. AFileSystemBase[] array;
  664. if (GameUty.ModPriorityToModFolder)
  665. {
  666. array = new AFileSystemBase[]
  667. {
  668. GameUty.m_ModFileSystem,
  669. priorityFileSystem
  670. };
  671. }
  672. else
  673. {
  674. array = new AFileSystemBase[]
  675. {
  676. priorityFileSystem,
  677. GameUty.m_ModFileSystem
  678. };
  679. }
  680. foreach (AFileSystemBase afileSystemBase in array)
  681. {
  682. if (afileSystemBase != null && afileSystemBase.IsExistentFile(fileName))
  683. {
  684. return true;
  685. }
  686. }
  687. return false;
  688. }
  689. public static string GetBuildVersionText()
  690. {
  691. int num = 1170;
  692. return (num >= 1000) ? ((float)num / 1000f).ToString("F2") : ((float)num / 100f).ToString("F2");
  693. }
  694. public static string GetGameVersionText()
  695. {
  696. string text = "COM3D2x64.exe";
  697. int num = 1170;
  698. string path = Path.GetFullPath(".\\") + "update.lst";
  699. string[] array = new string[0];
  700. if (File.Exists(path))
  701. {
  702. try
  703. {
  704. array = File.ReadAllLines(path, Encoding.GetEncoding("utf-8"));
  705. }
  706. catch (Exception ex)
  707. {
  708. Debug.LogError(ex.Message);
  709. array = new string[0];
  710. }
  711. }
  712. foreach (string text2 in array)
  713. {
  714. if (!string.IsNullOrEmpty(text2))
  715. {
  716. string[] array3 = text2.Split(new char[]
  717. {
  718. ','
  719. });
  720. if (array3 != null && array3.Length == 2 && array3[0].Trim().ToLower() == text.ToLower())
  721. {
  722. int.TryParse(array3[1].Trim(), out num);
  723. break;
  724. }
  725. }
  726. }
  727. string text3 = (num >= 1000) ? ((float)num / 1000f).ToString("F3") : ((float)num / 100f).ToString("F3");
  728. if (text3.Length == 5)
  729. {
  730. text3 = text3.Insert(4, ".");
  731. }
  732. return text3;
  733. }
  734. public static string GetLegacyGameVersionText()
  735. {
  736. if (!GameUty.IsEnabledCompatibilityMode)
  737. {
  738. return "0.0";
  739. }
  740. string text = "CM3D2x64.exe";
  741. string path = GameMain.Instance.CMSystem.CM3D2Path + "\\update.lst";
  742. string[] array = new string[0];
  743. if (File.Exists(path))
  744. {
  745. try
  746. {
  747. array = File.ReadAllLines(path, Encoding.GetEncoding("utf-8"));
  748. }
  749. catch (Exception ex)
  750. {
  751. Debug.LogError(ex.Message);
  752. array = new string[0];
  753. }
  754. }
  755. int num = 0;
  756. foreach (string text2 in array)
  757. {
  758. if (!string.IsNullOrEmpty(text2))
  759. {
  760. string[] array3 = text2.Split(new char[]
  761. {
  762. ','
  763. });
  764. if (array3 != null && array3.Length == 2 && array3 != null && array3.Length == 2 && array3[0].Trim().ToLower() == text.ToLower())
  765. {
  766. int.TryParse(array3[1].Trim(), out num);
  767. break;
  768. }
  769. }
  770. }
  771. string text3 = (num >= 1000) ? ((float)num / 1000f).ToString("F3") : ((float)num / 100f).ToString("F3");
  772. if (text3.Length == 5)
  773. {
  774. text3 = text3.Insert(4, ".");
  775. }
  776. return text3;
  777. }
  778. private static FileSystemArchive m_FileSystem = null;
  779. private static FileSystemArchive m_FileSystemOld = null;
  780. private static FileSystemWindows m_ModFileSystem = null;
  781. public static List<string> PathList = new List<string>();
  782. public static List<string> ExistCsvPathList = new List<string>();
  783. public static List<string> PathListOld = new List<string>();
  784. public static List<string> ExistCsvPathListOld = new List<string>();
  785. private static string[] m_aryMenuFiles = null;
  786. private static string[] m_aryModOnlysMenuFiles = new string[0];
  787. private static Dictionary<int, string> rid_menu_dic_ = new Dictionary<int, string>();
  788. private static Dictionary<string, AssetBundle> asset_bundle_dic = new Dictionary<string, AssetBundle>();
  789. private static string ModPriorityToModFolderInfo = "以下のフラグをtrueにするとMODフォルダのファイルが優先されるが、モザイクも安易に外すことが可能になる為に現在はオミット。";
  790. public static bool ModPriorityToModFolder = false;
  791. private static string[] m_strSystemMaterialName = new string[]
  792. {
  793. "System/Material/2dAlpha",
  794. "System/Material/2dMultiply",
  795. "System/Material/InfinityColor",
  796. "System/Material/TexTo8bitTex"
  797. };
  798. private static Material[] m_matSystem = new Material[4];
  799. public enum SystemMaterial
  800. {
  801. Alpha,
  802. Multiply,
  803. InfinityColor,
  804. TexTo8bitTex,
  805. Max
  806. }
  807. }