void Start() { if (!displayManager) { displayManager = CastRemoteDisplayManager.GetInstance(); } if (!displayManager) { Debug.LogError("No CastRemoteDisplayManager found!"); Destroy(gameObject); return; } displayManager.RemoteDisplaySessionStartEvent .AddListener(OnRemoteDisplaySessionStart); displayManager.RemoteDisplaySessionEndEvent .AddListener(OnRemoteDisplaySessionEnd); displayManager.RemoteDisplayErrorEvent .AddListener(OnRemoteDisplayError); if (displayManager.GetSelectedCastDevice() != null) { RemoteDisplayCamera.enabled = true; displayManager.RemoteDisplayCamera = MainCamera; } MainCamera.enabled = true; }
private void OnDestroy() { CastRemoteDisplayManager displayManager = CastRemoteDisplayManager.GetInstance(); displayManager.RemoteDisplaySessionStartEvent.RemoveListener(OnRemoteDisplaySessionStart); displayManager.RemoteDisplaySessionEndEvent.RemoveListener(OnRemoteDisplaySessionEnd); }
IEnumerator WaitforChromeCast() { while (CastRemoteDisplayManager.GetInstance().IsCasting() == false) { yield return(new WaitForEndOfFrame()); } _networkView.RPC("LoadGameSceneTogether", RPCMode.All); }
public void Start() { CastRemoteDisplayManager displayManager = CastRemoteDisplayManager.GetInstance(); gameObject.SetActive(displayManager.IsCasting()); pausedText.SetActive(false); displayManager.RemoteDisplaySessionStartEvent.AddListener(OnRemoteDisplaySessionStart); displayManager.RemoteDisplaySessionEndEvent.AddListener(OnRemoteDisplaySessionEnd); }
/** * Unlistens to the cast manager notifications. */ public void Uninitialize() { CastRemoteDisplayManager manager = CastRemoteDisplayManager.GetInstance(); if (isInitialized && manager) { manager.CastDevicesUpdatedEvent.RemoveListener(OnCastDevicesUpdated); manager.RemoteDisplaySessionStartEvent.RemoveListener(OnRemoteDisplaySessionStart); manager.RemoteDisplaySessionEndEvent.RemoveListener(OnRemoteDisplaySessionEnd); isInitialized = false; } }
public void Start() { CastRemoteDisplayManager displayManager = CastRemoteDisplayManager.GetInstance(); GameObject buttonFrame = GameObject.Find("CastButtonFrame"); playOnTvButton = buttonFrame.transform.Find("PlayOnTvButton").gameObject; backgroundImage.SetActive(displayManager.IsCasting()); playOnTvButton.SetActive(!displayManager.IsCasting()); displayManager.RemoteDisplaySessionStartEvent.AddListener(OnRemoteDisplaySessionStart); displayManager.RemoteDisplaySessionEndEvent.AddListener(OnRemoteDisplaySessionEnd); }
void Update() { if (playerHealth.currentHealth <= 0) { GetComponent <Animator>().SetTrigger("GameOver"); if (CastRemoteDisplayManager.GetInstance().IsCasting()) { gameOverButtonCanvas.SetActive(true); gameOverButtonCanvas.GetComponent <Animator>() .SetTrigger("GameOver"); } } }
public void Start() { this.audioSource = GetComponent <AudioSource>(); audioSource.clip = relaxedMusic; if (CastRemoteDisplayManager.GetInstance().IsCasting()) // Only play music if casting. { audioSource.Play(); } else { this.gameObject.SetActive(false); } }
public void CloseLobby() { CastRemoteDisplayManager castDisplayManager = CastRemoteDisplayManager.GetInstance(); if (castDisplayManager.IsCasting()) { castDisplayManager.StopRemoteDisplaySession(); } gameNetworkManager.StopHost(); LocalGameFinder localGameFinder = GameObject.FindObjectOfType <LocalGameFinder>(); localGameFinder.StopBroadCasting(); SceneManager.LoadScene("MainMenuScene"); }
public new void Start() { base.Start(); castSearchAnimation = Instantiate(Resources.Load("Menu/CastSearchAnimation", typeof(GameObject))) as GameObject; Debug.Assert(castSearchAnimation != null); castSearchAnimation.transform.localPosition = new Vector3(0, 0.25f, 6); // Setup the castManager. this.castDisplayManager = CastRemoteDisplayManager.GetInstance(); castDisplayManager.RemoteDisplaySessionStartEvent.AddListener(OnRemoteDisplaySessionStart); castDisplayManager.RemoteDisplaySessionEndEvent.AddListener(OnRemoteDisplaySessionEnd); castDisplayManager.RemoteDisplayErrorEvent.AddListener(OnRemoteDisplayError); castDisplayManager.CastDevicesUpdatedEvent.AddListener(OnCastDevicesUpdated); this.castDevices = castDisplayManager.GetCastDevices(); InvokeRepeating("TryConnectCast", castConnectDelay, castConnectRepeat); }
/** * Checks for the required remote display manager, and shows the default UI. */ void Start() { if (instance != this) { return; } if (!CastRemoteDisplayManager.GetInstance()) { Debug.LogError("DebugCastUIController ERROR: No CastRemoteDisplayManager found!"); Destroy(gameObject); return; } GetComponent <Canvas>().enabled = true; Initialize(); }
void Start() { displayManager = CastRemoteDisplayManager.GetInstance(); displayManager.RemoteDisplaySessionStartEvent .AddListener(OnRemoteDisplaySessionStart); displayManager.RemoteDisplaySessionEndEvent .AddListener(OnRemoteDisplaySessionEnd); displayManager.RemoteDisplayErrorEvent .AddListener(OnRemoteDisplayError); castUIController = GameObject.Find("CastDefaultUI"); pausePanel.SetActive(false); pauseButton.SetActive(false); if (displayManager.IsCasting()) { pauseButton.SetActive(true); } }
public new void Start() { base.Start(); CastRemoteDisplayManager castDisplayManager = CastRemoteDisplayManager.GetInstance(); if (castDisplayManager.IsCasting()) { castDisplayManager.RemoteDisplayErrorEvent.AddListener(OnRemoteDisplayError); castDisplayManager.RemoteDisplaySessionEndEvent.AddListener(OnRemoteDisplaySessionEnd); } this.gameNetworkManager = GameObject.FindObjectOfType <GameNetworkManager>(); InvokeRepeating("CheckConnection", CONNECTION_CHECK_INTERVAL, CONNECTION_CHECK_INTERVAL); // Load menu assets. arrowIcon = Resources.Load <Texture>("Menu/arrow"); arrowFlippedIcon = Resources.Load <Texture>("Menu/arrow-flipped"); difficultyIcons = Resources.LoadAll <Texture>("Menu/Difficulties"); }
void Update() { // If the player has run out of health... if (playerHealth.currentHealth <= 0) { // ... tell the animator the game is over. gameOverButtonCanvas.GetComponent <Canvas>().enabled = true; gameOverButtonCanvas.GetComponent <Animator>().SetTrigger("GameOver"); restartButton.SetActive(true); if (CastRemoteDisplayManager.GetInstance().IsCasting()) { gameOverRemoteCanvas.GetComponent <Animator>().SetTrigger("GameOver"); } else { gameOverRemoteCanvas.SetActive(false); } } }
public void setCommom() { GameObject p = GameObject.Find("persistencia"); if (p != null) { persistencia = p.GetComponent <Persistencia>(); if (persistencia.isChromecast) { displayManager = CastRemoteDisplayManager.GetInstance(); displayManager.RemoteDisplayCamera = tv_camera.GetComponent <Camera>(); displayManager.RemoteAudioListener = tv_camera.GetComponent <AudioListener>(); } } else { p = new GameObject(); p.AddComponent <Persistencia>(); } //Application.RegisterLogCallback(LogHandler); Debug.Log("MANAGER SCENE TOP LEVEL"); }
void Start() { Debug.Log(" MANAGER SCENE"); displayManager = CastRemoteDisplayManager.GetInstance(); displayManager.RemoteDisplaySessionStartEvent.AddListener(OnRemoteDisplaySessionStart); displayManager.RemoteDisplaySessionEndEvent.AddListener(OnRemoteDisplaySessionEnd); displayManager.RemoteDisplayErrorEvent.AddListener(OnRemoteDisplayError); castUIController = GameObject.Find("CastDefaultUI"); persistencia = GameObject.Find("persistencia").GetComponent <Persistencia>(); DontDestroyOnLoad(this); /* * pausePanel.SetActive(false); * pauseButton.SetActive(false); * * * foreach(CastDevice cd in displayManager.GetCastDevices()){ * Debug.Log("DEVICES ENCONTRADOS: "+cd.DeviceName+" :: "+cd.DeviceId+" :: " +cd.Status ); * * }*/ }
// Update is called once per frame void Update() { GetComponent <Text>().text = "Casting: " + CastRemoteDisplayManager.GetInstance().IsCasting() + "\nCast App Id: " + CastRemoteDisplayManager.GetInstance().CastAppId; }
public void OnLevelWasLoaded(int level) { CastRemoteDisplayManager.GetInstance().RemoteDisplayCamera = FindCastCamera(); }
/** * Called when the volume slider is changed - passes volume changes along to the Cast device. */ public void OnVolumeSet() { CastRemoteDisplayManager.GetInstance().SetCastVolume(volumeSlider.value); }
/** * Called when the disconnect button is pressed. */ public void OnDisconnectButtonTapped() { HideAll(); CastRemoteDisplayManager.GetInstance().StopRemoteDisplaySession(); }
/** * Set the cast device name for the dialog title. */ public void Setup(string name) { deviceName.text = name; volumeSlider.value = CastRemoteDisplayManager.GetInstance().GetCastVolume(); }