Esempio n. 1
0
 public void DownloadFileFromCDN(string fileName)
 {
     if (BibaUtility.CheckForInternetConnection())
     {
         RetrieveAndWriteData(BibaContentConstants.GetRelativePath(fileName), BibaContentConstants.GetPersistedPath(fileName));
     }
 }
Esempio n. 2
0
 public void DownloadFilesFromCDN()
 {
     if (BibaUtility.CheckForInternetConnection())
     {
         ReloadContent();
         RetrieveAndWriteData(BibaContentConstants.GetRelativePath(BibaContentConstants.MANIFEST_FILENAME), BibaContentConstants.GetPersistedPath(BibaContentConstants.MANIFEST_FILENAME), ManifestRetrieved);
     }
 }
Esempio n. 3
0
        public bool ShouldDownloadOptionalFile(string fileName)
        {
            var localFilePath = BibaContentConstants.GetPersistedPath(fileName);

            if (!File.Exists(localFilePath))
            {
                return(true);
            }

            var localManifestLine = _localManifest.Lines.Find(line => line.FileName == fileName);

            if (localManifestLine == null)
            {
                return(true);
            }

            return(BibaUtility.GetHashString(localFilePath) != localManifestLine.HashCode);
        }
Esempio n. 4
0
        static void UpdateManifestForContent()
        {
            ReloadManifest();

            var outputFolder    = Path.GetDirectoryName(BibaEditorConstants.GetContentOutputPath(""));
            var manifestUpdated = false;
            var manifest        = BibaManifest;
            var filesToUpload   = Directory.GetFiles(outputFolder, "*", SearchOption.AllDirectories).Where(filePath => (filePath.EndsWith(BibaContentConstants.UNITY3D_EXTENSION) || filePath.EndsWith(BibaContentConstants.TEXT_EXTENSION)) &&
                                                                                                           !filePath.EndsWith(BibaContentConstants.MANIFEST_FILENAME));

            foreach (var filePath in filesToUpload)
            {
                var fileName     = Path.GetFileName(filePath);
                var manifestLine = manifest.Lines.Find(line => line.FileName == fileName);
                if (manifestLine == null)
                {
                    manifestLine = new ManifestLine()
                    {
                        FileName         = fileName,
                        OptionalDownload = File.Exists(Path.Combine(BibaEditorConstants.OPTIONAL_ASSETBUNDLES_FOLDER, Path.GetFileNameWithoutExtension(fileName) + BibaEditorConstants.UNITY_EXTENSION))
                    };
                    manifest.Lines.Add(manifestLine);
                }

                var assetHashCode = BibaUtility.GetHashString(filePath);
                if (manifestLine.HashCode != assetHashCode)
                {
                    manifestLine.HashCode  = assetHashCode;
                    manifestLine.TimeStamp = DateTime.UtcNow;

                    manifestUpdated = true;
                }
            }

            if (manifestUpdated)
            {
                BibaManifest.TimeStamp = DateTime.UtcNow;
                new JSONDataService().WriteToDisk <BibaManifest>(BibaManifest, BibaEditorConstants.GetContentOutputPath(BibaContentConstants.MANIFEST_FILENAME));
            }

            AssetDatabase.Refresh();
        }
Esempio n. 5
0
        IEnumerator WaitForOrientationAndLoadChartboost()
        {
            var menuState = BibaSceneStack.Peek();

            if (menuState is SceneMenuState && BibaUtility.CheckForInternetConnection())
            {
                while (Screen.orientation != ((SceneMenuState)menuState).Orientation)
                {
                    yield return(null);
                }

                Chartboost.setShouldPauseClickForConfirmation(true);
                Chartboost.showInterstitial(BibaDeviceSession.TagEnabled ? CBLocation.locationFromName(BibaAnalyticConstants.HOUSE_AD) : CBLocation.Default);

                Chartboost.didDisplayInterstitial    += InterstitialLoaded;
                Chartboost.didFailToLoadInterstitial += FailToLoadInterstitial;
                var timeLapsed = 0f;
                while (timeLapsed < CHART_BOOST_TIME_OUT && !_loadedChartboost)
                {
                    timeLapsed += Time.deltaTime;
                    yield return(null);
                }

                Chartboost.didDisplayInterstitial    -= InterstitialLoaded;
                Chartboost.didFailToLoadInterstitial -= FailToLoadInterstitial;

                if (!_loadedChartboost)
                {
                    SetMenuStateTriggerSignal.Dispatch(MenuStateTrigger.Next);
                }
            }
            else
            {
                SetMenuStateTriggerSignal.Dispatch(MenuStateTrigger.Next);
            }
            Release();
        }