Esempio n. 1
0
 // Token: 0x060062BA RID: 25274 RVA: 0x002331E8 File Offset: 0x002315E8
 public static VRC_Pickup GetPickup(VRCUiCursor.CursorHandedness handedness)
 {
     if (handedness == VRCUiCursor.CursorHandedness.Left)
     {
         return(VRCUiCursorManager.instance.leftTarget.pickup);
     }
     if (handedness != VRCUiCursor.CursorHandedness.Right)
     {
         return(null);
     }
     return(VRCUiCursorManager.instance.rightTarget.pickup);
 }
Esempio n. 2
0
 // Token: 0x060062B9 RID: 25273 RVA: 0x002331B2 File Offset: 0x002315B2
 public static VRC_Interactable[] GetInteractable(VRCUiCursor.CursorHandedness handedness)
 {
     if (handedness == VRCUiCursor.CursorHandedness.Left)
     {
         return(VRCUiCursorManager.instance.leftTarget.interactable);
     }
     if (handedness != VRCUiCursor.CursorHandedness.Right)
     {
         return(null);
     }
     return(VRCUiCursorManager.instance.rightTarget.interactable);
 }
Esempio n. 3
0
 // Token: 0x0600625F RID: 25183 RVA: 0x002312B0 File Offset: 0x0022F6B0
 protected override void Initialize()
 {
     VRCUiCursor.CursorHandedness handedness = this.handedness;
     if (handedness != VRCUiCursor.CursorHandedness.Right)
     {
         if (handedness == VRCUiCursor.CursorHandedness.Left)
         {
             this.pointerTracking = VRCTracking.ID.HandTracker_LeftPointer;
             this.touchTracking   = VRCTracking.ID.HandTracker_LeftPalm;
         }
     }
     else
     {
         this.pointerTracking = VRCTracking.ID.HandTracker_RightPointer;
         this.touchTracking   = VRCTracking.ID.HandTracker_RightPalm;
     }
     this.materials     = new Material[this.dimRenderers.Length];
     this.baseColors    = new Color[this.dimRenderers.Length];
     this.currentColors = new Color[this.dimRenderers.Length];
     for (int i = 0; i < this.dimRenderers.Length; i++)
     {
         this.materials[i]     = this.dimRenderers[i].material;
         this.baseColors[i]    = this.materials[i].GetColor("_TintColor");
         this.currentColors[i] = this.baseColors[i];
     }
     this.beam = base.GetComponent <VRCSpaceUiBeam>();
     Renderer[] componentsInChildren = base.GetComponentsInChildren <Renderer>();
     for (int j = 0; j < componentsInChildren.Length; j++)
     {
         componentsInChildren[j].material.renderQueue = 3999;
     }
     if (this.fillImage != null)
     {
         this.fillImage.fillAmount = 0f;
     }
     this.initialized = true;
 }
Esempio n. 4
0
    // Token: 0x060062A6 RID: 25254 RVA: 0x0022F9C8 File Offset: 0x0022DDC8
    public void SetTargetInfo(VRCUiCursor.CursorRaycast target, bool useForUi)
    {
        if (this.inUse == null)
        {
            VRCUiCursor.CursorHandedness cursorHandedness = this.handedness;
            if (cursorHandedness != VRCUiCursor.CursorHandedness.Right)
            {
                if (cursorHandedness == VRCUiCursor.CursorHandedness.Left)
                {
                    this.inUse  = VRCInputManager.FindInput("UseLeft");
                    this.inDrop = VRCInputManager.FindInput("DropLeft");
                }
            }
            else
            {
                this.inUse  = VRCInputManager.FindInput("UseRight");
                this.inDrop = VRCInputManager.FindInput("DropRight");
            }
            if (this.inUse == null)
            {
                return;
            }
        }
        this.over           = target.over;
        this.distance       = target.hitInfo.distance;
        this.targetPosition = target.hitInfo.point;
        bool flag = false;

        if (useForUi)
        {
            if (target.over.Contains(VRCUiCursor.CursorOver.Ui))
            {
                Vector2          screenPos        = new Vector2(0f, 0f);
                UiShapeGenerator uiShapeGenerator = target.uiShape as UiShapeGenerator;
                if (uiShapeGenerator != null)
                {
                    screenPos = uiShapeGenerator.GetPointerPosition(target.hitInfo.textureCoord);
                }
                else
                {
                    screenPos = VRCVrCamera.GetInstance().screenCamera.WorldToScreenPoint(target.hitInfo.point);
                }
                this.uiInput.SetInputState(screenPos, target.hitInfo.point, this.inUse.down, this.inUse.up, this.inDrop.down, this.inDrop.up);
                if (this.uiInput.IsOverSelection())
                {
                    List <VRCUiCursor.CursorOver> list = new List <VRCUiCursor.CursorOver>
                    {
                        VRCUiCursor.CursorOver.UiSelectable
                    };
                    list.AddRange(target.over);
                    target.over = list.ToArray();
                }
                flag = true;
            }
            if (target.over.Contains(VRCUiCursor.CursorOver.Player))
            {
                if (this.inUse.click)
                {
                    this.SelectHoveredPlayer();
                }
                else
                {
                    if (this.hoveredPlayer != null)
                    {
                        PlayerSelector playerSelector = this.hoveredPlayer.playerSelector;
                        playerSelector.Hover(false);
                    }
                    this.hoveredPlayer = target.player;
                    PlayerSelector playerSelector2 = this.hoveredPlayer.playerSelector;
                    if (playerSelector2 != null)
                    {
                        playerSelector2.Hover(true);
                    }
                }
                flag = true;
            }
            else if (this.hoveredPlayer != null)
            {
                PlayerSelector playerSelector3 = this.hoveredPlayer.playerSelector;
                if (playerSelector3 != null)
                {
                    playerSelector3.Hover(false);
                }
                this.hoveredPlayer = null;
            }
            if (target.over.Contains(VRCUiCursor.CursorOver.Web))
            {
                if (this.activeWebView != target.webPanel && this.activeWebView != null)
                {
                    this.activeWebView.HandleFocusLoss();
                }
                this.activeWebView = target.webPanel;
                if (this.activeWebView != null)
                {
                    this.activeWebView.HandleRayHit(target.hitInfo);
                    flag = true;
                }
            }
            else if (this.activeWebView != null)
            {
                this.activeWebView.HandleFocusLoss();
                this.activeWebView = null;
            }
            if (target.over.Length == 0)
            {
                this.uiInput.SetInputState(Vector2.zero, target.hitInfo.point, false, true, false, true);
            }
            VRCUiCursor.CursorHandedness hand = this.handedness;
            if (!flag)
            {
                hand = VRCUiCursor.CursorHandedness.None;
            }
            VRCUiCursorManager.ForceCursorOn(hand);
        }
        VRC_Pickup selectedPickup = null;

        VRC_Interactable[] selectedInteractable = null;
        if (!VRCInputManager.legacyGrasp)
        {
            Component component;
            if (target.interactable == null)
            {
                component = null;
            }
            else
            {
                component = target.interactable.FirstOrDefault((VRC_Interactable i) => i.GetComponent <VRC_UseEvents>() != null || (i.GetComponent <VRC_Trigger>() != null && (i.GetComponent <VRC_Trigger>().HasInteractiveTriggers || i.GetComponent <VRC_Trigger>().HasPickupTriggers)));
            }
            Component component2 = component;
            this.outline.Clone(null);
            if (this.over.Contains(VRCUiCursor.CursorOver.Interactable) && component2 != null)
            {
                Transform trackedTransform = VRCTrackingManager.GetTrackedTransform((this.handedness != VRCUiCursor.CursorHandedness.Left) ? VRCTracking.ID.HandTracker_RightPalm : VRCTracking.ID.HandTracker_LeftPalm);
                bool      flag2            = trackedTransform == null || VRCTrackingManager.IsPointWithinHMDView(trackedTransform.position);
                if (flag2)
                {
                    this.outline.Clone(component2);
                    if (TutorialManager.Instance != null)
                    {
                        TutorialManager.Instance.InteractableSelected(target.interactable, component2, this.handedness == VRCUiCursor.CursorHandedness.Left);
                    }
                    selectedInteractable = target.interactable;
                }
            }
            if (this.over.Contains(VRCUiCursor.CursorOver.Pickup) && target.pickup != null)
            {
                if (target.pickup.currentlyHeldBy == null)
                {
                    this.outline.Clone(target.pickup);
                    if (TutorialManager.Instance != null)
                    {
                        TutorialManager.Instance.PickupSelected(target.pickup, this.handedness == VRCUiCursor.CursorHandedness.Left);
                    }
                    selectedPickup = target.pickup;
                }
                else
                {
                    this.outline.Clone(null);
                }
            }
        }
        else
        {
            this.outline.Clone(null);
        }
        VRCHandGrasper vrchandGrasper = null;

        if (VRCPlayer.Instance != null)
        {
            vrchandGrasper = VRCPlayer.Instance.GetHandGrasper((this.handedness != VRCUiCursor.CursorHandedness.Left) ? ControllerHand.Right : ControllerHand.Left);
        }
        if (vrchandGrasper != null)
        {
            vrchandGrasper.SetSelectedObject(selectedPickup, selectedInteractable);
        }
    }
Esempio n. 5
0
 // Token: 0x060062BC RID: 25276 RVA: 0x0023322B File Offset: 0x0023162B
 public static void SetDominantHand(VRCUiCursor.CursorHandedness hand)
 {
     VRCUiCursorManager.instance.dominantHand = hand;
 }
Esempio n. 6
0
 // Token: 0x060062BB RID: 25275 RVA: 0x0023321E File Offset: 0x0023161E
 public static void ForceCursorOn(VRCUiCursor.CursorHandedness hand)
 {
     VRCUiCursorManager.instance.forcedCursor = hand;
 }