1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using I2.Loc;
- using UnityEngine;
- using wf;
- public class GameUty
- {
- public static AFileSystemBase FileSystem
- {
- get
- {
- return GameUty.m_FileSystem;
- }
- }
- public static AFileSystemBase FileSystemOld
- {
- get
- {
- return GameUty.m_FileSystemOld;
- }
- }
- public static AFileSystemBase FileSystemMod
- {
- get
- {
- return GameUty.m_ModFileSystem;
- }
- }
- public static bool IsEnabledCompatibilityMode
- {
- get
- {
- return 0 < GameUty.PathListOld.Count && Product.type == Product.Type.JpAdult;
- }
- }
- public static HashSet<string> loadArchiveList { get; private set; }
- public static string[] MenuFiles
- {
- get
- {
- return GameUty.m_aryMenuFiles;
- }
- }
- public static string[] ModOnlysMenuFiles
- {
- get
- {
- return GameUty.m_aryModOnlysMenuFiles;
- }
- }
- public static Dictionary<int, string> RidMenuDic
- {
- get
- {
- return GameUty.rid_menu_dic_;
- }
- }
- public static Dictionary<string, AFileSystemBase> BgFiles { get; private set; }
- public static float MillisecondToSecond(int millisecond)
- {
- return (float)millisecond / 1000f;
- }
- public static Material GetSystemMaterial(GameUty.SystemMaterial f_mat)
- {
- Material material = GameUty.m_matSystem[(int)f_mat];
- if (material == null)
- {
- UnityEngine.Object original = Resources.Load(GameUty.m_strSystemMaterialName[(int)f_mat]);
- material = (UnityEngine.Object.Instantiate(original) as Material);
- GameUty.m_matSystem[(int)f_mat] = material;
- }
- return material;
- }
- public static GameObject LoadAssetBundle(string file_name)
- {
- if (GameUty.FileSystem == null || !GameUty.FileSystem.IsExistentFile(file_name))
- {
- return null;
- }
- UnityEngine.Object original = null;
- if (!GameUty.asset_bundle_dic.ContainsKey(file_name))
- {
- using (AFileBase afileBase = GameUty.FileSystem.FileOpen(file_name))
- {
- AssetBundle assetBundle = AssetBundle.LoadFromMemory(afileBase.ReadAll());
- if (assetBundle.mainAsset != null)
- {
- original = assetBundle.mainAsset;
- }
- else
- {
- original = assetBundle.LoadAllAssets<GameObject>()[0];
- }
- GameUty.asset_bundle_dic.Add(file_name, assetBundle);
- }
- }
- else
- {
- original = GameUty.asset_bundle_dic[file_name].mainAsset;
- }
- GameObject gameObject = UnityEngine.Object.Instantiate(original) as GameObject;
- gameObject.name = gameObject.name.Replace("(Clone)", string.Empty);
- return gameObject;
- }
- public static void DeviceInitialize()
- {
- }
- public static void Init()
- {
- GameUty.m_FileSystem = new FileSystemArchive();
- GameUty.m_FileSystemOld = new FileSystemArchive();
- GameUty.loadArchiveList = new HashSet<string>();
- GameUty.PathListOld = new List<string>();
- if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path))
- {
- GameUty.PathListOld = GameUty.ReadAutoPathFile("[2.0]", GameMain.Instance.CMSystem.CM3D2Path + "\\GameData\\paths.dat");
- if (GameUty.PathListOld == null)
- {
- GameUty.PathListOld = new List<string>();
- }
- }
- GameUty.UpdateFileSystemPath();
- GameUty.UpdateFileSystemPathOld();
- PluginData.CreateData(GameUty.m_FileSystem, (!GameUty.IsEnabledCompatibilityMode) ? null : GameUty.m_FileSystemOld);
- Debug.Log("■■■■■■■■ Plugin Check ■■■■■■■■");
- foreach (string text in PluginData.GetAllUniqueNames())
- {
- Debug.Log(string.Concat(new string[]
- {
- "[",
- PluginData.uniqueNameToId(text).ToString(),
- "]",
- text,
- " : ",
- (!PluginData.IsEnabled(text)) ? "×" : "○"
- }));
- }
- Debug.Log("■■■■■■■■■■■■■■■■■■■■");
- string windowTitel = Product.windowTitel;
- if (!string.IsNullOrEmpty(windowTitel))
- {
- DllBase.Win32.SetWindowText(DllBase.Win32.GetActiveWindow(), windowTitel);
- }
- }
- public static void Finish()
- {
- foreach (KeyValuePair<string, AssetBundle> keyValuePair in GameUty.asset_bundle_dic)
- {
- keyValuePair.Value.Unload(true);
- }
- GameUty.asset_bundle_dic.Clear();
- GameUty.m_FileSystem.Dispose();
- GameUty.m_FileSystem = null;
- if (GameUty.m_FileSystemOld != null)
- {
- GameUty.m_FileSystemOld.Dispose();
- GameUty.m_FileSystemOld = null;
- }
- if (GameUty.m_ModFileSystem != null)
- {
- GameUty.m_ModFileSystem.Dispose();
- GameUty.m_ModFileSystem = null;
- }
- }
- public static Dictionary<string, HashSet<string>> GetGameDataResourceList(string gameDataPath)
- {
- string[] array = new string[]
- {
- "script_cbl",
- "motion_cbl",
- "voice_cbl"
- };
- int length = (gameDataPath + "\\").Length;
- string[] directories = Directory.GetDirectories(gameDataPath);
- Dictionary<string, HashSet<string>> dictionary = new Dictionary<string, HashSet<string>>();
- for (int i = 0; i < directories.Length; i++)
- {
- string text = directories[i].Substring(length, directories[i].Length - length).ToLower();
- int startIndex = 0;
- foreach (string text2 in array)
- {
- if (text.IndexOf(text2) == 0)
- {
- startIndex = text2.Length;
- break;
- }
- }
- int num = text.IndexOf('_', startIndex);
- if (0 <= num)
- {
- string text3 = text.Substring(0, num);
- if (!string.IsNullOrEmpty(text3))
- {
- string text4 = text.Substring(text3.Length + 1, text.Length - (text3.Length + 1));
- if (!string.IsNullOrEmpty(text4))
- {
- if (!dictionary.ContainsKey(text3))
- {
- dictionary.Add(text3, new HashSet<string>());
- }
- if (!dictionary[text3].Contains(text4))
- {
- dictionary[text3].Add(text4);
- }
- else
- {
- Debug.LogWarning(text3 + "_" + text4 + "は既にリストに存在します");
- }
- }
- }
- }
- else if (!dictionary.ContainsKey(text))
- {
- dictionary.Add(text, new HashSet<string>());
- }
- else
- {
- Debug.LogWarning(text + "は既にリストに存在します");
- }
- }
- return dictionary;
- }
- public static List<string> ReadAutoPathFile(string uniqueName, string filePath)
- {
- if (!File.Exists(filePath))
- {
- return null;
- }
- List<string> list = new List<string>();
- using (FileStream fileStream = new FileStream(filePath, FileMode.Open))
- {
- using (BinaryReader binaryReader = new BinaryReader(fileStream))
- {
- string a = binaryReader.ReadString();
- NDebug.Assert(a == "CM3D2_PATHS", "パスファイルのヘッダーが不正です。");
- int num = binaryReader.ReadInt32();
- int num2 = binaryReader.ReadInt32();
- for (int i = 0; i < num2; i++)
- {
- string item = binaryReader.ReadString();
- list.Add(item);
- }
- }
- }
- return list;
- }
- public static void UpdateFileSystemPath()
- {
- string fullPath = Path.GetFullPath(".\\");
- string gameDataPath = "GameData";
- int check_ver_no = 3;
- Func<string, bool> AddFolderOrArchive = delegate(string name)
- {
- bool flag3 = GameUty.m_FileSystem.AddArchive(gameDataPath + "\\" + name + ".arc");
- if (flag3)
- {
- Debug.Log(string.Concat(new string[]
- {
- "[",
- gameDataPath,
- "\\",
- name,
- ".arc]を読み込みました"
- }));
- }
- if (flag3)
- {
- GameUty.loadArchiveList.Add(name.ToLower());
- }
- return flag3;
- };
- HashSet<string> addedLegacyArchives = new HashSet<string>();
- Action<string> action = delegate(string name)
- {
- foreach (string text29 in GameUty.PathList)
- {
- string text30 = name + "_" + text29;
- bool flag3 = AddFolderOrArchive(text30);
- if (flag3 && !addedLegacyArchives.Contains(text30))
- {
- addedLegacyArchives.Add(text30);
- }
- if (flag3)
- {
- if (name == "csv")
- {
- GameUty.ExistCsvPathList.Add(text29);
- }
- for (int num15 = 2; num15 <= check_ver_no; num15++)
- {
- AddFolderOrArchive(text30 + "_" + num15);
- }
- }
- }
- };
- Action<string> action2 = delegate(string name)
- {
- foreach (string text29 in GameUty.PathList)
- {
- string text30 = name + "_" + text29;
- bool flag3 = AddFolderOrArchive(text30);
- if (!flag3 && addedLegacyArchives.Contains(text30))
- {
- flag3 = true;
- }
- if (flag3)
- {
- if (name == "csv")
- {
- GameUty.ExistCsvPathList.Add(text29);
- }
- for (int num15 = 2; num15 <= check_ver_no; num15++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- name,
- "_",
- text29,
- "_",
- num15
- }));
- }
- }
- }
- };
- Action<string> action3 = delegate(string name)
- {
- foreach (string text29 in GameUty.PathList)
- {
- if (AddFolderOrArchive(name + "_" + text29))
- {
- if (name == "csv")
- {
- GameUty.ExistCsvPathList.Add(text29);
- }
- for (int num15 = 2; num15 <= check_ver_no; num15++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- name,
- "_",
- text29,
- "_",
- num15
- }));
- }
- }
- }
- };
- string str = string.Empty;
- str = "必用アーカイブがありません。GameData\\";
- GameUty.m_FileSystem.SetBaseDirectory(fullPath);
- AddFolderOrArchive("product");
- Product.Initialize(GameUty.m_FileSystem);
- Debug.Log("IsEnabledCompatibilityMode:" + GameUty.IsEnabledCompatibilityMode.ToString());
- string gameTitle = Product.gameTitle;
- string str2 = "カスタムメイド3D 2";
- Debug.Log(string.Concat(new string[]
- {
- gameTitle,
- " GameVersion ",
- GameUty.GetGameVersionText(),
- "(BuildVersion : ",
- GameUty.GetBuildVersionText(),
- ")"
- }));
- if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path))
- {
- Debug.Log(str2 + " GameVersion " + GameUty.GetLegacyGameVersionText());
- }
- if (Product.type != Product.Type.JpAdult)
- {
- GameUty.UpdateFileSystemPathToNewProduct();
- }
- else
- {
- StopWatch stopWatch = new StopWatch();
- if (GameUty.IsEnabledCompatibilityMode)
- {
- Debug.Log("■■■■■■■■ Archive Log[2.0] (CM3D2 GameData) ■■■■■■■■");
- GameUty.m_FileSystem.SetBaseDirectory(GameMain.Instance.CMSystem.CM3D2Path);
- GameUty.PathList = GameUty.PathListOld;
- AddFolderOrArchive("material");
- foreach (string text in GameUty.PathListOld)
- {
- string str3 = "material";
- if (text == "denkigai2015wTowelR")
- {
- AddFolderOrArchive(str3 + "_denkigai2015wTowel");
- }
- string text2 = str3 + "_" + text;
- bool flag = AddFolderOrArchive(text2);
- if (flag && !addedLegacyArchives.Contains(text2))
- {
- addedLegacyArchives.Add(text2);
- }
- if (flag)
- {
- for (int i2 = 2; i2 <= check_ver_no; i2++)
- {
- AddFolderOrArchive(text2 + "_" + i2);
- }
- }
- }
- AddFolderOrArchive("material2");
- AddFolderOrArchive("menu");
- action("menu");
- AddFolderOrArchive("menu2");
- AddFolderOrArchive("model");
- action("model");
- AddFolderOrArchive("model2");
- AddFolderOrArchive("texture");
- action("texture");
- AddFolderOrArchive("texture2");
- AddFolderOrArchive("texture3");
- AddFolderOrArchive("prioritymaterial");
- Debug.Log("■■■■■■■■■■■■■■■■■■■■");
- }
- Debug.Log("■■■■■■■■ Archive Log[2.1 Compatibility] (GameData_20) ■■■■■■■■");
- gameDataPath = "GameData_20";
- GameUty.m_FileSystem.SetBaseDirectory(fullPath);
- if (GameUty.IsEnabledCompatibilityMode)
- {
- GameUty.m_FileSystem.AddPatchDecryptPreferredSearchDirectory(GameMain.Instance.CMSystem.CM3D2Path + "\\GameData");
- }
- GameUty.PathList = GameUty.ReadAutoPathFile("[2.1Compatibility]", fullPath + gameDataPath + "\\paths.dat");
- if (GameUty.PathList != null && 0 < GameUty.PathList.Count)
- {
- foreach (string text3 in GameUty.PathList)
- {
- string text4 = "material";
- if (text3 == "denkigai2015wTowelR")
- {
- AddFolderOrArchive(text4 + "_denkigai2015wTowel");
- }
- string text5 = text4 + "_" + text3;
- bool flag2 = AddFolderOrArchive(text5);
- if (!flag2 && addedLegacyArchives.Contains(text5))
- {
- flag2 = true;
- }
- if (flag2)
- {
- for (int j = 2; j <= check_ver_no; j++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text4,
- "_",
- text3,
- "_",
- j
- }));
- }
- }
- }
- action2("menu");
- action2("model");
- action2("texture");
- AddFolderOrArchive("prioritymaterial");
- List<string> pathList = GameUty.PathList;
- GameUty.PathList = new List<string>();
- GameUty.PathList.Add("vp001");
- action2("bg");
- action2("motion");
- GameUty.PathList = pathList;
- }
- GameUty.m_FileSystem.ClearPatchDecryptPreferredSearchDirectory();
- Debug.Log("■■■■■■■■■■■■■■■■■■■■");
- Debug.Log("■■■■■■■■ Archive Log[2.1] (GameData) ■■■■■■■■");
- gameDataPath = "GameData";
- GameUty.PathList = GameUty.ReadAutoPathFile("[2.1]", fullPath + gameDataPath + "\\paths.dat");
- if (GameUty.PathList == null)
- {
- GameUty.PathList = new List<string>();
- NDebug.Assert("paths.datを読み込めませんでした", false);
- }
- AddFolderOrArchive("csv");
- foreach (string text6 in GameUty.PathList)
- {
- string text7 = "csv";
- if (AddFolderOrArchive(text7 + "_" + text6))
- {
- for (int k = 2; k <= check_ver_no; k++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text7,
- "_",
- text6,
- "_",
- k
- }));
- }
- }
- }
- AddFolderOrArchive("prioritymaterial");
- NDebug.Assert(AddFolderOrArchive("motion"), str + "motion");
- foreach (string text8 in GameUty.PathList)
- {
- string text9 = "motion";
- if (AddFolderOrArchive(text9 + "_" + text8))
- {
- for (int l = 2; l <= check_ver_no; l++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text9,
- "_",
- text8,
- "_",
- l
- }));
- }
- }
- }
- AddFolderOrArchive("motion2");
- NDebug.Assert(AddFolderOrArchive("script"), str + "script");
- foreach (string text10 in GameUty.PathList)
- {
- string text11 = "script";
- if (AddFolderOrArchive(text11 + "_" + text10))
- {
- for (int m = 2; m <= check_ver_no; m++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text11,
- "_",
- text10,
- "_",
- m
- }));
- }
- }
- }
- AddFolderOrArchive("script_share");
- foreach (string text12 in GameUty.PathList)
- {
- string text13 = "script_share";
- if (AddFolderOrArchive(text13 + "_" + text12))
- {
- for (int n = 2; n <= check_ver_no; n++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text13,
- "_",
- text12,
- "_",
- n
- }));
- }
- }
- }
- AddFolderOrArchive("script_share2");
- NDebug.Assert(AddFolderOrArchive("sound"), str + "sound");
- foreach (string text14 in GameUty.PathList)
- {
- string text15 = "sound";
- if (AddFolderOrArchive(text15 + "_" + text14))
- {
- for (int num = 2; num <= check_ver_no; num++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text15,
- "_",
- text14,
- "_",
- num
- }));
- }
- }
- }
- AddFolderOrArchive("sound2");
- NDebug.Assert(AddFolderOrArchive("system"), str + "system");
- foreach (string text16 in GameUty.PathList)
- {
- string text17 = "system";
- if (AddFolderOrArchive(text17 + "_" + text16))
- {
- for (int num2 = 2; num2 <= check_ver_no; num2++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text17,
- "_",
- text16,
- "_",
- num2
- }));
- }
- }
- }
- AddFolderOrArchive("system2");
- AddFolderOrArchive("language");
- foreach (string text18 in GameUty.PathList)
- {
- string text19 = "language";
- if (AddFolderOrArchive(text19 + "_" + text18))
- {
- for (int num3 = 2; num3 <= check_ver_no; num3++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text19,
- "_",
- text18,
- "_",
- num3
- }));
- }
- }
- }
- foreach (string text20 in GameUty.PathList)
- {
- string text21 = "bg";
- if (AddFolderOrArchive(text21 + "_" + text20))
- {
- for (int num4 = 2; num4 <= check_ver_no; num4++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text21,
- "_",
- text20,
- "_",
- num4
- }));
- }
- }
- }
- if (Product.isEnglish && !Product.isPublic)
- {
- string text22 = "bg-en";
- NDebug.Assert(AddFolderOrArchive(text22), str + text22);
- foreach (string text23 in GameUty.PathList)
- {
- if (AddFolderOrArchive(text22 + "_" + text23))
- {
- for (int num5 = 2; num5 <= check_ver_no; num5++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text22,
- "_",
- text23,
- "_",
- num5
- }));
- }
- }
- }
- AddFolderOrArchive("bg-en2");
- }
- AddFolderOrArchive("voice");
- for (int num6 = 0; num6 < 25; num6++)
- {
- string arg = "voice";
- string arg2 = arg + "_" + (char)(97 + num6);
- AddFolderOrArchive(arg2);
- }
- foreach (string text24 in GameUty.PathList)
- {
- string text25 = "voice";
- if (AddFolderOrArchive(text25 + "_" + text24))
- {
- for (int num7 = 2; num7 <= check_ver_no; num7++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text25,
- "_",
- text24,
- "_",
- num7
- }));
- }
- }
- }
- for (int num8 = 2; num8 <= check_ver_no; num8++)
- {
- string arg3 = "voice";
- AddFolderOrArchive(arg3 + num8);
- }
- string text26 = "parts";
- NDebug.Assert(AddFolderOrArchive(text26), str + text26);
- foreach (string text27 in GameUty.PathList)
- {
- if (AddFolderOrArchive(text26 + "_" + text27))
- {
- for (int num9 = 2; num9 <= check_ver_no; num9++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text26,
- "_",
- text27,
- "_",
- num9
- }));
- }
- }
- }
- AddFolderOrArchive("parts2");
- Debug.Log("■■■■■■■■■■■■■■■■■■■■" + stopWatch.Stop().ToString() + " ms");
- }
- GameUty.m_FileSystem.AddAutoPathForAllFolder();
- GameUty.BgFiles = new Dictionary<string, AFileSystemBase>();
- string[] list = GameUty.m_FileSystem.GetList("bg", AFileSystemBase.ListType.AllFile);
- if (list != null && 0 < list.Length)
- {
- foreach (string path in list)
- {
- string fileName = Path.GetFileName(path);
- if (!(Path.GetExtension(fileName) != ".asset_bg") && !GameUty.BgFiles.ContainsKey(fileName))
- {
- GameUty.BgFiles.Add(fileName, GameUty.m_FileSystem);
- }
- }
- }
- if (Product.supportMultiLanguage)
- {
- list = GameUty.m_FileSystem.GetList("language", AFileSystemBase.ListType.AllFile);
- if (list != null && 0 < list.Length)
- {
- foreach (string path2 in list)
- {
- string fileName2 = Path.GetFileName(path2);
- if (!(Path.GetExtension(fileName2) != ".asset_language"))
- {
- using (AFileBase afileBase = GameUty.m_FileSystem.FileOpen(fileName2))
- {
- AssetBundle assetBundle = AssetBundle.LoadFromMemory(afileBase.ReadAll());
- LanguageSource languageSource = UnityEngine.Object.Instantiate<LanguageSource>(assetBundle.LoadAllAssets<GameObject>()[0].GetComponent<LanguageSource>());
- if (GameMain.Instance.transform.Find("Language") == null)
- {
- new GameObject("Language").transform.SetParent(GameMain.Instance.transform);
- }
- languageSource.transform.SetParent(GameMain.Instance.transform.Find("Language"));
- assetBundle.Unload(true);
- }
- }
- }
- }
- foreach (LanguageSource languageSource2 in LocalizationManager.Sources)
- {
- languageSource2.LoadAllLanguages(false);
- }
- }
- if (Directory.Exists(fullPath + "Mod"))
- {
- GameUty.m_ModFileSystem = new FileSystemWindows();
- GameUty.m_ModFileSystem.SetBaseDirectory(fullPath);
- GameUty.m_ModFileSystem.AddFolder("Mod");
- string[] list2 = GameUty.m_ModFileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFolder);
- foreach (string text28 in list2)
- {
- if (!GameUty.m_ModFileSystem.AddAutoPath(text28))
- {
- Debug.Log("m_ModFileSystemのAddAutoPathには既に " + text28 + " がありました。");
- }
- }
- }
- string[] fileListAtExtension = GameUty.m_FileSystem.GetFileListAtExtension(".menu");
- List<string> list3 = new List<string>();
- foreach (string path3 in fileListAtExtension)
- {
- list3.Add(Path.GetFileName(path3));
- }
- GameUty.m_aryMenuFiles = list3.ToArray();
- if (GameUty.m_ModFileSystem != null)
- {
- string[] list4 = GameUty.m_ModFileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFile);
- GameUty.m_aryModOnlysMenuFiles = Array.FindAll<string>(list4, (string i) => new Regex(".*\\.menu$").IsMatch(i));
- GameUty.m_aryMenuFiles = GameUty.m_aryMenuFiles.Concat(GameUty.m_aryModOnlysMenuFiles).ToArray<string>();
- }
- if (GameUty.m_aryModOnlysMenuFiles != null && GameUty.m_aryModOnlysMenuFiles.Length != 0)
- {
- GameUty.ModPriorityToModFolderInfo = string.Empty;
- Debug.Log(GameUty.ModPriorityToModFolderInfo + "■MOD有り。MODフォルダ優先モード" + GameUty.ModPriorityToModFolder.ToString());
- }
- if (GameUty.rid_menu_dic_.Count == 0)
- {
- string[] menuFiles = GameUty.MenuFiles;
- GameUty.rid_menu_dic_ = new Dictionary<int, string>();
- for (int num14 = 0; num14 < menuFiles.Length; num14++)
- {
- string fileName3 = Path.GetFileName(menuFiles[num14]);
- int hashCode = fileName3.ToLower().GetHashCode();
- if (!GameUty.rid_menu_dic_.ContainsKey(hashCode))
- {
- GameUty.rid_menu_dic_.Add(hashCode, fileName3);
- }
- else
- {
- NDebug.Assert(fileName3 == GameUty.rid_menu_dic_[hashCode], string.Concat(new string[]
- {
- "[",
- fileName3,
- "]と[",
- GameUty.rid_menu_dic_[hashCode],
- "]は同じハッシュキーです"
- }));
- }
- }
- }
- }
- public static void UpdateFileSystemPathToNewProduct()
- {
- string fullPath = Path.GetFullPath(".\\");
- string gameDataPath = "GameData";
- string str = string.Empty;
- str = "必用アーカイブがありません。GameData" + Product.gameDataPath + "\\";
- int check_ver_no = 3;
- Func<string, bool> AddFolderOrArchive = delegate(string name)
- {
- string gameDataPath = gameDataPath;
- bool flag2 = GameUty.m_FileSystem.AddArchive(gameDataPath + "\\" + name + ".arc");
- if (flag2)
- {
- Debug.Log(string.Concat(new string[]
- {
- "[",
- gameDataPath,
- "\\",
- name,
- ".arc]を読み込みました"
- }));
- }
- if (flag2)
- {
- GameUty.loadArchiveList.Add(name.ToLower());
- }
- return flag2;
- };
- Action<string> action = delegate(string name)
- {
- foreach (string text27 in GameUty.PathList)
- {
- string arg5 = name + "_" + text27;
- bool flag2 = AddFolderOrArchive(arg5);
- if (flag2)
- {
- if (name == "csv")
- {
- GameUty.ExistCsvPathList.Add(text27);
- }
- for (int num10 = 2; num10 <= check_ver_no; num10++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- name,
- "_",
- text27,
- "_",
- num10
- }));
- }
- }
- }
- };
- Action<string> action2 = delegate(string name)
- {
- foreach (string text27 in GameUty.PathList)
- {
- if (AddFolderOrArchive(name + "_" + text27))
- {
- if (name == "csv")
- {
- GameUty.ExistCsvPathList.Add(text27);
- }
- for (int num10 = 2; num10 <= check_ver_no; num10++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- name,
- "_",
- text27,
- "_",
- num10
- }));
- }
- }
- }
- };
- StopWatch stopWatch = new StopWatch();
- Debug.Log("■■■■■■■■ Archive Log[2.1 Compatibility] (GameData_20) ■■■■■■■■");
- gameDataPath = "GameData_20";
- GameUty.m_FileSystem.SetBaseDirectory(fullPath);
- GameUty.PathList = GameUty.ReadAutoPathFile("[2.1Compatibility]", fullPath + gameDataPath + "\\paths.dat");
- if (GameUty.PathList != null && 0 < GameUty.PathList.Count)
- {
- foreach (string text in GameUty.PathList)
- {
- string text2 = "material";
- if (text == "denkigai2015wTowelR")
- {
- AddFolderOrArchive(text2 + "_denkigai2015wTowel");
- }
- string arg = text2 + "_" + text;
- bool flag = AddFolderOrArchive(arg);
- if (flag)
- {
- for (int i = 2; i <= check_ver_no; i++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text2,
- "_",
- text,
- "_",
- i
- }));
- }
- }
- }
- action("menu");
- action("model");
- action("texture");
- AddFolderOrArchive("prioritymaterial");
- List<string> pathList = GameUty.PathList;
- GameUty.PathList = new List<string>();
- GameUty.PathList.Add("vp001");
- action("bg");
- action("motion");
- GameUty.PathList = pathList;
- }
- Debug.Log("■■■■■■■■■■■■■■■■■■■■");
- Debug.Log("■■■■■■■■ Archive Log[2.1] (GameData) ■■■■■■■■");
- gameDataPath = "GameData";
- GameUty.PathList = GameUty.ReadAutoPathFile("[2.1]", fullPath + gameDataPath + "\\paths.dat");
- if (GameUty.PathList == null)
- {
- GameUty.PathList = new List<string>();
- NDebug.Assert("paths.datを読み込めませんでした", false);
- }
- GameUty.PathList.Add(Product.gameDataPath.Replace("_", string.Empty));
- AddFolderOrArchive("csv");
- foreach (string text3 in GameUty.PathList)
- {
- string text4 = "csv";
- if (AddFolderOrArchive(text4 + "_" + text3))
- {
- for (int j = 2; j <= check_ver_no; j++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text4,
- "_",
- text3,
- "_",
- j
- }));
- }
- }
- }
- AddFolderOrArchive("prioritymaterial");
- NDebug.Assert(AddFolderOrArchive("motion"), str + "motion");
- foreach (string text5 in GameUty.PathList)
- {
- string text6 = "motion";
- if (AddFolderOrArchive(text6 + "_" + text5))
- {
- for (int k = 2; k <= check_ver_no; k++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text6,
- "_",
- text5,
- "_",
- k
- }));
- }
- }
- }
- AddFolderOrArchive("motion2");
- NDebug.Assert(AddFolderOrArchive("script"), str + "script");
- foreach (string text7 in GameUty.PathList)
- {
- string text8 = "script";
- if (AddFolderOrArchive(text8 + "_" + text7))
- {
- for (int l = 2; l <= check_ver_no; l++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text8,
- "_",
- text7,
- "_",
- l
- }));
- }
- }
- }
- AddFolderOrArchive("script_share");
- foreach (string text9 in GameUty.PathList)
- {
- string text10 = "script_share";
- if (AddFolderOrArchive(text10 + "_" + text9))
- {
- for (int m = 2; m <= check_ver_no; m++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text10,
- "_",
- text9,
- "_",
- m
- }));
- }
- }
- }
- AddFolderOrArchive("script_share2");
- NDebug.Assert(AddFolderOrArchive("sound"), str + "sound");
- foreach (string text11 in GameUty.PathList)
- {
- string text12 = "sound";
- if (AddFolderOrArchive(text12 + "_" + text11))
- {
- for (int n = 2; n <= check_ver_no; n++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text12,
- "_",
- text11,
- "_",
- n
- }));
- }
- }
- }
- AddFolderOrArchive("sound2");
- NDebug.Assert(AddFolderOrArchive("system"), str + "system");
- foreach (string text13 in GameUty.PathList)
- {
- string text14 = "system";
- if (AddFolderOrArchive(text14 + "_" + text13))
- {
- for (int num = 2; num <= check_ver_no; num++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text14,
- "_",
- text13,
- "_",
- num
- }));
- }
- }
- }
- AddFolderOrArchive("system2");
- AddFolderOrArchive("language");
- foreach (string text15 in GameUty.PathList)
- {
- string text16 = "language";
- if (AddFolderOrArchive(text16 + "_" + text15))
- {
- for (int num2 = 2; num2 <= check_ver_no; num2++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text16,
- "_",
- text15,
- "_",
- num2
- }));
- }
- }
- }
- foreach (string text17 in GameUty.PathList)
- {
- string text18 = "bg";
- if (AddFolderOrArchive(text18 + "_" + text17))
- {
- for (int num3 = 2; num3 <= check_ver_no; num3++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text18,
- "_",
- text17,
- "_",
- num3
- }));
- }
- }
- }
- if (Product.isEnglish && !Product.isPublic)
- {
- string text19 = "bg-en";
- NDebug.Assert(AddFolderOrArchive(text19), str + text19);
- foreach (string text20 in GameUty.PathList)
- {
- if (AddFolderOrArchive(text19 + "_" + text20))
- {
- for (int num4 = 2; num4 <= check_ver_no; num4++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text19,
- "_",
- text20,
- "_",
- num4
- }));
- }
- }
- }
- AddFolderOrArchive("bg-en2");
- }
- AddFolderOrArchive("voice");
- for (int num5 = 0; num5 < 25; num5++)
- {
- string arg2 = "voice";
- string arg3 = arg2 + "_" + (char)(97 + num5);
- AddFolderOrArchive(arg3);
- }
- foreach (string text21 in GameUty.PathList)
- {
- string text22 = "voice";
- if (AddFolderOrArchive(text22 + "_" + text21))
- {
- for (int num6 = 2; num6 <= check_ver_no; num6++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text22,
- "_",
- text21,
- "_",
- num6
- }));
- }
- }
- }
- for (int num7 = 2; num7 <= check_ver_no; num7++)
- {
- string arg4 = "voice";
- AddFolderOrArchive(arg4 + num7);
- }
- string text23 = "parts";
- NDebug.Assert(AddFolderOrArchive(text23), str + text23);
- foreach (string text24 in GameUty.PathList)
- {
- if (AddFolderOrArchive(text23 + "_" + text24))
- {
- for (int num8 = 2; num8 <= check_ver_no; num8++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text23,
- "_",
- text24,
- "_",
- num8
- }));
- }
- }
- }
- AddFolderOrArchive("parts2");
- if (Product.isEnglish && !Product.isPublic)
- {
- string text25 = "parts-en";
- NDebug.Assert(AddFolderOrArchive(text25), str + text25);
- foreach (string text26 in GameUty.PathList)
- {
- if (AddFolderOrArchive(text25 + "_" + text26))
- {
- for (int num9 = 2; num9 <= check_ver_no; num9++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text25,
- "_",
- text26,
- "_",
- num9
- }));
- }
- }
- }
- AddFolderOrArchive("parts-en2");
- }
- Debug.Log("■■■■■■■■■■■■■■■■■■■■" + stopWatch.Stop().ToString() + " ms");
- }
- public static void UpdateFileSystemPathOld()
- {
- if (!GameUty.IsEnabledCompatibilityMode)
- {
- return;
- }
- FileSystemArchive fileSystem = GameUty.m_FileSystemOld;
- Debug.Log("■■■■■■■■ Archive Log[Legacy]■■■■■■■■");
- Func<string, bool> AddFolderOrArchive = delegate(string name)
- {
- bool flag = fileSystem.AddArchive("GameData\\" + name + ".arc");
- if (flag)
- {
- Debug.Log("[GameData\\" + name + ".arc]を読み込みました");
- }
- return flag;
- };
- int check_ver_no = 3;
- Action<string> action = delegate(string name)
- {
- foreach (string text2 in GameUty.PathListOld)
- {
- if (AddFolderOrArchive(name + "_" + text2))
- {
- if (name == "csv")
- {
- GameUty.ExistCsvPathListOld.Add(text2);
- }
- for (int m = 2; m <= check_ver_no; m++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- name,
- "_",
- text2,
- "_",
- m
- }));
- }
- }
- }
- };
- fileSystem.SetBaseDirectory(GameMain.Instance.CMSystem.CM3D2Path);
- AddFolderOrArchive("csv");
- action("csv");
- AddFolderOrArchive("motion");
- action("motion");
- AddFolderOrArchive("motion2");
- AddFolderOrArchive("script");
- action("script");
- action("script_share");
- AddFolderOrArchive("script_share2");
- AddFolderOrArchive("sound");
- action("sound");
- AddFolderOrArchive("sound2");
- AddFolderOrArchive("texture");
- action("texture");
- AddFolderOrArchive("texture2");
- AddFolderOrArchive("texture3");
- AddFolderOrArchive("system");
- action("system");
- action("bg");
- AddFolderOrArchive("voice");
- AddFolderOrArchive("voice_a");
- AddFolderOrArchive("voice_b");
- AddFolderOrArchive("voice_c");
- foreach (string str in GameUty.PathListOld)
- {
- string str2 = "voice";
- string text = str2 + "_" + str;
- if (AddFolderOrArchive(text))
- {
- for (int i = 2; i <= check_ver_no; i++)
- {
- AddFolderOrArchive(text + "_" + i);
- }
- }
- text = str2 + "_" + str + "a";
- if (AddFolderOrArchive(text))
- {
- for (int j = 2; j <= check_ver_no; j++)
- {
- AddFolderOrArchive(text + "_" + j);
- }
- }
- text = str2 + "_" + str + "b";
- if (AddFolderOrArchive(text))
- {
- for (int k = 2; k <= check_ver_no; k++)
- {
- AddFolderOrArchive(text + "_" + k);
- }
- }
- }
- AddFolderOrArchive("voice2");
- AddFolderOrArchive("voice3");
- fileSystem.AddAutoPathForAllFolder();
- string[] list = fileSystem.GetList("bg", AFileSystemBase.ListType.AllFile);
- if (list != null && 0 < list.Length)
- {
- foreach (string path in list)
- {
- string fileName = Path.GetFileName(path);
- if (!(Path.GetExtension(fileName) != ".asset_bg") && !GameUty.BgFiles.ContainsKey(fileName))
- {
- GameUty.BgFiles.Add(fileName, fileSystem);
- }
- }
- }
- Debug.Log("■■■■■■■■■■■■■■■■■■■■");
- }
- public static AFileBase FileOpen(string fileName, AFileSystemBase priorityFileSystem = null)
- {
- if (priorityFileSystem == null)
- {
- priorityFileSystem = GameUty.m_FileSystem;
- }
- AFileSystemBase[] array;
- if (GameUty.ModPriorityToModFolder)
- {
- array = new AFileSystemBase[]
- {
- GameUty.m_ModFileSystem,
- priorityFileSystem
- };
- }
- else
- {
- array = new AFileSystemBase[]
- {
- priorityFileSystem,
- GameUty.m_ModFileSystem
- };
- }
- AFileBase result = null;
- foreach (AFileSystemBase afileSystemBase in array)
- {
- if (afileSystemBase != null && afileSystemBase.IsExistentFile(fileName))
- {
- result = afileSystemBase.FileOpen(fileName);
- break;
- }
- }
- return result;
- }
- public static bool IsExistFile(string fileName, AFileSystemBase priorityFileSystem = null)
- {
- if (priorityFileSystem == null)
- {
- priorityFileSystem = GameUty.m_FileSystem;
- }
- AFileSystemBase[] array;
- if (GameUty.ModPriorityToModFolder)
- {
- array = new AFileSystemBase[]
- {
- GameUty.m_ModFileSystem,
- priorityFileSystem
- };
- }
- else
- {
- array = new AFileSystemBase[]
- {
- priorityFileSystem,
- GameUty.m_ModFileSystem
- };
- }
- foreach (AFileSystemBase afileSystemBase in array)
- {
- if (afileSystemBase != null && afileSystemBase.IsExistentFile(fileName))
- {
- return true;
- }
- }
- return false;
- }
- public static string GetBuildVersionText()
- {
- int num = 1300;
- return (num >= 1000) ? ((float)num / 1000f).ToString("F2") : ((float)num / 100f).ToString("F2");
- }
- public static string GetGameVersionText()
- {
- string text = "COM3D2x64.exe";
- int num = 1300;
- string path = Path.GetFullPath(".\\") + "update.lst";
- string[] array = new string[0];
- if (File.Exists(path))
- {
- try
- {
- array = File.ReadAllLines(path, Encoding.GetEncoding("utf-8"));
- }
- catch (Exception ex)
- {
- Debug.LogError(ex.Message);
- array = new string[0];
- }
- }
- foreach (string text2 in array)
- {
- if (!string.IsNullOrEmpty(text2))
- {
- string[] array3 = text2.Split(new char[]
- {
- ','
- });
- if (array3 != null && array3.Length == 2 && array3[0].Trim().ToLower() == text.ToLower())
- {
- int.TryParse(array3[1].Trim(), out num);
- break;
- }
- }
- }
- string text3 = (num >= 1000) ? ((float)num / 1000f).ToString("F3") : ((float)num / 100f).ToString("F3");
- if (text3.Length == 5)
- {
- text3 = text3.Insert(4, ".");
- }
- return text3;
- }
- public static string GetLegacyGameVersionText()
- {
- if (!GameUty.IsEnabledCompatibilityMode)
- {
- return "0.0";
- }
- string text = "CM3D2x64.exe";
- string path = GameMain.Instance.CMSystem.CM3D2Path + "\\update.lst";
- string[] array = new string[0];
- if (File.Exists(path))
- {
- try
- {
- array = File.ReadAllLines(path, Encoding.GetEncoding("utf-8"));
- }
- catch (Exception ex)
- {
- Debug.LogError(ex.Message);
- array = new string[0];
- }
- }
- int num = 0;
- foreach (string text2 in array)
- {
- if (!string.IsNullOrEmpty(text2))
- {
- string[] array3 = text2.Split(new char[]
- {
- ','
- });
- if (array3 != null && array3.Length == 2 && array3 != null && array3.Length == 2 && array3[0].Trim().ToLower() == text.ToLower())
- {
- int.TryParse(array3[1].Trim(), out num);
- break;
- }
- }
- }
- string text3 = (num >= 1000) ? ((float)num / 1000f).ToString("F3") : ((float)num / 100f).ToString("F3");
- if (text3.Length == 5)
- {
- text3 = text3.Insert(4, ".");
- }
- return text3;
- }
- private static FileSystemArchive m_FileSystem = null;
- private static FileSystemArchive m_FileSystemOld = null;
- private static FileSystemWindows m_ModFileSystem = null;
- public static List<string> PathList = new List<string>();
- public static List<string> ExistCsvPathList = new List<string>();
- public static List<string> PathListOld = new List<string>();
- public static List<string> ExistCsvPathListOld = new List<string>();
- private static string[] m_aryMenuFiles = null;
- private static string[] m_aryModOnlysMenuFiles = new string[0];
- private static Dictionary<int, string> rid_menu_dic_ = new Dictionary<int, string>();
- private static Dictionary<string, AssetBundle> asset_bundle_dic = new Dictionary<string, AssetBundle>();
- private static string ModPriorityToModFolderInfo = "以下のフラグをtrueにするとMODフォルダのファイルが優先されるが、モザイクも安易に外すことが可能になる為に現在はオミット。";
- public static bool ModPriorityToModFolder = false;
- private static string[] m_strSystemMaterialName = new string[]
- {
- "System/Material/2dAlpha",
- "System/Material/2dMultiply",
- "System/Material/InfinityColor",
- "System/Material/TexTo8bitTex"
- };
- private static Material[] m_matSystem = new Material[4];
- public enum SystemMaterial
- {
- Alpha,
- Multiply,
- InfinityColor,
- TexTo8bitTex,
- Max
- }
- }
|