Пример #1
0
 private void NetworkManagerHooks_OnLeave(VRC.Player player)
 {
     foreach (PureModSystem mod in Mods)
     {
         mod.OnPlayerLeave(player);
     }
 }
Пример #2
0
 private static bool CanUseStation(ref bool __result, VRC.Player __0, bool __1)
 {
     if (__0 != null && __0 == VRCPlayer.field_Internal_Static_VRCPlayer_0.field_Private_Player_0 && !Main.VRC_Station.Value)
     {
         __result = false;
         return(false);
     }
     return(true);
 }
Пример #3
0
        private static bool PlayerJoined(VRC.Player __0)
        {
            if (__0.IsModerator())
            {
                VRCUiManagerWrappers.Instance.QueueHudMessage($"MODERATOR {__0.ApiUser().displayName} joined! returning to home!");
                VRCUiManagerWrappers.Instance.QueueHudMessage("");

                VRCFlowManagerWrappers.Instance.GoHome();

                return(false);
            }

            return(true);
        }
Пример #4
0
 public void OnPlayerJoined(VRC.Player player)
 {
     // This will handle getting the master on instance join
     if (player.prop_VRCPlayerApi_0 != null && player.prop_VRCPlayerApi_0.isMaster)
     {
         if (APIUser.CurrentUser != null && player.prop_APIUser_0.id == APIUser.CurrentUser.id && LocalPlayerEntry.emmNameSpoofEnabled)
         {
             textComponent.text = OriginalText.Replace("{instancemaster}", LocalPlayerEntry.emmSpoofedName);
         }
         else
         {
             textComponent.text = OriginalText.Replace("{instancemaster}", player.prop_APIUser_0.displayName);
         }
     }
 }
Пример #5
0
        public override void Init(object[] parameters)
        {
            player  = (Player)parameters[0];
            apiUser = player.prop_APIUser_0;
            userId  = apiUser.id;

            platform   = platform = PlayerUtils.GetPlatform(player).PadRight(2);
            perf       = PerformanceRating.None;
            perfString = "<color=#" + ColorUtility.ToHtmlStringRGB(VRCUiAvatarStatsPanel.Method_Private_Static_Color_AvatarPerformanceCategory_PerformanceRating_0(AvatarPerformanceCategory.Overall, perf)) + ">" + PlayerUtils.ParsePerformanceText(perf) + "</color>";

            gameObject.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => UiManager.OpenUserInQuickMenu(player)));

            isFriend = APIUser.IsFriendsWith(apiUser.id);
            GetPlayerColor(false);
        }
Пример #6
0
 private void NetworkManagerHooks_OnJoin(VRC.Player player)
 {
     foreach (HVHSystem mod in Mods)
         mod.OnPlayerJoin(player);
 }
Пример #7
0
 public virtual void OnPlayerLeave(VRC.Player player)
 {
 }
Пример #8
0
 public virtual void OnPlayerJoin(VRC.Player player)
 {
 }
Пример #9
0
        public override void OnUpdate()
        {
            if (m_localPlayer == null)
            {
                VRC.Player player = VRC.Player.prop_Player_0;

                if (player != null) // early init I guess
                {
                    m_localPlayer = player;
                }
            }

            if (m_localPlayer == null)
            {
                return; // wait until player is ready
            }

            var currentInput = VRCInputManager.field_Private_Static_EnumNPublicSealedvaKeMoCoGaViOcViDaWaUnique_0;

            bool controller = currentInput == InputEnum.Controller;
            bool vr         = currentInput == InputEnum.Oculus || currentInput == InputEnum.Vive;
            bool desktop    = (currentInput == InputEnum.Keyboard || currentInput == InputEnum.Mouse);

            bool isActiveController = controller && Input.GetKey(KeyCode.JoystickButton5);
            bool isActiveVr         = vr && Input.GetKey((KeyCode)Oculus.LeftThumbstickPress);
            bool isActiveDesktop    = desktop && (Input.GetKey(KeyCode.Mouse4) || Input.GetKey(KeyCode.RightControl));

            bool swapSpeedsController = controller && Input.GetKey(KeyCode.JoystickButton9);
            bool swapSpeedsVr         = vr && Input.GetKey((KeyCode)Oculus.AButton);
            bool swapSpeedsKeyboard   = desktop && Input.GetKey(KeyCode.LeftShift);

            bool isActive   = isActiveController || isActiveVr || isActiveDesktop;
            bool swapSpeeds = swapSpeedsKeyboard || swapSpeedsController || swapSpeedsVr;

            if (isActive && Time.time - m_lastTime > 1f)
            {
                if (m_airbreakActive)
                {
                    // VRCUiManager.QueueHudMessage equivalent
                    // still same bug as years ago where two messages need to be queued for the first one to be displayed immediately
                    VRCUiManager.prop_VRCUiManager_0.field_Private_List_1_String_0.Add("Noclip OFF");
                    VRCUiManager.prop_VRCUiManager_0.field_Private_List_1_String_0.Add("");
                    DisableAirbreak();
                }
                else
                {
                    VRCUiManager.prop_VRCUiManager_0.field_Private_List_1_String_0.Add("Noclip ON");
                    VRCUiManager.prop_VRCUiManager_0.field_Private_List_1_String_0.Add("");
                    SetupAirbreak();
                }

                m_airbreakActive = !m_airbreakActive;

                m_lastTime = Time.time;
            }

            if (swapSpeeds && m_airbreakActive && Time.time - m_lastTime > 0.2f)
            {
                m_speedIndex += 1;

                if (m_speedIndex > m_speeds.Count() - 1)
                {
                    m_speedIndex = 0;
                }

                m_currentSpeed = m_speeds[m_speedIndex];
                m_lastTime     = Time.time;
            }

            // get default fallback
            Object[] ctrls = Object.FindObjectsOfType(Il2CppType.Of <VRCVrCameraOculus>());

            Transform trans = null;

            if (ctrls.Length > 0)
            {
                trans = ctrls[0].TryCast <VRCVrCameraOculus>().transform;
            }

            // alright so
            // let's start by getting our current vrcPlayer
            VRCPlayer vrcPlayer = m_localPlayer.field_Internal_VRCPlayer_0;

            Animator animator = null;

            if (vrcPlayer == null)
            {
                animator = null;
            }
            else
            {
                // let's get our avatar manager
                VRCAvatarManager vrcAvatarManager = vrcPlayer.prop_VRCAvatarManager_0;

                if (vrcAvatarManager == null)
                {
                    animator = null;
                }
                else
                {
                    // current avatar
                    GameObject currentAvatar = vrcAvatarManager.prop_GameObject_0;
                    animator = ((currentAvatar != null) ? currentAvatar.GetComponent(Il2CppType.Of <Animator>())?.TryCast <Animator>() : null);
                }
            }

            // if the animator is not null at this stage and airbreak is enabled
            if (animator != null)
            {
                // get the head bone
                Transform tempTrans = animator.GetBoneTransform(HumanBodyBones.Head);

                // if we're humanoid
                if (tempTrans != null)
                {
                    // use the head bone's transform instead of oculus camera
                    trans = tempTrans;
                }
            }

            if (trans == null)
            {
                MelonLogger.LogError("not humanoid?");
                return;
            }

            if (Input.GetKey(KeyCode.W))
            {
                m_position += trans.forward * m_currentSpeed * Time.deltaTime;
            }

            if (Input.GetKey(KeyCode.A))
            {
                m_position += (trans.right * -1) * m_currentSpeed * Time.deltaTime;
            }

            if (Input.GetKey(KeyCode.S))
            {
                m_position += (trans.forward * -1) * m_currentSpeed * Time.deltaTime;
            }

            if (Input.GetKey(KeyCode.D))
            {
                m_position += trans.right * m_currentSpeed * Time.deltaTime;
            }

            if (Input.GetKey(KeyCode.E))
            {
                m_position += m_localPlayer.transform.up * m_currentSpeed * Time.deltaTime;
            }

            if (Input.GetKey(KeyCode.Q))
            {
                m_position += (m_localPlayer.transform.up * -1) * m_currentSpeed * Time.deltaTime;
            }

            var a = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, OVRInput.Controller.LTouch);

            if (a.y != 0.0f)
            {
                m_position += trans.forward * m_currentSpeed * Time.deltaTime * a.y;
            }

            if (a.x != 0.0f)
            {
                m_position += trans.right * m_currentSpeed * Time.deltaTime * a.x;
            }

            if (m_airbreakActive)
            {
                m_localPlayer.transform.position = m_position;
            }
        }
Пример #10
0
 public static void TeleportTo(VRC.Player player) => TeleportTo(player.transform);
Пример #11
0
 public override void OnPlayerLeave(VRC.Player player) =>
 UpdateList();
Пример #12
0
 public override void OnPlayerJoin(VRC.Player player) =>
 UpdateList();