ObserverViewNetWorker.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /****************************************************************************
  2. * Copyright 2019 Nreal Techonology Limited. All rights reserved.
  3. *
  4. * This file is part of NRSDK.
  5. *
  6. * https://www.nreal.ai/
  7. *
  8. *****************************************************************************/
  9. namespace NRKernal.Experimental.StreammingCast
  10. {
  11. using NRKernal.Experimental.NetWork;
  12. /// <summary> An observer view net worker. </summary>
  13. public class ObserverViewNetWorker : NetWorkBehaviour
  14. {
  15. /// <summary> The context. </summary>
  16. ObserverViewFrameCaptureContext m_Context;
  17. public ObserverViewNetWorker(ObserverViewFrameCaptureContext contex)
  18. {
  19. this.m_Context = contex;
  20. }
  21. public override void Listen()
  22. {
  23. base.Listen();
  24. m_NetWorkClient.OnCameraParamUpdate += OnCameraParamUpdate;
  25. }
  26. /// <summary> Executes the 'camera parameter update' action. </summary>
  27. /// <param name="param"> The parameter.</param>
  28. private void OnCameraParamUpdate(CameraParam param)
  29. {
  30. if (this.m_Context == null)
  31. {
  32. return;
  33. }
  34. this.m_Context.GetBehaviour().UpdateCameraParam(param.fov);
  35. }
  36. }
  37. }