DebuggerComponent.SystemInformationWindow.cs 2.9 KB

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