public void ClearProgression() { PersistentDataStorage vision = new PersistentDataStorage(Game.None); vision.DeleteFolder(vision.GetPersistentDataPath("")); PlayerPrefs.DeleteAll(); ProxyReload.SceneToLoad = SceneManager.GetActiveScene().name; SceneManager.LoadScene("ReloadProxyScene"); }
public void Init() { if (IsLoading == true || isCancel == true) { Cancel(); return; } IsLoading = true; persistentStore = new PersistentDataStorage(Game.None); cacheDirectory = persistentStore.GetPersistentDataPath(""); cache = new Dictionary <string, double>(); if (persistentStore.FileExists(CacheName)) { string tempOldCache = persistentStore.LoadText(CacheName); Log.Debug("old cache text = " + tempOldCache, Log.LogChannel.Download); string[] tempOldCacheLines = tempOldCache.Split('\n'); for (int i = 0; i < tempOldCacheLines.Length; i++) { if (!string.IsNullOrEmpty(tempOldCacheLines[i])) { string rawLine = tempOldCacheLines[i]; string[] rawLineComponents = rawLine.Split(':'); cache[rawLineComponents[0]] = double.Parse(rawLineComponents[1]); } } } downloads = new List <string>(); cloudStorageAPI = new CloudStorageAPI(monoBehaviour); progress = new Progress(); progress.StartingFileCount = 1; progress.FileRemainingCount = 1; #if RC_BUILD progress.Sections = 2; progress.CurrentSection = 1; UpdateProgress(); cloudStorageAPI.GetContentList(OnContentList, ""); #else progress.Sections = 3; progress.CurrentSection = 1; UpdateProgress(); cloudStorageAPI.AuthenticateWithGAE(OnAuthResponse, (downloadPercent) => { progress.PercentOfCurrentLoadingFileDownloaded = downloadPercent; UpdateProgress(); }); #endif }
private string LoadFromCdnOrSdkResources(string fileName) { string path = System.IO.Path.Combine("Profiles", fileName); // first try the OTA versions if (persistentDataStorage.FileExists(path)) { Log.Debug("load settings from persistent : " + persistentDataStorage.GetPersistentDataPath(path)); string text = persistentDataStorage.LoadText(path); if (text != null) { return(text); } } // fallback to load from Resources path = path.Replace(".json", "").Replace(".txt", ""); //Log.Debug("attempt to load Resource from " + path); TextAsset textAsset = Resources.Load <TextAsset>(path); return(textAsset != null ? textAsset.text : null); }
/// <summary> /// Plays the trailer /// </summary> /// <param name="showVideoControls">If set to <c>true</c> show video controls.</param> public IEnumerator PlayTrailer(bool showVideoControls = false) { StreamingAssetsStorage storage = new StreamingAssetsStorage(Game.ForceVision, null); string introVideoPath = ""; //copying to persistent data may work, you can also try prefixing the path with "jar://" #if UNITY_ANDROID PersistentDataStorage persistentStorage = new PersistentDataStorage(Game.ForceVision); if (persistentStorage.FileExists(StarWarsIntroVideo) == false) { storage.LoadStreamingAssetsFile(StarWarsIntroVideo, (string error, byte[] bytes) => { if (string.IsNullOrEmpty(error)) { //save file in persistentdata bool writeSuccess = persistentStorage.SaveBytes(StarWarsIntroVideo, bytes); if (writeSuccess) { introVideoPath = persistentStorage.GetPersistentDataPath(StarWarsIntroVideo); } else { //handle error Log.Error("Error! Unable to save the video file to persistent data."); } } else { //handle error Log.Error("Error! Unable to load from streaming assets."); } }, true); } else { introVideoPath = persistentStorage.GetPersistentDataPath(StarWarsIntroVideo); } #else introVideoPath = storage.GetStreamingAssetPath(StarWarsIntroVideo); #endif // checking that path is valid string if (!string.IsNullOrEmpty(introVideoPath)) { if (PlayCount > 0) { // setting button state if (TrailerPlayButton) { TrailerPlayButton.interactable = false; } // stopping background music AudioEvent.Play(AudioEventName.Ftue.Stereo.BackgroundMusicPause, gameObject); } if (Application.isEditor) { Debug.Log("Playing Trailer (Trailer cannot play in Editor)"); } else { // playing intro video Handheld.PlayFullScreenMovie(introVideoPath, Color.black, showVideoControls ? FullScreenMovieControlMode.CancelOnInput : FullScreenMovieControlMode.Hidden); } // adding pause yield return(new WaitForSeconds(1.5f)); if (PlayCount > 0) { // setting button state if (TrailerPlayButton) { TrailerPlayButton.interactable = true; } // starting background music AudioEvent.Play(AudioEventName.Ftue.Stereo.BackgroundMusicResume, gameObject); } // setting new play count StereoStorage.SetPrefInt(IntroPlayedCountKey, PlayCount + 1); } }