Exemplo n.º 1
0
        /**
         * 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.º 2
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);
    }
Exemplo n.º 3
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);
    }
Exemplo n.º 4
0
 public void OnCastDevicesUpdated(CastRemoteDisplayManager manager)
 {
     this.castDevices = manager.GetCastDevices();
 }
    /**
     * 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.º 6
0
 public void OnCastDevicesUpdated(CastRemoteDisplayManager manager)
 {
     this.castDevices = manager.GetCastDevices();
 }