ScreenLocate.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using UnityEngine;
  5. using ZIM;
  6. /// <summary>
  7. /// JC-补充接口
  8. /// </summary>
  9. public partial class ScreenLocate : MonoBehaviour
  10. {
  11. public bool IsScreenLoateOK()
  12. {
  13. return screenIdentification != null &&
  14. screenIdentification.Screen != null &&
  15. screenIdentification.Screen.Active;
  16. }
  17. public bool IsScreenLocateManualDoing()
  18. {
  19. return mode == Mode.ScreenLocateManual;
  20. }
  21. public Texture2D EnterScreenLocateManual()
  22. {
  23. CreateUVCTexture2DIfNeeded();
  24. Texture2D texture = mUVCTexture2D.zimAutoLight(0);
  25. mode = Mode.ScreenLocateManual;
  26. return texture;
  27. }
  28. public void QuitScreenLocateManual(List<Vector2> points)
  29. {
  30. if (points != null && points.Count == 4)
  31. {
  32. screenIdentification?.LocateScreenManual(
  33. new OrdinalQuadrilateral(
  34. points[0].o0Vector(),
  35. points[1].o0Vector(),
  36. points[3].o0Vector(),
  37. points[2].o0Vector()
  38. )
  39. );
  40. }
  41. ToMode(Mode.InfraredLocate);
  42. }
  43. public void EnterScreenLocateManualAuto()
  44. {
  45. BtnScreenLocate();
  46. }
  47. public void SetCapture(int value)
  48. {
  49. Capture = value;
  50. }
  51. public void SetDelay(int value)
  52. {
  53. Delay = value;
  54. }
  55. }