NxrMenu.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. 
  2. using System.IO;
  3. using UnityEditor;
  4. using UnityEngine;
  5. namespace Nxr.Internal
  6. {
  7. public class NxrMenu
  8. {
  9. [InitializeOnLoad]
  10. public class Startup
  11. {
  12. static Startup()
  13. {
  14. // 首次加载调用
  15. Debug.Log("NXR-Plugin-StartUp");
  16. NxrQualitySettingsEditor.InputManagerAssistant mInputManagerAssistant = new NxrQualitySettingsEditor.InputManagerAssistant();
  17. NxrQualitySettingsEditor.InputManagerAssistant.InputAxis axis3th = new NxrQualitySettingsEditor.InputManagerAssistant.InputAxis();
  18. axis3th.name = "3th axis";
  19. axis3th.type = NxrQualitySettingsEditor.InputManagerAssistant.AxisType.JoystickAxis;
  20. axis3th.axis = 3;
  21. mInputManagerAssistant.AddAxis(axis3th);
  22. axis3th.name = "4th axis";
  23. axis3th.type = NxrQualitySettingsEditor.InputManagerAssistant.AxisType.JoystickAxis;
  24. axis3th.axis = 4;
  25. mInputManagerAssistant.AddAxis(axis3th);
  26. axis3th.name = "5th axis";
  27. axis3th.type = NxrQualitySettingsEditor.InputManagerAssistant.AxisType.JoystickAxis;
  28. axis3th.axis = 5;
  29. mInputManagerAssistant.AddAxis(axis3th);
  30. axis3th.name = "6th axis";
  31. axis3th.type = NxrQualitySettingsEditor.InputManagerAssistant.AxisType.JoystickAxis;
  32. axis3th.axis = 6;
  33. mInputManagerAssistant.AddAxis(axis3th);
  34. axis3th.name = "joystick_Horizontal";
  35. axis3th.type = NxrQualitySettingsEditor.InputManagerAssistant.AxisType.JoystickAxis;
  36. axis3th.axis = 1;
  37. mInputManagerAssistant.AddAxis(axis3th);
  38. axis3th.name = "joystick_Vertical";
  39. axis3th.type = NxrQualitySettingsEditor.InputManagerAssistant.AxisType.JoystickAxis;
  40. axis3th.axis =2;
  41. mInputManagerAssistant.AddAxis(axis3th);
  42. }
  43. }
  44. [MenuItem("NibiruXR/About Nibiru XR", false, 200)]
  45. private static void OpenAbout()
  46. {
  47. EditorUtility.DisplayDialog("Nibiru XR SDK for Unity",
  48. "Version: " + NxrViewer.NXR_SDK_VERSION + "\n\n"
  49. + "QQ Group: 464811686. \n"
  50. + "Email: support@nibiruplayer.com. \n\n"
  51. + "Copyright: ©2020 Nibiru Inc. All rights reserved.\n"
  52. + "https://dev.inibiru.com",
  53. "OK");
  54. }
  55. // Add menu named "My Window" to the Window menu
  56. // [MenuItem("NibiruXR/SDK Repair", false, 88)]
  57. static void SDKSelfCheck()
  58. {
  59. string dirPath = Application.dataPath + "/Plugins/Android/";
  60. DirectoryInfo root = new DirectoryInfo(dirPath);
  61. FileInfo[] files = root.GetFiles();
  62. if (files == null) return;
  63. FileInfo deleteFileInfo = null;
  64. foreach(FileInfo fileInfo in files)
  65. {
  66. if (fileInfo != null && fileInfo.Extension.Equals(".jar"))
  67. {
  68. if (fileInfo.Name.Contains("nibiru_vr_pro_sdk_") && !fileInfo.Name.Contains("latest"))
  69. {
  70. deleteFileInfo = fileInfo;
  71. break;
  72. }
  73. }
  74. }
  75. if(deleteFileInfo != null)
  76. {
  77. File.Delete(deleteFileInfo.FullName);
  78. Debug.Log("[SDK Repair] Delete file." + deleteFileInfo.FullName);
  79. }
  80. }
  81. [MenuItem("NibiruXR/APK Encryption", false, 199)]
  82. public static void createApkEncryptionMenu()
  83. {
  84. NxrApkEncryptionEditor window = (NxrApkEncryptionEditor)EditorWindow.GetWindow(typeof(NxrApkEncryptionEditor), false, "Nibiru Apk Encryption");
  85. window.minSize = new Vector2(300, 60);
  86. window.Show();
  87. }
  88. [MenuItem("NibiruXR/SDK Verify", false, 199)]
  89. public static void createSDKVerifyMenu()
  90. {
  91. NxrSDKVerifyEditor window = (NxrSDKVerifyEditor)EditorWindow.GetWindow(typeof(NxrSDKVerifyEditor), false, "Nibiru SDK Verify");
  92. window.minSize = new Vector2(300, 60);
  93. window.Show();
  94. }
  95. }
  96. }