PicoGs.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*******************************************************************************
  2. Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
  3. NOTICE:All information contained herein is, and remains the property of
  4. PICO Technology Co., Ltd. The intellectual and technical concepts
  5. contained herein are proprietary to PICO Technology Co., Ltd. and may be
  6. covered by patents, patents in process, and are protected by trade secret or
  7. copyright law. Dissemination of this information or reproduction of this
  8. material is strictly forbidden unless prior written permission is obtained from
  9. PICO Technology Co., Ltd.
  10. *******************************************************************************/
  11. using System.Collections.Generic;
  12. using Unity.XR.PXR;
  13. using UnityEditor;
  14. using UnityEditor.XR.Management;
  15. using UnityEditor.XR.Management.Metadata;
  16. using UnityEngine;
  17. using UnityEngine.XR.Management;
  18. namespace Pico.Platform.Editor
  19. {
  20. public class PicoGs
  21. {
  22. public static string appId
  23. {
  24. get { return PXR_PlatformSetting.Instance.appID; }
  25. set
  26. {
  27. PXR_PlatformSetting.Instance.appID = value;
  28. EditorUtility.SetDirty(PXR_PlatformSetting.Instance);
  29. }
  30. }
  31. public static bool useHighlight
  32. {
  33. get { return PXR_PlatformSetting.Instance.useHighlight; }
  34. set
  35. {
  36. PXR_PlatformSetting.Instance.useHighlight = value;
  37. EditorUtility.SetDirty(PXR_PlatformSetting.Instance);
  38. }
  39. }
  40. public static bool enableEntitlementCheck
  41. {
  42. get { return PXR_PlatformSetting.Instance.entitlementCheckSimulation; }
  43. set
  44. {
  45. PXR_PlatformSetting.Instance.entitlementCheckSimulation = value;
  46. EditorUtility.SetDirty(PXR_PlatformSetting.Instance);
  47. }
  48. }
  49. public static List<string> entitlementCheckDeviceList
  50. {
  51. get { return PXR_PlatformSetting.Instance.deviceSN; }
  52. set { PXR_PlatformSetting.Instance.deviceSN = value; }
  53. }
  54. #if USING_XR_SDK_PICO
  55. static XRManagerSettings GetXrSettings()
  56. {
  57. XRGeneralSettings generalSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(BuildTargetGroup.Android);
  58. if (generalSettings == null) return null;
  59. var assignedSettings = generalSettings.AssignedSettings;
  60. return assignedSettings;
  61. }
  62. static PXR_Loader GetPxrLoader()
  63. {
  64. var x = GetXrSettings();
  65. if (x == null) return null;
  66. foreach (var i in x.activeLoaders)
  67. {
  68. if (i is PXR_Loader)
  69. {
  70. return i as PXR_Loader;
  71. }
  72. }
  73. return null;
  74. }
  75. public static bool UsePicoXr
  76. {
  77. get { return GetPxrLoader() != null; }
  78. set
  79. {
  80. var x = GetXrSettings();
  81. if (x == null) return;
  82. var loader = GetPxrLoader();
  83. if (value == false)
  84. {
  85. if (loader == null)
  86. {
  87. }
  88. else
  89. {
  90. x.TryRemoveLoader(loader);
  91. }
  92. }
  93. else
  94. {
  95. if (loader == null)
  96. {
  97. var res = XRPackageMetadataStore.AssignLoader(x, nameof(PXR_Loader), BuildTargetGroup.Android);
  98. Debug.Log($"设置XR{res} {value}");
  99. }
  100. else
  101. {
  102. }
  103. }
  104. }
  105. }
  106. #endif
  107. }
  108. }
粤ICP备19079148号