void changeWatchLayout(int num) { for (int i = 0; i < ViewLayout; i++) { if (i == num) { Cam[i].depth = 10f; isZoom[i] = true; if (vpManager.getAudioSupport(i)) { Vp[i].SetDirectAudioMute(0, false); } Sd[i].transform.localPosition = new Vector3(-100.0f, -210.0f, 0.0f); FName[i].transform.localPosition = new Vector3(-550.0f, 255.0f, 0.0f); DTime[i].transform.localPosition = new Vector3(-50.0f, -256.0f, 0.0f); ETime[i].transform.localPosition = new Vector3(-720.0f, -256.0f, 0.0f); Sd[i].gameObject.SetActive(true); FName[i].gameObject.SetActive(true); DTime[i].gameObject.SetActive(true); ETime[i].gameObject.SetActive(true); } else { Cam[i].depth = -1f; isZoom[i] = false; Vp[i].SetDirectAudioMute(0, true); Sd[i].gameObject.SetActive(false); FName[i].gameObject.SetActive(false); DTime[i].gameObject.SetActive(false); ETime[i].gameObject.SetActive(false); } } }
// Update is called once per frame void Update() { if (Input.GetKeyUp(KeyCode.Alpha1)) { if (!isZoom[0]) { if (vpManager.getAudioSupport(0)) { Vp[0].SetDirectAudioMute(0, false); } isZoom[0] = true; } else { Vp[0].SetDirectAudioMute(0, true); isZoom[0] = false; } } }
// Use this for initialization void Start() { vpManager = GameObject.Find("VideoPlayerManager").GetComponent <VideoPlayerManager>(); while (true) { ViewCount = vpManager.getViewCount(); if (ViewCount != 0) { break; } } date = vpManager.getMovieStartDate(0) + " "; SdAll = GameObject.Find("Slider").GetComponent <Slider>(); DTimeAll = GameObject.Find("TimesOfDay").GetComponent <Text>(); ETimeAll = GameObject.Find("ElapsedTime").GetComponent <Text>(); for (int i = 0; i < ViewCount; i++) { Sd[i] = GameObject.Find(SliderString[i]).GetComponent <Slider>(); FName[i] = GameObject.Find(FNameString[i]).GetComponent <Text>(); DTime[i] = GameObject.Find(DTimeString[i]).GetComponent <Text>(); ETime[i] = GameObject.Find(ETimeString[i]).GetComponent <Text>(); if (vpManager.getAudioSupport(i)) { FName[i].text = vpManager.getMovieName(i); } else { FName[i].text = vpManager.getMovieName(i) + " (Audio codec not supported)"; FName[i].color = new Color(255f / 255f, 0f / 255f, 0f / 255f); } } }
private void CheckAudioSupport(int num, string movieInfoFile) { string line; try { System.IO.StreamReader seekFile = new System.IO.StreamReader(movieInfoFile); Regex rgx = new Regex(@"ac3|AC-3", RegexOptions.IgnoreCase); while ((line = seekFile.ReadLine()) != null) { if (rgx.Match(line).Success) { vpManager.setAudioSupport(num, false); Debug.Log("The audio codec of this movie is ac-3. AudioSupport is " + vpManager.getAudioSupport(num) + "."); } } seekFile.Close(); } catch (System.IO.IOException ex) { SetErrorDialog("ERROR:MovieInfo File Open Error", ex.Message); } }