public override T InitTracker <T>() { if (!VuforiaRuntimeUtilities.IsVuforiaEnabled()) { return(default(T)); } bool flag = true; if (VuforiaRuntimeUtilities.IsPlayMode() && (typeof(T) == typeof(DeviceTracker) || typeof(T) == typeof(RotationalDeviceTracker))) { flag = false; } if (flag && VuforiaWrapper.Instance.TrackerManagerInitTracker((int)TypeMapping.GetTypeID(typeof(T))) == 0) { Debug.LogError("Could not initialize the tracker."); return(default(T)); } if (typeof(T) == typeof(ObjectTracker)) { if (this.mObjectTracker == null) { this.mObjectTracker = new ObjectTrackerImpl(); } return(this.mObjectTracker as T); } if (typeof(T) == typeof(TextTracker)) { if (this.mTextTracker == null) { this.mTextTracker = new TextTrackerImpl(); } return(this.mTextTracker as T); } if (typeof(T) == typeof(SmartTerrainTracker)) { if (this.mSmartTerrainTracker == null) { this.mSmartTerrainTracker = new SmartTerrainTrackerImpl(); } return(this.mSmartTerrainTracker as T); } if (typeof(T) == typeof(DeviceTracker) || typeof(T) == typeof(RotationalDeviceTracker)) { if (this.mDeviceTracker == null) { if (VuforiaRuntimeUtilities.IsPlayMode()) { this.mDeviceTracker = new RotationalPlayModeDeviceTrackerImpl(); } else { this.mDeviceTracker = new RotationalDeviceTrackerImpl(); } } return(this.mDeviceTracker as T); } Debug.LogError("Could not initialize tracker. Unknown tracker type."); return(default(T)); }
internal static bool StopCameraIfPossible(out bool objectTrackerWasStopped) { bool flag = false; bool flag2 = false; if (CameraDevice.Instance.IsActive()) { SmartTerrainTracker tracker = TrackerManager.Instance.GetTracker <SmartTerrainTracker>(); TextTracker tracker2 = TrackerManager.Instance.GetTracker <TextTracker>(); if ((tracker == null || !tracker.IsActive) && (tracker2 == null || !tracker2.IsActive)) { bool flag3 = false; ObjectTracker tracker3 = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (tracker3 != null && tracker3.IsActive) { if (tracker3.GetActiveDataSets().Any <DataSet>()) { flag3 = true; } else { TargetFinder.InitState initState = tracker3.TargetFinder.GetInitState(); if (initState == TargetFinder.InitState.INIT_RUNNING || initState == TargetFinder.InitState.INIT_SUCCESS) { flag3 = true; } else if (tracker3.TargetFinder.GetImageTargets().Any <ImageTarget>()) { flag3 = true; } else if (tracker3.ImageTargetBuilder.IsScanning()) { flag3 = true; } else { flag2 = true; } } } if (!flag3) { flag = true; } } } if (flag2) { TrackerManager.Instance.GetTracker <ObjectTracker>().Stop(); } if (flag) { CameraDevice.Instance.Stop(); } objectTrackerWasStopped = flag2; return(flag); }
void initTextTracker() { textTracker = (TextTracker)TrackerManager.Instance.GetTracker <TextTracker>(); Rect regionOfInterestTracking = new Rect(Screen.width * 0.1f, Screen.height * 0.1f, Screen.width * 0.8f, Screen.height * 0.4f); Rect regionOfInterestDetection = new Rect(Screen.width * 0.2f, Screen.height * 0.2f, Screen.width * 0.6f, Screen.height * 0.2f); textTracker.SetRegionOfInterest(regionOfInterestDetection, regionOfInterestTracking); }
private void StopTextTracker() { Debug.Log("Stopping Text Tracker"); TextTracker tracker = TrackerManager.Instance.GetTracker <TextTracker>(); if (tracker != null) { tracker.Stop(); } }
private void SetupWordList() { TextTracker tracker = TrackerManager.Instance.GetTracker <TextTracker>(); if (tracker != null) { WordList wordList = tracker.WordList; wordList.LoadWordListFile(this.mWordListFile); if (this.mCustomWordListFile != "") { wordList.AddWordsFromFile(this.mCustomWordListFile); } if (this.mAdditionalCustomWords != null) { string[] array = this.mAdditionalCustomWords.Split(new char[] { '\r', '\n' }); for (int i = 0; i < array.Length; i++) { string text = array[i]; if (text.Length > 0) { wordList.AddWord(text); } } } wordList.SetFilterMode(this.mFilterMode); if (this.mFilterMode != WordFilterMode.NONE) { if (this.mFilterListFile != "") { wordList.LoadFilterListFile(this.mFilterListFile); } if (this.mAdditionalFilterWords != null) { string[] array = this.mAdditionalFilterWords.Split(new char[] { '\n' }); for (int i = 0; i < array.Length; i++) { string text2 = array[i]; if (text2.Length > 0) { wordList.AddWordToFilterList(text2); } } } } } }
protected override void OnDestroy() { ((StateManagerImpl)TrackerManager.Instance.GetStateManager()).ClearTrackableBehaviours(); ObjectTracker tracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (tracker != null) { tracker.DestroyAllDataSets(false); tracker.Stop(); } TextTracker tracker2 = TrackerManager.Instance.GetTracker <TextTracker>(); if (tracker2 != null) { tracker2.Stop(); } SmartTerrainTracker tracker3 = TrackerManager.Instance.GetTracker <SmartTerrainTracker>(); if (tracker3 != null) { tracker3.Stop(); } DeviceTracker tracker4 = TrackerManager.Instance.GetTracker <DeviceTracker>(); if (tracker4 != null) { tracker4.Stop(); } VuforiaManager.Instance.Deinit(); if (tracker != null) { TrackerManager.Instance.DeinitTracker <ObjectTracker>(); } if (tracker2 != null) { TrackerManager.Instance.DeinitTracker <TextTracker>(); } if (tracker3 != null) { tracker3.SmartTerrainBuilder.Deinit(); TrackerManager.Instance.DeinitTracker <SmartTerrainTracker>(); } if (tracker4 != null) { TrackerManager.Instance.DeinitTracker <DeviceTracker>(); } this.mHasStartedOnce = false; if (this.mOnVuforiaDeinitialized != null) { this.mOnVuforiaDeinitialized.InvokeWithExceptionHandling(); } }
private void OnDestroy() { VuforiaARController expr_05 = VuforiaARController.Instance; expr_05.UnregisterVuforiaInitializedCallback(new Action(this.OnVuforiaInitialized)); expr_05.UnregisterVuforiaStartedCallback(new Action(this.OnVuforiaStarted)); expr_05.UnregisterTrackablesUpdatedCallback(new Action(this.OnTrackablesUpdated)); expr_05.UnregisterOnPauseCallback(new Action <bool>(this.OnPause)); TextTracker tracker = TrackerManager.Instance.GetTracker <TextTracker>(); if (tracker != null) { tracker.WordList.UnloadAllLists(); } }
private void OnDisable() { TextTracker tracker = TrackerManager.Instance.GetTracker <TextTracker>(); if (tracker != null) { this.mTrackerWasActiveBeforeDisabling = tracker.IsActive; if (tracker.IsActive) { this.StopTextTracker(); } } WordManagerImpl wordManagerImpl = (WordManagerImpl)TrackerManager.Instance.GetStateManager().GetWordManager(); if (wordManagerImpl != null) { wordManagerImpl.CleanupWordBehaviours(); } }
internal void OnPause(bool pause) { TextTracker tracker = TrackerManager.Instance.GetTracker <TextTracker>(); if (tracker != null) { if (pause) { this.mTrackerWasActiveBeforePause = tracker.IsActive; if (tracker.IsActive) { this.StopTextTracker(); return; } } else if (this.mTrackerWasActiveBeforePause) { this.StartTextTracker(); } } }
public override bool DeinitTracker <T>() { bool flag = true; if (VuforiaRuntimeUtilities.IsPlayMode() && (typeof(T) == typeof(DeviceTracker) || typeof(T) == typeof(RotationalDeviceTracker))) { flag = false; } if (flag && VuforiaWrapper.Instance.TrackerManagerDeinitTracker((int)TypeMapping.GetTypeID(typeof(T))) == 0) { Debug.LogError("Could not deinitialize the tracker."); return(false); } if (typeof(T) == typeof(ObjectTracker)) { this.mObjectTracker = null; } else if (typeof(T) == typeof(TextTracker)) { this.mTextTracker = null; } else if (typeof(T) == typeof(SmartTerrainTracker)) { this.mSmartTerrainTracker = null; } else { if (typeof(T) != typeof(DeviceTracker) && typeof(T) != typeof(RotationalDeviceTracker)) { Debug.LogError("Could not deinitialize tracker. Unknown tracker type."); return(false); } this.mDeviceTracker = null; } return(true); }