Пример #1
0
 internal static void AddVirtualButtons(ImageTargetAbstractBehaviour it, ConfigData.VirtualButtonData[] vbs)
 {
     for (int i = 0; i < vbs.Length; i++)
     {
         VirtualButtonEditor.AddVirtualButton(it, vbs[i]);
     }
 }
        public override void ApplyDataSetProperties()
        {
            if (VuforiaUtilities.GetPrefabType(this.mTarget) == PrefabType.Prefab)
            {
                return;
            }
            ImageTargetAbstractBehaviour it = (ImageTargetAbstractBehaviour)this.mTarget;

            ConfigData.ImageTargetData imageTargetData;
            using (this.mSerializedObject.Edit())
            {
                if (this.TrackableInDataSet(this.mSerializedObject.TrackableName, this.mSerializedObject.GetDataSetName()))
                {
                    ConfigDataManager.Instance.GetConfigData(this.mSerializedObject.GetDataSetName()).GetImageTarget(this.mSerializedObject.TrackableName, out imageTargetData);
                }
                else if (this.mSerializedObject.ImageTargetType != ImageTargetType.PREDEFINED)
                {
                    imageTargetData = VuforiaUtilities.CreateDefaultImageTarget();
                }
                else
                {
                    ConfigDataManager.Instance.GetConfigData("--- EMPTY ---").GetImageTarget("--- EMPTY ---", out imageTargetData);
                    this.mSerializedObject.DataSetPath   = "--- EMPTY ---";
                    this.mSerializedObject.TrackableName = "--- EMPTY ---";
                }
                ImageTargetEditor.UpdateScale(this.mSerializedObject, imageTargetData.size);
            }
            VirtualButtonEditor.UpdateVirtualButtons(it, imageTargetData.virtualButtons.ToArray());
        }
Пример #3
0
 public static void EditorConfigureTarget(VirtualButtonAbstractBehaviour vb)
 {
     if (vb == null)
     {
         Debug.LogError("VirtualButtonAbstractBehaviour parameter is null !");
         return;
     }
     if (VuforiaUtilities.GetPrefabType(vb) == PrefabType.Prefab)
     {
         return;
     }
     if (!SceneManager.Instance.SceneInitialized)
     {
         SceneManager.Instance.InitScene();
     }
     if (!EditorApplication.isPlaying)
     {
         if (!vb.HasUpdatedPose)
         {
             vb.UpdatePose();
         }
         if (!VirtualButtonEditor.IsVBMeshCreated(vb))
         {
             VirtualButtonEditor.CreateVBMesh(vb.gameObject);
         }
         VirtualButtonEditor.Validate();
     }
 }
Пример #4
0
 internal static void UpdateVirtualButtons(ImageTargetAbstractBehaviour it, ConfigData.VirtualButtonData[] vbs)
 {
     for (int i = 0; i < vbs.Length; i++)
     {
         VirtualButtonAbstractBehaviour[] componentsInChildren = it.GetComponentsInChildren <VirtualButtonAbstractBehaviour>();
         bool flag = false;
         for (int j = 0; j < componentsInChildren.Length; j++)
         {
             if (componentsInChildren[j].VirtualButtonName == vbs[i].name)
             {
                 SerializedObject serializedObject = new SerializedObject(componentsInChildren[j]);
                 using (serializedObject.Edit())
                 {
                     componentsInChildren[j].enabled = vbs[i].enabled;
                     VirtualButtonEditor.GetSensitivityProperty(serializedObject).enumValueIndex = (int)vbs[i].sensitivity;
                     componentsInChildren[j].SetPosAndScaleFromButtonArea(new Vector2(vbs[i].rectangle[0], vbs[i].rectangle[1]), new Vector2(vbs[i].rectangle[2], vbs[i].rectangle[3]));
                 }
                 flag = true;
             }
         }
         if (!flag)
         {
             VirtualButtonEditor.AddVirtualButton(it, vbs[i]);
         }
     }
 }
Пример #5
0
        public void OnEnable()
        {
            VirtualButtonAbstractBehaviour arg_2D_0 = (VirtualButtonAbstractBehaviour)base.target;

            this.mName        = VirtualButtonEditor.GetNameProperty(base.serializedObject);
            this.mSensitivity = VirtualButtonEditor.GetSensitivityProperty(base.serializedObject);
            VirtualButtonEditor.EditorConfigureTarget(arg_2D_0);
        }
Пример #6
0
 public void EditorUpdate()
 {
     TrackableBehaviour[]             trackables = (TrackableBehaviour[])UnityEngine.Object.FindObjectsOfType(typeof(TrackableBehaviour));
     VirtualButtonAbstractBehaviour[] arg_31_0   = (VirtualButtonAbstractBehaviour[])UnityEngine.Object.FindObjectsOfType(typeof(VirtualButtonAbstractBehaviour));
     this.CorrectTrackableScales(trackables);
     VirtualButtonEditor.CorrectPoses(arg_31_0);
     if (this.mDoDeserialization)
     {
         ConfigDataManager.Instance.DoRead();
         bool flag = DatabaseLoadEditor.OnConfigDataChanged();
         this.ApplyDataSetAppearance();
         this.mDoDeserialization = !flag;
     }
     if (this.mApplyAppearance)
     {
         this.UpdateTrackableAppearance(trackables);
         this.mApplyAppearance = false;
     }
     if (this.mApplyProperties)
     {
         this.UpdateTrackableProperties(trackables);
         this.mApplyProperties = false;
     }
     if (this.mValidateScene)
     {
         this.CheckForDuplicates(trackables);
         WordEditor.CheckForDuplicates();
         VirtualButtonEditor.Validate();
         this.mValidateScene = false;
     }
     if (this.mGoToTargetManagerPage)
     {
         this.mGoToTargetManagerPage = false;
         Process.Start("https://developer.vuforia.com/target-manager");
     }
     if (this.mGoToSampleAppPage)
     {
         this.mGoToSampleAppPage = false;
         Process.Start("https://developer.vuforia.com/downloads/samples");
     }
     if (this.mUnloadUnusedAssets)
     {
         Resources.UnloadUnusedAssets();
         this.mUnloadUnusedAssets = false;
     }
 }
Пример #7
0
        private static void AddVirtualButton(ImageTargetAbstractBehaviour it, ConfigData.VirtualButtonData vb)
        {
            VirtualButtonAbstractBehaviour virtualButtonAbstractBehaviour = it.CreateVirtualButton(vb.name, new Vector2(0f, 0f), new Vector2(1f, 1f));

            if (virtualButtonAbstractBehaviour != null)
            {
                SerializedObject serializedObject = new SerializedObject(virtualButtonAbstractBehaviour);
                using (serializedObject.Edit())
                {
                    VirtualButtonEditor.GetSensitivityProperty(serializedObject).enumValueIndex = (int)vb.sensitivity;
                }
                virtualButtonAbstractBehaviour.SetPosAndScaleFromButtonArea(new Vector2(vb.rectangle[0], vb.rectangle[1]), new Vector2(vb.rectangle[2], vb.rectangle[3]));
                VirtualButtonEditor.CreateVBMesh(virtualButtonAbstractBehaviour.gameObject);
                VirtualButtonEditor.CreateMaterial(virtualButtonAbstractBehaviour.gameObject);
                virtualButtonAbstractBehaviour.enabled = vb.enabled;
                BehaviourComponentFactory.Instance.AddTurnOffBehaviour(virtualButtonAbstractBehaviour.gameObject);
                virtualButtonAbstractBehaviour.UpdatePose();
                return;
            }
            Debug.LogError("VirtualButton could not be added!");
        }
Пример #8
0
 internal static void Validate()
 {
     ImageTargetAbstractBehaviour[] array = UnityEngine.Object.FindObjectsOfType <ImageTargetAbstractBehaviour>();
     for (int i = 0; i < array.Length; i++)
     {
         VirtualButtonEditor.DetectDuplicates(array[i]);
     }
     VirtualButtonAbstractBehaviour[] array2 = UnityEngine.Object.FindObjectsOfType <VirtualButtonAbstractBehaviour>();
     for (int i = 0; i < array2.Length; i++)
     {
         VirtualButtonAbstractBehaviour virtualButtonAbstractBehaviour = array2[i];
         ImageTargetAbstractBehaviour   imageTargetBehaviour           = virtualButtonAbstractBehaviour.GetImageTargetBehaviour();
         if (imageTargetBehaviour == null)
         {
             Debug.LogError("Virtual Button '" + virtualButtonAbstractBehaviour.name + "' doesn't have an Image Target as an ancestor.");
         }
         else if (imageTargetBehaviour.ImageTargetType == ImageTargetType.USER_DEFINED)
         {
             Debug.LogError("Virtual Button '" + virtualButtonAbstractBehaviour.name + "' cannot be added to a user defined target.");
         }
     }
 }