private async Task DownloadLayout(Stream targetStream)
        {
            var fileNames = await layoutsContainer.ListFiles();

            var layoutName = fileNames[Random.Range(0, fileNames.Count)];

            await layoutsContainer.DownloadFile(layoutName, targetStream);
        }
Пример #2
0
        private async Task <Replay> GetReplay(string fileName)
        {
            using (var stream = new MemoryStream()) {
                try {
                    await replaysContainer.DownloadFile(fileName, stream);
                } catch (AzureException) { }

                var json   = Encoding.UTF8.GetString(stream.GetBuffer());
                var replay = JsonUtility.FromJson <Replay>(json);

                return(replay);
            }
        }
 private async Task DownloadBase(string fileName, Stream stream)
 {
     try {
         //If we are debugging tutorial, we want to download layout instead of the real base
         if (Tutorials.TutorialUtility.IsTutorialRunning() &&
             Tutorials.TutorialUtility.IsDebugMode)
         {
             await DownloadLayout(stream);
         }
         else
         {
             await basesContainer.DownloadFile(fileName, stream);
         }
     } catch (AzureException) {
         //Provided player id doesn't exist, so we need to download a new base from layout
         await DownloadLayout(stream);
     }
 }