NibiruVirtualMouse.cs 1008 B

123456789101112131415161718192021222324252627282930313233
  1. using UnityEngine;
  2. namespace Nxr.Internal
  3. {
  4. public class NibiruVirtualMouse : MonoBehaviour
  5. {
  6. NibiruService nibiruService;
  7. // Use this for initialization
  8. void Start()
  9. {
  10. nibiruService = NxrViewer.Instance.GetNibiruService();
  11. if (nibiruService != null)
  12. {
  13. nibiruService.RegisterVirtualMouseService(OnServiceConnected);
  14. }
  15. }
  16. void OnServiceConnected(bool succ)
  17. {
  18. // when service is connected, succ = true, call the api SetEnableVirtualMouse to show/dismiss virtual mouse;
  19. // nibiruService.SetEnableVirtualMouse(true);
  20. Debug.Log("------------VirtualMouse Service Connected : " + succ);
  21. }
  22. private void OnDestroy()
  23. {
  24. if (nibiruService != null)
  25. {
  26. nibiruService.UnRegisterVirtualMouseService();
  27. Debug.Log("NibiruVirtualMouse.OnDestroy");
  28. }
  29. }
  30. }
  31. }