コード例 #1
0
        private WordAbstractBehaviour AssociateWordBehaviour(WordResult wordResult)
        {
            string text = wordResult.Word.StringValue.ToLowerInvariant();
            List <WordAbstractBehaviour> list;

            if (this.mWordBehaviours.ContainsKey(text))
            {
                list = this.mWordBehaviours[text];
            }
            else
            {
                if (!this.mWordBehaviours.ContainsKey("Template_ID"))
                {
                    Debug.Log("No prefab available for string value " + text);
                    return(null);
                }
                list = this.mWordBehaviours["Template_ID"];
            }
            foreach (WordAbstractBehaviour current in list)
            {
                if (current.Trackable == null)
                {
                    WordAbstractBehaviour result = this.AssociateWordBehaviour(wordResult, current);
                    return(result);
                }
            }
            if (list.Count < this.mMaxInstances)
            {
                WordAbstractBehaviour wordAbstractBehaviour = WordManagerImpl.InstantiateWordBehaviour(list.First <WordAbstractBehaviour>());
                list.Add(wordAbstractBehaviour);
                return(this.AssociateWordBehaviour(wordResult, wordAbstractBehaviour));
            }
            return(null);
        }
コード例 #2
0
        public override void ReassociateTrackables()
        {
            this.RemoveDestroyedTrackables();
            VuMarkManagerImpl expr_11 = (VuMarkManagerImpl)this.GetVuMarkManager();

            expr_11.RemoveDestroyedTrackables();
            expr_11.DestroyBehaviourCopies();
            ObjectTracker tracker = TrackerManager.Instance.GetTracker <ObjectTracker>();

            if (tracker != null)
            {
                IEnumerable <DataSet> dataSets = tracker.GetDataSets();
                List <DataSet>        list     = tracker.GetActiveDataSets().ToList <DataSet>();
                foreach (DataSet current in dataSets)
                {
                    if (list.Contains(current))
                    {
                        tracker.DeactivateDataSet(current);
                    }
                    this.AssociateTrackableBehavioursForDataSet(current);
                    if (list.Contains(current))
                    {
                        tracker.ActivateDataSet(current);
                    }
                }
            }
            WordManagerImpl expr_9B = (WordManagerImpl)this.GetWordManager();

            expr_9B.RemoveDestroyedTrackables();
            expr_9B.InitializeWordBehaviourTemplates();
        }
コード例 #3
0
        internal void OnTrackablesUpdated()
        {
            WordManagerImpl          expr_14   = (WordManagerImpl)TrackerManager.Instance.GetStateManager().GetWordManager();
            IEnumerable <WordResult> newWords  = expr_14.GetNewWords();
            IEnumerable <Word>       lostWords = expr_14.GetLostWords();

            this.NotifyEventHandlersOfChanges(lostWords, newWords);
        }
コード例 #4
0
 internal void InitializeWordBehaviourTemplates()
 {
     if (this.mWordPrefabCreationMode == WordPrefabCreationMode.DUPLICATE)
     {
         List <WordAbstractBehaviour> list = this.mWordBehavioursMarkedForDeletion.ToList <WordAbstractBehaviour>();
         if (this.mAutomaticTemplate && this.mWordBehaviours.ContainsKey("Template_ID"))
         {
             foreach (WordAbstractBehaviour current in this.mWordBehaviours["Template_ID"])
             {
                 list.Add(current);
                 UnityEngine.Object.Destroy(current.gameObject);
             }
             this.mWordBehaviours.Remove("Template_ID");
         }
         WordAbstractBehaviour[] array = (WordAbstractBehaviour[])UnityEngine.Object.FindObjectsOfType(typeof(WordAbstractBehaviour));
         for (int i = 0; i < array.Length; i++)
         {
             WordAbstractBehaviour wordAbstractBehaviour = array[i];
             if (!list.Contains(wordAbstractBehaviour))
             {
                 string text = wordAbstractBehaviour.IsTemplateMode ? "Template_ID" : wordAbstractBehaviour.SpecificWord.ToLowerInvariant();
                 if (!this.mWordBehaviours.ContainsKey(text))
                 {
                     this.mWordBehaviours[text] = new List <WordAbstractBehaviour>
                     {
                         wordAbstractBehaviour
                     };
                     if (text == "Template_ID")
                     {
                         this.mAutomaticTemplate = false;
                     }
                 }
             }
         }
         if (!this.mWordBehaviours.ContainsKey("Template_ID"))
         {
             WordAbstractBehaviour item = WordManagerImpl.CreateWordBehaviour();
             this.mWordBehaviours.Add("Template_ID", new List <WordAbstractBehaviour>
             {
                 item
             });
             this.mAutomaticTemplate = true;
         }
     }
     this.mWordBehavioursMarkedForDeletion.Clear();
 }
コード例 #5
0
        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();
            }
        }