コード例 #1
0
        // Token: 0x060012E3 RID: 4835 RVA: 0x0006A8B4 File Offset: 0x00068AB4
        public override string GetControllerElementPath(SDK_BaseController.ControllerElements element, SDK_BaseController.ControllerHand hand, bool fullPath = false)
        {
            string text = fullPath ? "/attach" : "";

            switch (element)
            {
            case SDK_BaseController.ControllerElements.AttachPoint:
                return("");

            case SDK_BaseController.ControllerElements.Trigger:
                return(text ?? "");

            case SDK_BaseController.ControllerElements.GripLeft:
                return(text ?? "");

            case SDK_BaseController.ControllerElements.GripRight:
                return(text ?? "");

            case SDK_BaseController.ControllerElements.Touchpad:
                return(text ?? "");

            case SDK_BaseController.ControllerElements.ButtonOne:
                return(text ?? "");

            case SDK_BaseController.ControllerElements.SystemMenu:
                return(text ?? "");

            case SDK_BaseController.ControllerElements.Body:
                return("");
            }
            return(null);
        }
コード例 #2
0
        protected virtual Color GetColourParameter(SDK_BaseController.ControllerElements element)
        {
            switch (element)
            {
            case SDK_BaseController.ControllerElements.Body:
                return(highlightBody);

            case SDK_BaseController.ControllerElements.Trigger:
                return(highlightTrigger);

            case SDK_BaseController.ControllerElements.GripLeft:
            case SDK_BaseController.ControllerElements.GripRight:
                return(highlightGrip);

            case SDK_BaseController.ControllerElements.Touchpad:
                return(highlightTouchpad);

            case SDK_BaseController.ControllerElements.TouchpadTwo:
                return(highlightTouchpadTwo);

            case SDK_BaseController.ControllerElements.ButtonOne:
                return(highlightButtonOne);

            case SDK_BaseController.ControllerElements.ButtonTwo:
                return(highlightButtonTwo);

            case SDK_BaseController.ControllerElements.SystemMenu:
                return(highlightSystemMenu);

            case SDK_BaseController.ControllerElements.StartMenu:
                return(highlightStartMenu);
            }

            return(Color.clear);
        }
コード例 #3
0
        public string GetPathToVisualizedButton(SDK_BaseController.ControllerElements button)
        {
            switch (button)
            {
            case SDK_BaseController.ControllerElements.AttachPoint:
                return(attachPointPath);

            case SDK_BaseController.ControllerElements.SystemMenu:
                return(homePath);

            case SDK_BaseController.ControllerElements.StartMenu:
                return(menuPath);

            case SDK_BaseController.ControllerElements.GripLeft:
            case SDK_BaseController.ControllerElements.GripRight:
                return(graspPath);

            case SDK_BaseController.ControllerElements.Trigger:
                return(selectPath);

            case SDK_BaseController.ControllerElements.TouchpadTwo:
                return(thumbstickPath);

            case SDK_BaseController.ControllerElements.Touchpad:
                return(touchpadPath);

            default:
                return(null);
            }
        }
コード例 #4
0
        protected virtual string GetPathForControllerElement(SDK_BaseController.ControllerElements controllerElement)
        {
            switch (controllerElement)
            {
            case SDK_BaseController.ControllerElements.Body:
                return(modelElementPaths.bodyModelPath);

            case SDK_BaseController.ControllerElements.Trigger:
                return(modelElementPaths.triggerModelPath);

            case SDK_BaseController.ControllerElements.GripLeft:
                return(modelElementPaths.leftGripModelPath);

            case SDK_BaseController.ControllerElements.GripRight:
                return(modelElementPaths.rightGripModelPath);

            case SDK_BaseController.ControllerElements.Touchpad:
                return(modelElementPaths.touchpadModelPath);

            case SDK_BaseController.ControllerElements.ButtonOne:
                return(modelElementPaths.buttonOneModelPath);

            case SDK_BaseController.ControllerElements.ButtonTwo:
                return(modelElementPaths.buttonTwoModelPath);

            case SDK_BaseController.ControllerElements.SystemMenu:
                return(modelElementPaths.systemMenuModelPath);

            case SDK_BaseController.ControllerElements.StartMenu:
                return(modelElementPaths.startMenuModelPath);
            }
            return("");
        }
コード例 #5
0
        protected virtual string GetElementPath(string currentPath, SDK_BaseController.ControllerElements elementType)
        {
            SDK_BaseController.ControllerHand currentHand = VRTK_DeviceFinder.GetControllerHand(actualController);
            string foundElementPath = VRTK_SDK_Bridge.GetControllerElementPath(elementType, currentHand);

            return(currentPath.Trim() == "" && foundElementPath != null ? foundElementPath : currentPath.Trim());
        }
コード例 #6
0
        /// <summary>
        /// The HighlightElement method attempts to highlight a specific controller element.
        /// </summary>
        /// <param name="elementType">The element type on the controller.</param>
        /// <param name="color">The Color to highlight the controller element to.</param>
        /// <param name="fadeDuration">The duration in seconds to fade from the initial color to the target color.</param>
        public virtual void HighlightElement(SDK_BaseController.ControllerElements elementType, Color color, float fadeDuration = 0f)
        {
            Transform element = GetElementTransform(GetPathForControllerElement(elementType));

            if (element != null)
            {
                VRTK_ObjectAppearance.HighlightObject(element.gameObject, color, fadeDuration);
                SetColourParameter(elementType, color);
            }
        }
コード例 #7
0
        // Token: 0x06001549 RID: 5449 RVA: 0x000757A0 File Offset: 0x000739A0
        protected virtual string GetElementPath(string currentPath, SDK_BaseController.ControllerElements elementType)
        {
            SDK_BaseController.ControllerHand controllerHand = VRTK_DeviceFinder.GetControllerHand(this.controllerAlias);
            string controllerElementPath = VRTK_SDK_Bridge.GetControllerElementPath(elementType, controllerHand, false);

            if (!(currentPath.Trim() == "") || controllerElementPath == null)
            {
                return(currentPath.Trim());
            }
            return(controllerElementPath);
        }
コード例 #8
0
        protected virtual void SetColourParameter(SDK_BaseController.ControllerElements element, Color color)
        {
            color = (color == Color.clear && highlightController != Color.clear ? highlightController : color);

            switch (element)
            {
            case SDK_BaseController.ControllerElements.Body:
                highlightBody     = color;
                lastHighlightBody = color;
                break;

            case SDK_BaseController.ControllerElements.Trigger:
                highlightTrigger     = color;
                lastHighlightTrigger = color;
                break;

            case SDK_BaseController.ControllerElements.GripLeft:
            case SDK_BaseController.ControllerElements.GripRight:
                highlightGrip     = color;
                lastHighlightGrip = color;
                break;

            case SDK_BaseController.ControllerElements.Touchpad:
                highlightTouchpad     = color;
                lastHighlightTouchpad = color;
                break;

            case SDK_BaseController.ControllerElements.TouchpadTwo:
                highlightTouchpadTwo     = color;
                lastHighlightTouchpadTwo = color;
                break;

            case SDK_BaseController.ControllerElements.ButtonOne:
                highlightButtonOne     = color;
                lastHighlightButtonOne = color;
                break;

            case SDK_BaseController.ControllerElements.ButtonTwo:
                highlightButtonTwo     = color;
                lastHighlightButtonTwo = color;
                break;

            case SDK_BaseController.ControllerElements.SystemMenu:
                highlightSystemMenu     = color;
                lastHighlightSystemMenu = color;
                break;

            case SDK_BaseController.ControllerElements.StartMenu:
                highlightStartMenu     = color;
                lastHighlightStartMenu = color;
                break;
            }
        }
コード例 #9
0
 // Token: 0x06001475 RID: 5237 RVA: 0x00071E04 File Offset: 0x00070004
 protected virtual void ToggleElementHighlight(bool state, SDK_BaseController.ControllerElements elementType, Color?color, float fadeDuration = 0f)
 {
     if (this.controllerHighlighter != null)
     {
         if (state)
         {
             this.controllerHighlighter.HighlightElement(elementType, ((color == null) ? new Color?(Color.white) : color).Value, fadeDuration);
             return;
         }
         this.controllerHighlighter.UnhighlightElement(elementType);
     }
 }
コード例 #10
0
 /// <summary>
 /// 关闭按键呼吸提示
 /// </summary>
 /// <param name="elements"></param>
 public void ButtonBreatheOff(SDK_BaseController.ControllerElements elements)
 {
     for (int i = 0; i < items.Count; i++)
     {
         if (items[i].element == elements)
         {
             //关闭光亮
             items[i].active = false;
             highlighter.UnhighlightElement(elements);
             items.Remove(items[i]);
         }
     }
 }
コード例 #11
0
        // Token: 0x06001543 RID: 5443 RVA: 0x0007554C File Offset: 0x0007374C
        protected virtual void SetColourParameter(SDK_BaseController.ControllerElements element, Color color)
        {
            color = ((color == Color.clear && this.highlightController != Color.clear) ? this.highlightController : color);
            switch (element)
            {
            case SDK_BaseController.ControllerElements.Trigger:
                this.highlightTrigger     = color;
                this.lastHighlightTrigger = color;
                return;

            case SDK_BaseController.ControllerElements.GripLeft:
            case SDK_BaseController.ControllerElements.GripRight:
                this.highlightGrip     = color;
                this.lastHighlightGrip = color;
                return;

            case SDK_BaseController.ControllerElements.Touchpad:
                this.highlightTouchpad     = color;
                this.lastHighlightTouchpad = color;
                return;

            case SDK_BaseController.ControllerElements.ButtonOne:
                this.highlightButtonOne     = color;
                this.lastHighlightButtonOne = color;
                return;

            case SDK_BaseController.ControllerElements.ButtonTwo:
                this.highlightButtonTwo     = color;
                this.lastHighlightButtonTwo = color;
                return;

            case SDK_BaseController.ControllerElements.SystemMenu:
                this.highlightSystemMenu     = color;
                this.lastHighlightSystemMenu = color;
                return;

            case SDK_BaseController.ControllerElements.Body:
                this.highlightBody     = color;
                this.lastHighlightBody = color;
                return;

            case SDK_BaseController.ControllerElements.StartMenu:
                this.highlightStartMenu     = color;
                this.lastHighlightStartMenu = color;
                return;

            default:
                return;
            }
        }
コード例 #12
0
 protected virtual void ToggleElementHighlight(bool state, SDK_BaseController.ControllerElements elementType, Color?color, float fadeDuration = 0f)
 {
     if (controllerHighlighter != null)
     {
         if (state)
         {
             controllerHighlighter.HighlightElement(elementType, (Color)(color == null ? Color.white : color), fadeDuration);
         }
         else
         {
             controllerHighlighter.UnhighlightElement(elementType);
         }
     }
 }
コード例 #13
0
 /// <summary>
 /// The UnhighlightElement method attempts to remove the highlight from the specific controller element.
 /// </summary>
 /// <param name="elementType">The element type on the controller.</param>
 public virtual void UnhighlightElement(SDK_BaseController.ControllerElements elementType)
 {
     if (!controllerHighlighted)
     {
         Transform element = GetElementTransform(GetPathForControllerElement(elementType));
         if (element != null)
         {
             VRTK_ObjectAppearance.UnhighlightObject(element.gameObject);
             SetColourParameter(elementType, Color.clear);
         }
     }
     else if (highlightController != Color.clear && GetColourParameter(elementType) != highlightController)
     {
         HighlightElement(elementType, highlightController, 0f);
     }
 }
コード例 #14
0
 // Token: 0x0600153C RID: 5436 RVA: 0x00075294 File Offset: 0x00073494
 public virtual void UnhighlightElement(SDK_BaseController.ControllerElements elementType)
 {
     if (!this.controllerHighlighted)
     {
         Transform elementTransform = this.GetElementTransform(this.GetPathForControllerElement(elementType));
         if (elementTransform != null)
         {
             VRTK_ObjectAppearance.UnhighlightObject(elementTransform.gameObject);
             this.SetColourParameter(elementType, Color.clear);
             return;
         }
     }
     else if (this.highlightController != Color.clear && this.GetColourParameter(elementType) != this.highlightController)
     {
         this.HighlightElement(elementType, this.highlightController, 0f);
     }
 }
コード例 #15
0
        // Token: 0x0600110C RID: 4364 RVA: 0x00064298 File Offset: 0x00062498
        protected virtual Transform GetTransform(Transform setTransform, SDK_BaseController.ControllerElements findElement)
        {
            Transform result = null;

            if (setTransform != null)
            {
                result = setTransform;
            }
            else if (this.controllerEvents != null)
            {
                GameObject modelAliasController = VRTK_DeviceFinder.GetModelAliasController(this.controllerEvents.gameObject);
                if (modelAliasController != null && modelAliasController.activeInHierarchy)
                {
                    SDK_BaseController.ControllerHand controllerHand = VRTK_DeviceFinder.GetControllerHand(this.controllerEvents.gameObject);
                    string controllerElementPath = VRTK_SDK_Bridge.GetControllerElementPath(findElement, controllerHand, true);
                    result = ((controllerElementPath != null) ? modelAliasController.transform.Find(controllerElementPath) : null);
                }
            }
            return(result);
        }
コード例 #16
0
        // Token: 0x06001322 RID: 4898 RVA: 0x0006B444 File Offset: 0x00069644
        public override string GetControllerElementPath(SDK_BaseController.ControllerElements element, SDK_BaseController.ControllerHand hand, bool fullPath = false)
        {
            string text = fullPath ? "/attach" : "";

            switch (element)
            {
            case SDK_BaseController.ControllerElements.AttachPoint:
                return("tip/attach");

            case SDK_BaseController.ControllerElements.Trigger:
                return("trigger" + text);

            case SDK_BaseController.ControllerElements.GripLeft:
                return(this.GetControllerGripPath(hand, text, SDK_BaseController.ControllerHand.Left));

            case SDK_BaseController.ControllerElements.GripRight:
                return(this.GetControllerGripPath(hand, text, SDK_BaseController.ControllerHand.Right));

            case SDK_BaseController.ControllerElements.Touchpad:
                return(this.GetControllerTouchpadPath(hand, text));

            case SDK_BaseController.ControllerElements.ButtonOne:
                return(this.GetControllerButtonOnePath(hand, text));

            case SDK_BaseController.ControllerElements.ButtonTwo:
                return(this.GetControllerButtonTwoPath(hand, text));

            case SDK_BaseController.ControllerElements.SystemMenu:
                return(this.GetControllerSystemMenuPath(hand, text));

            case SDK_BaseController.ControllerElements.Body:
                return("body");

            case SDK_BaseController.ControllerElements.StartMenu:
                return(this.GetControllerStartMenuPath(hand, text));

            default:
                return(null);
            }
        }
        public string GetPathToButton(SDK_BaseController.ControllerElements element, InteractionSourceHandedness handedness)
        {
            switch (handedness)
            {
            case InteractionSourceHandedness.Left:
                if (leftControllerModel != null)
                {
                    return(leftControllerModel.GetPathToVisualizedButton(element));
                }
                return(null);

            case InteractionSourceHandedness.Right:
                if (rightControllerModel != null)
                {
                    return(rightControllerModel.GetPathToVisualizedButton(element));
                }
                return(null);

            default:
                return(null);
            }
        }
コード例 #18
0
        protected virtual Transform GetTransform(Transform setTransform, SDK_BaseController.ControllerElements findElement)
        {
            Transform returnTransform = null;

            if (setTransform)
            {
                returnTransform = setTransform;
            }
            else if (controllerEvents != null)
            {
                GameObject modelController = VRTK_DeviceFinder.GetModelAliasController(controllerEvents.gameObject);

                if (modelController && modelController.activeInHierarchy)
                {
                    SDK_BaseController.ControllerHand controllerHand = VRTK_DeviceFinder.GetControllerHand(controllerEvents.gameObject);
                    string elementPath = VRTK_SDK_Bridge.GetControllerElementPath(findElement, controllerHand, true);
                    returnTransform = modelController.transform.FindChild(elementPath);
                }
            }

            return(returnTransform);
        }
コード例 #19
0
        private Transform GetTransform(Transform setTransform, SDK_BaseController.ControllerElements findElement)
        {
            Transform returnTransform = null;

            if (setTransform)
            {
                returnTransform = setTransform;
            }
            else
            {
                var modelController = VRTK_DeviceFinder.GetModelAliasController(controllerActions.gameObject);

                if (modelController && modelController.activeInHierarchy)
                {
                    var controllerHand = VRTK_DeviceFinder.GetControllerHand(controllerActions.gameObject);
                    var elementPath    = VRTK_SDK_Bridge.GetControllerElementPath(findElement, controllerHand, true);
                    returnTransform = modelController.transform.Find(elementPath);
                }
            }

            return(returnTransform);
        }
コード例 #20
0
    /// <summary>
    /// 打开按键呼吸提示
    /// </summary>
    /// <param name="elements">按键</param>
    /// <param name="color">颜色</param>
    /// <param name="cycle">周期</param>
    public void ButtonBreatheOn(SDK_BaseController.ControllerElements elements, Color color, float cycle)
    {
        if (elements == SDK_BaseController.ControllerElements.StartMenu)
        {
            elements = SDK_BaseController.ControllerElements.ButtonTwo;
        }
        HightItem hight = new HightItem(elements, color, cycle, true);

        if (items.Contains(hight))
        {
            return;
        }
        hight.active = true;
        items.Add(hight);
        if (items == null)
        {
            return;
        }
        foreach (var item in items)
        {
            highlighter.HighlightElement(item.element, item.color);
        }
    }
コード例 #21
0
 // Token: 0x06001290 RID: 4752 RVA: 0x0005DD8C File Offset: 0x0005BF8C
 public override string GetControllerElementPath(SDK_BaseController.ControllerElements element, SDK_BaseController.ControllerHand hand, bool fullPath = false)
 {
     return("");
 }
コード例 #22
0
 public static string GetControllerElementPath(SDK_BaseController.ControllerElements element, SDK_BaseController.ControllerHand hand, bool fullPath = false)
 {
     return(GetControllerSDK().GetControllerElementPath(element, hand, fullPath));
 }
コード例 #23
0
        private void CreatePathToTransform(Transform transform)
        {
            Transform parentTransform = transform.parent;

            SDK_BaseController.ControllerElements controllerElement = SDK_BaseController.ControllerElements.Body;

            string path = transform.name;

            while (parentTransform != ControllerParent.transform)
            {
                switch (parentTransform.name.ToLower())
                {
                case "tracking_mesh":
                    controllerElement = SDK_BaseController.ControllerElements.AttachPoint;
                    break;

                case "home":
                    controllerElement = SDK_BaseController.ControllerElements.SystemMenu;
                    break;

                case "menu":
                    controllerElement = SDK_BaseController.ControllerElements.StartMenu;
                    break;

                case "grasp":
                    controllerElement = SDK_BaseController.ControllerElements.GripLeft;
                    break;

                case "select":
                    controllerElement = SDK_BaseController.ControllerElements.Trigger;
                    break;

                case "thumbstick_press":
                    controllerElement = SDK_BaseController.ControllerElements.TouchpadTwo;
                    break;

                case "touchpad_press":
                    controllerElement = SDK_BaseController.ControllerElements.Touchpad;
                    break;
                }

                path = parentTransform.name + "/" + path;

                parentTransform = parentTransform.parent;
            }

            switch (controllerElement)
            {
            case SDK_BaseController.ControllerElements.AttachPoint:
                attachPointPath = path;
                break;

            case SDK_BaseController.ControllerElements.SystemMenu:
                homePath = path;
                break;

            case SDK_BaseController.ControllerElements.StartMenu:
                menuPath = path;
                break;

            case SDK_BaseController.ControllerElements.GripLeft:
                graspPath = path;
                break;

            case SDK_BaseController.ControllerElements.Trigger:
                selectPath = path;
                break;

            case SDK_BaseController.ControllerElements.TouchpadTwo:
                thumbstickPath = path;
                break;

            case SDK_BaseController.ControllerElements.Touchpad:
                touchpadPath = path;
                break;
            }
        }
コード例 #24
0
 // Token: 0x06001242 RID: 4674
 public abstract string GetControllerElementPath(SDK_BaseController.ControllerElements element, SDK_BaseController.ControllerHand hand, bool fullPath = false);
コード例 #25
0
 public HightItem(SDK_BaseController.ControllerElements ele, Color color, float cycle, bool active)
 {
     this.element = ele; this.color = color; this.cycle = cycle;
 }