ShowSystemInfo.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using UnityEngine;
  2. using UnityEngine.SceneManagement;
  3. using UnityEngine.UI;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using OpenCVForUnity.CoreModule;
  7. using OpenCVForUnity.UnityUtils;
  8. namespace OpenCVForUnityExample
  9. {
  10. public class ShowSystemInfo : MonoBehaviour
  11. {
  12. public Text systemInfoText;
  13. public InputField systemInfoInputField;
  14. Dictionary<string, string> dicSystemInfo;
  15. // Use this for initialization
  16. void Start ()
  17. {
  18. dicSystemInfo = GetSystemInfo ();
  19. systemInfoText.text = systemInfoInputField.text = "### System Info ###" + "\n";
  20. Debug.Log ("### System Info ###");
  21. foreach (string key in dicSystemInfo.Keys) {
  22. systemInfoText.text = systemInfoInputField.text += key + " = " + dicSystemInfo [key] + "\n";
  23. Debug.Log (key + "=" + dicSystemInfo [key]);
  24. }
  25. systemInfoText.text = systemInfoInputField.text += "###################" + "\n";
  26. Debug.Log ("###################");
  27. }
  28. // Update is called once per frame
  29. void Update ()
  30. {
  31. }
  32. public Dictionary<string, string> GetSystemInfo ()
  33. {
  34. Dictionary<string, string> dicSystemInfo = new Dictionary<string, string> ();
  35. dicSystemInfo.Add ("OpenCVForUnity version", Core.NATIVE_LIBRARY_NAME + " " + Utils.getVersion () + " (" + Core.VERSION + ")");
  36. dicSystemInfo.Add ("Build Unity version", Application.unityVersion);
  37. #if UNITY_EDITOR
  38. dicSystemInfo.Add ("Build target", "Editor");
  39. #elif UNITY_STANDALONE_WIN
  40. dicSystemInfo.Add("Build target", "Windows");
  41. #elif UNITY_STANDALONE_OSX
  42. dicSystemInfo.Add("Build target", "Mac OSX");
  43. #elif UNITY_STANDALONE_LINUX
  44. dicSystemInfo.Add("Build target", "Linux");
  45. #elif UNITY_ANDROID
  46. dicSystemInfo.Add("Build target", "Android");
  47. #elif UNITY_IOS
  48. dicSystemInfo.Add("Build target", "iOS");
  49. #elif UNITY_WSA
  50. dicSystemInfo.Add("Build target", "WSA");
  51. #elif UNITY_WEBGL
  52. dicSystemInfo.Add("Build target", "WebGL");
  53. #else
  54. dicSystemInfo.Add("Build target", "");
  55. #endif
  56. #if ENABLE_MONO
  57. dicSystemInfo.Add ("Scripting backend", "Mono");
  58. #elif ENABLE_IL2CPP
  59. dicSystemInfo.Add("Scripting backend", "IL2CPP");
  60. #elif ENABLE_DOTNET
  61. dicSystemInfo.Add("Scripting backend", ".NET");
  62. #else
  63. dicSystemInfo.Add("Scripting backend", "");
  64. #endif
  65. dicSystemInfo.Add ("operatingSystem", SystemInfo.operatingSystem);
  66. #if UNITY_IOS
  67. #if UNITY_5_4_OR_NEWER
  68. dicSystemInfo.Add("iPhone.generation", UnityEngine.iOS.Device.generation.ToString());
  69. #else
  70. dicSystemInfo.Add("iPhone.generation", UnityEngine.iPhone.generation.ToString());
  71. #endif
  72. #else
  73. dicSystemInfo.Add ("iPhone.generation", "");
  74. #endif
  75. //dicSystemInfo.Add("deviceUniqueIdentifier", SystemInfo.deviceUniqueIdentifier);
  76. dicSystemInfo.Add ("deviceModel", SystemInfo.deviceModel);
  77. dicSystemInfo.Add ("deviceName", SystemInfo.deviceName);
  78. dicSystemInfo.Add ("deviceType", SystemInfo.deviceType.ToString ());
  79. dicSystemInfo.Add ("graphicsDeviceName", SystemInfo.graphicsDeviceName);
  80. dicSystemInfo.Add ("graphicsDeviceVendor", SystemInfo.graphicsDeviceVendor);
  81. dicSystemInfo.Add ("processorType", SystemInfo.processorType);
  82. dicSystemInfo.Add ("graphicsMemorySize", SystemInfo.graphicsMemorySize.ToString ());
  83. dicSystemInfo.Add ("systemMemorySize", SystemInfo.systemMemorySize.ToString ());
  84. dicSystemInfo.Add ("graphicsDeviceID", SystemInfo.graphicsDeviceID.ToString ());
  85. dicSystemInfo.Add ("graphicsDeviceType", SystemInfo.graphicsDeviceType.ToString ());
  86. dicSystemInfo.Add ("graphicsDeviceVendorID", SystemInfo.graphicsDeviceVendorID.ToString ());
  87. dicSystemInfo.Add ("graphicsDeviceVersion", SystemInfo.graphicsDeviceVersion);
  88. dicSystemInfo.Add ("graphicsMultiThreaded", SystemInfo.graphicsMultiThreaded.ToString ());
  89. dicSystemInfo.Add ("graphicsShaderLevel", SystemInfo.graphicsShaderLevel.ToString ());
  90. #if UNITY_5_4_OR_NEWER
  91. dicSystemInfo.Add ("copyTextureSupport", SystemInfo.copyTextureSupport.ToString ());
  92. #else
  93. dicSystemInfo.Add ("copyTextureSupport", "");
  94. #endif
  95. dicSystemInfo.Add ("supportsAccelerometer", SystemInfo.supportsAccelerometer.ToString ());
  96. dicSystemInfo.Add ("supportsGyroscope", SystemInfo.supportsGyroscope.ToString ());
  97. dicSystemInfo.Add ("supportsVibration", SystemInfo.supportsVibration.ToString ());
  98. dicSystemInfo.Add ("supportsLocationService", SystemInfo.supportsLocationService.ToString ());
  99. return dicSystemInfo;
  100. }
  101. public void OnBackButtonClick ()
  102. {
  103. SceneManager.LoadScene ("OpenCVForUnityExample");
  104. }
  105. }
  106. }