ProjectionCallback.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace EZXR.Glass.Projection
  6. {
  7. public class ProjectionCallback : AndroidJavaProxy
  8. {
  9. public event Action<int> callBack_OnStart;
  10. public event Action callBack_OnStop;
  11. public ProjectionCallback() : base("com.ezxr.glass.projectionlib.callback.ProjectionCallback")
  12. {
  13. }
  14. public ProjectionCallback(
  15. Action<int> callBack_OnStart,
  16. Action callBack_OnStop
  17. ) : base("com.ezxr.glass.projectionlib.callback.ProjectionCallback")
  18. {
  19. this.callBack_OnStart += callBack_OnStart;
  20. this.callBack_OnStop += callBack_OnStop;
  21. }
  22. /// <summary>
  23. /// 开始投屏或录屏 type: 0投屏 1录屏 2截屏
  24. /// </summary>
  25. /// <param name="type"></param>
  26. void onStart(int type)
  27. {
  28. Debug.Log("ProjectionCallback--> onStart: " + type);
  29. if (callBack_OnStart != null)
  30. {
  31. callBack_OnStart(type);
  32. }
  33. }
  34. /// <summary>
  35. /// 结束投屏或录屏
  36. /// </summary>
  37. void onStop()
  38. {
  39. Debug.Log("ProjectionCallback--> onStop");
  40. if (callBack_OnStop != null)
  41. {
  42. callBack_OnStop();
  43. }
  44. }
  45. }
  46. }