コード例 #1
0
        protected virtual void Update()
        {
            if (rotateTowards == null) // Backup
            {
                Transform headset = VRTK_DeviceFinder.HeadsetTransform();
                if (headset)
                {
                    rotateTowards = headset.gameObject;
                }
                else
                {
                    VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.COULD_NOT_FIND_OBJECT_FOR_ACTION, "IndependentRadialMenu", "an object", "rotate towards"));
                }
            }

            if (menu.isShown)
            {
                if (interactingObjects.Count > 0) // There's not really an event for the controller moving, so just update the position every frame
                {
                    DoChangeAngle(CalculateAngle(interactingObjects[0]), this);
                }

                if (rotateTowards != null)
                {
                    transform.rotation = Quaternion.LookRotation((rotateTowards.transform.position - transform.position) * -1, Vector3.up) * initialRotation; // Face the target, but maintain initial rotation
                }
            }
        }
コード例 #2
0
 // Token: 0x0600116F RID: 4463 RVA: 0x00065E04 File Offset: 0x00064004
 protected virtual void Start()
 {
     this.interactableObject = base.gameObject.transform.parent.gameObject;
     if (this.interactableObject == null || this.interactableObject.GetComponent <VRTK_InteractableObject>() == null)
     {
         VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, new object[]
         {
             "PanelMenuController",
             "VRTK_InteractableObject",
             "a parent"
         }));
         return;
     }
     this.interactableObject.GetComponent <VRTK_InteractableObject>().InteractableObjectGrabbed   += this.DoInteractableObjectIsGrabbed;
     this.interactableObject.GetComponent <VRTK_InteractableObject>().InteractableObjectUngrabbed += this.DoInteractableObjectIsUngrabbed;
     this.canvasObject = base.gameObject.transform.GetChild(0).gameObject;
     if (this.canvasObject == null || this.canvasObject.GetComponent <Canvas>() == null)
     {
         VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, new object[]
         {
             "PanelMenuController",
             "Canvas",
             "a child"
         }));
     }
 }
コード例 #3
0
        protected virtual void Update()
        {
            if (interactableObject != null)
            {
                if (rotateTowards == null)
                {
                    rotateTowards = VRTK_DeviceFinder.HeadsetTransform().gameObject;
                    if (rotateTowards == null)
                    {
                        VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.COULD_NOT_FIND_OBJECT_FOR_ACTION, "PanelMenuController", "an object", "rotate towards"));
                    }
                }

                if (isShown)
                {
                    if (rotateTowards != null)
                    {
                        transform.rotation = Quaternion.LookRotation((rotateTowards.transform.position - transform.position) * -1, Vector3.up);
                    }
                }

                if (isPendingSwipeCheck)
                {
                    CalculateSwipeAction();
                }
            }
        }
コード例 #4
0
 // Token: 0x06001147 RID: 4423 RVA: 0x000653E8 File Offset: 0x000635E8
 protected virtual void Update()
 {
     if (this.rotateTowards == null)
     {
         Transform transform = VRTK_DeviceFinder.HeadsetTransform();
         if (transform)
         {
             this.rotateTowards = transform.gameObject;
         }
         else
         {
             VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.COULD_NOT_FIND_OBJECT_FOR_ACTION, new object[]
             {
                 "IndependentRadialMenu",
                 "an object",
                 "rotate towards"
             }));
         }
     }
     if (this.menu.isShown)
     {
         if (this.interactingObjects.Count > 0)
         {
             this.DoChangeAngle(this.CalculateAngle(this.interactingObjects[0]), this);
         }
         if (this.rotateTowards != null)
         {
             base.transform.rotation = Quaternion.LookRotation((this.rotateTowards.transform.position - base.transform.position) * -1f, Vector3.up) * this.initialRotation;
         }
     }
 }
コード例 #5
0
        protected virtual void Update()
        {
            if (rotateTowards == null) // Backup
            {
                Transform headset = VRTK_DeviceFinder.HeadsetTransform();
                if (headset)
                {
                    rotateTowards = headset.gameObject;
                }
                else
                {
                    VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.COULD_NOT_FIND_OBJECT_FOR_ACTION, "IndependentRadialMenu", "an object", "rotate towards"));
                }
            }

            if (menu.isShown)
            {
                if (interactingObjects.Count > 0) // There's not really an event for the controller moving, so just update the position every frame
                {
                    DoChangeAngle(CalculateAngle(interactingObjects[0]), this);
                }

                if (rotateTowards != null)
                {
                    transform.rotation = Quaternion.LookRotation((rotateTowards.transform.position - transform.position) * -1, Vector3.up) * initialRotation; // Face the target, but maintain initial rotation
                }
            }

            SphereCollider collider = eventsManager.gameObject.GetComponent <SphereCollider>();

            collider.center = headSet.transform.position + (headSet.transform.forward * distanceFromheadSet); // my addition to finding the menu collider for this sitution.             /*eventsManager.transform.InverseTransformVector(transform.position - eventsManager.transform.position);*/
            // moved this ^  from the (addmenucollider) if statement and edited it
        }
コード例 #6
0
        protected virtual void CreateHighlightersInEditor()
        {
            //Only run if it's in the editor
            if (VRTK_SharedMethods.IsEditTime())
            {
                //Generate the main highlight object
                GenerateHighlightObject();

                //If a joint is being used but no joint is found then throw a warning in the console
                if (snapType == SnapTypes.UseJoint && GetComponent <Joint>() == null)
                {
                    VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "SnapDropZone:" + name, "Joint", "the same", " because the `Snap Type` is set to `Use Joint`"));
                }

                //Generate the editor highlighter object with the custom material
                GenerateEditorHighlightObject();

                //Ensure the game object references are force set based on whether they exist in the path
                ForceSetObjects();

                //Show the editor highlight object if it's set.
                if (highlightEditorObject != null)
                {
                    highlightEditorObject.SetActive(displayDropZoneInEditor);
                }
            }
        }
コード例 #7
0
 // Token: 0x06001BEA RID: 7146 RVA: 0x00091AD4 File Offset: 0x0008FCD4
 protected virtual void OnEnable()
 {
     if (this.onlyInEditor && !Application.isEditor)
     {
         base.enabled = false;
         return;
     }
     this.headset  = VRTK_DeviceFinder.HeadsetTransform();
     this.playArea = VRTK_DeviceFinder.PlayAreaTransform();
     if (!this.headset)
     {
         VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_SCENE, new object[]
         {
             "VRTK_Simulator",
             "Headset Camera",
             ". Simulator deactivated."
         }));
         base.enabled = false;
         return;
     }
     if (this.camStart && this.camStart.gameObject.activeInHierarchy)
     {
         this.playArea.position = this.camStart.position;
         this.playArea.rotation = this.camStart.rotation;
     }
     this.initialPosition = this.playArea.position;
     this.initialRotation = this.playArea.rotation;
 }
コード例 #8
0
ファイル: VRTK_Simulator.cs プロジェクト: kgpasta/SantoriniVR
        protected virtual void OnEnable()
        {
            // don't run in builds outside the editor
            if (onlyInEditor && !Application.isEditor)
            {
                enabled = false;
                return;
            }

            headset  = VRTK_DeviceFinder.HeadsetTransform();
            playArea = VRTK_DeviceFinder.PlayAreaTransform();
            if (!headset)
            {
                VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_SCENE, "VRTK_Simulator", "Headset Camera", ". Simulator deactivated."));
                enabled = false;
                return;
            }

            if (camStart && camStart.gameObject.activeInHierarchy)
            {
                playArea.position = camStart.position;
                playArea.rotation = camStart.rotation;
            }

            initialPosition = playArea.position;
            initialRotation = playArea.rotation;
        }
コード例 #9
0
        // Token: 0x06001B46 RID: 6982 RVA: 0x0008E558 File Offset: 0x0008C758
        public void TryLoadSDKSetup(int startIndex, bool tryToReinitialize, params VRTK_SDKSetup[] sdkSetups)
        {
            if (sdkSetups.Length == 0)
            {
                return;
            }
            if (startIndex < 0 || startIndex >= sdkSetups.Length)
            {
                VRTK_Logger.Fatal(new ArgumentOutOfRangeException("startIndex"));
                return;
            }
            sdkSetups = sdkSetups.ToList <VRTK_SDKSetup>().GetRange(startIndex, sdkSetups.Length - startIndex).ToArray();
            foreach (VRTK_SDKSetup vrtk_SDKSetup in from setup in sdkSetups
                     where !setup.isValid
                     select setup)
            {
                string text = string.Join("\n- ", vrtk_SDKSetup.GetSimplifiedErrorDescriptions());
                if (!string.IsNullOrEmpty(text))
                {
                    text = "- " + text;
                    VRTK_Logger.Warn(string.Format("Ignoring SDK Setup '{0}' because there are some errors with it:\n{1}", vrtk_SDKSetup.name, text));
                }
            }
            sdkSetups = (from setup in sdkSetups
                         where setup.isValid
                         select setup).ToArray <VRTK_SDKSetup>();
            VRTK_SDKSetup loadedSetup = this.loadedSetup;

            this.ToggleBehaviours(false);
            this.loadedSetup = null;
            if (loadedSetup != null)
            {
                loadedSetup.OnUnloaded(this);
            }
            if (!XRSettings.enabled || !sdkSetups[0].usedVRDeviceNames.Contains(XRSettings.loadedDeviceName))
            {
                if (!tryToReinitialize && !XRSettings.enabled && !string.IsNullOrEmpty(XRSettings.loadedDeviceName))
                {
                    sdkSetups = (from setup in sdkSetups
                                 where !setup.usedVRDeviceNames.Contains(XRSettings.loadedDeviceName)
                                 select setup).ToArray <VRTK_SDKSetup>();
                }
                VRTK_SDKSetup[] array = (from setup in sdkSetups
                                         where setup.usedVRDeviceNames.Except(XRSettings.supportedDevices).Any <string>()
                                         select setup).ToArray <VRTK_SDKSetup>();
                foreach (VRTK_SDKSetup vrtk_SDKSetup2 in array)
                {
                    string arg = string.Join(", ", vrtk_SDKSetup2.usedVRDeviceNames.Except(XRSettings.supportedDevices).ToArray <string>());
                    VRTK_Logger.Warn(string.Format("Ignoring SDK Setup '{0}' because the following VR device names are missing from the PlayerSettings:\n{1}", vrtk_SDKSetup2.name, arg));
                }
                sdkSetups = sdkSetups.Except(array).ToArray <VRTK_SDKSetup>();
                XRSettings.LoadDeviceByName(sdkSetups.SelectMany((VRTK_SDKSetup setup) => setup.usedVRDeviceNames).Distinct <string>().Concat(new string[]
                {
                    "None"
                }).ToArray <string>());
            }
            base.StartCoroutine(this.FinishSDKSetupLoading(sdkSetups, loadedSetup));
        }
コード例 #10
0
 protected virtual void OnEnable()
 {
     playArea     = VRTK_DeviceFinder.PlayAreaTransform();
     roomExtender = FindObjectOfType <VRTK_RoomExtender>();
     if (playArea == null || roomExtender == null)
     {
         VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_RoomExtender_PlayAreaGizmo", "PlayArea or VRTK_RoomExtender", "an active"));
         return;
     }
 }
コード例 #11
0
 protected virtual void CheckAxisIsValid(string axisName, string varName)
 {
     try
     {
         Input.GetAxis(axisName);
     }
     catch (System.ArgumentException ae)
     {
         VRTK_Logger.Warn(ae.Message + " on index [" + index + "] variable [" + varName + "]");
     }
 }
コード例 #12
0
        protected override void OnEnable()
        {
            base.OnEnable();
            VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Pointer);
            SetDefaultValues();

            if (NoPointerRenderer())
            {
                VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_PARAMETER, "VRTK_Pointer", "VRTK_BasePointerRenderer", "Pointer Renderer"));
            }
        }
コード例 #13
0
        protected virtual void OnEnable()
        {
            headset         = VRTK_DeviceFinder.HeadsetCamera();
            isTransitioning = false;
            isFaded         = false;

            VRTK_SharedMethods.AddCameraFade();
            if (!VRTK_SDK_Bridge.HasHeadsetFade(headset))
            {
                VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_HeadsetFade", "compatible fade", "Camera"));
            }
        }
コード例 #14
0
        protected virtual void Update()
        {
            if (rotateTowards == null) // Backup
            {
                Transform headset = VRTK_DeviceFinder.HeadsetTransform();
                if (headset)
                {
                    rotateTowards = headset.gameObject;
                }
                else
                {
                    VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.COULD_NOT_FIND_OBJECT_FOR_ACTION, "IndependentRadialMenu", "an object", "rotate towards"));
                }
            }

            if (menu.isShown)
            {
                if (interactingObjects.Count > 0) // There's not really an event for the controller moving, so just update the position every frame
                {
                    float   distance = (Camera.main.transform.position - transform.position).magnitude;
                    Vector3 rayEnd   = Camera.main.transform.position + Camera.main.transform.forward * distance;
                    DoChangeAngle(CalculateAngle(rayEnd), this);
                    if ((rayEnd - transform.position).magnitude > 0.75f)   ////
                    {
                        DoHideMenu(true);
                    }
                }
                if (Input.GetKeyDown(KeyCode.Mouse0) && firstClickDone)  ////
                {
                    DoClickButton();
                    lockOption = true;
                    GetComponent <RadialMenuText>().PickOption(GetComponent <VRTK_RadialMenu>().optionHovered);
                    DoHideMenu(true);
                }
                firstClickDone = true;

                if (rotateTowards != null)
                {
                    transform.rotation = Quaternion.LookRotation((rotateTowards.transform.position - transform.position) * -1, Vector3.up) * initialRotation; // Face the target, but maintain initial rotation
                }
            }
            else
            {
                if (lockOption)
                {
                    DoUnClickButton();
                    DoHideMenu(true);
                    lockOption = false;
                }
                firstClickDone = false; ////
            }
        }
コード例 #15
0
 protected virtual void OnEnable()
 {
     movementTransform = VRTK_DeviceFinder.HeadsetTransform();
     if (movementTransform == null)
     {
         VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_SCENE, "VRTK_RoomExtender", "Headset Transform"));
     }
     activationEnabled = false;
     buttonSubscribed  = false;
     playArea          = VRTK_DeviceFinder.PlayAreaTransform();
     MoveHeadCircleNonLinearDrift();
     lastPosition = movementTransform.localPosition;
 }
コード例 #16
0
 protected virtual bool ValidRigObjects()
 {
     if (headset == null)
     {
         VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_SCENE, "VRTK_BasicTeleport", "rig headset", ". Are you trying to access the headset before the SDK Manager has initialised it?"));
         return(false);
     }
     if (playArea == null)
     {
         VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_SCENE, "VRTK_BasicTeleport", "rig boundaries", ". Are you trying to access the boundaries before the SDK Manager has initialised it?"));
         return(false);
     }
     return(true);
 }
コード例 #17
0
        protected override void OnEnable()
        {
#pragma warning disable 0618
            controllerEvents = (controller != null && controllerEvents == null ? controller : controllerEvents);
#pragma warning restore 0618
            base.OnEnable();
            attachedTo = (attachedTo == null ? gameObject : attachedTo);
            VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Pointer);
            SetDefaultValues();

            if (NoPointerRenderer())
            {
                VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_PARAMETER, "VRTK_Pointer", "VRTK_BasePointerRenderer", "Pointer Renderer"));
            }
        }
コード例 #18
0
 // Token: 0x06001974 RID: 6516 RVA: 0x00087748 File Offset: 0x00085948
 protected virtual void CheckButtonMappingConflict()
 {
     if (this.activationButton == this.selectionButton)
     {
         if (this.selectOnPress && this.holdButtonToActivate)
         {
             VRTK_Logger.Warn("`Hold Button To Activate` and `Select On Press` cannot both be checked when using the same button for Activation and Selection. Fixing by setting `Select On Press` to `false`.");
         }
         if (!this.selectOnPress && !this.holdButtonToActivate)
         {
             VRTK_Logger.Warn("`Hold Button To Activate` and `Select On Press` cannot both be unchecked when using the same button for Activation and Selection. Fixing by setting `Select On Press` to `true`.");
         }
         this.selectOnPress = !this.holdButtonToActivate;
     }
 }
コード例 #19
0
        protected virtual bool FindController()
        {
            controllerEvents    = (controllerEvents == null ? GetComponentInParent <VRTK_ControllerEvents>() : controllerEvents);
            controllerReference = VRTK_ControllerReference.GetControllerReference((controllerEvents != null ? controllerEvents.gameObject : null));

            if (ControllerRequired() && controllerEvents == null)
            {
                VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_Pointer", "VRTK_ControllerEvents", "the Controller Alias", ". To omit this warning, set the `Activation Button` and `Selection Button` to `Undefined`"));
                return(false);
            }

            GetInteractUse();

            return(true);
        }
コード例 #20
0
        protected virtual void SetControllerButtons(ControllerHand hand)
        {
            List <string> checkhands = (hand == ControllerHand.Right ? validRightHands : validLeftHands);

            bool joystickFound      = false;
            int  validJoystickIndex = 0;

            string[] availableJoysticks = Input.GetJoystickNames();
            for (int i = 0; i < availableJoysticks.Length; i++)
            {
                if (checkhands.Contains(availableJoysticks[i]))
                {
                    SetCachedControllerType(availableJoysticks[i]);
                    joystickFound      = true;
                    validJoystickIndex = i + 1;
                }
            }

            //If the joystick isn't found then try and match on headset type
            if (!joystickFound)
            {
                switch (VRTK_DeviceFinder.GetHeadsetType())
                {
                case SDK_BaseHeadset.HeadsetType.GoogleDaydream:
                    SetCachedControllerType("googledaydream");
                    joystickFound      = true;
                    validJoystickIndex = 1;
                    break;
                }
            }

            if (joystickFound)
            {
                if (hand == ControllerHand.Right)
                {
                    var pressCodes = cachedControllerType == ControllerType.Oculus_OculusRemote ? rightOculusRemotePressCodes : rightControllerPressCodes;
                    SetControllerButtonValues(ref rightControllerTouchKeyCodes, ref rightControllerPressKeyCodes, validJoystickIndex, rightControllerTouchCodes, pressCodes);
                }
                else
                {
                    SetControllerButtonValues(ref leftControllerTouchKeyCodes, ref leftControllerPressKeyCodes, validJoystickIndex, leftControllerTouchCodes, leftControllerPressCodes);
                }
            }
            else if (availableJoysticks.Length > 0 && VRTK_ControllerReference.GetControllerReference(hand) != null && VRTK_ControllerReference.GetControllerReference(hand).actual.gameObject.activeInHierarchy)
            {
                VRTK_Logger.Warn("Failed setting controller buttons on [" + hand + "] due to no valid joystick type found in `GetJoyStickNames` -> " + string.Join(", ", availableJoysticks));
            }
        }
コード例 #21
0
ファイル: VRTK_RoomExtender.cs プロジェクト: KKJSP/USPTO
 protected virtual void OnEnable()
 {
     movementTransform = VRTK_DeviceFinder.HeadsetTransform();
     if (movementTransform == null)
     {
         VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_SCENE, "VRTK_RoomExtender", "Headset Transform"));
     }
     playArea = VRTK_DeviceFinder.PlayAreaTransform();
     additionalMovementEnabled = !additionalMovementEnabledOnButtonPress;
     if (debugTransform != null)
     {
         debugTransform.localScale = new Vector3(headZoneRadius * 2, 0.01f, headZoneRadius * 2);
     }
     MoveHeadCircleNonLinearDrift();
     lastPosition = movementTransform.localPosition;
 }
コード例 #22
0
        /// <summary>
        /// Setup the MR camera properly.
        /// </summary>
        protected virtual void SetupMRCamera()
        {
            Camera camera = GetComponent <Camera>();

            if (camera.tag != "MainCamera")
            {
                camera.tag = "MainCamera";
            }

            camera.nearClipPlane = 0.01f;

            if (camera.stereoTargetEye != StereoTargetEyeMask.Both)
            {
                VRTK_Logger.Warn("Target eye of main camera is not set to both. Are you sure you want to render only one eye?");
            }
        }
コード例 #23
0
ファイル: VRTK_DeviceFinder.cs プロジェクト: KKJSP/USPTO
        public static Headsets GetHeadsetType(bool summary = false)
        {
            Headsets returnValue = Headsets.Unknown;

            cachedHeadsetType = (cachedHeadsetType == "" ? XRDevice.model.Replace(" ", "").Replace(".", "").ToLowerInvariant() : cachedHeadsetType);
            switch (cachedHeadsetType)
            {
            case "oculusriftcv1":
                returnValue = (summary ? Headsets.OculusRift : Headsets.OculusRiftCV1);
                break;

            case "oculusriftes07":
                returnValue = (summary ? Headsets.OculusRift : Headsets.OculusRiftES07);
                break;

            case "vivemv":
                returnValue = (summary ? Headsets.Vive : Headsets.ViveMV);
                break;

            case "vivedvt":
                returnValue = (summary ? Headsets.Vive : Headsets.ViveDVT);
                break;
            }

            if (returnValue == Headsets.Unknown)
            {
                VRTK_Logger.Warn(
                    string.Format("Your headset is of type '{0}' which VRTK doesn't know about yet. Please report this headset type to the maintainers of VRTK."
                                  + (summary ? " Falling back to a slower check to summarize the headset type now." : ""),
                                  cachedHeadsetType)
                    );

                if (summary)
                {
                    if (cachedHeadsetType.Contains("rift"))
                    {
                        return(Headsets.OculusRift);
                    }
                    if (cachedHeadsetType.Contains("vive"))
                    {
                        return(Headsets.Vive);
                    }
                }
            }

            return(returnValue);
        }
コード例 #24
0
        // Token: 0x06001B4D RID: 6989 RVA: 0x0008E9D3 File Offset: 0x0008CBD3
        private IEnumerator FinishSDKSetupLoading(VRTK_SDKSetup[] sdkSetups, VRTK_SDKSetup previousLoadedSetup)
        {
            yield return(null);

            string loadedDeviceName = string.IsNullOrEmpty(XRSettings.loadedDeviceName) ? "None" : XRSettings.loadedDeviceName;

            this.loadedSetup = sdkSetups.FirstOrDefault((VRTK_SDKSetup setup) => setup.usedVRDeviceNames.Contains(loadedDeviceName));
            if (this.loadedSetup == null)
            {
                this.UnloadSDKSetup(false);
                VRTK_Logger.Error("No SDK Setup from the provided list could be loaded.");
                this.OnLoadedSetupChanged(new VRTK_SDKManager.LoadedSetupChangeEventArgs(previousLoadedSetup, null, "No SDK Setup from the provided list could be loaded."));
                yield break;
            }
            if (this.loadedSetup.usedVRDeviceNames.Except(new string[]
            {
                "None"
            }).Any <string>())
            {
                XRSettings.enabled = true;
                if (!XRDevice.isPresent)
                {
                    int    num  = Array.IndexOf <VRTK_SDKSetup>(sdkSetups, this.loadedSetup) + 1;
                    string text = "An SDK Setup from the provided list could be loaded, but the device is not in working order.";
                    this.ToggleBehaviours(false);
                    this.loadedSetup = null;
                    if (num < sdkSetups.Length && sdkSetups.Length - num > 0)
                    {
                        text += " Now retrying with the remaining SDK Setups from the provided list...";
                        VRTK_Logger.Warn(text);
                        this.OnLoadedSetupChanged(new VRTK_SDKManager.LoadedSetupChangeEventArgs(previousLoadedSetup, null, text));
                        this.TryLoadSDKSetup(num, false, sdkSetups);
                        yield break;
                    }
                    this.UnloadSDKSetup(false);
                    text += " There are no other Setups in the provided list to try.";
                    VRTK_Logger.Error(text);
                    this.OnLoadedSetupChanged(new VRTK_SDKManager.LoadedSetupChangeEventArgs(previousLoadedSetup, null, text));
                    yield break;
                }
            }
            this.loadedSetup.OnLoaded(this);
            this.ToggleBehaviours(true);
            this.OnLoadedSetupChanged(new VRTK_SDKManager.LoadedSetupChangeEventArgs(previousLoadedSetup, this.loadedSetup, null));
            yield break;
        }
コード例 #25
0
        /// <summary>
        /// The GetHeadsetType method returns the type of headset connected to the computer.
        /// </summary>
        /// <param name="summary">If this is true, then the generic name for the headset is returned not including the version type (e.g. OculusRift will be returned for DK2 and CV1).</param>
        /// <returns>The Headset type that is connected.</returns>
        public static Headsets GetHeadsetType(bool summary = false)
        {
            Headsets returnValue = Headsets.Unknown;
            string   checkValue  = VRDevice.model;

            switch (checkValue)
            {
            case "Oculus Rift CV1":
                returnValue = (summary ? Headsets.OculusRift : Headsets.OculusRiftCV1);
                break;

            case "Vive MV":
            case "Vive. MV":
                returnValue = (summary ? Headsets.Vive : Headsets.ViveMV);
                break;

            case "Vive DVT":
                returnValue = (summary ? Headsets.Vive : Headsets.ViveDVT);
                break;
            }

            if (returnValue == Headsets.Unknown)
            {
                VRTK_Logger.Warn(
                    string.Format("Your headset is of type '{0}' which VRTK doesn't know about yet. Please report this headset type to the maintainers of VRTK."
                                  + (summary ? " Falling back to a slower check to summarize the headset type now." : ""),
                                  checkValue)
                    );

                if (summary)
                {
                    checkValue = checkValue.ToLowerInvariant();
                    if (checkValue.Contains("rift"))
                    {
                        return(Headsets.OculusRift);
                    }
                    if (checkValue.Contains("vive"))
                    {
                        return(Headsets.Vive);
                    }
                }
            }

            return(returnValue);
        }
コード例 #26
0
ファイル: VRTK_Pointer.cs プロジェクト: zinkins/VRTK
        protected virtual void FindController()
        {
            if (controller == null)
            {
                controller = GetComponentInParent <VRTK_ControllerEvents>();
                SetupController();
            }

            if (controller == null && (activationButton != VRTK_ControllerEvents.ButtonAlias.Undefined || selectionButton != VRTK_ControllerEvents.ButtonAlias.Undefined))
            {
                VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_Pointer", "VRTK_ControllerEvents", "the Controller Alias", ". To omit this warning, set the `Activation Button` and `Selection Button` to `Undefined`"));
            }

            if (directionIndicator != null)
            {
                directionIndicator.Initialize(controller);
            }
        }
コード例 #27
0
        protected virtual bool FindController()
        {
            if (controller == null)
            {
                controller = GetComponentInParent <VRTK_ControllerEvents>();
            }

            if (controller == null && ControllerRequired())
            {
                VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_Pointer", "VRTK_ControllerEvents", "the Controller Alias", ". To omit this warning, set the `Activation Button` and `Selection Button` to `Undefined`"));
                return(false);
            }

            GetInteractUse();
            SetupDirectionIndicator();

            return(true);
        }
コード例 #28
0
        protected virtual void Start()
        {
            interactableObject = gameObject.transform.parent.gameObject;
            if (interactableObject == null || interactableObject.GetComponent <VRTK_InteractableObject>() == null)
            {
                VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "PanelMenuController", "VRTK_InteractableObject", "a parent"));
                return;
            }

            interactableObject.GetComponent <VRTK_InteractableObject>().InteractableObjectGrabbed   += new InteractableObjectEventHandler(DoInteractableObjectIsGrabbed);
            interactableObject.GetComponent <VRTK_InteractableObject>().InteractableObjectUngrabbed += new InteractableObjectEventHandler(DoInteractableObjectIsUngrabbed);

            canvasObject = gameObject.transform.GetChild(0).gameObject;
            if (canvasObject == null || canvasObject.GetComponent <Canvas>() == null)
            {
                VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "PanelMenuController", "Canvas", "a child"));
            }
        }
コード例 #29
0
 protected virtual void CheckSkyboxTexture()
 {
     if (effectSkybox == null)
     {
         Cubemap tempTexture = new Cubemap(1, TextureFormat.ARGB32, false);
         tempTexture.SetPixel(CubemapFace.NegativeX, 0, 0, Color.white);
         tempTexture.SetPixel(CubemapFace.NegativeY, 0, 0, Color.white);
         tempTexture.SetPixel(CubemapFace.NegativeZ, 0, 0, Color.white);
         tempTexture.SetPixel(CubemapFace.PositiveX, 0, 0, Color.white);
         tempTexture.SetPixel(CubemapFace.PositiveY, 0, 0, Color.white);
         tempTexture.SetPixel(CubemapFace.PositiveZ, 0, 0, Color.white);
         effectSkybox = tempTexture;
     }
     else if (effectColor.r < 0.15f && effectColor.g < 0.15 && effectColor.b < 0.15)
     {
         VRTK_Logger.Warn("`VRTK_TunnelOverlay` has an `Effect Skybox` texture but the `Effect Color` is too dark which will tint the texture so it is not visible.");
     }
 }
コード例 #30
0
        protected virtual void CreateHighlightersInEditor()
        {
            if (VRTK_SharedMethods.IsEditTime())
            {
                GenerateHighlightObject();

                if (snapType == SnapTypes.UseJoint && GetComponent <Joint>() == null)
                {
                    VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "SnapDropZone:" + name, "Joint", "the same", " because the `Snap Type` is set to `Use Joint`"));
                }

                GenerateEditorHighlightObject();
                ForceSetObjects();
                if (highlightEditorObject != null)
                {
                    highlightEditorObject.SetActive(displayDropZoneInEditor);
                }
            }
        }