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"); // } }
// Update is called once per frame void Update() { updateCount++; if (textMesh_SensorData == null) { GameObject Obj = GameObject.Find("TextSensorData"); if (Obj != null) { textMesh_SensorData = Obj.GetComponent <TextMesh>(); Debug.Log("find TextSensorData"); return; } } if (textMesh_DriverVersion == null) { GameObject Obj = GameObject.Find("DriverVersion"); if (Obj != null) { textMesh_DriverVersion = Obj.GetComponent <TextMesh>(); Debug.Log("find DriverVersion"); return; } } if (textMesh_VendorVersion == null) { GameObject Obj = GameObject.Find("VendorSwVersion"); if (Obj != null) { textMesh_VendorVersion = Obj.GetComponent <TextMesh>(); Debug.Log("find VendorSwVersion"); return; } } if (textMesh_Light == null) { GameObject Obj = GameObject.Find("LightValue"); if (Obj != null) { textMesh_Light = Obj.GetComponent <TextMesh>(); Debug.Log("find LightValue"); return; } } if (textMesh_Proximity == null) { GameObject Obj = GameObject.Find("ProximityValue"); if (Obj != null) { textMesh_Proximity = Obj.GetComponent <TextMesh>(); Debug.Log("find ProximityValue"); return; } } if (textMesh_Brightness == null) { GameObject Obj = GameObject.Find("BrightnessValue"); if (Obj != null) { textMesh_Brightness = Obj.GetComponent <TextMesh>(); Debug.Log("find BrightnessValue"); return; } } if (nibiruService != null && !updateOnce) { // Avoid frequent calls updateOnce = true; Debug.Log("----------------------------------------Service-------------"); textMesh_DriverVersion.text = "Driver board software version:" + nibiruService.GetVendorSWVersion(); textMesh_VendorVersion.text = "System version:" + nibiruService.GetModel() + "," + nibiruService.GetOSVersion(); textMesh_Brightness.text = "Screen brightness:" + nibiruService.GetBrightnessValue(); textMesh_Light.text = "Light sensor:" + nibiruService.GetLightValue(); textMesh_Proximity.text = "Distance sensor:" + nibiruService.GetProximityValue(); } // 1s1次 if (updateCount > 60 && textMesh_Brightness != null && nibiruService != null) { updateCount = 0; textMesh_Brightness.text = "Screen brightness:" + nibiruService.GetBrightnessValue(); } }