DebuggerComponent.SystemInformationWindow.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //------------------------------------------------------------
  2. // Game Framework v3.x
  3. // Copyright © 2013-2017 Jiang Yin. All rights reserved.
  4. // Homepage: http://gameframework.cn/
  5. // Feedback: mailto:jiangyin@gameframework.cn
  6. //------------------------------------------------------------
  7. using UnityEngine;
  8. namespace UnityGameFramework.Runtime
  9. {
  10. public partial class DebuggerComponent
  11. {
  12. private sealed class SystemInformationWindow : ScrollableDebuggerWindowBase
  13. {
  14. protected override void OnDrawScrollableWindow()
  15. {
  16. GUILayout.Label("<b>System Information</b>");
  17. GUILayout.BeginVertical("box");
  18. {
  19. DrawItem("Device Unique ID:", SystemInfo.deviceUniqueIdentifier);
  20. DrawItem("Device Name:", SystemInfo.deviceName);
  21. DrawItem("Device Type:", SystemInfo.deviceType.ToString());
  22. DrawItem("Device Model:", SystemInfo.deviceModel);
  23. DrawItem("Processor Type:", SystemInfo.processorType);
  24. DrawItem("Processor Count:", SystemInfo.processorCount.ToString());
  25. DrawItem("Processor Frequency:", string.Format("{0} MHz", SystemInfo.processorFrequency.ToString()));
  26. DrawItem("Memory Size:", string.Format("{0} MB", SystemInfo.systemMemorySize.ToString()));
  27. #if UNITY_5_5_OR_NEWER
  28. DrawItem("Operating System Family:", SystemInfo.operatingSystemFamily.ToString());
  29. #endif
  30. DrawItem("Operating System:", SystemInfo.operatingSystem);
  31. #if UNITY_5_6_OR_NEWER
  32. DrawItem("Battery Status:", SystemInfo.batteryStatus.ToString());
  33. DrawItem("Battery Level:", GetBatteryLevelString(SystemInfo.batteryLevel));
  34. #endif
  35. #if UNITY_5_4_OR_NEWER
  36. DrawItem("Supports Audio:", SystemInfo.supportsAudio.ToString());
  37. #endif
  38. DrawItem("Supports Location Service:", SystemInfo.supportsLocationService.ToString());
  39. DrawItem("Supports Accelerometer:", SystemInfo.supportsAccelerometer.ToString());
  40. DrawItem("Supports Gyroscope:", SystemInfo.supportsGyroscope.ToString());
  41. DrawItem("Supports Vibration:", SystemInfo.supportsVibration.ToString());
  42. DrawItem("Genuine:", Application.genuine.ToString());
  43. DrawItem("Genuine Check Available:", Application.genuineCheckAvailable.ToString());
  44. }
  45. GUILayout.EndVertical();
  46. }
  47. private string GetBatteryLevelString(float batteryLevel)
  48. {
  49. if (batteryLevel < 0f)
  50. {
  51. return "Unavailable";
  52. }
  53. return batteryLevel.ToString("P0");
  54. }
  55. }
  56. }
  57. }