void initialize() { go(1, () => { UIHelper.iniFaces(); initializeALLcameras(); fixALLcamerasPreFrame(); backGroundPic = new BackGroundPic(); servants.Add(backGroundPic); backGroundPic.fixScreenProblem(); }); go(300, () => { InterString.initialize("config/translation.conf"); InterString.initialize("config" + AppLanguage.LanguageDir() + "/translation.conf"); //System Language GameTextureManager.initialize(); Config.initialize("config/config.conf"); UpdateClient(); GameStringManager.initialize("config/strings.conf"); if (File.Exists("config/strings.conf")) { GameStringManager.initialize("config/strings.conf"); } if (File.Exists("expansions/strings.conf")) { GameStringManager.initialize("expansions/strings.conf"); } YGOSharp.BanlistManager.initialize("config/lflist.conf"); FileInfo[] fileInfos = (new DirectoryInfo("cdb")).GetFiles().OrderByDescending(x => x.Name).ToArray(); //load cards.cdb last this way for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("cdb/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("cdb" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);//System Language } } } if (Directory.Exists("expansions")) { if (Directory.Exists("expansions" + AppLanguage.LanguageDir())) { fileInfos = (new DirectoryInfo("expansions")).GetFiles().OrderByDescending(x => x.Name).ToArray();; fileInfos = (new DirectoryInfo("expansions" + AppLanguage.LanguageDir())).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("expansions/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("expansions" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } } } fileInfos = (new DirectoryInfo("pack")).GetFiles(); fileInfos = (new DirectoryInfo("pack" + AppLanguage.LanguageDir())).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 3) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 3, 3) == ".db") { YGOSharp.PacksManager.initialize("pack/" + fileInfos[i].Name); YGOSharp.PacksManager.initialize("pack" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } YGOSharp.PacksManager.initializeSec(); initializeALLservants(); loadResources(); }); }
void initialize() { go(1, () => { UIHelper.iniFaces(); initializeALLcameras(); fixALLcamerasPreFrame(); backGroundPic = new BackGroundPic(); servants.Add(backGroundPic); backGroundPic.fixScreenProblem(); }); go(300, () => { Config.initialize("Assets/essential/config/config.conf"); localSha = new ShaCache(); try { UpdateClient("Assets/essential/cdb/", cdbID); UpdateClient("Assets/essential/config/", configID); } catch { // TODO: I would like to log to the chat log but that doesn't get initalized till initializeALLservants // book.add("Auto Update Failed...\nCheck your network connection and relaunch the game..."); } InterString.initialize("Assets/essential/config/translation.conf"); InterString.initialize("Assets/essential/config" + AppLanguage.LanguageDir() + "/translation.conf"); //System Language GameTextureManager.initialize(); GameStringManager.initialize("Assets/essential/config/strings.conf"); if (File.Exists("Assets/essential/config/strings.conf")) { GameStringManager.initialize("Assets/essential/config/strings.conf"); } if (File.Exists("expansions/strings.conf")) { GameStringManager.initialize("expansions/strings.conf"); } YGOSharp.BanlistManager.initialize("Assets/essential/config/lflist.conf"); if (File.Exists("expansions/lflist.conf")) { YGOSharp.BanlistManager.initialize("expansions/lflist.conf"); } FileInfo[] fileInfos; if (Directory.Exists("expansions")) { fileInfos = (new DirectoryInfo("expansions")).GetFiles().Where(x => x.Extension == ".cdb").OrderBy(x => x.Name).ToArray(); if (Directory.Exists("expansions" + AppLanguage.LanguageDir())) { fileInfos = (new DirectoryInfo("expansions" + AppLanguage.LanguageDir())).GetFiles().Where(x => x.Extension == ".cdb").OrderBy(x => x.Name).ToArray(); } for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("expansions/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("expansions" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } } fileInfos = (new DirectoryInfo("Assets/essential/cdb")).GetFiles().OrderByDescending(x => x.Name).ToArray(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("Assets/essential/cdb/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("Assets/essential/cdb" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);//System Language } } } fileInfos = (new DirectoryInfo("Assets/essential/pack")).GetFiles(); fileInfos = (new DirectoryInfo("Assets/essential/pack" + AppLanguage.LanguageDir())).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 3) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 3, 3) == ".db") { YGOSharp.PacksManager.initialize("Assets/essential/pack/" + fileInfos[i].Name); YGOSharp.PacksManager.initialize("Assets/essential/pack" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } YGOSharp.PacksManager.initializeSec(); initializeALLservants(); loadResources(); }); }
void initialize() { #if UNITY_ANDROID //Android //保持唤醒 Screen.sleepTimeout = SleepTimeout.NeverSleep; //创建资源目录 DirectoryInfo gameDir = new DirectoryInfo(Application.persistentDataPath); string sdcardpath = gameDir.FullName.Substring(0, gameDir.FullName.LastIndexOf("Android")); if (!Directory.Exists(Path.Combine(sdcardpath, "ygocore/texture")) || !File.Exists(Path.Combine(sdcardpath, "ygocore/picture/null.png"))) { string filePath = Application.streamingAssetsPath + "/ygocore.zip"; var www = new WWW(filePath); while (!www.isDone) { } byte[] bytes = www.bytes; ExtractZipFile(bytes, sdcardpath, false); DirPaths(Path.Combine(sdcardpath, "ygocore/cdb/")); DirPaths(Path.Combine(sdcardpath, "ygocore/config/")); DirPaths(Path.Combine(sdcardpath, "ygocore/deck/")); DirPaths(Path.Combine(sdcardpath, "ygocore/pack/")); DirPaths(Path.Combine(sdcardpath, "ygocore/updates/")); DirPaths(Path.Combine(sdcardpath, "ygocore/picture/card/")); DirPaths(Path.Combine(sdcardpath, "ygocore/picture/closeup/")); DirPaths(Path.Combine(sdcardpath, "ygocore/picture/field/")); DirPaths(Path.Combine(sdcardpath, "ygocore/replay/")); DirPaths(Path.Combine(sdcardpath, "ygocore/sound/")); DirPaths(Path.Combine(sdcardpath, "ygocore/texture/common/")); DirPaths(Path.Combine(sdcardpath, "ygocore/texture/face/")); DirPaths(Path.Combine(sdcardpath, "ygocore/texture/duel/healthBar/")); DirPaths(Path.Combine(sdcardpath, "ygocore/texture/duel/phase/")); DirPaths(Path.Combine(sdcardpath, "ygocore/texture/ui/")); File.Create(Path.Combine(sdcardpath, "ygocore/.nomedia")); File.Create(Path.Combine(sdcardpath, "ygocore/picture/card/.nomedia")); File.Create(Path.Combine(sdcardpath, "ygocore/picture/closeup/.nomedia")); File.Create(Path.Combine(sdcardpath, "ygocore/picture/field/.nomedia")); } Environment.CurrentDirectory = Path.Combine(sdcardpath, "ygocore"); System.IO.Directory.SetCurrentDirectory(Path.Combine(sdcardpath, "ygocore")); #elif UNITY_IOS //iPhone if (!Directory.Exists(Application.persistentDataPath + "/ygocore/texture") || !File.Exists(Application.persistentDataPath + "/ygocore/picture/null.png")) { string filePath = Application.streamingAssetsPath + "/ygocore.zip"; ExtractZipFile(System.IO.File.ReadAllBytes(filePath), Application.persistentDataPath + "/", false); } Environment.CurrentDirectory = Application.persistentDataPath + "/ygocore"; System.IO.Directory.SetCurrentDirectory(Application.persistentDataPath + "/ygocore"); #endif go(1, () => { initializeALLcameras(); fixALLcamerasPreFrame(); backGroundPic = new BackGroundPic(); servants.Add(backGroundPic); backGroundPic.fixScreenProblem(); }); go(300, () => { UpdateClient(); InterString.initialize("config/translation.conf"); InterString.initialize("config" + AppLanguage.LanguageDir() + "/translation.conf"); //System Language GameTextureManager.initialize(); Config.initialize("config/config.conf"); GameStringManager.initialize("config/strings.conf"); if (File.Exists("config/strings.conf")) { GameStringManager.initialize("config/strings.conf"); } if (File.Exists("expansions/strings.conf")) { GameStringManager.initialize("expansions/strings.conf"); } YGOSharp.BanlistManager.initialize("config/lflist.conf"); FileInfo[] fileInfos = (new DirectoryInfo("cdb")).GetFiles().OrderByDescending(x => x.Name).ToArray(); //load cards.cdb last this way for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("cdb/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("cdb" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);//System Language } } } if (Directory.Exists("expansions")) { if (Directory.Exists("expansions" + AppLanguage.LanguageDir())) { fileInfos = (new DirectoryInfo("expansions")).GetFiles().OrderByDescending(x => x.Name).ToArray();; fileInfos = (new DirectoryInfo("expansions" + AppLanguage.LanguageDir())).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 4) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb") { YGOSharp.CardsManager.initialize("expansions/" + fileInfos[i].Name); YGOSharp.CardsManager.initialize("expansions" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } } } fileInfos = (new DirectoryInfo("pack")).GetFiles(); fileInfos = (new DirectoryInfo("pack" + AppLanguage.LanguageDir())).GetFiles(); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.Length > 3) { if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 3, 3) == ".db") { YGOSharp.PacksManager.initialize("pack/" + fileInfos[i].Name); YGOSharp.PacksManager.initialize("pack" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name); } } } YGOSharp.PacksManager.initializeSec(); initializeALLservants(); loadResources(); }); }