Esempio n. 1
0
        public bool Save(bool sign, ReplayInfo flag)
        {
            if (File.Exists(FileName))
            {
                File.Delete(FileName);
            }
            ReplayStream = File.Create(FileName);

            if (sign && (flag & ReplayInfo.Signed) != ReplayInfo.Signed)
            {
                flag |= ReplayInfo.Signed;
            }


            Writer = new ReplayWriter(ReplayStream, flag);
            if (SaveReplay(sign))
            {
                //    Writer.Compress(ReplayStream, FileName);
                ReplayStream.Close();
                Writer.Dispose();
                //File.Delete(FileName);
                //File.Move(FileName + ".gz", FileName);
                if (Directory.Exists(CacheDirectory))
                {
                    DeleteDirectory(CacheDirectory);
                }
                return(true);
            }

            ReplayStream.Close();
            Writer.Dispose();
            File.Delete(FileName);
            return(false);
        }
        private IEnumerator BackToMainMenuCoroutine()
        {
            GameEnded = true;

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            if (ReplayStream != null)
            {
                ReplayStream.Close();
            }
            Helper.ReplayBytes = new byte[0];

            yield return(SceneManager.LoadSceneAsync("MainMenu").WaitUntilComplete());
        }