コード例 #1
0
ファイル: MainForm.cs プロジェクト: CryptArc/PSVRFramework
 private void button3_Click(object sender, EventArgs e)
 {
     Task.Run(async() =>
     {
         PSVRController.EnableVRTracking();
         await Task.Delay(1500);
         PSVRController.ApplyLedSettings();
     });
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: CryptArc/PSVRFramework
        private void button17_Click(object sender, EventArgs e)
        {
            LedMask mask = LedMask.None;

            switch (cbLeds.SelectedIndex)
            {
            case 0:
                Settings.Instance.LedAIntensity = (byte)trkLedIntensity.Value;
                mask = LedMask.LedA;
                break;

            case 1:
                Settings.Instance.LedBIntensity = (byte)trkLedIntensity.Value;
                mask = LedMask.LedB;
                break;

            case 2:
                Settings.Instance.LedCIntensity = (byte)trkLedIntensity.Value;
                mask = LedMask.LedC;
                break;

            case 3:
                Settings.Instance.LedDIntensity = (byte)trkLedIntensity.Value;
                mask = LedMask.LedD;
                break;

            case 4:
                Settings.Instance.LedEIntensity = (byte)trkLedIntensity.Value;
                mask = LedMask.LedE;
                break;

            case 5:
                Settings.Instance.LedFIntensity = (byte)trkLedIntensity.Value;
                mask = LedMask.LedF;
                break;

            case 6:
                Settings.Instance.LedGIntensity = (byte)trkLedIntensity.Value;
                mask = LedMask.LedG;
                break;

            case 7:
                Settings.Instance.LedHIntensity = (byte)trkLedIntensity.Value;
                mask = LedMask.LedH;
                break;

            case 8:
                Settings.Instance.LedIIntensity = (byte)trkLedIntensity.Value;
                mask = LedMask.LedI;
                break;

            case 9:
                Settings.Instance.LedAIntensity                                 =
                    Settings.Instance.LedBIntensity                             =
                        Settings.Instance.LedCIntensity                         =
                            Settings.Instance.LedDIntensity                     =
                                Settings.Instance.LedEIntensity                 =
                                    Settings.Instance.LedFIntensity             =
                                        Settings.Instance.LedGIntensity         =
                                            Settings.Instance.LedHIntensity     =
                                                Settings.Instance.LedIIntensity = (byte)trkLedIntensity.Value;

                mask = LedMask.All;
                break;
            }

            if (mask != LedMask.None)
            {
                Settings.SaveSettings();
                PSVRController.ApplyLedSettings();
            }
        }
コード例 #3
0
        private void ProcessCommand(RemoteCommand cmd)
        {
            switch (cmd.Command)
            {
            case "HeadsetOn":
                PSVRController.HeadsetOn();
                break;

            case "HeadsetOff":
                PSVRController.HeadsetOff();
                break;

            case "EnableVRTracking":
                PSVRController.EnableVRTracking();
                break;

            case "EnableVRMode":
                PSVRController.EnableVRMode();
                break;

            case "EnableCinematicMode":
                PSVRController.EnableCinematicMode();
                break;

            case "Recenter":
                PSVRController.Recenter();
                break;

            case "Shutdown":
                PSVRController.Shutdown();
                break;

            case "CinematicSettings":

                CinematicSettingsCommand ccmd = cmd as CinematicSettingsCommand;

                if (ccmd != null)
                {
                    bool apply = false;

                    if (ccmd.Brightness != null && ccmd.Brightness.HasValue)
                    {
                        var bright = ccmd.Brightness.Value;

                        if (bright > 32)
                        {
                            return;
                        }

                        Settings.Instance.Brightness = bright;
                        apply = true;
                    }

                    if (ccmd.Size != null && ccmd.Size.HasValue)
                    {
                        var siz = ccmd.Size.Value + 26;

                        if (siz > 80)
                        {
                            Settings.ReadSettings();
                            return;
                        }

                        Settings.Instance.ScreenSize = (byte)siz;
                        apply = true;
                    }

                    if (ccmd.Distance != null && ccmd.Distance.HasValue)
                    {
                        var dist = ccmd.Distance.Value + 2;

                        if (dist > 50)
                        {
                            Settings.ReadSettings();
                            return;
                        }

                        Settings.Instance.ScreenDistance = (byte)dist;
                        apply = true;
                    }

                    if (apply)
                    {
                        PSVRController.ApplyCinematicSettings();
                    }
                }

                break;

            case "LedSettings":

                LEDSettingsCommand lcmd = cmd as LEDSettingsCommand;

                if (lcmd != null)
                {
                    bool apply = false;

                    if (lcmd.LedA != null && lcmd.LedA.HasValue)
                    {
                        if (lcmd.LedA.Value > 100)
                        {
                            return;
                        }

                        Settings.Instance.LedAIntensity = lcmd.LedA.Value;
                        apply = true;
                    }

                    if (lcmd.LedB != null && lcmd.LedB.HasValue)
                    {
                        if (lcmd.LedB.Value > 100)
                        {
                            Settings.ReadSettings();
                            return;
                        }
                        Settings.Instance.LedBIntensity = lcmd.LedB.Value;
                        apply = true;
                    }

                    if (lcmd.LedC != null && lcmd.LedC.HasValue)
                    {
                        if (lcmd.LedC.Value > 100)
                        {
                            Settings.ReadSettings();
                            return;
                        }
                        Settings.Instance.LedCIntensity = lcmd.LedC.Value;
                        apply = true;
                    }

                    if (lcmd.LedD != null && lcmd.LedD.HasValue)
                    {
                        if (lcmd.LedD.Value > 100)
                        {
                            Settings.ReadSettings();
                            return;
                        }
                        Settings.Instance.LedDIntensity = lcmd.LedD.Value;
                        apply = true;
                    }

                    if (lcmd.LedE != null && lcmd.LedE.HasValue)
                    {
                        if (lcmd.LedE.Value > 100)
                        {
                            Settings.ReadSettings();
                            return;
                        }
                        Settings.Instance.LedEIntensity = lcmd.LedE.Value;
                        apply = true;
                    }

                    if (lcmd.LedF != null && lcmd.LedF.HasValue)
                    {
                        if (lcmd.LedF.Value > 100)
                        {
                            Settings.ReadSettings();
                            return;
                        }
                        Settings.Instance.LedFIntensity = lcmd.LedF.Value;
                        apply = true;
                    }

                    if (lcmd.LedG != null && lcmd.LedG.HasValue)
                    {
                        if (lcmd.LedG.Value > 100)
                        {
                            Settings.ReadSettings();
                            return;
                        }
                        Settings.Instance.LedGIntensity = lcmd.LedG.Value;
                        apply = true;
                    }

                    if (lcmd.LedH != null && lcmd.LedH.HasValue)
                    {
                        if (lcmd.LedH.Value > 100)
                        {
                            Settings.ReadSettings();
                            return;
                        }
                        Settings.Instance.LedHIntensity = lcmd.LedH.Value;
                        apply = true;
                    }

                    if (lcmd.LedI != null && lcmd.LedI.HasValue)
                    {
                        if (lcmd.LedI.Value > 100)
                        {
                            Settings.ReadSettings();
                            return;
                        }
                        Settings.Instance.LedIIntensity = lcmd.LedI.Value;
                        apply = true;
                    }

                    if (apply)
                    {
                        PSVRController.ApplyLedSettings();
                    }
                }

                break;

            case "StoreSettings":
                Settings.SaveSettings();
                break;

            case "DiscardSettings":
                Settings.ReadSettings();
                break;
            }
        }