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;
    }
Exemplo n.º 2
0
 void Start()
 {
     this.castDisplayManager = CastRemoteDisplayManager.GetInstance();
     castDisplayManager.RemoteDisplayErrorEvent.AddListener(OnRemoteDisplayError);
     castDisplayManager.RemoteDisplaySessionEndEvent.AddListener(OnRemoteDisplaySessionEnd);
     castDisplayManager.RemoteDisplayCamera = remoteCamera;
 }
Exemplo n.º 3
0
 public void stopCasting(CastRemoteDisplayManager c)
 {
     mainCanvas.worldCamera = phoneCamera;
     phoneCanvas.worldCamera = chromecastCamera;
     phoneCanvas.enabled = false;
     GraphicRaycaster gR = mainCanvas.GetComponent<GraphicRaycaster>();
     gR.enabled = true;
 }
Exemplo n.º 4
0
 public void OnRemoteDisplaySessionStart(CastRemoteDisplayManager manager)
 {
     // Start hosting and join lobby.
     Destroy(castSearchAnimation);
     LocalGameFinder localGameFinder = GameObject.FindObjectOfType<LocalGameFinder>();
     localGameFinder.StartBroadCasting();
     GameNetworkManager networkManager = GameObject.FindObjectOfType<GameNetworkManager>();
     networkManager.StartHost();
     SceneManager.LoadScene("LobbyScene");
 }
Exemplo n.º 5
0
    public void Start()
    {
        phoneCanvas.enabled = false;

        chromeCast = (CastRemoteDisplayManager)FindObjectOfType(typeof(CastRemoteDisplayManager));
        chromeCast.RemoteDisplaySessionStartEvent.AddListener(startCasting);
        chromeCast.RemoteDisplaySessionEndEvent.AddListener(stopCasting);
        chromeCast.RemoteDisplayErrorEvent.AddListener(errorCasting);

        phoneCanvas.enabled = false;

        chromeCast.RemoteDisplayCamera = chromecastCamera;

        /* The phone is allready connected to a chromecast*/
        if (chromeCast.IsCasting())
        {
            startCasting(null);
        }
    }
  /**
  * Listen to the CastRemoteDisplayManager events.
  */
  void Start() {
    if (!displayManager) {
      displayManager = CastRemoteDisplayManager.GetInstance();
    }

    if (!displayManager) {
      Debug.LogError("DebugCastUIController ERROR: No CastRemoteDisplayManager found!");
      Destroy(gameObject);
      return;
    }

    displayManager.RemoteDisplaySessionStartEvent.AddListener(OnRemoteDisplaySessionStart);
    displayManager.RemoteDisplaySessionEndEvent.AddListener(OnRemoteDisplaySessionEnd);
    displayManager.RemoteDisplayErrorEvent.AddListener(OnRemoteDisplayError);
    if (displayManager.IsCasting()) {
      RemoteDisplayCamera.enabled = true;
      displayManager.RemoteDisplayCamera = MainCamera;
    }

    MainCamera.enabled = true;
  }
Exemplo n.º 7
0
 /**
  * Cast session started, so change the mobile device camera.
  */
 public void OnRemoteDisplaySessionStart(CastRemoteDisplayManager manager)
 {
     displayManager.RemoteDisplayCamera = MainCamera;
     RemoteDisplayCamera.enabled        = true;
 }
 private void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager)
 {
     gameObject.SetActive(false);
 }
Exemplo n.º 9
0
 public void OnRemoteDisplayError(CastRemoteDisplayManager manager)
 {
     Debug.Log("DISPLAY ERROR");
 }
Exemplo n.º 10
0
 public void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager)
 {
     GoBack();
 }
Exemplo n.º 11
0
    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);
    }
 private void OnRemoteDisplaySessionStart(CastRemoteDisplayManager manager) {
   gameObject.SetActive(true);
 }
Exemplo n.º 13
0
 public void OnCastDevicesUpdated(CastRemoteDisplayManager manager)
 {
     this.castDevices = manager.GetCastDevices();
 }
 public void OnRemoteDisplaySessionStart(CastRemoteDisplayManager manager)
 {
     castUIController.SetActive(false);
       pauseButton.SetActive(true);
 }
 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);
       }
 }
 /**
  * Handles error messages from the Remote Display Manager.
  */
 public void OnRemoteDisplayError(CastRemoteDisplayManager manager) {
   RemoteDisplayCamera.enabled = false;
   MainCamera.enabled = true;
 }
 /**
  * Cast session ended, so change the mobile device camera.
  */
 public void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager) {
   displayManager.RemoteDisplayCamera = null;
   RemoteDisplayCamera.enabled = false;
   MainCamera.enabled = true;
 }
 /**
  * Cast session started, so change the mobile device camera.
  */
 public void OnRemoteDisplaySessionStart(CastRemoteDisplayManager manager) {
   displayManager.RemoteDisplayCamera = MainCamera;
   RemoteDisplayCamera.enabled = true;
 }
Exemplo n.º 19
0
 /**
  * Cleans up display when the session is over.
  */
 public void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager)
 {
     isCasting = false;
     castButtonFrame.ShowNotCasting();
 }
 private void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager) {
   gameObject.SetActive(false);
 }
Exemplo n.º 21
0
 public void OnRemoteDisplayError(CastRemoteDisplayManager manager)
 {
     Debug.LogError("Casting failed: " + manager.GetLastError());
     manager.StopRemoteDisplaySession();
 }
Exemplo n.º 22
0
 /**
  * Set the cast device name for the dialog title.
  */
 public void Setup(string name)
 {
     deviceName.text    = name;
     volumeSlider.value = CastRemoteDisplayManager.GetInstance().GetCastVolume();
 }
Exemplo n.º 23
0
 public void OnCastDevicesUpdated(CastRemoteDisplayManager manager)
 {
     this.castDevices = manager.GetCastDevices();
 }
Exemplo n.º 24
0
 /**
  * Called when the volume slider is changed - passes volume changes along to the Cast device.
  */
 public void OnVolumeSet()
 {
     CastRemoteDisplayManager.GetInstance().SetCastVolume(volumeSlider.value);
 }
Exemplo n.º 25
0
 public void OnLevelWasLoaded(int level)
 {
     CastRemoteDisplayManager.GetInstance().RemoteDisplayCamera = FindCastCamera();
 }
Exemplo n.º 26
0
 public void errorCasting(CastRemoteDisplayManager c)
 {
     mainCanvas.worldCamera = phoneCamera;
     phoneCanvas.worldCamera = chromecastCamera;
     phoneCanvas.enabled = false;
 }
 private void OnRemoteDisplaySessionStart(CastRemoteDisplayManager manager)
 {
     gameObject.SetActive(true);
 }
Exemplo n.º 28
0
 public void OnRemoteDisplayError(CastRemoteDisplayManager manager)
 {
     castUIController.SetActive(true);
     pauseButton.SetActive(false);
 }
Exemplo n.º 29
0
 public void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager)
 {
     Debug.Log("SESSION END");
     persistencia.CarregarCena(TelaCarregamento.CONECTAR_CHROMECAST);
 }
Exemplo n.º 30
0
 public void OnRemoteDisplayError(CastRemoteDisplayManager manager)
 {
     Debug.LogError("Casting failed: " + manager.GetLastError());
     manager.StopRemoteDisplaySession();
 }
Exemplo n.º 31
0
 /**
  * Handles error messages from the Remote Display Manager.
  */
 public void OnRemoteDisplayError(CastRemoteDisplayManager manager)
 {
     RemoteDisplayCamera.enabled = false;
     MainCamera.enabled          = true;
 }
Exemplo n.º 32
0
 public void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager)
 {
     GoBack();
 }
Exemplo n.º 33
0
 /**
  * Cast session ended, so change the mobile device camera.
  */
 public void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager)
 {
     displayManager.RemoteDisplayCamera = null;
     RemoteDisplayCamera.enabled        = false;
     MainCamera.enabled = true;
 }
    /**
     * Populates the list of casts with devices, and sets up callbacks for selecting said devices.
     */
    public void PopulateList(CastRemoteDisplayManager manager) {
      foreach (var button in currentButtons) {
        Destroy(button);
      }
      currentButtons.Clear();

      IList<CastDevice> devices = manager.GetCastDevices();
      foreach (CastDevice listDevice in devices) {
        GameObject newButton = Instantiate(listElementPrefab) as GameObject;
        CastListButton button = newButton.GetComponent<CastListButton>();
        button.nameLabel.text = listDevice.DeviceName;
        button.statusLabel.text = listDevice.Status;
        string deviceId = listDevice.DeviceId;
        button.button.onClick.AddListener(() => {
          manager.SelectCastDevice(deviceId);
          castButtonFrame.ShowConnecting();
          this.ShowConnectingState();
        });
        newButton.transform.SetParent(contentPanel.transform, false);
        currentButtons.Add(newButton);
      }

      if (!connecting) {
        ResetDialog();
      }
    }
Exemplo n.º 35
0
 // Update is called once per frame
 void Update()
 {
     GetComponent <Text>().text = "Casting: " + CastRemoteDisplayManager.GetInstance().IsCasting() + "\nCast App Id: " + CastRemoteDisplayManager.GetInstance().CastAppId;
 }
 private void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager) {
   backgroundImage.SetActive(false);
   playOnTvButton.SetActive(true);
 }
Exemplo n.º 37
0
 public void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager)
 {
     CloseGame();
 }
 /**
  * When the list of devices updates, update the list. Called when the list of
  * devices updates.
  */
 public void OnCastDevicesUpdated(CastRemoteDisplayManager manager) {
   if (enableFirstTimeCastUI) {
     ShowFirstTimeCastDialogIfNeeded();
   }
   castListDialog.PopulateList(manager);
 }
Exemplo n.º 39
0
 /**
  * Closes the list of devices, sets up the casting display.
  */
 public void OnRemoteDisplaySessionStart(CastRemoteDisplayManager manager)
 {
     isCasting = true;
     HideAll();
     castButtonFrame.ShowCasting();
 }
    /**
     * Closes the list of devices, sets up the casting display.
     */
    public void OnRemoteDisplaySessionStart(CastRemoteDisplayManager manager) {
        isCasting = true;
        HideAll();
            //castButtonFrame.ShowCasting();

            lobbyManager.StartHost();
    }
Exemplo n.º 41
0
 /**
  * Called when the disconnect button is pressed.
  */
 public void OnDisconnectButtonTapped()
 {
     HideAll();
     CastRemoteDisplayManager.GetInstance().StopRemoteDisplaySession();
 }
 /**
  * Cleans up display when the session is over.
  */
 public void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager) {
   isCasting = false;
   castButtonFrame.ShowNotCasting();
 }
Exemplo n.º 43
0
 public void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager)
 {
     CloseLobby();
 }
 private void OnRemoteDisplaySessionEnd(CastRemoteDisplayManager manager)
 {
     backgroundImage.SetActive(false);
     playOnTvButton.SetActive(true);
 }