PlatformUtil.cs 927 B

1234567891011121314151617181920212223242526272829
  1. using XGame.Framework;
  2. using System;
  3. using UnityEditor;
  4. namespace XGame.Editor.Asset
  5. {
  6. public static class PlatformUtil
  7. {
  8. public static PlatformType ActivePlatform => BuildTargetToPlatformType(EditorUserBuildSettings.activeBuildTarget);
  9. public static PlatformType BuildTargetToPlatformType(BuildTarget target)
  10. {
  11. switch (target)
  12. {
  13. case BuildTarget.StandaloneOSX:
  14. return PlatformType.Mac;
  15. case BuildTarget.StandaloneWindows:
  16. case BuildTarget.StandaloneWindows64:
  17. return PlatformType.Windows;
  18. case BuildTarget.iOS:
  19. return PlatformType.iOS;
  20. case BuildTarget.Android:
  21. return PlatformType.Android;
  22. default:
  23. throw new NotImplementedException();
  24. }
  25. }
  26. }
  27. }