예제 #1
0
    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);
        }
예제 #3
0
 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);
        }
예제 #5
0
        /**
         * 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);
        }
예제 #7
0
 void Update()
 {
     if (playerHealth.currentHealth <= 0)
     {
         GetComponent <Animator>().SetTrigger("GameOver");
         if (CastRemoteDisplayManager.GetInstance().IsCasting())
         {
             gameOverButtonCanvas.SetActive(true);
             gameOverButtonCanvas.GetComponent <Animator>()
             .SetTrigger("GameOver");
         }
     }
 }
예제 #8
0
 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);
     }
 }
예제 #9
0
파일: Lobby.cs 프로젝트: RUGSoftEng/Team-7
    public void CloseLobby()
    {
        CastRemoteDisplayManager castDisplayManager = CastRemoteDisplayManager.GetInstance();

        if (castDisplayManager.IsCasting())
        {
            castDisplayManager.StopRemoteDisplaySession();
        }
        gameNetworkManager.StopHost();
        LocalGameFinder localGameFinder = GameObject.FindObjectOfType <LocalGameFinder>();

        localGameFinder.StopBroadCasting();
        SceneManager.LoadScene("MainMenuScene");
    }
예제 #10
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);
    }
예제 #11
0
        /**
         * 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();
        }
예제 #12
0
 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);
     }
 }
예제 #13
0
파일: Lobby.cs 프로젝트: RUGSoftEng/Team-7
    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");
    }
예제 #14
0
 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);
         }
     }
 }
예제 #15
0
    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");
    }
예제 #16
0
    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 );
         *
         * }*/
    }
예제 #17
0
 // Update is called once per frame
 void Update()
 {
     GetComponent <Text>().text = "Casting: " + CastRemoteDisplayManager.GetInstance().IsCasting() + "\nCast App Id: " + CastRemoteDisplayManager.GetInstance().CastAppId;
 }
예제 #18
0
 public void OnLevelWasLoaded(int level)
 {
     CastRemoteDisplayManager.GetInstance().RemoteDisplayCamera = FindCastCamera();
 }
예제 #19
0
 /**
  * Called when the volume slider is changed - passes volume changes along to the Cast device.
  */
 public void OnVolumeSet()
 {
     CastRemoteDisplayManager.GetInstance().SetCastVolume(volumeSlider.value);
 }
예제 #20
0
 /**
  * Called when the disconnect button is pressed.
  */
 public void OnDisconnectButtonTapped()
 {
     HideAll();
     CastRemoteDisplayManager.GetInstance().StopRemoteDisplaySession();
 }
예제 #21
0
 /**
  * Set the cast device name for the dialog title.
  */
 public void Setup(string name)
 {
     deviceName.text    = name;
     volumeSlider.value = CastRemoteDisplayManager.GetInstance().GetCastVolume();
 }