public void OnTrackablesUpdated()
    {
        WordManagerImpl          wordManager = (WordManagerImpl)TrackerManager.Instance.GetStateManager().GetWordManager();
        IEnumerable <WordResult> newWords    = wordManager.GetNewWords();
        IEnumerable <Word>       lostWords   = wordManager.GetLostWords();

        this.NotifyEventHandlersOfChanges(lostWords, newWords);
    }
Ejemplo n.º 2
0
 private void OnLevelWasLoaded()
 {
     if (this.mKeepARCameraAlive)
     {
         List <TrackableBehaviour> list;
         StateManagerImpl          stateManager = (StateManagerImpl)TrackerManager.Instance.GetStateManager();
         if (this.mKeepTrackableBehavioursAlive)
         {
             list = stateManager.GetTrackableBehaviours().ToList <TrackableBehaviour>();
             foreach (WordAbstractBehaviour behaviour in stateManager.GetWordManager().GetTrackableBehaviours())
             {
                 list.Add(behaviour);
             }
         }
         else
         {
             list = new List <TrackableBehaviour>();
         }
         foreach (ILoadLevelEventHandler handler in this.mHandlers)
         {
             handler.OnLevelLoaded(list);
         }
         TrackableBehaviour[] behaviourArray = (TrackableBehaviour[])UnityEngine.Object.FindObjectsOfType(typeof(TrackableBehaviour));
         stateManager.RemoveDestroyedTrackables();
         stateManager.AssociateMarkerBehaviours();
         ImageTracker tracker = TrackerManager.Instance.GetTracker <ImageTracker>();
         if (tracker != null)
         {
             IEnumerable <DataSet> dataSets = tracker.GetDataSets();
             List <DataSet>        list2    = tracker.GetActiveDataSets().ToList <DataSet>();
             foreach (DataSet set in dataSets)
             {
                 if (list2.Contains(set))
                 {
                     tracker.DeactivateDataSet(set);
                 }
                 stateManager.AssociateTrackableBehavioursForDataSet(set);
                 if (list2.Contains(set))
                 {
                     tracker.ActivateDataSet(set);
                 }
             }
         }
         bool flag = false;
         TextRecoAbstractBehaviour behaviour2 = (TextRecoAbstractBehaviour)UnityEngine.Object.FindObjectOfType(typeof(TextRecoAbstractBehaviour));
         if (behaviour2 != null)
         {
             if (!behaviour2.IsInitialized)
             {
                 flag = true;
             }
             else
             {
                 WordManagerImpl wordManager = (WordManagerImpl)stateManager.GetWordManager();
                 wordManager.RemoveDestroyedTrackables();
                 wordManager.InitializeWordBehaviourTemplates();
             }
         }
         List <TrackableBehaviour>           disabledTrackables  = new List <TrackableBehaviour>();
         IEnumerable <TrackableBehaviour>    trackableBehaviours = stateManager.GetTrackableBehaviours();
         IEnumerable <WordAbstractBehaviour> source = stateManager.GetWordManager().GetTrackableBehaviours();
         foreach (TrackableBehaviour behaviour3 in behaviourArray)
         {
             if (behaviour3 is WordAbstractBehaviour)
             {
                 if (!flag && !source.Contains <WordAbstractBehaviour>((behaviour3 as WordAbstractBehaviour)))
                 {
                     behaviour3.gameObject.SetActive(false);
                     disabledTrackables.Add(behaviour3);
                 }
             }
             else if ((!(behaviour3 is ImageTargetAbstractBehaviour) || (((IEditorImageTargetBehaviour)behaviour3).ImageTargetType == ImageTargetType.PREDEFINED)) && !trackableBehaviours.Contains <TrackableBehaviour>(behaviour3))
             {
                 behaviour3.gameObject.SetActive(false);
                 disabledTrackables.Add(behaviour3);
             }
         }
         foreach (ILoadLevelEventHandler handler2 in this.mHandlers)
         {
             handler2.OnDuplicateTrackablesDisabled(disabledTrackables);
         }
     }
 }