PXR_PlatformSettingEditor.cs 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 Unity.XR.PXR;
  12. using UnityEditor;
  13. using UnityEngine;
  14. namespace Pico.Platform.Editor
  15. {
  16. [CustomEditor(typeof(PXR_PlatformSetting))]
  17. public class PXR_PlatformSettingEditor : UnityEditor.Editor
  18. {
  19. private SerializedProperty deviceSNList;
  20. private void OnEnable()
  21. {
  22. deviceSNList = serializedObject.FindProperty("deviceSN");
  23. }
  24. public override void OnInspectorGUI()
  25. {
  26. var startEntitleCheckTip = "If selected, you will need to enter the APPID that is obtained from" +
  27. " PICO Developer Platform after uploading the app for an entitlement check upon the app launch.";
  28. var startEntitleCheckLabel = new GUIContent("User Entitlement Check[?]", startEntitleCheckTip);
  29. PXR_PlatformSetting.Instance.startTimeEntitlementCheck =
  30. EditorGUILayout.Toggle(startEntitleCheckLabel, PXR_PlatformSetting.Instance.startTimeEntitlementCheck);
  31. if (PXR_PlatformSetting.Instance.startTimeEntitlementCheck)
  32. {
  33. serializedObject.Update();
  34. EditorGUILayout.BeginHorizontal();
  35. GUILayout.Label("App ID ", GUILayout.Width(100));
  36. EditorGUILayout.EndHorizontal();
  37. EditorGUILayout.BeginHorizontal();
  38. PXR_PlatformSetting.Instance.appID =
  39. EditorGUILayout.TextField(PXR_PlatformSetting.Instance.appID, GUILayout.Width(350.0f));
  40. EditorGUILayout.EndHorizontal();
  41. if (PXR_PlatformSetting.Instance.appID == "")
  42. {
  43. EditorGUILayout.BeginHorizontal(GUILayout.Width(300));
  44. EditorGUILayout.HelpBox("APPID is required for Entitlement Check", UnityEditor.MessageType.Error, true);
  45. EditorGUILayout.EndHorizontal();
  46. }
  47. EditorGUILayout.BeginHorizontal();
  48. GUILayout.Label("The APPID is required to run an Entitlement Check. Create / Find your APPID Here:", GUILayout.Width(500));
  49. EditorGUILayout.EndHorizontal();
  50. EditorGUILayout.BeginHorizontal();
  51. GUIStyle style = new GUIStyle();
  52. style.normal.textColor = new Color(0, 122f / 255f, 204f / 255f);
  53. if (GUILayout.Button("" + "https://developer.pico-interactive.com/developer/overview", style,
  54. GUILayout.Width(200)))
  55. {
  56. Application.OpenURL("https://developer.pico-interactive.com/developer/overview");
  57. }
  58. EditorGUILayout.EndHorizontal();
  59. EditorGUILayout.BeginHorizontal();
  60. GUILayout.Label("If you do not need user Entitlement Check, please uncheck it.", GUILayout.Width(500));
  61. EditorGUILayout.EndHorizontal();
  62. serializedObject.ApplyModifiedProperties();
  63. var simulationTip = "If true,Development devices will simulate Entitlement Check," +
  64. "you should enter a valid device SN codes list." +
  65. "The SN code can be obtain in Settings-General-Device serial number or input \"adb devices\" in cmd";
  66. var simulationLabel = new GUIContent("Entitlement Check Simulation [?]", simulationTip);
  67. PXR_PlatformSetting.Instance.entitlementCheckSimulation = EditorGUILayout.Toggle(simulationLabel, PXR_PlatformSetting.Instance.entitlementCheckSimulation);
  68. if (PXR_PlatformSetting.Instance.entitlementCheckSimulation)
  69. {
  70. serializedObject.Update();
  71. EditorGUILayout.PropertyField(deviceSNList, true);
  72. serializedObject.ApplyModifiedProperties();
  73. }
  74. if (GUI.changed)
  75. {
  76. EditorUtility.SetDirty(PXR_PlatformSetting.Instance);
  77. GUI.changed = false;
  78. }
  79. }
  80. }
  81. }
  82. }