void Start() { DeviceInfo info = GetComponentInParent <DeviceInfo>(); transform.localScale = new Vector3(info.ScreenHeight / 1000, info.ScreenWidth / 1000, 0.008f); transform.position = transform.position - Vector3.forward * 0.008f; controller = info.GetComponentInChildren <ViewRCameraController>(); if (controller != null) { controller.OnStartCamera.AddListener(StartStream); controller.OnStopStream.AddListener(StopStream); } r = screen.GetComponent <MeshRenderer>(); }
// Use this for initialization void Start() { button = GetComponent <UnityEngine.UI.Button>(); info = GetComponentInParent <DeviceInfo>(); if (info != null) { deviceId = info.DeviceId; } Input.RegisterTouchable(gameObject); controller = info.GetComponentInChildren <ViewRCameraController>(); controller.OnStartCamera.AddListener(OnStartStream); }
void OnClientConnected(DeviceInfo info, GameObject client) { GameObject cam = Instantiate(cameraObject); cam.transform.parent = client.transform; cam.name = cameraObject.name; ViewRCameraController controller = cam.GetComponent <ViewRCameraController>(); foreach (GameObject go in canvasObjects) { GameObject c = Instantiate(go); c.AddComponent <ViewRCanvas>().AttachListener(controller); c.transform.parent = client.transform; c.name = go.name; } }
public void AttachListener(ViewRCameraController controller) { controller.OnStartCamera.AddListener(OnStartStream); }