12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541 |
- 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 text = UTY.gameProjectPath + "\\";
- 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 text30 in GameUty.PathList)
- {
- string text31 = name + "_" + text30;
- bool flag3 = AddFolderOrArchive(text31);
- if (flag3 && !addedLegacyArchives.Contains(text31))
- {
- addedLegacyArchives.Add(text31);
- }
- if (flag3)
- {
- if (name == "csv")
- {
- GameUty.ExistCsvPathList.Add(text30);
- }
- for (int num15 = 2; num15 <= check_ver_no; num15++)
- {
- AddFolderOrArchive(text31 + "_" + num15);
- }
- }
- }
- };
- Action<string> action2 = delegate(string name)
- {
- foreach (string text30 in GameUty.PathList)
- {
- string text31 = name + "_" + text30;
- bool flag3 = AddFolderOrArchive(text31);
- if (!flag3 && addedLegacyArchives.Contains(text31))
- {
- flag3 = true;
- }
- if (flag3)
- {
- if (name == "csv")
- {
- GameUty.ExistCsvPathList.Add(text30);
- }
- for (int num15 = 2; num15 <= check_ver_no; num15++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- name,
- "_",
- text30,
- "_",
- num15
- }));
- }
- }
- }
- };
- Action<string> action3 = delegate(string name)
- {
- foreach (string text30 in GameUty.PathList)
- {
- if (AddFolderOrArchive(name + "_" + text30))
- {
- if (name == "csv")
- {
- GameUty.ExistCsvPathList.Add(text30);
- }
- for (int num15 = 2; num15 <= check_ver_no; num15++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- name,
- "_",
- text30,
- "_",
- num15
- }));
- }
- }
- }
- };
- string str = string.Empty;
- str = "必用アーカイブがありません。GameData\\";
- GameUty.m_FileSystem.SetBaseDirectory(text);
- 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 text2 in GameUty.PathListOld)
- {
- string str3 = "material";
- if (text2 == "denkigai2015wTowelR")
- {
- AddFolderOrArchive(str3 + "_denkigai2015wTowel");
- }
- string text3 = str3 + "_" + text2;
- bool flag = AddFolderOrArchive(text3);
- if (flag && !addedLegacyArchives.Contains(text3))
- {
- addedLegacyArchives.Add(text3);
- }
- if (flag)
- {
- for (int i2 = 2; i2 <= check_ver_no; i2++)
- {
- AddFolderOrArchive(text3 + "_" + 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(text);
- if (GameUty.IsEnabledCompatibilityMode)
- {
- GameUty.m_FileSystem.AddPatchDecryptPreferredSearchDirectory(GameMain.Instance.CMSystem.CM3D2Path + "\\GameData");
- }
- GameUty.PathList = GameUty.ReadAutoPathFile("[2.1Compatibility]", text + gameDataPath + "\\paths.dat");
- if (GameUty.PathList != null && 0 < GameUty.PathList.Count)
- {
- foreach (string text4 in GameUty.PathList)
- {
- string text5 = "material";
- if (text4 == "denkigai2015wTowelR")
- {
- AddFolderOrArchive(text5 + "_denkigai2015wTowel");
- }
- string text6 = text5 + "_" + text4;
- bool flag2 = AddFolderOrArchive(text6);
- if (!flag2 && addedLegacyArchives.Contains(text6))
- {
- flag2 = true;
- }
- if (flag2)
- {
- for (int j = 2; j <= check_ver_no; j++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text5,
- "_",
- text4,
- "_",
- 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]", text + gameDataPath + "\\paths.dat");
- if (GameUty.PathList == null)
- {
- GameUty.PathList = new List<string>();
- NDebug.Assert("paths.datを読み込めませんでした", false);
- }
- GameUty.PathList.Add("jp");
- AddFolderOrArchive("csv");
- foreach (string text7 in GameUty.PathList)
- {
- string text8 = "csv";
- if (AddFolderOrArchive(text8 + "_" + text7))
- {
- for (int k = 2; k <= check_ver_no; k++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text8,
- "_",
- text7,
- "_",
- k
- }));
- }
- }
- }
- AddFolderOrArchive("prioritymaterial");
- NDebug.Assert(AddFolderOrArchive("motion"), str + "motion");
- foreach (string text9 in GameUty.PathList)
- {
- string text10 = "motion";
- if (AddFolderOrArchive(text10 + "_" + text9))
- {
- for (int l = 2; l <= check_ver_no; l++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text10,
- "_",
- text9,
- "_",
- l
- }));
- }
- }
- }
- AddFolderOrArchive("motion2");
- NDebug.Assert(AddFolderOrArchive("script"), str + "script");
- foreach (string text11 in GameUty.PathList)
- {
- string text12 = "script";
- if (AddFolderOrArchive(text12 + "_" + text11))
- {
- for (int m = 2; m <= check_ver_no; m++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text12,
- "_",
- text11,
- "_",
- m
- }));
- }
- }
- }
- AddFolderOrArchive("script_share");
- foreach (string text13 in GameUty.PathList)
- {
- string text14 = "script_share";
- if (AddFolderOrArchive(text14 + "_" + text13))
- {
- for (int n = 2; n <= check_ver_no; n++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text14,
- "_",
- text13,
- "_",
- n
- }));
- }
- }
- }
- AddFolderOrArchive("script_share2");
- NDebug.Assert(AddFolderOrArchive("sound"), str + "sound");
- foreach (string text15 in GameUty.PathList)
- {
- string text16 = "sound";
- if (AddFolderOrArchive(text16 + "_" + text15))
- {
- for (int num = 2; num <= check_ver_no; num++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text16,
- "_",
- text15,
- "_",
- num
- }));
- }
- }
- }
- AddFolderOrArchive("sound2");
- NDebug.Assert(AddFolderOrArchive("system"), str + "system");
- foreach (string text17 in GameUty.PathList)
- {
- string text18 = "system";
- if (AddFolderOrArchive(text18 + "_" + text17))
- {
- for (int num2 = 2; num2 <= check_ver_no; num2++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text18,
- "_",
- text17,
- "_",
- num2
- }));
- }
- }
- }
- AddFolderOrArchive("system2");
- AddFolderOrArchive("language");
- foreach (string text19 in GameUty.PathList)
- {
- string text20 = "language";
- if (AddFolderOrArchive(text20 + "_" + text19))
- {
- for (int num3 = 2; num3 <= check_ver_no; num3++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text20,
- "_",
- text19,
- "_",
- num3
- }));
- }
- }
- }
- foreach (string text21 in GameUty.PathList)
- {
- string text22 = "bg";
- if (AddFolderOrArchive(text22 + "_" + text21))
- {
- for (int num4 = 2; num4 <= check_ver_no; num4++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text22,
- "_",
- text21,
- "_",
- num4
- }));
- }
- }
- }
- if (Product.isEnglish && !Product.isPublic)
- {
- string text23 = "bg-en";
- NDebug.Assert(AddFolderOrArchive(text23), str + text23);
- foreach (string text24 in GameUty.PathList)
- {
- if (AddFolderOrArchive(text23 + "_" + text24))
- {
- for (int num5 = 2; num5 <= check_ver_no; num5++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text23,
- "_",
- text24,
- "_",
- 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 text25 in GameUty.PathList)
- {
- string text26 = "voice";
- if (AddFolderOrArchive(text26 + "_" + text25))
- {
- for (int num7 = 2; num7 <= check_ver_no; num7++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text26,
- "_",
- text25,
- "_",
- num7
- }));
- }
- }
- }
- for (int num8 = 2; num8 <= check_ver_no; num8++)
- {
- string arg3 = "voice";
- AddFolderOrArchive(arg3 + num8);
- }
- string text27 = "parts";
- NDebug.Assert(AddFolderOrArchive(text27), str + text27);
- foreach (string text28 in GameUty.PathList)
- {
- if (AddFolderOrArchive(text27 + "_" + text28))
- {
- for (int num9 = 2; num9 <= check_ver_no; num9++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text27,
- "_",
- text28,
- "_",
- num9
- }));
- }
- }
- }
- AddFolderOrArchive("parts2");
- Debug.Log("■■■■■■■■■■■■■■■■■■■■" + stopWatch.Stop().ToString() + " ms");
- }
- GameUty.m_FileSystem.AddAutoPathForAllFolder();
- if (Product.isPublic && !GameUty.m_FileSystem.IsExistentFile("21C399027026.dat"))
- {
- NDebug.MessageBox("Error", Product.type.ToString() + " : 21C399027026.dat");
- Application.Quit();
- return;
- }
- 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(text + "Mod"))
- {
- GameUty.m_ModFileSystem = new FileSystemWindows();
- GameUty.m_ModFileSystem.SetBaseDirectory(text);
- GameUty.m_ModFileSystem.AddFolder("Mod");
- string[] list2 = GameUty.m_ModFileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFolder);
- foreach (string text29 in list2)
- {
- if (!GameUty.m_ModFileSystem.AddAutoPath(text29))
- {
- Debug.Log("m_ModFileSystemのAddAutoPathには既に " + text29 + " がありました。");
- }
- }
- }
- 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 text = UTY.gameProjectPath + "\\";
- 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 text28 in GameUty.PathList)
- {
- string arg5 = name + "_" + text28;
- bool flag2 = AddFolderOrArchive(arg5);
- if (flag2)
- {
- if (name == "csv")
- {
- GameUty.ExistCsvPathList.Add(text28);
- }
- for (int num10 = 2; num10 <= check_ver_no; num10++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- name,
- "_",
- text28,
- "_",
- num10
- }));
- }
- }
- }
- };
- Action<string> action2 = delegate(string name)
- {
- foreach (string text28 in GameUty.PathList)
- {
- if (AddFolderOrArchive(name + "_" + text28))
- {
- if (name == "csv")
- {
- GameUty.ExistCsvPathList.Add(text28);
- }
- for (int num10 = 2; num10 <= check_ver_no; num10++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- name,
- "_",
- text28,
- "_",
- num10
- }));
- }
- }
- }
- };
- StopWatch stopWatch = new StopWatch();
- Debug.Log("■■■■■■■■ Archive Log[2.1 Compatibility] (GameData_20) ■■■■■■■■");
- gameDataPath = "GameData_20";
- GameUty.m_FileSystem.SetBaseDirectory(text);
- GameUty.PathList = GameUty.ReadAutoPathFile("[2.1Compatibility]", text + gameDataPath + "\\paths.dat");
- if (GameUty.PathList != null && 0 < GameUty.PathList.Count)
- {
- foreach (string text2 in GameUty.PathList)
- {
- string text3 = "material";
- if (text2 == "denkigai2015wTowelR")
- {
- AddFolderOrArchive(text3 + "_denkigai2015wTowel");
- }
- string arg = text3 + "_" + text2;
- bool flag = AddFolderOrArchive(arg);
- if (flag)
- {
- for (int i = 2; i <= check_ver_no; i++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text3,
- "_",
- text2,
- "_",
- 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]", text + 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 text4 in GameUty.PathList)
- {
- string text5 = "csv";
- if (AddFolderOrArchive(text5 + "_" + text4))
- {
- for (int j = 2; j <= check_ver_no; j++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text5,
- "_",
- text4,
- "_",
- j
- }));
- }
- }
- }
- AddFolderOrArchive("prioritymaterial");
- NDebug.Assert(AddFolderOrArchive("motion"), str + "motion");
- foreach (string text6 in GameUty.PathList)
- {
- string text7 = "motion";
- if (AddFolderOrArchive(text7 + "_" + text6))
- {
- for (int k = 2; k <= check_ver_no; k++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text7,
- "_",
- text6,
- "_",
- k
- }));
- }
- }
- }
- AddFolderOrArchive("motion2");
- NDebug.Assert(AddFolderOrArchive("script"), str + "script");
- foreach (string text8 in GameUty.PathList)
- {
- string text9 = "script";
- if (AddFolderOrArchive(text9 + "_" + text8))
- {
- for (int l = 2; l <= check_ver_no; l++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text9,
- "_",
- text8,
- "_",
- l
- }));
- }
- }
- }
- AddFolderOrArchive("script_share");
- foreach (string text10 in GameUty.PathList)
- {
- string text11 = "script_share";
- if (AddFolderOrArchive(text11 + "_" + text10))
- {
- for (int m = 2; m <= check_ver_no; m++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text11,
- "_",
- text10,
- "_",
- m
- }));
- }
- }
- }
- AddFolderOrArchive("script_share2");
- NDebug.Assert(AddFolderOrArchive("sound"), str + "sound");
- foreach (string text12 in GameUty.PathList)
- {
- string text13 = "sound";
- if (AddFolderOrArchive(text13 + "_" + text12))
- {
- for (int n = 2; n <= check_ver_no; n++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text13,
- "_",
- text12,
- "_",
- n
- }));
- }
- }
- }
- AddFolderOrArchive("sound2");
- NDebug.Assert(AddFolderOrArchive("system"), str + "system");
- foreach (string text14 in GameUty.PathList)
- {
- string text15 = "system";
- if (AddFolderOrArchive(text15 + "_" + text14))
- {
- for (int num = 2; num <= check_ver_no; num++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text15,
- "_",
- text14,
- "_",
- num
- }));
- }
- }
- }
- AddFolderOrArchive("system2");
- AddFolderOrArchive("language");
- foreach (string text16 in GameUty.PathList)
- {
- string text17 = "language";
- if (AddFolderOrArchive(text17 + "_" + text16))
- {
- for (int num2 = 2; num2 <= check_ver_no; num2++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text17,
- "_",
- text16,
- "_",
- num2
- }));
- }
- }
- }
- foreach (string text18 in GameUty.PathList)
- {
- string text19 = "bg";
- if (AddFolderOrArchive(text19 + "_" + text18))
- {
- for (int num3 = 2; num3 <= check_ver_no; num3++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text19,
- "_",
- text18,
- "_",
- num3
- }));
- }
- }
- }
- if (Product.isEnglish && !Product.isPublic)
- {
- string text20 = "bg-en";
- NDebug.Assert(AddFolderOrArchive(text20), str + text20);
- foreach (string text21 in GameUty.PathList)
- {
- if (AddFolderOrArchive(text20 + "_" + text21))
- {
- for (int num4 = 2; num4 <= check_ver_no; num4++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text20,
- "_",
- text21,
- "_",
- 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 text22 in GameUty.PathList)
- {
- string text23 = "voice";
- if (AddFolderOrArchive(text23 + "_" + text22))
- {
- for (int num6 = 2; num6 <= check_ver_no; num6++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text23,
- "_",
- text22,
- "_",
- num6
- }));
- }
- }
- }
- for (int num7 = 2; num7 <= check_ver_no; num7++)
- {
- string arg4 = "voice";
- AddFolderOrArchive(arg4 + num7);
- }
- string text24 = "parts";
- NDebug.Assert(AddFolderOrArchive(text24), str + text24);
- foreach (string text25 in GameUty.PathList)
- {
- if (AddFolderOrArchive(text24 + "_" + text25))
- {
- for (int num8 = 2; num8 <= check_ver_no; num8++)
- {
- AddFolderOrArchive(string.Concat(new object[]
- {
- text24,
- "_",
- text25,
- "_",
- num8
- }));
- }
- }
- }
- AddFolderOrArchive("parts2");
- if (Product.isEnglish && !Product.isPublic)
- {
- string text26 = "parts-en";
- 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("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 = 1320;
- return (num >= 1000) ? ((float)num / 1000f).ToString("F2") : ((float)num / 100f).ToString("F2");
- }
- public static string GetGameVersionText()
- {
- string text = "COM3D2x64.exe";
- int num = 1320;
- string path = UTY.gameProjectPath + "\\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
- }
- }
|