Exemplo n.º 1
0
    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();
        });
    }
Exemplo n.º 2
0
    void initialize()
    {
        go(1, () =>
        {
            UIHelper.iniFaces();
            initializeALLcameras();
            fixALLcamerasPreFrame();
            backGroundPic = new BackGroundPic();
            servants.Add(backGroundPic);
            backGroundPic.fixScreenProblem();
        });
        go(300, () =>
        {
            Config.initialize("config/config.conf");
            localSha = new ShaCache();
            try
            {
                UpdateClient("cdb/", cdbID);
                UpdateClient("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("config/translation.conf");
            InterString.initialize("config" + AppLanguage.LanguageDir() + "/translation.conf");   //System Language
            GameTextureManager.initialize();
            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");
            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("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("cdb/" + fileInfos[i].Name);
                        YGOSharp.CardsManager.initialize("cdb" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);//System Language
                    }
                }
            }

            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();
        });
    }
Exemplo n.º 3
0
    void initialize()
    {
        go(1, () =>
        {
            UIHelper.iniFaces();
            initializeALLcameras();
            fixALLcamerasPreFrame();
            backGroundPic = new BackGroundPic();
            servants.Add(backGroundPic);
            backGroundPic.fixScreenProblem();
        });
        go(300, () =>
        {
            InterString.initialize("config/translation.conf");
            GameTextureManager.initialize();
            Config.initialize("config/config.conf");
            GameStringManager.initialize("config/strings.conf");
            if (File.Exists("cdb/strings.conf"))
            {
                GameStringManager.initialize("cdb/strings.conf");
            }
            if (File.Exists("diy/strings.conf"))
            {
                GameStringManager.initialize("diy/strings.conf");
            }
            YGOSharp.BanlistManager.initialize("config/lflist.conf");

            var fileInfos = (new DirectoryInfo("cdb")).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("cdb/" + fileInfos[i].Name);
                    }
                }
            }

            if (Directory.Exists("diy"))
            {
                fileInfos = (new DirectoryInfo("diy")).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("diy/" + fileInfos[i].Name);
                        }
                    }
                }
            }

            if (Directory.Exists("pack"))
            {
                fileInfos = (new DirectoryInfo("pack")).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.initializeSec();
            }

            initializeALLservants();
            loadResources();
        });
    }
Exemplo n.º 4
0
    void initialize()
    {
        go(1, () =>
        {
            UIHelper.iniFaces();
            initializeALLcameras();
            fixALLcamerasPreFrame();
            backGroundPic = new BackGroundPic();
            servants.Add(backGroundPic);
            backGroundPic.fixScreenProblem();
        });
        go(300, () =>
        {
            InterString.initialize("config/translation.conf");
            GameTextureManager.initialize();
            Config.initialize("config/config.conf");

            if (!Directory.Exists("expansions"))
            {
                try
                {
                    Directory.CreateDirectory("expansions");
                }
                catch
                {
                }
            }

            if (!Directory.Exists("replay"))
            {
                try
                {
                    Directory.CreateDirectory("replay");
                }
                catch
                {
                }
            }

            var fileInfos = new FileInfo[0];

            if (Directory.Exists("expansions"))
            {
                fileInfos = (new DirectoryInfo("expansions")).GetFiles();
                foreach (FileInfo file in fileInfos)
                {
                    if (file.Name.ToLower().EndsWith(".ypk"))
                    {
                        GameZipManager.Zips.Add(new Ionic.Zip.ZipFile("expansions/" + file.Name));
                    }
                    if (file.Name.ToLower().EndsWith(".conf"))
                    {
                        GameStringManager.initialize("expansions/" + file.Name);
                    }
                    if (file.Name.ToLower().EndsWith(".cdb"))
                    {
                        YGOSharp.CardsManager.initialize("expansions/" + file.Name);
                    }
                }
            }

            if (Directory.Exists("cdb"))
            {
                fileInfos = (new DirectoryInfo("cdb")).GetFiles();
                foreach (FileInfo file in fileInfos)
                {
                    if (file.Name.ToLower().EndsWith(".conf"))
                    {
                        GameStringManager.initialize("cdb/" + file.Name);
                    }
                    if (file.Name.ToLower().EndsWith(".cdb"))
                    {
                        YGOSharp.CardsManager.initialize("cdb/" + file.Name);
                    }
                }
            }

            if (Directory.Exists("diy"))
            {
                fileInfos = (new DirectoryInfo("diy")).GetFiles();
                foreach (FileInfo file in fileInfos)
                {
                    if (file.Name.ToLower().EndsWith(".conf"))
                    {
                        GameStringManager.initialize("diy/" + file.Name);
                    }
                    if (file.Name.ToLower().EndsWith(".cdb"))
                    {
                        YGOSharp.CardsManager.initialize("diy/" + file.Name);
                    }
                }
            }

            if (Directory.Exists("data"))
            {
                fileInfos = (new DirectoryInfo("data")).GetFiles();
                foreach (FileInfo file in fileInfos)
                {
                    if (file.Name.ToLower().EndsWith(".zip"))
                    {
                        GameZipManager.Zips.Add(new Ionic.Zip.ZipFile("data/" + file.Name));
                    }
                }
            }

            foreach (ZipFile zip in GameZipManager.Zips)
            {
                if (zip.Name.ToLower().EndsWith("script.zip"))
                {
                    continue;
                }
                foreach (string file in zip.EntryFileNames)
                {
                    if (file.ToLower().EndsWith(".conf"))
                    {
                        MemoryStream ms = new MemoryStream();
                        ZipEntry e      = zip[file];
                        e.Extract(ms);
                        GameStringManager.initializeContent(Encoding.UTF8.GetString(ms.ToArray()));
                    }
                    if (file.ToLower().EndsWith(".cdb"))
                    {
                        ZipEntry e      = zip[file];
                        string tempfile = Path.Combine(Path.GetTempPath(), file);
                        e.Extract(Path.GetTempPath(), ExtractExistingFileAction.OverwriteSilently);
                        YGOSharp.CardsManager.initialize(tempfile);
                        File.Delete(tempfile);
                    }
                }
            }

            GameStringManager.initialize("config/strings.conf");
            YGOSharp.BanlistManager.initialize("config/lflist.conf");

            YGOSharp.CardsManager.updateSetNames();

            if (Directory.Exists("pack"))
            {
                fileInfos = (new DirectoryInfo("pack")).GetFiles();
                foreach (FileInfo file in fileInfos)
                {
                    if (file.Name.ToLower().EndsWith(".db"))
                    {
                        YGOSharp.PacksManager.initialize("pack/" + file.Name);
                    }
                }
                YGOSharp.PacksManager.initializeSec();
            }

            initializeALLservants();
            loadResources();
            readParams();
        });
    }
Exemplo n.º 5
0
    void initialize()
    {
#if !UNITY_EDITOR && UNITY_STANDALONE_OSX                   //Mac
        string GamePaths = Application.streamingAssetsPath; // .app/Contents/Resources/Data/StreamingAssets/
        Environment.CurrentDirectory = GamePaths;
        System.IO.Directory.SetCurrentDirectory(GamePaths);
#endif

        go(1, () =>
        {
            UIHelper.iniFaces();
            initializeALLcameras();
            fixALLcamerasPreFrame();
            backGroundPic = new BackGroundPic();
            servants.Add(backGroundPic);
            backGroundPic.fixScreenProblem();
        });
        go(300, () =>
        {
            InterString.initialize("config/translation.conf");
            GameTextureManager.initialize();
            Config.initialize("config/config.conf");
            if (File.Exists("config/strings.conf"))
            {
                GameStringManager.initialize("config/strings.conf");
            }
            //if (File.Exists("config" + AppLanguage.LanguageDir() + "/strings.conf"))
            //{
            //    GameStringManager.initialize("config" + AppLanguage.LanguageDir() + "/strings.conf");
            //}
            if (File.Exists("cdb/strings.conf"))
            {
                GameStringManager.initialize("cdb/strings.conf");
            }
            if (File.Exists("expansions/strings.conf"))
            {
                GameStringManager.initialize("expansions/strings.conf");
            }
            YGOSharp.BanlistManager.initialize("config/lflist.conf");

            var fileInfos = (new DirectoryInfo("cdb")).GetFiles();
            //var fileInfos = (new DirectoryInfo("cdb" + 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("cdb/" + fileInfos[i].Name);
                        //YGOSharp.CardsManager.initialize("cdb" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);
                    }
                }
            }

            if (Directory.Exists("expansions"))
            {
                fileInfos = (new DirectoryInfo("expansions")).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);
                        }
                    }
                }
            }

            if (Directory.Exists("pack"))
            {
                fileInfos = (new DirectoryInfo("pack")).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.initializeSec();
            }

            initializeALLservants();
            loadResources();
        });
    }
Exemplo n.º 6
0
    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();
        });
    }