SceneHelper.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright 2016 Nibiru. All rights reserved.
  2. using UnityEngine;
  3. using UnityEngine.SceneManagement;
  4. using UnityEngine.UI;
  5. using Nxr.Internal;
  6. using NibiruTask;
  7. namespace NXR.Samples
  8. {
  9. public class SceneHelper : MonoBehaviour
  10. {
  11. TextMesh textMesh, distanceText;
  12. // Use this for initialization
  13. void Start()
  14. {
  15. GameObject disObj = GameObject.Find("ObjectDistance");
  16. if (disObj != null)
  17. {
  18. distanceText = disObj.GetComponent<TextMesh>();
  19. }
  20. GameObject frameIdObj = GameObject.Find("FrameIdText");
  21. if (frameIdObj != null)
  22. {
  23. textMesh = frameIdObj.GetComponent<TextMesh>();
  24. }
  25. }
  26. // Update is called once per frame
  27. void Update()
  28. {
  29. if (distanceText != null)
  30. {
  31. distanceText.text = "Distance : " + Nxr.Internal.NxrGlobal.focusObjectDistance;
  32. }
  33. if (textMesh != null)
  34. {
  35. textMesh.text = "FrameId: " + NxrViewer.Instance.GetFrameId();
  36. }
  37. }
  38. /// <summary>
  39. /// 暂不支持-------
  40. /// </summary>
  41. //public void GoSyncFrameScene()
  42. //{
  43. // NibiruKeyBoard.Instance.Dismiss();
  44. // SceneManager.LoadScene("SyncFrameScene");
  45. //}
  46. public void PointerEnter()
  47. {
  48. Debug.Log("pointer enter");
  49. }
  50. public void PointerExit()
  51. {
  52. Debug.Log("pointer exit");
  53. }
  54. public void ShowKeyBoard()
  55. {
  56. //
  57. Text text = GetComponentInParent<Text>();
  58. NibiruKeyBoard.Instance.SetText(text);
  59. // change keyboard postion or rotation
  60. NibiruKeyBoard.Instance.GetKeyBoardTransform();
  61. // get the input string
  62. NibiruKeyBoard.Instance.GetKeyBoardString();
  63. // show keyboard
  64. NibiruKeyBoard.Instance.Show(0, new Vector3(-0.5f, -2f, 5f), new Vector3(30, 0, 0));
  65. }
  66. }
  67. }