using XGame.Framework; using System; using UnityEditor; namespace XGame.Editor.Asset { public static class PlatformUtil { public static PlatformType ActivePlatform => BuildTargetToPlatformType(EditorUserBuildSettings.activeBuildTarget); public static PlatformType BuildTargetToPlatformType(BuildTarget target) { switch (target) { case BuildTarget.StandaloneOSX: return PlatformType.Mac; case BuildTarget.StandaloneWindows: case BuildTarget.StandaloneWindows64: return PlatformType.Windows; case BuildTarget.iOS: return PlatformType.iOS; case BuildTarget.Android: return PlatformType.Android; case BuildTarget.WeixinMiniGame: return PlatformType.Weixin; case BuildTarget.WebGL: return PlatformType.WebGL; default: throw new NotImplementedException(); } } } }