using UnityEngine; #if UNITY_IPHONE || UNITY_IOS using System.Runtime.InteropServices; #endif public abstract class SdkIosBase : SdkBase { #region Dll Interface #if UNITY_IPHONE || UNITY_IOS [DllImport("__Internal")] private static extern string GetChannelNative(); [DllImport("__Internal")] private static extern void LoginNative(bool isAuto); [DllImport("__Internal")] private static extern void LogoutNative(); [DllImport("__Internal")] private static extern void SwitchAccountNative(); [DllImport("__Internal")] protected static extern void PaymentNative(string payString); [DllImport("__Internal")] protected static extern void SubmitRoleNative(string roleString); #else private static string GetChannelNative() { return string.Empty; } private static void LoginNative(bool isAuto) { } private static void LogoutNative() { } private static void SwitchAccountNative() { } protected static void PaymentNative(string payString) { } protected static void SubmitRoleNative(string roleString) { } #endif #endregion public override bool useGm { get { return false; } } public override void Dispose() { } public static SdkBase CreateSdkLink() { SdkBase result; var channel = AssetUpdateManager.channel; if (channel == "Editor") result = new SdkEditor(); else if (channel.StartsWith("Test")) result = new SdkEmpty(); else if (channel.StartsWith("YuCheng")) result = new SdkIosYuCheng(); else if (channel.StartsWith("Traceless01")) result = new SdkIosTraceless01(); else if (channel.StartsWith("Traceless")) result = new SdkIosTraceless(); else { Debug.LogError(string.Format("Unable to handle channel {0}! Controller falls into default!", channel)); result = null; } return result; } public override void Logout() { LogoutNative(); } public override void LoginSdk(bool isAuto) { LoginNative(isAuto); } public override void SwitchAccount() { SwitchAccountNative(); } public override void ShakeDevice() { // 尚未处理手机震动功能 } public override void CloseGame() { // iOS不允许主动退出进程 } }