ScreenApapter.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. using UnityEngine;
  10. namespace NRKernal.NRExamples
  11. {
  12. public class ScreenApapter : MonoBehaviour
  13. {
  14. public enum ScreenType
  15. {
  16. Normal,
  17. LR3D
  18. }
  19. public ScreenType screenType = ScreenType.Normal;
  20. public GameObject normalScreen;
  21. public GameObject leftRightScreen;
  22. private VideoScreen m_Screen;
  23. private void Awake()
  24. {
  25. SetScreen();
  26. }
  27. public void SetScreen()
  28. {
  29. if (screenType == ScreenType.Normal)
  30. {
  31. normalScreen.SetActive(true);
  32. leftRightScreen.SetActive(false);
  33. m_Screen = new NormalScreen();
  34. m_Screen.SetScreen(normalScreen);
  35. }
  36. else
  37. {
  38. normalScreen.SetActive(false);
  39. leftRightScreen.SetActive(true);
  40. m_Screen = new LeftRightScreen();
  41. m_Screen.SetScreen(leftRightScreen);
  42. }
  43. }
  44. public void SetContent(Texture content)
  45. {
  46. m_Screen.SetContent(content);
  47. }
  48. }
  49. }