void Update()
    {
#if UNITY_ANDROID
        if (controllerlink.neoserviceStarted)
        {
            var fixedpose0 = controllerlink.GetControllerFixedSensorState(0);
            if (controllerlink.controller0Connected)
            {
                var pose0 = controllerlink.GetCvControllerPoseData(0);
                controllerlink.Controller0.Rotation = new Quaternion(pose0[0], pose0[1], pose0[2], pose0[3]);
                controllerlink.Controller0.Position = new Vector3(pose0[4] / 1000.0f, pose0[5] / 1000.0f, -pose0[6] / 1000.0f);

                var key0 = controllerlink.GetCvControllerKeyData(0);
                Sensor.UPvr_SetReinPosition(fixedpose0[0], fixedpose0[1], fixedpose0[2], fixedpose0[3], fixedpose0[4], fixedpose0[5], fixedpose0[6], 0, true, Convert.ToInt32((Convert.ToString(key0[35]) + "000"), 2));
                TransformData(controllerlink.Controller0, 0, key0);
            }
            else
            {
                Sensor.UPvr_SetReinPosition(fixedpose0[0], fixedpose0[1], fixedpose0[2], fixedpose0[3], fixedpose0[4], fixedpose0[5], fixedpose0[6], 0, false, 0);
            }

            var fixedpose1 = controllerlink.GetControllerFixedSensorState(1);
            if (controllerlink.controller1Connected)
            {
                var pose1 = controllerlink.GetCvControllerPoseData(1);
                controllerlink.Controller1.Rotation = new Quaternion(pose1[0], pose1[1], pose1[2], pose1[3]);
                controllerlink.Controller1.Position = new Vector3(pose1[4] / 1000.0f, pose1[5] / 1000.0f, -pose1[6] / 1000.0f);

                var key1 = controllerlink.GetCvControllerKeyData(1);
                Sensor.UPvr_SetReinPosition(fixedpose0[0], fixedpose0[1], fixedpose0[2], fixedpose0[3], fixedpose1[4], fixedpose1[5], fixedpose1[6], 1, true, Convert.ToInt32((Convert.ToString(key1[35]) + "000"), 2));
                TransformData(controllerlink.Controller1, 1, key1);
            }
            else
            {
                Sensor.UPvr_SetReinPosition(fixedpose0[0], fixedpose0[1], fixedpose0[2], fixedpose0[3], fixedpose1[4], fixedpose1[5], fixedpose1[6], 1, false, 0);
            }
        }

        //Goblin controller
        if (controllerlink.goblinserviceStarted && controllerlink.controller0Connected)
        {
            var pose0 = controllerlink.GetHBControllerPoseData();
            controllerlink.Controller0.Rotation = new Quaternion(pose0[0], pose0[1], pose0[2], pose0[3]);

            var key0 = controllerlink.GetHBControllerKeyData();
            TransformData(controllerlink.Controller0, 0, key0);
        }

        SetSystemKey();
#endif
    }
Example #2
0
    void Update()
    {
#if UNITY_ANDROID
        if (controllerlink.neoserviceStarted)
        {
            var sensorData = controllerlink.GetControllerSensorData();
            var keyData    = controllerlink.GetControllerKeyData();

            if (controllerlink.controller0Connected)
            {
                if (Pvr_UnitySDKManager.SDK.ShowVideoSeethrough)
                {
                    //var fixedpose0 = controllerlink.GetControllerFixedSensorState(0);
                    // fixed pose
                    sensorData[2] = -sensorData[2];
                    sensorData[3] = -sensorData[3];
                    controllerlink.Controller0.Rotation.Set(sensorData[0], sensorData[1], sensorData[2], sensorData[3]);
                    controllerlink.Controller0.Position.Set(sensorData[4] / 1000.0f, sensorData[5] / 1000.0f, -sensorData[6] / 1000.0f);
                }
                else
                {
                    controllerlink.Controller0.Rotation.Set(sensorData[7], sensorData[8], sensorData[9],
                                                            sensorData[10]);
                    controllerlink.Controller0.Position.Set(sensorData[11] / 1000.0f, sensorData[12] / 1000.0f,
                                                            -sensorData[13] / 1000.0f);
                }

                if (!controllerlink.Controller0.isShowBoundary)
                {
                    if (controllerlink.getControllerSensorStatus(0) == 0)
                    {
                        Sensor.UPvr_SetReinPosition(sensorData[0], sensorData[1], sensorData[2], sensorData[3], sensorData[4], sensorData[5], sensorData[6], 0, false, 0);
                    }
                    else
                    {
                        controllerlink.Controller0.isShowBoundary = true;
                        Sensor.UPvr_SetReinPosition(sensorData[0], sensorData[1], sensorData[2], sensorData[3], sensorData[4], sensorData[5], sensorData[6], 0, true, Convert.ToInt32((Convert.ToString(keyData[35]) + Convert.ToString(keyData[15]) + "00"), 2));
                    }
                }
                else
                {
                    Sensor.UPvr_SetReinPosition(sensorData[0], sensorData[1], sensorData[2], sensorData[3], sensorData[4], sensorData[5], sensorData[6], 0, true, Convert.ToInt32((Convert.ToString(keyData[35]) + Convert.ToString(keyData[15]) + "00"), 2));
                }
                TransformData(controllerlink.Controller0, 0, keyData);
            }
            else
            {
                Sensor.UPvr_SetReinPosition(sensorData[0], sensorData[1], sensorData[2], sensorData[3], sensorData[4], sensorData[5], sensorData[6], 0, false, 0);
            }

            if (controllerlink.controller1Connected)
            {
                if (Pvr_UnitySDKManager.SDK.ShowVideoSeethrough)
                {
                    //var fixedpose1 = controllerlink.GetControllerFixedSensorState(1);
                    // fixed pose
                    sensorData[16] = -sensorData[16];
                    sensorData[17] = -sensorData[17];
                    controllerlink.Controller1.Rotation.Set(sensorData[14], sensorData[15], sensorData[16], sensorData[17]);
                    controllerlink.Controller1.Position.Set(sensorData[18] / 1000.0f, sensorData[19] / 1000.0f, -sensorData[20] / 1000.0f);
                }
                else
                {
                    controllerlink.Controller1.Rotation.Set(sensorData[21], sensorData[22], sensorData[23],
                                                            sensorData[24]);
                    controllerlink.Controller1.Position.Set(sensorData[25] / 1000.0f, sensorData[26] / 1000.0f,
                                                            -sensorData[27] / 1000.0f);
                }

                if (!controllerlink.Controller1.isShowBoundary)
                {
                    if (controllerlink.getControllerSensorStatus(1) == 0)
                    {
                        Sensor.UPvr_SetReinPosition(sensorData[14], sensorData[15], sensorData[16], sensorData[17], sensorData[18], sensorData[19], sensorData[20], 1, false, 0);
                    }
                    else
                    {
                        controllerlink.Controller1.isShowBoundary = true;
                        Sensor.UPvr_SetReinPosition(sensorData[14], sensorData[15], sensorData[16], sensorData[17], sensorData[18], sensorData[19], sensorData[20], 1, true, Convert.ToInt32((Convert.ToString(keyData[102]) + Convert.ToString(keyData[82]) + "00"), 2));
                    }
                }
                else
                {
                    Sensor.UPvr_SetReinPosition(sensorData[14], sensorData[15], sensorData[16], sensorData[17], sensorData[18], sensorData[19], sensorData[20], 1, true, Convert.ToInt32((Convert.ToString(keyData[102]) + Convert.ToString(keyData[82]) + "00"), 2));
                }
                TransformData(controllerlink.Controller1, 1, keyData);
            }
            else
            {
                Sensor.UPvr_SetReinPosition(sensorData[14], sensorData[15], sensorData[16], sensorData[17], sensorData[18], sensorData[19], sensorData[20], 1, false, 0);
            }
        }

        //Goblin controller
        if (controllerlink.goblinserviceStarted && controllerlink.controller0Connected)
        {
            var pose0 = controllerlink.GetHBControllerPoseData();
            controllerlink.Controller0.Rotation.Set(pose0[0], pose0[1], pose0[2], pose0[3]);

            var key0 = controllerlink.GetHBControllerKeyData();
            TransformData(controllerlink.Controller0, 0, key0);
        }

        SetSystemKey();
#endif
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
#if UNITY_ANDROID
        if (controllerlink.neoserviceStarted)
        {
            if (controllerlink.controller0Connected)
            {
                var pose0 = controllerlink.GetCvControllerPoseData(0);
                controllerlink.Controller0.Rotation = new Quaternion(pose0[0], pose0[1], pose0[2], pose0[3]);
                controllerlink.Controller0.Position = new Vector3(pose0[4] / 1000.0f, pose0[5] / 1000.0f, -pose0[6] / 1000.0f);

                var key0 = controllerlink.GetCvControllerKeyData(0);
                controllerlink.Controller0.TouchPadPosition = new Vector2(key0[0], key0[1]);

                SetSwipeData(controllerlink.Controller0);

                SetTouchPadClick(controllerlink.Controller0);

                TransformData(controllerlink.Controller0.HomeKey, key0[2]);

                TransformData(controllerlink.Controller0.AppKey, key0[3]);

                TransformData(controllerlink.Controller0.TouchKey, key0[4]);

                TransformData(controllerlink.Controller0.VolumeUpKey, key0[5]);

                TransformData(controllerlink.Controller0.VolumeDownKey, key0[6]);

                controllerlink.Controller0.TriggerNum = key0[7];

                SetTriggerClick(controllerlink.Controller0.TriggerKey, key0[7]);

                controllerlink.Controller0.Battery = key0[8];
            }
            if (controllerlink.controller1Connected)
            {
                var pose1 = controllerlink.GetCvControllerPoseData(1);
                controllerlink.Controller1.Rotation = new Quaternion(pose1[0], pose1[1], pose1[2], pose1[3]);
                controllerlink.Controller1.Position = new Vector3(pose1[4] / 1000.0f, pose1[5] / 1000.0f, -pose1[6] / 1000.0f);

                var key1 = controllerlink.GetCvControllerKeyData(1);
                controllerlink.Controller1.TouchPadPosition = new Vector2(key1[0], key1[1]);

                SetSwipeData(controllerlink.Controller1);

                SetTouchPadClick(controllerlink.Controller1);

                TransformData(controllerlink.Controller1.HomeKey, key1[2]);

                TransformData(controllerlink.Controller1.AppKey, key1[3]);

                TransformData(controllerlink.Controller1.TouchKey, key1[4]);

                TransformData(controllerlink.Controller1.VolumeUpKey, key1[5]);

                TransformData(controllerlink.Controller1.VolumeDownKey, key1[6]);

                controllerlink.Controller1.TriggerNum = key1[7];

                SetTriggerClick(controllerlink.Controller1.TriggerKey, key1[7]);

                controllerlink.Controller1.Battery = key1[8];
            }
        }
        //Goblin controller
        if (controllerlink.goblinserviceStarted && controllerlink.controller0Connected)
        {
            var pose0 = controllerlink.GetHBControllerPoseData();
            var jpose = JsonMapper.ToObject(pose0);
            controllerlink.Controller0.Rotation = new Quaternion(Convert.ToSingle(jpose[1].ToString()), Convert.ToSingle(jpose[2].ToString()), Convert.ToSingle(jpose[3].ToString()), Convert.ToSingle(jpose[0].ToString()));
            PLOG.D("PvrLog GoblinController X:" + controllerlink.Controller0.Rotation.eulerAngles.x + " Y:" +
                   controllerlink.Controller0.Rotation.eulerAngles.y + " Z:" +
                   controllerlink.Controller0.Rotation.eulerAngles.z);

            var key0 = controllerlink.GetHBControllerKeyData();
            var jkey = JsonMapper.ToObject(key0);
            controllerlink.Controller0.TouchPadPosition = new Vector2(Convert.ToInt16(jkey[0].ToString()), Convert.ToInt16(jkey[1].ToString()));

            SetSwipeData(controllerlink.Controller0);

            SetTouchPadClick(controllerlink.Controller0);

            TransformData(controllerlink.Controller0.HomeKey, Convert.ToInt16(jkey[2].ToString()));

            TransformData(controllerlink.Controller0.AppKey, Convert.ToInt16(jkey[3].ToString()));

            TransformData(controllerlink.Controller0.TouchKey, Convert.ToInt16(jkey[4].ToString()));

            TransformData(controllerlink.Controller0.VolumeUpKey, Convert.ToInt16(jkey[5].ToString()));

            TransformData(controllerlink.Controller0.VolumeDownKey, Convert.ToInt16(jkey[6].ToString()));

            controllerlink.Controller0.Battery = Convert.ToInt16(jkey[7].ToString());

            TransformData(controllerlink.Controller0.TriggerKey, controllerlink.GetTriggerKeyEvent());
        }

        SetSystemKey();
#endif
    }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        if (Pvr_UnitySDKAPI.Controller.UPvr_GetControllerState(0) == ControllerState.Connected)
        {
            if (head != null)
            {
                head.SetActive(false);
            }
            if (Pvr_UnitySDKAPI.System.UPvr_GetDeviceMode() == DeviceMode.PicoNeo)
            {
                Neo.SetActive(true);
            }
            else
            {
                Goblin.SetActive(true);
            }
        }
        else
        {
            if (head != null)
            {
                head.SetActive(true);
            }
            if (Pvr_UnitySDKAPI.System.UPvr_GetDeviceMode() == DeviceMode.PicoNeo)
            {
                Neo.SetActive(false);
            }
            else
            {
                Goblin.SetActive(false);
            }
        }

#if UNITY_ANDROID
        //区分平台
        if (controllerlink.cvserviceBindState)
        {
            if (controllerlink.controller0Connected)
            {
                //手柄0姿态数据
                var pose0 = controllerlink.GetCvControllerPoseData(0);
                controllerlink.Controller0.Rotation = new Quaternion(pose0[0], pose0[1], pose0[2], pose0[3]);
                controllerlink.Controller0.Position = new Vector3(pose0[4] / 1000.0f, pose0[5] / 1000.0f, -pose0[6] / 1000.0f);
                //手柄0键值数据
                var key0 = controllerlink.GetCvControllerKeyData(0);
                controllerlink.Controller0.TouchPadPosition = new Vector2(key0[0], key0[1]);
                //滑动手势判断
                SetSwipeData(controllerlink.Controller0);
                //touchpad点击
                SetTouchPadClick(controllerlink.Controller0);
                //HomeKey
                TransformData(controllerlink.Controller0.HomeKey, key0[2]);
                //AppKey
                TransformData(controllerlink.Controller0.AppKey, key0[3]);
                //TouchClickKey
                TransformData(controllerlink.Controller0.TouchKey, key0[4]);
                //VolumeuUpKey
                TransformData(controllerlink.Controller0.VolumeUpKey, key0[5]);
                //VolumeDownKey
                TransformData(controllerlink.Controller0.VolumeDownKey, key0[6]);
                //Trigger num
                controllerlink.Controller0.TriggerNum = key0[7];
                //Trigger Click
                SetTriggerClick(controllerlink.Controller0);
                //Battery
                controllerlink.Controller0.Battery = key0[8];
            }
            if (controllerlink.controller1Connected)
            {
                //手柄1姿态数据
                var pose1 = controllerlink.GetCvControllerPoseData(1);
                controllerlink.Controller1.Rotation = new Quaternion(pose1[0], pose1[1], pose1[2], pose1[3]);
                controllerlink.Controller1.Position = new Vector3(pose1[4] / 1000.0f, pose1[5] / 1000.0f, -pose1[6] / 1000.0f);
                //手柄0键值数据
                var key1 = controllerlink.GetCvControllerKeyData(1);
                controllerlink.Controller1.TouchPadPosition = new Vector2(key1[0], key1[1]);
                //滑动手势判断
                SetSwipeData(controllerlink.Controller1);
                //touchpad点击
                SetTouchPadClick(controllerlink.Controller1);
                //HomeKey
                TransformData(controllerlink.Controller1.HomeKey, key1[2]);
                //AppKey
                TransformData(controllerlink.Controller1.AppKey, key1[3]);
                //TouchClickKey
                TransformData(controllerlink.Controller1.TouchKey, key1[4]);
                //VolumeuUpKey
                TransformData(controllerlink.Controller1.VolumeUpKey, key1[5]);
                //VolumeDownKey
                TransformData(controllerlink.Controller1.VolumeDownKey, key1[6]);
                //Trigger num
                controllerlink.Controller1.TriggerNum = key1[7];
                //Trigger Click
                SetTriggerClick(controllerlink.Controller1);
                //Battery
                controllerlink.Controller1.Battery = key1[8];
            }
        }
        //Goblin controller
        if (controllerlink.hbserviceBindState && controllerlink.controller0Connected)
        {
            //手柄0姿态数据
            var pose0 = controllerlink.GetHBControllerPoseData();
            var jpose = JsonMapper.ToObject(pose0);
            controllerlink.Controller0.Rotation = new Quaternion(Convert.ToSingle(jpose[1].ToString()), Convert.ToSingle(jpose[2].ToString()), Convert.ToSingle(jpose[3].ToString()), Convert.ToSingle(jpose[0].ToString()));
            //手柄0键值数据
            var key0 = controllerlink.GetHBControllerKeyData();
            var jkey = JsonMapper.ToObject(key0);
            controllerlink.Controller0.TouchPadPosition = new Vector2(Convert.ToInt16(jkey[0].ToString()), Convert.ToInt16(jkey[1].ToString()));
            //滑动手势判断
            SetSwipeData(controllerlink.Controller0);
            //touchpad点击
            SetTouchPadClick(controllerlink.Controller0);
            //HomeKey
            TransformData(controllerlink.Controller0.HomeKey, Convert.ToInt16(jkey[2].ToString()));
            //AppKey
            TransformData(controllerlink.Controller0.AppKey, Convert.ToInt16(jkey[3].ToString()));
            //TouchClickKey
            TransformData(controllerlink.Controller0.TouchKey, Convert.ToInt16(jkey[4].ToString()));
            //VolumeuUpKey
            TransformData(controllerlink.Controller0.VolumeUpKey, Convert.ToInt16(jkey[5].ToString()));
            //VolumeDownKey
            TransformData(controllerlink.Controller0.VolumeDownKey, Convert.ToInt16(jkey[6].ToString()));
            //Battery
            controllerlink.Controller0.Battery = Convert.ToInt16(jkey[7].ToString());
        }
        //系统按键相关
        SetSystemKey();
#endif
        #region IOSData
#if IOS_DEVICE
        Controller.PVR_GetLark2SensorMessage(ref lark2x, ref lark2y, ref lark2z, ref lark2w);
        Controller.ControllerQua = new Quaternion(lark2x, lark2y, lark2z, lark2w);

        Controller.PVR_GetLark2KeyValueMessage(ref lark2touchx, ref lark2touchy, ref lark2home, ref lark2app, ref lark2click, ref lark2volup, ref lark2voldown, ref lark2power);
        if (lark2touchx > 0 || lark2touchy > 0)
        {
            if (lark2touchx == 0)
            {
                TouchPadPosition.x = 1;
            }
            if (lark2touchy == 0)
            {
                TouchPadPosition.y = 1;
            }
            TouchPadPosition.x = lark2touchx;
            TouchPadPosition.y = lark2touchy;
        }
        else
        {
            touchNum++;
            if (touchNum >= 1)
            {
                TouchPadPosition.x = 0;
                TouchPadPosition.y = 0;
                touchNum           = 0;
            }
        }
        Controller.BatteryLevel = lark2power;
        #region base api
        //键值状态
        //Home Key
        if (lark2home == 1)
        {
            if (!HomeKey.state)
            {
                HomeKey.pressedDown = true;
                longPressclock      = false;
            }
            else
            {
                HomeKey.pressedDown = false;
            }
            HomeKey.state = true;
        }
        else
        {
            if (HomeKey.state)
            {
                HomeKey.pressedUp = true;
            }
            else
            {
                HomeKey.pressedUp = false;
            }
            HomeKey.state       = false;
            HomeKey.pressedDown = false;
        }
        //APP Key
        if (lark2app == 1)
        {
            if (!APPKey.state)
            {
                APPKey.pressedDown = true;
                longPressclock     = false;
            }
            else
            {
                APPKey.pressedDown = false;
            }
            APPKey.state = true;
        }
        else
        {
            if (APPKey.state)
            {
                APPKey.pressedUp = true;
            }
            else
            {
                APPKey.pressedUp = false;
            }
            APPKey.state       = false;
            APPKey.pressedDown = false;
        }
        //Touchpad Key
        if (lark2click == 1)
        {
            if (!TouchPadKey.state)
            {
                TouchPadKey.pressedDown = true;
                longPressclock          = false;
            }
            else
            {
                TouchPadKey.pressedDown = false;
            }
            TouchPadKey.state = true;
        }
        else
        {
            if (TouchPadKey.state)
            {
                TouchPadKey.pressedUp = true;
            }
            else
            {
                TouchPadKey.pressedUp = false;
            }
            TouchPadKey.state       = false;
            TouchPadKey.pressedDown = false;
        }
        //VolumeUP Key
        if (lark2volup == 1)
        {
            if (!VolumeUpKey.state)
            {
                VolumeUpKey.pressedDown = true;
                longPressclock          = false;
            }
            else
            {
                VolumeUpKey.pressedDown = false;
            }
            VolumeUpKey.state = true;
        }
        else
        {
            if (VolumeUpKey.state)
            {
                VolumeUpKey.pressedUp = true;
            }
            else
            {
                VolumeUpKey.pressedUp = false;
            }
            VolumeUpKey.state       = false;
            VolumeUpKey.pressedDown = false;
        }
        //VolumeDown Key
        if (lark2voldown == 1)
        {
            if (!VolumeDownKey.state)
            {
                VolumeDownKey.pressedDown = true;
                longPressclock            = false;
            }
            else
            {
                VolumeDownKey.pressedDown = false;
            }
            VolumeDownKey.state = true;
        }
        else
        {
            if (VolumeDownKey.state)
            {
                VolumeDownKey.pressedUp = true;
            }
            else
            {
                VolumeDownKey.pressedUp = false;
            }
            VolumeDownKey.state       = false;
            VolumeDownKey.pressedDown = false;
        }


        #endregion

        #region extended api
        //打开扩展API后,提供长按和滑动功能
        if (ExtendedAPI)
        {
            //slip
            if (TouchPadPosition.x > 0 || TouchPadPosition.y > 0)
            {
                if (!touchClock)
                {
                    touchXBegin = TouchPadPosition.x;
                    touchYBegin = TouchPadPosition.y;
                    touchClock  = true;
                }
                touchXEnd = TouchPadPosition.x;
                touchYEnd = TouchPadPosition.y;
            }
            else
            {
                if (touchXEnd > touchXBegin)
                {
                    if (touchYEnd > touchYBegin)
                    {
                        if (touchXEnd - touchXBegin > slipNum && ((touchXEnd - touchXBegin) > (touchYEnd - touchYBegin)))
                        {
                            //slide up
                            TouchPadKey.slideup = true;
                        }
                        if (touchYEnd - touchYBegin > slipNum && ((touchYEnd - touchYBegin) > (touchXEnd - touchXBegin)))
                        {
                            //slide right
                            TouchPadKey.slideright = true;
                        }
                    }
                    else if (touchYEnd < touchYBegin)
                    {
                        if (touchXEnd - touchXBegin > slipNum && ((touchXEnd - touchXBegin) > (touchYBegin - touchYEnd)))
                        {
                            //slide up
                            TouchPadKey.slideup = true;
                        }
                        if (touchYBegin - touchYEnd > slipNum && ((touchYBegin - touchYEnd) > (touchXEnd - touchXBegin)))
                        {
                            //slide left
                            TouchPadKey.slideleft = true;
                        }
                    }
                }
                else if (touchXEnd < touchXBegin)
                {
                    if (touchYEnd > touchYBegin)
                    {
                        if (touchXBegin - touchXEnd > slipNum && ((touchXBegin - touchXEnd) > (touchYEnd - touchYBegin)))
                        {
                            //slide down
                            TouchPadKey.slidedown = true;
                        }
                        if (touchYEnd - touchYBegin > slipNum && ((touchYEnd - touchYBegin) > (touchXBegin - touchXEnd)))
                        {
                            //slide right
                            TouchPadKey.slideright = true;
                        }
                    }
                    else if (touchYEnd < touchYBegin)
                    {
                        if (touchXBegin - touchXEnd > slipNum && ((touchXBegin - touchXEnd) > (touchYBegin - touchYEnd)))
                        {
                            //slide down
                            TouchPadKey.slidedown = true;
                        }
                        if (touchYBegin - touchYEnd > slipNum && ((touchYBegin - touchYEnd) > (touchXBegin - touchXEnd)))
                        {
                            //slide left
                            TouchPadKey.slideleft = true;
                        }
                    }
                }
                else
                {
                    TouchPadKey.slideright = false;
                    TouchPadKey.slideleft  = false;
                    TouchPadKey.slidedown  = false;
                    TouchPadKey.slideup    = false;
                }
                touchXBegin = 0;
                touchXEnd   = 0;
                touchYBegin = 0;
                touchYEnd   = 0;
                touchClock  = false;
            }

            //longpress
            if (HomeKey.state)
            {
                HomeKey.timecount += Time.deltaTime;
                if (HomeKey.timecount >= longPressTime && !HomeKey.longPressedClock)
                {
                    HomeKey.longPressed      = true;
                    HomeKey.longPressedClock = true;
                    longPressclock           = true;
                }
                else
                {
                    HomeKey.longPressed = false;
                }
            }
            else
            {
                HomeKey.longPressedClock = false;
                HomeKey.timecount        = 0;
                HomeKey.longPressed      = false;
            }
            if (APPKey.state)
            {
                APPKey.timecount += Time.deltaTime;
                if (APPKey.timecount >= longPressTime && !APPKey.longPressedClock)
                {
                    APPKey.longPressed      = true;
                    APPKey.longPressedClock = true;
                    longPressclock          = true;
                }
                else
                {
                    APPKey.longPressed = false;
                }
            }
            else
            {
                APPKey.longPressedClock = false;
                APPKey.timecount        = 0;
                APPKey.longPressed      = false;
            }
            if (TouchPadKey.state)
            {
                TouchPadKey.timecount += Time.deltaTime;
                if (TouchPadKey.timecount >= longPressTime && !TouchPadKey.longPressedClock)
                {
                    TouchPadKey.longPressed      = true;
                    TouchPadKey.longPressedClock = true;
                    longPressclock = true;
                }
                else
                {
                    TouchPadKey.longPressed = false;
                }
            }
            else
            {
                TouchPadKey.longPressedClock = false;
                TouchPadKey.timecount        = 0;
                TouchPadKey.longPressed      = false;
            }
            if (VolumeUpKey.state)
            {
                VolumeUpKey.timecount += Time.deltaTime;
                if (VolumeUpKey.timecount >= longPressTime && !VolumeUpKey.longPressedClock)
                {
                    VolumeUpKey.longPressed      = true;
                    VolumeUpKey.longPressedClock = true;
                    longPressclock = true;
                }
                else
                {
                    VolumeUpKey.longPressed = false;
                }
            }
            else
            {
                VolumeUpKey.longPressedClock = false;
                VolumeUpKey.timecount        = 0;
                VolumeUpKey.longPressed      = false;
            }
            if (VolumeDownKey.state)
            {
                VolumeDownKey.timecount += Time.deltaTime;
                if (VolumeDownKey.timecount >= longPressTime && !VolumeDownKey.longPressedClock)
                {
                    VolumeDownKey.longPressed      = true;
                    VolumeDownKey.longPressedClock = true;
                    longPressclock = true;
                }
                else
                {
                    VolumeDownKey.longPressed = false;
                }
            }
            else
            {
                VolumeDownKey.longPressedClock = false;
                VolumeDownKey.timecount        = 0;
                VolumeDownKey.longPressed      = false;
            }
        }
        if (Controller.UPvr_GetKeyLongPressed(0, Pvr_KeyCode.HOME))
        {
            Pvr_UnitySDKManager.pvr_UnitySDKSensor.ResetUnitySDKSensor();
            ResetController(0);
        }
        #endregion
#endif
        #endregion
    }