コード例 #1
0
        private void MouseFixHook(On.VideoCamera.orig_Update orig, VideoCamera self)
        {
            orig(self);

            var m_active    = GetValue(typeof(VideoCamera), self, "m_active");
            var m_character = GetValue(typeof(VideoCamera), self, "m_character");

            if (m_active is bool active && m_character is Character character)
            {
                if (active == false && character != null)
                {
                    if (freeCameraFlag && localPlayerID == -1)
                    {
                        localPlayerID = ControlsInput.GetMouseOwner();
                    }
                    if (!freeCameraFlag)
                    {
                        freeCameraFlag   = true;
                        Cursor.lockState = CursorLockMode.Locked;
                        if (localPlayerID != -1)
                        {
                            ControlsInput.AssignMouseKeyboardToPlayer(localPlayerID);
                        }
                    }
                }
                if (active == true && freeCameraFlag == true)
                {
                    freeCameraFlag = false;
                }
            }
        }