ShowInfoTipManager.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using TMPro;
  4. using UnityEngine;
  5. public class ShowInfoTipManager : MonoSingleton<ShowInfoTipManager>
  6. {
  7. public GameObject go;
  8. public TextMeshProUGUI text;
  9. public void showTip(string msg,bool isHead=true)
  10. {
  11. if(!isHead)
  12. {
  13. if (WindowsManager.Instance.tipInfoGameObject != null && GSXR_Transform.position != null)
  14. {
  15. WindowsManager.Instance.tipInfoGameObject.transform.parent = GSXR_Transform;
  16. WindowsManager.Instance.tipInfoGameObject.transform.position = GSXR_Transform.position;
  17. WindowsManager.Instance.tipInfoGameObject.transform.LookAt(OpenXRCamera.Instance.head);
  18. }
  19. }
  20. else
  21. {
  22. if (WindowsManager.Instance.tipInfoGameObject != null && GSXR_Transform.position != null)
  23. {
  24. WindowsManager.Instance.tipInfoGameObject.transform.parent = OpenXRCamera.Instance.head;
  25. WindowsManager.Instance.tipInfoGameObject.transform.localPosition = new Vector3(0, 0, 1.5f);
  26. WindowsManager.Instance.tipInfoGameObject.transform.localEulerAngles = new Vector3(0,180,0);
  27. // WindowsManager.Instance.tipInfoGameObject.transform.LookAt(OpenXRCamera.Instance.head);
  28. }
  29. }
  30. go.gameObject.SetActive(true);
  31. text.text = msg;
  32. }
  33. ///API-No.61
  34. /// <summary>
  35. /// 输入设备Cursor的位置,优先级为Head/BTRight/BTLeft/GTRight/GTLeft/GGTRight/GGLeft
  36. /// </summary>
  37. public static Transform GSXR_Transform
  38. {
  39. get
  40. {
  41. if (API_GSXR_Module_InputSystem_Head.GSXR_Head != null)
  42. {
  43. return API_GSXR_Module_InputSystem_Head.GSXR_Get_HeadCursor.transform;
  44. }
  45. else if (API_GSXR_Module_InputSystem_BT3Dof.GSXR_BTRight != null)
  46. {
  47. return API_GSXR_Module_InputSystem_BT3Dof.GSXR_Get_BTCursor(API_GSXR_Module_InputSystem_BT3Dof.BTType.Right).transform;
  48. }
  49. else if (API_GSXR_Module_InputSystem_BT3Dof.GSXR_BTLeft != null)
  50. {
  51. return API_GSXR_Module_InputSystem_BT3Dof.GSXR_Get_BTCursor(API_GSXR_Module_InputSystem_BT3Dof.BTType.Left).transform;
  52. }
  53. else if (API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTRight != null)
  54. {
  55. return API_GSXR_Module_InputSystem_GGT26Dof.GSXR_Get_GGTCursor(API_GSXR_Module_InputSystem_GGT26Dof.GGestureType.Right).transform;
  56. }
  57. else if (API_GSXR_Module_InputSystem_GGT26Dof.GSXR_GGTLeft != null)
  58. {
  59. return API_GSXR_Module_InputSystem_GGT26Dof.GSXR_Get_GGTCursor(API_GSXR_Module_InputSystem_GGT26Dof.GGestureType.Left).transform;
  60. }
  61. else if (API_GSXR_Module_InputSystem_KS.GSXR_KSRight != null)
  62. {
  63. return API_GSXR_Module_InputSystem_KS.GSXR_Get_KSCursor(API_GSXR_Module_InputSystem_KS.GCType.Right).transform;
  64. }
  65. else if (API_GSXR_Module_InputSystem_KS.GSXR_KSLeft != null)
  66. {
  67. return API_GSXR_Module_InputSystem_KS.GSXR_Get_KSCursor(API_GSXR_Module_InputSystem_KS.GCType.Left).transform;
  68. }
  69. return null;
  70. }
  71. }
  72. public void closeTip()
  73. {
  74. go.gameObject.SetActive(false);
  75. }
  76. }