예제 #1
0
 public void StartRecord()
 {
     if (NxrViewer.Instance.GetNibiruService() != null)
     {
         NibiruService.SetCaptureVideoSize(VIDEO_SIZE.V720P);
         string filePath = NxrViewer.Instance.GetStoragePath() + "/unityrecord.mp4";
         NxrViewer.Instance.GetNibiruService().StartCapture(filePath);
     }
     textMesh_Status.text = "Recording is in progress,\nyou can click [Stop]\n to stop!";
 }
예제 #2
0
        void Start()
        {
            nibiruService = NxrViewer.Instance.GetNibiruService();

            if (nibiruService == null)
            {
                Debug.Log("nibiruService is null >>>>>>>>>>>>>>>>>>");
            }
            NibiruService.OnSensorDataChangedHandler += onSensorDataChanged;

            Debug.Log("----------------nibiruService is Start----------------");
        }
예제 #3
0
        void CameraIdle()
        {
            if (hasTrigger)
            {
                return;
            }
            Debug.Log(".CameraIdle");
            NibiruService nibiruService = NxrViewer.Instance.GetNibiruService();

            if (nibiruService != null)
            {
                nibiruService.StartCameraPreView(true);
            }
            hasTrigger = true;
        }
예제 #4
0
        public void OnPointerUp()
        {
            NibiruService nibiruService = NxrViewer.Instance.GetNibiruService();

            Debug.Log("OnPointerUp : " + gameObject.name);
            // stop
            GameObject apiObj = GameObject.Find("apiRoot");

            if (nibiruService != null && apiObj != null && apiObj.transform.Find("ButtonStartRec") != null)
            {
                GameObject startRecObj = apiObj.transform.Find("ButtonStartRec").gameObject;
                if (startRecObj == null)
                {
                    return;
                }
                bool isActive = startRecObj.activeSelf;
                if (isActive && startRecObj.GetComponent <TeleportService>().isGazedAt())
                {
                    nibiruService.StopVoiceRecording();
                }
            }
        }
예제 #5
0
        public void OnGazeTrigger()
        {
            NibiruService nibiruService = NxrViewer.Instance.GetNibiruService();

            // if (nibiruService != null && gameObject.name.Equals("CubeTouchCursor"))
            // {
            //     cursorEnabled = !cursorEnabled;
            //     nibiruService.SetEnableTouchCursor(cursorEnabled);
            // }
            // else if (nibiruService != null && gameObject.name.Equals("CubeDisplayMode"))
            // {
            //     curMode = curMode == DISPLAY_MODE.MODE_3D ? DISPLAY_MODE.MODE_2D : DISPLAY_MODE.MODE_3D;
            //     nibiruService.SetDisplayMode(curMode);
            // }
            if (nibiruService != null && gameObject.name.Equals("CubeBrightnessUp"))
            {
                nibiruService.SetBrightnessValue(nibiruService.GetBrightnessValue() + 1);
            }
            else if (nibiruService != null && gameObject.name.Equals("CubeBrightnessDown"))
            {
                nibiruService.SetBrightnessValue(nibiruService.GetBrightnessValue() - 1);
            }
            // else if (gameObject.name.Equals("CubeLanguageCN"))
            // {
            //     NxrViewer.Instance.VoiceLanguage = VOICE_LANGUAGE.CHINESE;
            //
            //     gameObject.GetComponent<Renderer>().material.color = Color.green;
            //
            //     GameObject cnObj = GameObject.Find("CubeLanguageEN");
            //     if (cnObj != null)
            //     {
            //         cnObj.GetComponent<Renderer>().material.color = Color.white;
            //     }
            //     // resume
            //     Transform rootTransform = GameObject.Find("UIRoot").transform;
            //     rootTransform.Find("CubeNextDemo").transform.gameObject.SetActive(true);
            //
            //     // refresh
            //     UpdateTextContent(LocalizationManager.chinese);
            //
            //     LocalizationManager.GetInstance.ChangeLanguage(LocalizationManager.chinese);
            // }
            // else if (gameObject.name.Equals("CubeLanguageEN"))
            // {
            //     NxrViewer.Instance.VoiceLanguage = VOICE_LANGUAGE.ENGLISH;
            //     gameObject.GetComponent<Renderer>().material.color = Color.green;
            //     GameObject enObj = GameObject.Find("CubeLanguageCN");
            //     if (enObj != null)
            //     {
            //         enObj.GetComponent<Renderer>().material.color = Color.white;
            //     }
            //
            //     if (GetPageNumber() == 2)
            //     {
            //         Transform rootTransform = GameObject.Find("UIRoot").transform;
            //         // dismiss
            //         rootTransform.Find("CubeNextDemo").transform.gameObject.SetActive(false);
            //     }
            //
            //     // refresh
            //     UpdateTextContent(LocalizationManager.english);
            //
            //     LocalizationManager.GetInstance.ChangeLanguage(LocalizationManager.english);
            // }
            else if (nibiruService != null && gameObject.name.Equals("CameraStart"))
            {
                // camera preview
                hasTrigger = false;
                nibiruService.GetCameraStatus();
            }
            else if (nibiruService != null && gameObject.name.Equals("CameraPause"))
            {
                nibiruService.StopCamereaPreView();
            }
            // else if (gameObject.name.Equals("CubeNextDemo"))
            // {
            //     int page = GetPageNumber();
            //     if (page == 0 || page == 2)
            //     {
            //         UpdateVoiceApiDemoPage(true);
            //         // dismiss text
            //         Transform rootTransform = GameObject.Find("UIRoot").transform;
            //         rootTransform.Find("TextControlTip").gameObject.SetActive(false);
            //         rootTransform.Find("TextTip").gameObject.SetActive(false);
            //         // dismiss progressbar
            //         Transform parentTransform = GameObject.Find("VolumeRoot").transform;
            //         parentTransform.Find("VolumeIcon").gameObject.SetActive(false);
            //         parentTransform.Find("VolumeProgressBG").gameObject.SetActive(false);
            //         parentTransform.Find("VolumeProgressValue").gameObject.SetActive(false);
            //         // change en/cn
            //         rootTransform.Find("CubeLanguageEN").transform.gameObject.SetActive(true);
            //         rootTransform.Find("CubeLanguageCN").transform.gameObject.SetActive(true);
            //         return;
            //     }
            //     else if (page == 1)
            //     {
            //         UpdateVoiceApiDemoPage(false);
            //         // resume text
            //         Transform rootTransform = GameObject.Find("UIRoot").transform;
            //         rootTransform.Find("TextControlTip").gameObject.SetActive(true);
            //         rootTransform.Find("TextTip").gameObject.SetActive(true);
            //     }
            //
            //     // next page
            //     LocalizationText localizationText = GameObject.Find("TextControlTip").GetComponent<LocalizationText>();
            //     string newKey = localizationText.key == "voice_say_content" ? "voice_say_content_volume" : "voice_say_content";
            //     localizationText.UpdateKey(newKey);
            //
            //
            //     //Debug.Log("-------------------:www---------------" + newKey);
            //
            //     // back
            //     LocalizationText localizationTextNxt = GameObject.Find("TextNextDemo").GetComponent<LocalizationText>();
            //     newKey = localizationTextNxt.key == "next_demo_text" ? "last_demo_text" : "next_demo_text";
            //     localizationTextNxt.UpdateKey(newKey);
            //
            //     LocalizationText localizationTextTip = GameObject.Find("TextTip").GetComponent<LocalizationText>();
            //     newKey = localizationTextTip.key == "voice_tip_content" ? "voice_tip_content_v" : "voice_tip_content";
            //     localizationTextTip.UpdateKey(newKey);
            //
            //     if (newKey == "voice_tip_content_v")
            //     {
            //         Transform rootTransform = GameObject.Find("UIRoot").transform;
            //
            //         // dismiss en button
            //         rootTransform.Find("CubeLanguageEN").transform.gameObject.SetActive(false);
            //         rootTransform.Find("CubeLanguageCN").transform.gameObject.SetActive(false);
            //         //
            //         // show progressbar
            //         Transform parentTransform = GameObject.Find("VolumeRoot").transform;
            //         parentTransform.Find("VolumeIcon").gameObject.SetActive(true);
            //         parentTransform.Find("VolumeProgressBG").gameObject.SetActive(true);
            //         parentTransform.Find("VolumeProgressValue").gameObject.SetActive(true);
            //
            //         UpdateVolumeProgress();
            //     }
            //     else if (newKey == "voice_tip_content")
            //     {
            //         Transform rootTransform = GameObject.Find("UIRoot").transform;
            //         rootTransform.Find("CubeLanguageEN").transform.gameObject.SetActive(true);
            //         rootTransform.Find("CubeLanguageCN").transform.gameObject.SetActive(true);
            //         //
            //         // dismiss progressbar
            //         Transform parentTransform = GameObject.Find("VolumeRoot").transform;
            //         parentTransform.Find("VolumeIcon").gameObject.SetActive(false);
            //         parentTransform.Find("VolumeProgressBG").gameObject.SetActive(false);
            //         parentTransform.Find("VolumeProgressValue").gameObject.SetActive(false);
            //     }
            //
            //     page++;
            // }
            else if (nibiruService != null && gameObject.name.Equals("CubeStartSensor"))
            {
                nibiruService.RegisterSensorListener(SENSOR_TYPE.ACCELEROMETER, SENSOR_LOCATION.HMD);
                nibiruService.RegisterSensorListener(SENSOR_TYPE.GYROSCOPE, SENSOR_LOCATION.HMD);
                nibiruService.RegisterSensorListener(SENSOR_TYPE.MAGNETIC_FIELD, SENSOR_LOCATION.HMD);
            }
            else if (nibiruService != null && gameObject.name.Equals("CubeStopSensor"))
            {
                nibiruService.UnRegisterSensorListener();
            }
            // else if (nibiruService != null && gameObject.name.Equals("ButtonStopRec"))
            // {
            //     nibiruService.StopVoiceRecording();
            // }
            // else if (gameObject.name.Equals("ButtonStartRec"))
            // {
            //     //nibiruService.StartVoiceRecording();
            //     Transform btnTransform = gameObject.transform.Find("ApiButtonText");
            //     LocalizationText localizationText = btnTransform.gameObject.GetComponent<LocalizationText>();
            //     localizationText.UpdateKey("voice_say_content_3");
            // }
        }