using UnityEngine; namespace AlicizaX { /// /// 应用帮助类 /// [UnityEngine.Scripting.Preserve] public static class ApplicationHelper { /// /// 是否是编辑器 /// [UnityEngine.Scripting.Preserve] public static bool IsEditor { get { #if UNITY_EDITOR return true; #else return false; #endif } } /// /// 是否是安卓 /// [UnityEngine.Scripting.Preserve] public static bool IsAndroid { get { #if UNITY_ANDROID return true; #else return false; #endif } } /// /// 是否是WebGL平台 /// [UnityEngine.Scripting.Preserve] public static bool IsWebGL { get { return Application.platform == RuntimePlatform.WebGLPlayer; } } /// /// 是否是Windows平台 /// [UnityEngine.Scripting.Preserve] public static bool IsWindows { get { return Application.platform == RuntimePlatform.WindowsPlayer; } } /// /// 是否是Linux平台 /// [UnityEngine.Scripting.Preserve] public static bool IsLinux { get { return Application.platform == RuntimePlatform.LinuxPlayer; } } /// /// 是否是Mac平台 /// [UnityEngine.Scripting.Preserve] public static bool IsMacOsx { get { return Application.platform == RuntimePlatform.OSXPlayer; } } /// /// 是否是iOS 移动平台 /// [UnityEngine.Scripting.Preserve] public static bool IsIOS { get { #if UNITY_IOS return true; #else return false; #endif } } /// /// 退出 /// public static void Quit() { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; return; #endif Application.Quit(); } #if UNITY_IOS [System.Runtime.InteropServices.DllImport("__Internal")] private static extern void open_url(string url); #endif /// /// 打开URL /// /// url地址 public static void OpenURL(string url) { #if UNITY_EDITOR Application.OpenURL(url); return; #endif #if UNITY_IOS open_url(url); #else Application.OpenURL(url); #endif } } }