Ejemplo n.º 1
0
 // Token: 0x06005545 RID: 21829 RVA: 0x001D682E File Offset: 0x001D4C2E
 public static void VRC_Tutorial_ActivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart, string text, float duration, int priority)
 {
     if (TutorialManager.Instance != null)
     {
         TutorialManager.Instance.ActivateControllerLabel(hand, controllerPart, text, duration, priority);
     }
 }
Ejemplo n.º 2
0
    // Token: 0x06005FF5 RID: 24565 RVA: 0x0021BD98 File Offset: 0x0021A198
    private void Awake()
    {
        IEnumerator enumerator = Enum.GetValues(typeof(ControllerInputUI)).GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object            obj = enumerator.Current;
                ControllerInputUI controllerInputUI = (ControllerInputUI)obj;
                Renderer          meshRenderer      = this.GetMeshRenderer(controllerInputUI);
                if (meshRenderer != null)
                {
                    Material[] materials = meshRenderer.materials;
                    if (materials != null)
                    {
                        for (int i = 0; i < materials.Length; i++)
                        {
                            materials[i].EnableKeyword("_EMISSION");
                        }
                    }
                    this._originalMaterials[(int)controllerInputUI] = materials;
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
    }
Ejemplo n.º 3
0
 // Token: 0x06005546 RID: 21830 RVA: 0x001D6850 File Offset: 0x001D4C50
 public static void VRC_Tutorial_DeactivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart)
 {
     if (TutorialManager.Instance != null)
     {
         TutorialManager.Instance.DeactivateControllerLabel(hand, controllerPart);
     }
 }
Ejemplo n.º 4
0
    // Token: 0x06005FF9 RID: 24569 RVA: 0x0021C17C File Offset: 0x0021A57C
    public void DisableAllHighlights()
    {
        IEnumerator enumerator = Enum.GetValues(typeof(ControllerInputUI)).GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object            obj = enumerator.Current;
                ControllerInputUI controllerInputUI = (ControllerInputUI)obj;
                Renderer          meshRenderer      = this.GetMeshRenderer(controllerInputUI);
                if (meshRenderer != null)
                {
                    meshRenderer.materials = this._originalMaterials[(int)controllerInputUI];
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
    }
Ejemplo n.º 5
0
 public static void DeactivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart)
 {
     if (_DeactivateControllerLabel != null)
     {
         _DeactivateControllerLabel(hand, controllerPart);
     }
 }
Ejemplo n.º 6
0
 public static void ActivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart, string text, float duration, int priority)
 {
     if (_ActivateControllerLabel != null)
     {
         _ActivateControllerLabel(hand, controllerPart, text, duration, priority);
     }
 }
Ejemplo n.º 7
0
 // Token: 0x06005575 RID: 21877 RVA: 0x001D7AF4 File Offset: 0x001D5EF4
 public void DeactivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart)
 {
     foreach (TutorialManager.ActiveLabel activeLabel in this._activeLabels.Values)
     {
         if (activeLabel.Type == TutorialLabelType.Controller && activeLabel.Hand == hand && activeLabel.ControllerPart == controllerPart && activeLabel.Label.IsActive)
         {
             this.DeactivateLabel(activeLabel);
         }
     }
 }
Ejemplo n.º 8
0
 // Token: 0x0600554B RID: 21835 RVA: 0x001D6974 File Offset: 0x001D4D74
 public void PickupSelected(VRC_Pickup pickup, bool leftHand)
 {
     if (pickup.currentlyHeldBy != null)
     {
         return;
     }
     if (VRCInputManager.IsUsingHandController())
     {
         ControllerInputUI controllerPart = (VRCInputManager.LastInputMethod != VRCInputManager.InputMethod.Oculus) ? ControllerInputUI.Trigger : ControllerInputUI.Grip;
         this.ActivateControllerLabel((!leftHand) ? ControllerHand.Right : ControllerHand.Left, controllerPart, (!VRCHandGrasper.IsAutoEquipPickup(pickup)) ? "Hold to Grab" : "Equip", 0.1f, 0);
     }
     else if (!this.IsShowingOtherLabelOfType(TutorialLabelType.Pickup, pickup.transform))
     {
         this.ActivateObjectLabel(pickup.transform, TutorialLabelType.Pickup, (!leftHand) ? ControllerHand.Right : ControllerHand.Left, (!VRCInputManager.IsUsingAutoEquipControllerType() || !VRCHandGrasper.IsAutoEquipPickup(pickup)) ? "Hold to Grab" : "Equip", ControllerActionUI.Use, 0.1f, 0, AttachMode.PositionOnly, false);
     }
 }
Ejemplo n.º 9
0
        // Token: 0x06005580 RID: 21888 RVA: 0x001D8160 File Offset: 0x001D6560
        public void SetController(ControllerHand hand, ControllerInputUI part)
        {
            ControllerUI controllerUI = VRCTrackingManager.GetControllerUI(this.Hand);

            if (controllerUI != null)
            {
                controllerUI.EnableHighlight(this.ControllerPart, false);
            }
            ControllerUI controllerUI2 = VRCTrackingManager.GetControllerUI(hand);

            if (controllerUI2 != null)
            {
                controllerUI2.EnableHighlight(part, true);
            }
            this.Hand           = hand;
            this.ControllerPart = part;
        }
Ejemplo n.º 10
0
    // Token: 0x06005570 RID: 21872 RVA: 0x001D79B4 File Offset: 0x001D5DB4
    public void ActivateControllerLabel(string id, ControllerHand hand, ControllerInputUI controllerPart, string text, float duration = 0.1f, int priority = 0)
    {
        ControllerUI controllerUI = VRCTrackingManager.GetControllerUI(hand);

        if (controllerUI == null)
        {
            return;
        }
        Transform transform;
        Transform transform2;

        if (!controllerUI.GetUIAttachmentPoints(controllerPart, out transform, out transform2))
        {
            return;
        }
        this.ActivateLabel(transform, id, TutorialLabelType.Controller, hand, controllerPart, text, ControllerActionUI.None, string.Empty, ControllerActionUI.None, duration, priority, new Vector3?(transform.position), new Vector3?(transform2.position), AttachMode.PositionAndRotation, true, 0.8f);
        this.RefreshControllerUiVisibility(hand);
    }
Ejemplo n.º 11
0
    // Token: 0x0600554A RID: 21834 RVA: 0x001D688C File Offset: 0x001D4C8C
    public void InteractableSelected(VRC_Interactable[] interactable, Component useComponent, bool leftHand)
    {
        string text = (interactable == null || interactable.Length <= 0 || string.IsNullOrEmpty(interactable[0].interactText)) ? "Use" : interactable[0].interactText;

        if (text.CompareTo("Use") == 0 && useComponent.GetComponent <VRC_Station>() != null)
        {
            text = "Sit";
        }
        if (!this.IsShowingOtherLabelOfType(TutorialLabelType.Interactable, useComponent.transform))
        {
            this.ActivateObjectLabel(useComponent.transform, TutorialLabelType.Interactable, (!leftHand) ? ControllerHand.Right : ControllerHand.Left, text, (!VRCInputManager.IsUsingHandController()) ? ControllerActionUI.Use : ControllerActionUI.None, 0.1f, 0, AttachMode.PositionOnly, false);
        }
        if (VRCInputManager.IsUsingHandController())
        {
            ControllerInputUI controllerPart = (VRCInputManager.LastInputMethod != VRCInputManager.InputMethod.Oculus) ? ControllerInputUI.Trigger : ControllerInputUI.Grip;
            this.ActivateControllerLabel((!leftHand) ? ControllerHand.Right : ControllerHand.Left, controllerPart, text, 0.1f, 0);
        }
    }
Ejemplo n.º 12
0
 // Token: 0x06005FF8 RID: 24568 RVA: 0x0021C080 File Offset: 0x0021A480
 public void EnableHighlight(ControllerInputUI part, bool enable)
 {
     if (part >= (ControllerInputUI)this._highlightActive.Length)
     {
         return;
     }
     this._highlightActive[(int)part] = enable;
     if (enable)
     {
         Renderer meshRenderer = this.GetMeshRenderer(part);
         if (meshRenderer != null && this.HighlightMaterial != null)
         {
             int        num   = this._originalMaterials[(int)part].Length;
             Material[] array = new Material[num];
             for (int i = 0; i < num; i++)
             {
                 array[i] = this.HighlightMaterial;
             }
             meshRenderer.materials = array;
             Material[] materials = meshRenderer.materials;
             foreach (Material material in materials)
             {
                 material.color       = this.HighlightColor;
                 material.renderQueue = 3998;
             }
             meshRenderer.materials = materials;
         }
     }
     else
     {
         Renderer meshRenderer2 = this.GetMeshRenderer(part);
         if (meshRenderer2 != null)
         {
             meshRenderer2.materials = this._originalMaterials[(int)part];
         }
     }
 }
Ejemplo n.º 13
0
    // Token: 0x06005577 RID: 21879 RVA: 0x001D7BF8 File Offset: 0x001D5FF8
    private bool ActivateLabel(Transform targetObj, string id, TutorialLabelType type, ControllerHand hand, ControllerInputUI controllerPart, string text, ControllerActionUI action, string textSecondary, ControllerActionUI actionSecondary, float duration, int priority, Vector3?tetherPos, Vector3?labelPos, AttachMode attachMode, bool showOffscreen, float scale)
    {
        if (!this.AreLabelsEnabled)
        {
            return(false);
        }
        if (this.TutorialLabelPrefab == null)
        {
            return(false);
        }
        bool flag = targetObj == null || type == TutorialLabelType.Popup || type == TutorialLabelType.PopupAttached;

        if (targetObj == null)
        {
            targetObj = this.FloatingLabelTransform;
        }
        TutorialManager.ActiveLabel activeLabel = this.FindActiveLabel(targetObj.GetInstanceID());
        if (activeLabel == null)
        {
            if (flag)
            {
                Vector3 value = TutorialLabel.CalculateFloatingLabelPosition();
                tetherPos = new Vector3?(value);
                labelPos  = new Vector3?(value);
            }
            else if (tetherPos == null || labelPos == null)
            {
                Vector3 value2;
                Vector3 value3;
                TutorialLabel.FindLabelAttachPoints(targetObj, out value2, out value3);
                if (tetherPos == null)
                {
                    tetherPos = new Vector3?(value2);
                }
                if (labelPos == null)
                {
                    labelPos = new Vector3?(value3);
                }
            }
            if (!showOffscreen && !VRCTrackingManager.IsPointWithinHMDView(labelPos.Value))
            {
                return(false);
            }
            activeLabel = new TutorialManager.ActiveLabel();
            activeLabel.TargetObject = targetObj;
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.TutorialLabelPrefab);
            activeLabel.Label = gameObject.GetComponent <TutorialLabel>();
            activeLabel.Label.Init();
            this._activeLabels.Add(activeLabel.TargetObject.GetInstanceID(), activeLabel);
            activeLabel.Label.SetTargetObject(targetObj, attachMode, tetherPos.Value, labelPos.Value, flag);
        }
        else if (activeLabel.Label.IsActive && activeLabel.Priority > priority)
        {
            VRC.Core.Logger.LogOnceEvery(10f, this, string.Concat(new object[]
            {
                "TutorialManager: Existing label (",
                activeLabel.ID,
                ", ",
                activeLabel.TargetObject.name,
                ") \"",
                activeLabel.Label.TextString,
                "\" has higher priority ",
                activeLabel.Priority,
                " > ",
                priority,
                ", discarding new one"
            }));
            return(false);
        }
        activeLabel.ID   = id;
        activeLabel.Type = type;
        activeLabel.SetController(hand, controllerPart);
        activeLabel.ShowOffscreen = showOffscreen;
        activeLabel.Priority      = priority;
        activeLabel.Label.SetText(text, textSecondary);
        activeLabel.Label.SetIcon(action, actionSecondary);
        activeLabel.Label.SetTextScaleOverride(scale);
        bool invertLabelAlignment = type == TutorialLabelType.Controller && hand == ControllerHand.Right && VRCInputManager.LastInputMethod == VRCInputManager.InputMethod.Oculus;

        activeLabel.Label.IsFloatingLabel      = flag;
        activeLabel.Label.InvertLabelAlignment = invertLabelAlignment;
        activeLabel.Label.IsAttachedToView     = (type == TutorialLabelType.PopupAttached);
        activeLabel.Label.RefreshComponentPositions();
        activeLabel.TimeToLive = duration;
        activeLabel.Label.Activate();
        return(true);
    }
Ejemplo n.º 14
0
 // Token: 0x0600556F RID: 21871 RVA: 0x001D79A0 File Offset: 0x001D5DA0
 public void ActivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart, string text, float duration = 0.1f, int priority = 0)
 {
     this.ActivateControllerLabel("<no id>", hand, controllerPart, text, duration, priority);
 }
Ejemplo n.º 15
0
    // Token: 0x06005FFA RID: 24570 RVA: 0x0021C208 File Offset: 0x0021A608
    private Renderer GetMeshRenderer(ControllerInputUI part)
    {
        Transform transform = null;

        switch (part)
        {
        case ControllerInputUI.Trigger:
            transform = this.TriggerMesh;
            break;

        case ControllerInputUI.Grip:
            transform = this.GripMesh;
            break;

        case ControllerInputUI.ButtonOne:
            transform = this.ButtonOneMesh;
            break;

        case ControllerInputUI.ButtonTwo:
            transform = this.ButtonTwoMesh;
            break;

        case ControllerInputUI.Analog:
            transform = this.AnalogMesh;
            break;

        case ControllerInputUI.TrackpadCenter:
            transform = this.TrackpadCenterMesh;
            if (transform == null)
            {
                transform = this.AnalogMesh;
            }
            break;

        case ControllerInputUI.TrackpadTopLeft:
            transform = this.TrackpadTopLeftMesh;
            if (transform == null)
            {
                transform = this.TrackpadCenterMesh;
            }
            if (transform == null)
            {
                transform = this.AnalogMesh;
            }
            break;

        case ControllerInputUI.TrackpadTop:
            transform = this.TrackpadTopMesh;
            if (transform == null)
            {
                transform = this.TrackpadCenterMesh;
            }
            if (transform == null)
            {
                transform = this.AnalogMesh;
            }
            break;

        case ControllerInputUI.TrackpadTopRight:
            transform = this.TrackpadTopRightMesh;
            if (transform == null)
            {
                transform = this.TrackpadCenterMesh;
            }
            if (transform == null)
            {
                transform = this.AnalogMesh;
            }
            break;

        case ControllerInputUI.TrackpadBottomLeft:
            transform = this.TrackpadBottomLeftMesh;
            if (transform == null)
            {
                transform = this.TrackpadCenterMesh;
            }
            if (transform == null)
            {
                transform = this.AnalogMesh;
            }
            break;

        case ControllerInputUI.TrackpadBottom:
            transform = this.TrackpadBottomMesh;
            if (transform == null)
            {
                transform = this.TrackpadCenterMesh;
            }
            if (transform == null)
            {
                transform = this.AnalogMesh;
            }
            break;

        case ControllerInputUI.TrackpadBottomRight:
            transform = this.TrackpadBottomRightMesh;
            if (transform == null)
            {
                transform = this.TrackpadCenterMesh;
            }
            if (transform == null)
            {
                transform = this.AnalogMesh;
            }
            break;

        case ControllerInputUI.MenuButton:
            transform = this.MenuButtonMesh;
            break;

        case ControllerInputUI.SystemButton:
            transform = this.SystemButtonMesh;
            break;
        }
        return((!(transform != null)) ? null : transform.GetComponent <Renderer>());
    }
Ejemplo n.º 16
0
    // Token: 0x06005FF7 RID: 24567 RVA: 0x0021BECC File Offset: 0x0021A2CC
    public bool GetUIAttachmentPoints(ControllerInputUI controllerPart, out Transform start, out Transform end)
    {
        switch (controllerPart)
        {
        case ControllerInputUI.Trigger:
            start = this.TriggerUIAttachPointStart;
            end   = this.TriggerUIAttachPointEnd;
            break;

        case ControllerInputUI.Grip:
            start = this.GripUIAttachPointStart;
            end   = this.GripUIAttachPointEnd;
            break;

        case ControllerInputUI.ButtonOne:
            start = this.ButtonOneAttachPointStart;
            end   = this.ButtonOneAttachPointEnd;
            break;

        case ControllerInputUI.ButtonTwo:
            start = this.ButtonTwoAttachPointStart;
            end   = this.ButtonTwoAttachPointEnd;
            break;

        case ControllerInputUI.Analog:
            start = this.AnalogAttachPointStart;
            end   = this.AnalogAttachPointEnd;
            break;

        case ControllerInputUI.TrackpadCenter:
        case ControllerInputUI.TrackpadTopLeft:
        case ControllerInputUI.TrackpadTopRight:
        case ControllerInputUI.TrackpadBottomLeft:
        case ControllerInputUI.TrackpadBottom:
        case ControllerInputUI.TrackpadBottomRight:
            start = this.TrackpadUIAttachPointStart;
            if (start == null)
            {
                start = this.AnalogAttachPointStart;
            }
            end = this.TrackpadUIAttachPointEnd;
            if (end == null)
            {
                end = this.AnalogAttachPointEnd;
            }
            break;

        case ControllerInputUI.TrackpadTop:
            start = this.TrackpadTopUIAttachPointStart;
            if (start == null)
            {
                start = this.AnalogAttachPointStart;
            }
            end = this.TrackpadTopUIAttachPointEnd;
            if (end == null)
            {
                end = this.AnalogAttachPointEnd;
            }
            break;

        case ControllerInputUI.MenuButton:
            start = this.MenuButtonUIAttachPointStart;
            end   = this.MenuButtonUIAttachPointEnd;
            break;

        case ControllerInputUI.SystemButton:
            start = this.SystemButtonUIAttachPointEnd;
            end   = this.SystemButtonUIAttachPointEnd;
            break;

        default:
            start = null;
            end   = null;
            return(false);
        }
        if (start == null)
        {
            Debug.LogError("Couldn't find UI attachment point Start transform for ControllerInputUI." + controllerPart);
            return(false);
        }
        if (end == null)
        {
            Debug.LogError("Couldn't find UI attachment point End transform for ControllerInputUI." + controllerPart);
            return(false);
        }
        return(true);
    }
Ejemplo n.º 17
0
 public void ActivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart, string text, float duration, int priority)
 {
     Tutorial.ActivateControllerLabel(hand, controllerPart, text, duration, priority);
 }
Ejemplo n.º 18
0
 public void DeactivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart)
 {
     Tutorial.DeactivateControllerLabel(hand, controllerPart);
 }