Exemplo n.º 1
0
        public static void ToQuickMenu()
        {
            UserInfoExtensionsMod.HideAllPopups();

            foreach (Player player in PlayerManager.prop_PlayerManager_0.field_Private_List_1_Player_0)
            {
                if (player.field_Private_APIUser_0 == null)
                {
                    continue;
                }
                if (player.field_Private_APIUser_0.id == VRCUtils.ActiveUser.id)
                {
                    closeMenu.Invoke(VRCUiManager.prop_VRCUiManager_0, new object[] { true, false }); //Closes Big Menu
                    openQuickMenu.Invoke(QuickMenu.prop_QuickMenu_0, new object[] { true });          //Opens Quick Menu

                    if (VRCUiCursorManager.Method_Public_Static_VRCUiCursor_0().gameObject.activeSelf)
                    {
                        clickMethod.Invoke(VRCUiCursorManager.Method_Public_Static_VRCUiCursor_0(), new object[] { player.field_Internal_VRCPlayer_0 });
                    }

                    QuickMenu.prop_QuickMenu_0.Method_Public_Void_Player_0(player); //Does the rest lmao

                    return;
                }
            }
            VRCUtils.OpenPopupV2("Notice:", "You cannot show this user on the Quick Menu because they are not in the same instance", "Close", new Action(VRCUtils.ClosePopup));
        }
Exemplo n.º 2
0
 // Token: 0x060051CE RID: 20942 RVA: 0x001C06D0 File Offset: 0x001BEAD0
 private void Update()
 {
     if (this.inUseRight.down || this.inGrabRight.down)
     {
         VRC_Interactable[] interactable = VRCUiCursorManager.GetInteractable(VRCUiCursor.CursorHandedness.Right);
         if (interactable != null)
         {
             foreach (VRC_Interactable vrc_Interactable in interactable)
             {
                 vrc_Interactable.Interact();
             }
         }
     }
     if (this.inUseLeft.down || this.inGrabLeft.down)
     {
         VRC_Interactable[] interactable2 = VRCUiCursorManager.GetInteractable(VRCUiCursor.CursorHandedness.Left);
         if (interactable2 != null)
         {
             foreach (VRC_Interactable vrc_Interactable2 in interactable2)
             {
                 vrc_Interactable2.Interact();
             }
         }
     }
 }
Exemplo n.º 3
0
    // Token: 0x060062D6 RID: 25302 RVA: 0x00230E84 File Offset: 0x0022F284
    private void CheckUiActive()
    {
        bool flag = this.ActiveScreens.Count > 0;

        if (flag != this.UiActive)
        {
            if (flag)
            {
                this.PlaceUi();
            }
            this.UiActive = flag;
            VRCUiCursorManager.SetUiActive(flag);
            USpeaker.CacheDevices();
            this.menuContentTransform.gameObject.GetComponent <Collider>().enabled = flag;
            if (flag && QuickMenu.Instance != null && QuickMenu.Instance && QuickMenu.Instance.IsActive)
            {
                QuickMenu.Instance.CloseMenu();
            }
        }
    }
Exemplo n.º 4
0
        void Awake()
        {
            scrollContent = UnityUiUtils.CreateScrollView(GetComponent <RectTransform>(), 1500, 850, 0, 875, false, true); // 1000 -> 800
            scrollContent.parent.parent.localPosition = new Vector2(0, 62);

            CreateButton("Apply", -300, () =>
            {
                ModPrefs.SaveConfigs();
                VRCUiManagerUtils.GetVRCUiManager().CloseUi(true);
                VRCUiCursorManager.SetUiActive(false);
            });
            CreateButton("Close", 300, () =>
            {
                ResetConfigs();
                VRCUiManagerUtils.GetVRCUiManager().CloseUi(true);
                VRCUiCursorManager.SetUiActive(false);
            });

            SetupConfigs();
        }
Exemplo n.º 5
0
 // Token: 0x060062D0 RID: 25296 RVA: 0x00230A60 File Offset: 0x0022EE60
 public void ShowScreen(VRCUiPage page)
 {
     if (page == null)
     {
         Debug.LogError("Screen Not Found - " + page);
     }
     this.CheckIfSubPage(page);
     this.HideScreen(page.screenType);
     page.SetShown(true);
     this.ActiveScreens.Add(page.screenType, page);
     this.CheckUiActive();
     if (page.onPageActivated != null)
     {
         page.onPageActivated();
     }
     VRCUiCursorManager.SetUiActive(true);
     if (this.onPageShown != null)
     {
         this.onPageShown(page);
     }
 }
Exemplo n.º 6
0
 // Token: 0x06006260 RID: 25184 RVA: 0x0023140C File Offset: 0x0022F80C
 private void Update()
 {
     if (!this.initialized)
     {
         this.Initialize();
     }
     this.beam.layerMask = (VRCUiCursorManager.GetCurrentInteractiveLayers() & (-1 ^ 1 << LayerMask.NameToLayer("Walkthrough")));
     for (int i = 0; i < this.materials.Length; i++)
     {
         Color endColor = this.baseColors[i];
         if (this.over.Contains(VRCUiCursor.CursorOver.Ui))
         {
             endColor = this.UiColor;
         }
         else if (this.over.Contains(VRCUiCursor.CursorOver.Player))
         {
             endColor = this.UiColor;
         }
         else if (this.over.Contains(VRCUiCursor.CursorOver.Web))
         {
             endColor = this.UiColor;
         }
         else if (this.over.Contains(VRCUiCursor.CursorOver.Interactable))
         {
             endColor = this.InteractiveColor;
         }
         else if (this.over.Contains(VRCUiCursor.CursorOver.Pickup))
         {
             endColor = this.InteractiveColor;
         }
         this.currentColors[i].r      = Mathf.MoveTowards(this.currentColors[i].r, endColor.r, 2f * Time.deltaTime);
         this.currentColors[i].g      = Mathf.MoveTowards(this.currentColors[i].g, endColor.g, 2f * Time.deltaTime);
         this.currentColors[i].b      = Mathf.MoveTowards(this.currentColors[i].b, endColor.b, 2f * Time.deltaTime);
         this.lineRenderer.startColor = Color.white;
         this.lineRenderer.endColor   = endColor;
         this.materials[i].SetColor("_TintColor", this.currentColors[i]);
     }
 }
Exemplo n.º 7
0
 // Token: 0x06006163 RID: 24931 RVA: 0x002260B6 File Offset: 0x002244B6
 public override void ActivateModule()
 {
     base.ActivateModule();
     VRCUiCursorManager.SetActiveCursor(VRCUiCursorManager.CursorType.None);
 }
Exemplo n.º 8
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);
        }
    }
Exemplo n.º 9
0
    // Token: 0x060062A4 RID: 25252 RVA: 0x0022F1A8 File Offset: 0x0022D5A8
    protected VRCUiCursor.CursorOver[] CheckCursorTouch(VRCUiCursor.CursorRaycast target)
    {
        if (VRCPlayer.Instance == null)
        {
            return(new VRCUiCursor.CursorOver[0]);
        }
        VRCHandGrasper handGrasper = VRCPlayer.Instance.GetHandGrasper((this.handedness != VRCUiCursor.CursorHandedness.Left) ? ControllerHand.Right : ControllerHand.Left);

        if (handGrasper != null && handGrasper.IsHoldingObject())
        {
            return(new VRCUiCursor.CursorOver[0]);
        }
        int     num    = -1;
        Vector3 point  = Vector3.zero;
        Vector3 normal = Vector3.zero;
        float   num2   = float.PositiveInfinity;

        VRC_Interactable[] array      = null;
        VRC_Pickup         vrc_Pickup = null;
        VRC_PlayerApi      apiPlayer  = VRCPlayer.Instance.apiPlayer;

        Collider[] array2 = Physics.OverlapSphere(target.touch.position, target.touch.radius, VRCUiCursorManager.GetCurrentInteractiveLayers());
        for (int i = 0; i < array2.Length; i++)
        {
            bool    flag    = false;
            Vector3 vector  = PhysicsUtil.ClosestPointOnCollider(array2[i], target.touch.position, ref flag);
            Vector3 vector2 = vector - target.touch.position;
            float   dist    = (!flag) ? vector2.magnitude : 0f;
            if (dist <= target.touch.radius)
            {
                VRC_Interactable[] array3 = (from inter in array2[i].GetComponents <VRC_Interactable>()
                                             where inter.IsInteractiveForPlayer(apiPlayer)
                                             select inter).ToArray <VRC_Interactable>();
                VRC_Pickup vrc_Pickup2 = array2[i].GetComponent <VRC_Pickup>();
                if (array3.Length != 0 || !(vrc_Pickup2 == null))
                {
                    if (array3 != null && (array3.Length == 0 || array3.All((VRC_Interactable x) => dist > x.proximity)))
                    {
                        array3 = null;
                    }
                    VRC_StationInternal component = array2[i].GetComponent <VRC_StationInternal>();
                    if (array3 != null && component != null && component.Occupant == VRCPlayer.Instance.gameObject)
                    {
                        array3 = null;
                    }
                    if (vrc_Pickup2 != null && (!vrc_Pickup2.pickupable || !VRCPlayer.Instance.canPickupObjects || (vrc_Pickup2.IsHeld && vrc_Pickup2.DisallowTheft && vrc_Pickup2.currentPlayer != apiPlayer)))
                    {
                        vrc_Pickup2 = null;
                    }
                    if (vrc_Pickup2 != null && vrc_Pickup2.currentlyHeldBy != null && dist > VRCHandGrasper.LerpToHandMinDistance)
                    {
                        vrc_Pickup2 = null;
                    }
                    if ((vrc_Pickup2 != null && vrc_Pickup == null) || dist <= num2)
                    {
                        if (!(vrc_Pickup2 == null) || (array3 != null && array3.Length != 0))
                        {
                            num        = i;
                            num2       = dist;
                            point      = vector;
                            normal     = vector2.normalized;
                            array      = array3;
                            vrc_Pickup = vrc_Pickup2;
                        }
                    }
                }
            }
        }
        if (num < 0)
        {
            return(new VRCUiCursor.CursorOver[0]);
        }
        target.hitInfo.distance = num2;
        target.hitInfo.normal   = normal;
        target.hitInfo.point    = point;
        target.pickup           = vrc_Pickup;
        target.interactable     = array;
        if (vrc_Pickup != null && array != null)
        {
            target.over = new VRCUiCursor.CursorOver[]
            {
                VRCUiCursor.CursorOver.Pickup,
                VRCUiCursor.CursorOver.Interactable
            };
        }
        else if (array != null)
        {
            target.over = new VRCUiCursor.CursorOver[]
            {
                VRCUiCursor.CursorOver.Interactable
            };
        }
        else if (vrc_Pickup != null)
        {
            target.over = new VRCUiCursor.CursorOver[]
            {
                VRCUiCursor.CursorOver.Pickup
            };
        }
        else
        {
            target.over = new VRCUiCursor.CursorOver[0];
        }
        return(target.over);
    }
Exemplo n.º 10
0
    // Token: 0x060062A5 RID: 25253 RVA: 0x0022F56C File Offset: 0x0022D96C
    protected VRCUiCursor.CursorOver[] CastCursorRay(VRCUiCursor.CursorRaycast target)
    {
        target.over = new VRCUiCursor.CursorOver[0];
        List <VRCUiCursor.CursorOver> list = new List <VRCUiCursor.CursorOver>();
        int   layerMask = VRCUiCursorManager.GetCurrentInteractiveLayers();
        Ray   ray       = target.ray;
        float num       = 0f;
        float num2      = 100f;

        while (num2 > 0f && list.Count == 0)
        {
            ray.origin += ray.direction * num;
            num2       -= num;
            RaycastHit hitInfo;
            if (!Physics.Raycast(ray, out hitInfo, num2, layerMask))
            {
                target.hitInfo.distance = 10f;
                target.hitInfo.point    = target.ray.origin + target.ray.direction * 10f;
                break;
            }
            num = hitInfo.distance + 0.01f;
            GameObject  gameObject = hitInfo.collider.gameObject;
            VRC_UiShape component  = gameObject.GetComponent <VRC_UiShape>();
            if (component != null)
            {
                target.hitInfo = hitInfo;
                target.uiShape = component;
                list.Add(VRCUiCursor.CursorOver.Ui);
            }
            else if (gameObject.GetComponentInParent <VRCPlayer>() != null)
            {
                if (this.uiMenuLayer < 0)
                {
                    this.uiMenuLayer = LayerMask.NameToLayer("UiMenu");
                }
                if (gameObject.layer == this.uiMenuLayer)
                {
                    target.hitInfo = hitInfo;
                    target.player  = gameObject.GetComponentInParent <VRCPlayer>();
                    list.Add(VRCUiCursor.CursorOver.Player);
                }
            }
            if (VRCPlayer.Instance != null)
            {
                VRCHandGrasper handGrasper = VRCPlayer.Instance.GetHandGrasper((this.handedness != VRCUiCursor.CursorHandedness.Left) ? ControllerHand.Right : ControllerHand.Left);
                if (!(handGrasper != null) || !handGrasper.IsHoldingObject())
                {
                    float num3 = 0f;
                    if (target.extraReach)
                    {
                        num3 = VRCTrackingManager.GetRayReach(target.ray);
                    }
                    VRC_PlayerApi      apiPlayer = VRCPlayer.Instance.apiPlayer;
                    float              range     = hitInfo.distance - num3;
                    VRC_Interactable[] array     = (from inter in gameObject.GetComponents <VRC_Interactable>()
                                                    where range <= inter.proximity && inter.IsInteractiveForPlayer(apiPlayer)
                                                    select inter).ToArray <VRC_Interactable>();
                    VRC_Pickup vrc_Pickup = gameObject.GetComponent <VRC_Pickup>();
                    if (array.Length == 0)
                    {
                        array = null;
                    }
                    VRC_StationInternal component2 = gameObject.GetComponent <VRC_StationInternal>();
                    if (array != null && component2 != null && component2.Occupant == VRCPlayer.Instance.gameObject)
                    {
                        array = null;
                    }
                    if (vrc_Pickup != null && (!vrc_Pickup.pickupable || !VRCPlayer.Instance.canPickupObjects || (vrc_Pickup.IsHeld && vrc_Pickup.DisallowTheft && vrc_Pickup.currentPlayer != apiPlayer)))
                    {
                        vrc_Pickup = null;
                    }
                    if (array != null && vrc_Pickup != null)
                    {
                        target.hitInfo      = hitInfo;
                        target.interactable = array;
                        target.pickup       = vrc_Pickup;
                        list.Add(VRCUiCursor.CursorOver.Pickup);
                        list.Add(VRCUiCursor.CursorOver.Interactable);
                    }
                    else if (array != null)
                    {
                        target.hitInfo      = hitInfo;
                        target.interactable = array;
                        list.Add(VRCUiCursor.CursorOver.Interactable);
                        VRC_WebPanel component3 = gameObject.GetComponent <VRC_WebPanel>();
                        if (component3 != null && component3.interactive)
                        {
                            target.hitInfo  = hitInfo;
                            target.webPanel = component3.GetComponent <WebPanelInternal>();
                            list.Add(VRCUiCursor.CursorOver.Web);
                        }
                    }
                    else if (vrc_Pickup != null && range <= 0f)
                    {
                        target.hitInfo = hitInfo;
                        target.pickup  = vrc_Pickup;
                        list.Add(VRCUiCursor.CursorOver.Pickup);
                    }
                    if (list.Count == 0)
                    {
                        if (Vector3.Dot(Vector3.up, hitInfo.normal) > 0.7f)
                        {
                            target.hitInfo = hitInfo;
                            list.Add(VRCUiCursor.CursorOver.Floor);
                        }
                        else
                        {
                            target.hitInfo = hitInfo;
                            list.Add(VRCUiCursor.CursorOver.Other);
                        }
                    }
                }
            }
            else
            {
                VRC_WebPanel component4 = gameObject.GetComponent <VRC_WebPanel>();
                if (component4 != null && component4.interactive)
                {
                    target.hitInfo  = hitInfo;
                    target.webPanel = component4.GetComponent <WebPanelInternal>();
                    list.Add(VRCUiCursor.CursorOver.Web);
                }
            }
        }
        target.over = list.ToArray();
        return(target.over);
    }