protected void OnSdkReady() { // no further initialization needed if FTUE is complete if (FtueDataController.IsFtueComplete(FtueType.Intro)) { return; } // adding controller saberPeripheral = new ControllerPeripheral(VisionSDK.ControllerName, ControllerTransform, null, container.GetSavedSaberColorID()); Sdk.Connections.AddPeripheral(saberPeripheral); // adding beacon Sdk.Tracking.OnBeaconStateChange += OnBeaconStateChange; // checking beacon signal if (Sdk.Tracking.IsBeaconTracked) { beaconSeen = true; // playing audio - signal acquired AudioEvent.Play(AudioEventName.Ftue.Computer.SignalAcquired, gameObject); } else { // playing audio - searching for signal AudioEvent.Play(AudioEventName.Ftue.Computer.AcquireSignal, gameObject); } // setting input handler Sdk.Input.OnButtonDown += OnButtonDown; // adding input listeners Sdk.Connections.OnPeripheralStateChange += OnPeripheralConnected; Sdk.Connections.OnPeripheralStateChange += OnPeripheralDisconnected; // adding animation listener HolocronAnimations.OnAnimationComplete += OnHolocronEnterAnimationComplete; // loading animation sequence config StreamingAssetsStorage loader = new StreamingAssetsStorage(Game.ForceVision, null); loader.LoadStreamingAssetsText(AnimationConfigFile, OnConfigLoaded, true); // playing sound AudioEvent.Play(AudioEventName.Ftue.MusicStart, gameObject); }
protected void OnSdkReady() { // no further initialization needed if FTUE is complete if (FtueDataController.IsFtueComplete(FtueType.DarkSide)) { return; } // adding controller saberPeripheral = new ControllerPeripheral( VisionSDK.ControllerName, ControllerTransform, null, container.GetSavedSaberColorID() ); Sdk.Connections.AddPeripheral(saberPeripheral); // adding beacon Sdk.Tracking.OnBeaconStateChange += OnBeaconStateChange; // checking beacon signal if (Sdk.Tracking.IsBeaconTracked) { beaconSeen = true; } else { } // setting input handler Sdk.Input.OnButtonDown += OnButtonDown; // adding input listeners Sdk.Connections.OnPeripheralStateChange += OnPeripheralConnected; Sdk.Connections.OnPeripheralStateChange += OnPeripheralDisconnected; // loading animation sequence config StreamingAssetsStorage loader = new StreamingAssetsStorage(Game.ForceVision, null); loader.LoadStreamingAssetsText(AnimationConfigFile, OnConfigLoaded, true); // playing the menu FTUE animation Menu.GetComponent <Animator>().Play(MenuFtue); }
/// <summary> /// Purges the cpipe cache. /// Called when app starts and runs if the app version on disk is older then the app verison. /// The purge will delete any english or non loc specific files and update the cache with all of the latest version from the embedded manifest. /// </summary> public static void PurgeCpipeCache() { bool doPurge = false; Dictionary <string, string> cache = new Dictionary <string, string>(); PersistentDataStorage persistentDataStorage = new PersistentDataStorage(Game.None); StreamingAssetsStorage streamingAssetsStorage = new StreamingAssetsStorage(Game.None, null); //if app version has increased, do purge AppVersion appVersion = new AppVersion(Application.version); if (persistentDataStorage.FileExists(appVerisonFile)) { AppVersion storedVersion = new AppVersion(persistentDataStorage.LoadText(appVerisonFile)); if (storedVersion.Major > appVersion.Major) { doPurge = true; } else if (storedVersion.Major >= appVersion.Major && storedVersion.Minor > appVersion.Minor) { doPurge = true; } else if (storedVersion.Major >= appVersion.Major && storedVersion.Minor >= appVersion.Minor && storedVersion.Revision > appVersion.Revision) { doPurge = true; } } else { doPurge = true; } Log.Debug("dopurge " + doPurge, Log.LogChannel.General); if (doPurge == false) { return; } string oldCache = ""; if (persistentDataStorage.FileExists(CacheName)) { oldCache = persistentDataStorage.LoadText(CacheName); string[] tempOldCacheLines = oldCache.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]] = rawLineComponents[1]; } } } Log.Debug("load manifest from streaming at " + Application.streamingAssetsPath + "/" + Game.ForceVision + "/" + EmbeddedCpipeManifestFile, Log.LogChannel.General); //load streaming assets manifest and write cache file of embedded content streamingAssetsStorage.LoadStreamingAssetsText(Game.ForceVision + "/" + EmbeddedCpipeManifestFile, (error, text) => { if (string.IsNullOrEmpty(error)) { try { JSONObject manifest = new JSONObject(text); WriteManifestVersion(manifest["version"].ToString()); JSONObject paths = manifest["paths"]; string newCacheString = ""; for (int i = 0; i < paths.keys.Count; i++) { string folder = paths.keys[i]; string v = paths[i]["v"].ToString(); //update english only bool isEnglishFile = true; foreach (string languageFolder in Localizer.LanguageFolders) { if (folder.Contains("GeneratedSoundBanks") && folder.Contains("/" + languageFolder + "/") && languageFolder != Localizer.LanguageFolders[0]) { isEnglishFile = false; Log.Debug("non english file found. path = " + folder, Log.LogChannel.Download); } } if (isEnglishFile) { if (cache.ContainsKey(folder)) { //if in cache already then update to local version and delete local file if (persistentDataStorage.FileExists(folder)) { persistentDataStorage.DeleteFile(folder); Log.Debug("deleteing file in " + folder, Log.LogChannel.Download); } } newCacheString += folder + ":" + v + "\n"; } else { if (cache.ContainsKey(folder)) { newCacheString += folder + ":" + v + "\n"; } } } persistentDataStorage.SaveText(CacheName, newCacheString, false); persistentDataStorage.SaveText(appVerisonFile, Application.version, false); } catch (System.Exception e) { Log.Exception(e); } } else { #if !UNITY_EDITOR Log.Error("error loading manifest from streamingassets. " + error); #endif } }, true); }