/// <summary>
    /// 是否推荐游玩,iOS内存小于1G不推荐; 安卓不做判读
    /// </summary>
    /// <returns></returns>
    public static bool IsRecommendPlay()
    {
#if UNITY_IPHONE && !UNITY_EDITOR
        DeviceGeneration generation = Device.generation;

        switch (generation)
        {
        case DeviceGeneration.iPadAir2:
        case DeviceGeneration.iPhone6S:
        case DeviceGeneration.iPhone6SPlus:
        case DeviceGeneration.iPadPro1Gen:
        case DeviceGeneration.iPadMini4Gen:
        case DeviceGeneration.iPadPro10Inch1Gen:
        case DeviceGeneration.iPhone7:
        case DeviceGeneration.iPhone7Plus:
        case DeviceGeneration.iPhoneSE1Gen:
        case DeviceGeneration.iPhoneUnknown:
        case DeviceGeneration.iPadUnknown:
            return(true);

        default:
            return(false);
        }
#endif
        return(true);
    }
Example #2
0
        /// <summary>
        /// This methods tests the current device generation against a list of devices that don't support haptics, and returns true if haptics are supported, false otherwise.
        /// </summary>
        /// <returns><c>true</c>, if supported was hapticsed, <c>false</c> otherwise.</returns>
        public static bool HapticsSupported()
        {
            bool hapticsSupported = false;

#if UNITY_IOS
            DeviceGeneration generation = Device.generation;
            if ((generation == DeviceGeneration.iPhone3G) ||
                (generation == DeviceGeneration.iPhone3GS) ||
                (generation == DeviceGeneration.iPodTouch1Gen) ||
                (generation == DeviceGeneration.iPodTouch2Gen) ||
                (generation == DeviceGeneration.iPodTouch3Gen) ||
                (generation == DeviceGeneration.iPodTouch4Gen) ||
                (generation == DeviceGeneration.iPhone4) ||
                (generation == DeviceGeneration.iPhone4S) ||
                (generation == DeviceGeneration.iPhone5) ||
                (generation == DeviceGeneration.iPhone5C) ||
                (generation == DeviceGeneration.iPhone5S) ||
                (generation == DeviceGeneration.iPhone6) ||
                (generation == DeviceGeneration.iPhone6Plus) ||
                (generation == DeviceGeneration.iPhone6S) ||
                (generation == DeviceGeneration.iPhone6SPlus) ||
                (generation == DeviceGeneration.iPhoneSE1Gen) ||
                (generation == DeviceGeneration.iPad1Gen) ||
                (generation == DeviceGeneration.iPad2Gen) ||
                (generation == DeviceGeneration.iPad3Gen) ||
                (generation == DeviceGeneration.iPad4Gen) ||
                (generation == DeviceGeneration.iPad5Gen) ||
                (generation == DeviceGeneration.iPadAir1) ||
                (generation == DeviceGeneration.iPadAir2) ||
                (generation == DeviceGeneration.iPadMini1Gen) ||
                (generation == DeviceGeneration.iPadMini2Gen) ||
                (generation == DeviceGeneration.iPadMini3Gen) ||
                (generation == DeviceGeneration.iPadMini4Gen) ||
                (generation == DeviceGeneration.iPadPro10Inch1Gen) ||
                (generation == DeviceGeneration.iPadPro10Inch2Gen) ||
                (generation == DeviceGeneration.iPadPro11Inch) ||
                (generation == DeviceGeneration.iPadPro1Gen) ||
                (generation == DeviceGeneration.iPadPro2Gen) ||
                (generation == DeviceGeneration.iPadPro3Gen) ||
                (generation == DeviceGeneration.iPadUnknown) ||
                (generation == DeviceGeneration.iPodTouch1Gen) ||
                (generation == DeviceGeneration.iPodTouch2Gen) ||
                (generation == DeviceGeneration.iPodTouch3Gen) ||
                (generation == DeviceGeneration.iPodTouch4Gen) ||
                (generation == DeviceGeneration.iPodTouch5Gen) ||
                (generation == DeviceGeneration.iPodTouch6Gen) ||
                (generation == DeviceGeneration.iPhone6SPlus))
            {
                hapticsSupported = false;
            }
            else
            {
                hapticsSupported = true;
            }
#endif

            return(hapticsSupported);
        }
Example #3
0
    //获取设备型号
    public static string GetDeviceModel()
    {
#if UNITY_ANDROID || UNITY_STANDALONE_WIN || UNITY_EDITOR
        return(SystemInfo.deviceModel);
#else
        //iOS写法
        DeviceGeneration dg = Device.generation;
        return(dg.ToString());
#endif
    }
Example #4
0
        private static bool IsLowEndiOS()
        {
            DeviceGeneration device = Device.generation;

            // Devices older than iPad Mini 1st gen, except iPhone 5 are
            // considered low end.
            // See the full list of iOS devices here:
            // https://github.com/Unity-Technologies/UnityCsReference/blob/3cfc6c4729d5cacedf67a38df5de1bfffb5994a3/Runtime/Export/iOS/iOSDevice.bindings.cs
            return(device != DeviceGeneration.iPhone5 && (int)device <= 15);
        }
Example #5
0
    static public void SetQualitySetting()
    {
#if UNITY_IOS
        DeviceGeneration iOSGen = Device.generation;

        switch (iOSGen)
        {
        // ipad
        case DeviceGeneration.iPad1Gen:
        case DeviceGeneration.iPad2Gen:
        case DeviceGeneration.iPad3Gen:
        case DeviceGeneration.iPad4Gen:
        case DeviceGeneration.iPadAir1:
        case DeviceGeneration.iPadAir2:
        case DeviceGeneration.iPadMini1Gen:
        case DeviceGeneration.iPadMini2Gen:
        case DeviceGeneration.iPadMini3Gen:
        case DeviceGeneration.iPadMini4Gen:
        case DeviceGeneration.iPadPro1Gen:
        case DeviceGeneration.iPadUnknown:

        // iphone
        case DeviceGeneration.iPhone:
        case DeviceGeneration.iPhone3G:
        case DeviceGeneration.iPhone3GS:
        case DeviceGeneration.iPhone4:
        case DeviceGeneration.iPhone4S:
        case DeviceGeneration.iPhone5:
        case DeviceGeneration.iPhone5C:
        case DeviceGeneration.iPhone5S:
        case DeviceGeneration.iPhone6:
        case DeviceGeneration.iPhone6Plus:
        case DeviceGeneration.iPhone6S:
        case DeviceGeneration.iPhone6SPlus:
        case DeviceGeneration.iPhoneUnknown:
        // touch
        case DeviceGeneration.iPodTouch1Gen:
        case DeviceGeneration.iPodTouch2Gen:
        case DeviceGeneration.iPodTouch3Gen:
        case DeviceGeneration.iPodTouch4Gen:
        case DeviceGeneration.iPodTouch5Gen:
        case DeviceGeneration.iPodTouchUnknown:

        // unknow
        case DeviceGeneration.Unknown:
            IsLowDevices = false;
            break;
        }
#elif UNITY_ANDROID
#endif

//		QualitySettings.SetQualityLevel (IsLowDevices ? 0 : 1);
    }
    public void RetrievePlatformInfo()
    {
        //Get and Store the platform
        platform = Application.platform;
        //We need to also store the iOS stuff, we should also consider doing something
        //broadly similar for Android
#if UNITY_IPHONE
        if (platform == RuntimePlatform.IPhonePlayer)
        {
            iOSDevice = Device.generation;
        }
#endif
    }
    public static Performance GetDetectedPerformanceLevel()
    {
#if UNITY_EDITOR
        return(Performance.Fantastic);
#endif

#if UNITY_IPHONE
        DeviceGeneration generation = Device.generation;

        switch (generation)
        {
        case DeviceGeneration.iPhone:
        case DeviceGeneration.iPodTouch1Gen:
        case DeviceGeneration.iPodTouch2Gen:
        case DeviceGeneration.iPhone3G:
        case DeviceGeneration.iPhone3GS:
        case DeviceGeneration.iPodTouch3Gen:
        case DeviceGeneration.iPad1Gen:
            return(Performance.Fastest);

        case DeviceGeneration.iPhone4:
        case DeviceGeneration.iPodTouch4Gen:
            return(Performance.Fast);

        case DeviceGeneration.iPad2Gen:
        case DeviceGeneration.iPhone4S:
        case DeviceGeneration.iPad3Gen:
        case DeviceGeneration.iPodTouch5Gen:
        case DeviceGeneration.iPadMini1Gen:
            return(Performance.Good);

        case DeviceGeneration.iPhone5:
        case DeviceGeneration.iPhone5C:
        case DeviceGeneration.iPhone5S:
        case DeviceGeneration.iPad4Gen:
        case DeviceGeneration.iPad5Gen:
        case DeviceGeneration.iPadMini2Gen:
        case DeviceGeneration.iPhone6:
        case DeviceGeneration.iPhone6Plus:
        case DeviceGeneration.iPadMini3Gen:
        case DeviceGeneration.iPadAir2:
            return(Performance.Beautiful);

        default:
            return(Performance.Beautiful);
        }
#elif UNITY_ANDROID
        if (SystemInfo.supportedRenderTargetCount > 1 || SystemInfo.supportsInstancing)
        {
            return(Performance.Beautiful);
        }
        else if (SystemInfo.supportsStencil <= 0 || !SystemInfo.supportsImageEffects || !SystemInfo.supportsRenderTextures || SystemInfo.graphicsShaderLevel <= 20 ||
                 !SystemInfo.supportsVertexPrograms)
        {
            return(Performance.Fastest);
        }
        else if (SystemInfo.systemMemorySize <= 512 || SystemInfo.graphicsMemorySize < 128 || SystemInfo.processorCount <= 2 || SystemInfo.maxTextureSize <= 2048)
        {
            return(Performance.Fast);
        }
        else if (SystemInfo.systemMemorySize <= 1024)
        {
            return(Performance.Simple);
        }
        else if (SystemInfo.systemMemorySize <= 2048 || SystemInfo.processorCount <= 4)
        {
            return(Performance.Good);
        }
        else
        {
            return(Performance.Beautiful);
        }
#elif UNITY_STANDALONE
        if (SystemInfo.graphicsShaderLevel >= 30 && SystemInfo.processorCount >= 2 && SystemInfo.graphicsMemorySize >= 512 && SystemInfo.systemMemorySize >= 4096)
        {
            return(Performance.Beautiful);
        }
        else if (SystemInfo.graphicsMemorySize >= 256 && SystemInfo.systemMemorySize >= 2048)
        {
            return(Performance.Good);
        }
        else if (SystemInfo.graphicsMemorySize >= 128 && SystemInfo.systemMemorySize >= 1024)
        {
            return(Performance.Simple);
        }
        else
        {
            return(Performance.Fast);
        }
#else
        return(Performance.Fast);
#endif
    }
Example #8
0
        private void ParseModelNumber(string modelString, out DeviceModel model, out DeviceGeneration generation)
        {
            switch (modelString)
            {
            case "M8513":
            case "M8541":
            case "M8697":
            case "M8709":
                model      = DeviceModel.Regular;
                generation = DeviceGeneration.First;
                break;

            case "M8737":
            case "M8740":
            case "M8738":
            case "M8741":
                model      = DeviceModel.Regular;
                generation = DeviceGeneration.Second;
                break;

            case "M8976":
            case "M8946":
            case "M9460":
            case "M9244":
            case "M8948":
            case "M9245":
                model      = DeviceModel.Regular;
                generation = DeviceGeneration.Third;
                break;

            case "M9282":
            case "M9787":
            case "M9268":
            case "MA079":
            case "MA127":
            case "ME436":     //HP iPod
                model      = DeviceModel.Regular;
                generation = DeviceGeneration.Fourth;
                break;

            case "M9160":
                model      = DeviceModel.Mini;
                generation = DeviceGeneration.First;
                break;

            case "M9436":
                model      = DeviceModel.MiniBlue;
                generation = DeviceGeneration.First;
                break;

            case "M9435":
                model      = DeviceModel.MiniPink;
                generation = DeviceGeneration.First;
                break;

            case "M9434":
                model      = DeviceModel.MiniGreen;
                generation = DeviceGeneration.First;
                break;

            case "M9437":
                model      = DeviceModel.MiniGold;
                generation = DeviceGeneration.First;
                break;

            case "M9800":
            case "M9801":
                model      = DeviceModel.Mini;
                generation = DeviceGeneration.Second;
                break;

            case "M9802":
            case "M9803":
                model      = DeviceModel.MiniBlue;
                generation = DeviceGeneration.Second;
                break;

            case "M9804":
            case "M9805":
                model      = DeviceModel.MiniPink;
                generation = DeviceGeneration.Second;
                break;

            case "M9806":
            case "M9807":
                model      = DeviceModel.MiniGreen;
                generation = DeviceGeneration.Second;
                break;

            case "M9829":
            case "M9585":
            case "M9586":
            case "M9830":
                model      = DeviceModel.Color;
                generation = DeviceGeneration.Fourth;
                break;

            case "M9724":
            case "M9725":
                model      = DeviceModel.Shuffle;
                generation = DeviceGeneration.First;
                break;

            case "MA546":
                model      = DeviceModel.ShuffleSilver;
                generation = DeviceGeneration.Second;
                break;

            case "MA947":
                model      = DeviceModel.ShufflePink;
                generation = DeviceGeneration.Second;
                break;

            case "MA949":
                model      = DeviceModel.ShuffleBlue;
                generation = DeviceGeneration.Second;
                break;

            case "MA951":
                model      = DeviceModel.ShuffleGreen;
                generation = DeviceGeneration.Second;
                break;

            case "MA953":
                model      = DeviceModel.ShuffleOrange;
                generation = DeviceGeneration.Second;
                break;

            case "MA350":
            case "MA004":
            case "MA005":
                model      = DeviceModel.NanoWhite;
                generation = DeviceGeneration.First;
                break;

            case "MA352":
            case "MA009":
            case "MA107":
                model      = DeviceModel.NanoBlack;
                generation = DeviceGeneration.First;
                break;

            case "MA477":
            case "MA426":
                model      = DeviceModel.NanoSilver;
                generation = DeviceGeneration.Second;
                break;

            case "MA428":
                model      = DeviceModel.NanoBlue;
                generation = DeviceGeneration.Second;
                break;

            case "MA487":
                model      = DeviceModel.NanoGreen;
                generation = DeviceGeneration.Second;
                break;

            case "MA489":
                model      = DeviceModel.NanoPink;
                generation = DeviceGeneration.Second;
                break;

            case "MA725":
            case "MA726":
                model      = DeviceModel.NanoProductRed;
                generation = DeviceGeneration.Second;
                break;

            case "MA497":
                model      = DeviceModel.NanoBlack;
                generation = DeviceGeneration.Second;
                break;

            case "MA002":
            case "MA003":
            case "MA444":
                model      = DeviceModel.VideoWhite;
                generation = DeviceGeneration.Fifth;
                break;

            case "MA146":
            case "MA147":
            case "MA448":
            case "MA450":     /* Possibly Video U2? */
            case "MA446":     /* Video U2 */
                model      = DeviceModel.VideoBlack;
                generation = DeviceGeneration.Fifth;
                break;

            default:
                model      = DeviceModel.Unknown;
                generation = DeviceGeneration.Unknown;
                break;
            }
        }
Example #9
0
 private void ParseModelNumber(string modelString, out DeviceModel model, out DeviceGeneration generation)
 {
     switch (modelString)
     {
         case "M8513":
         case "M8541":
         case "M8697":
         case "M8709":
             model = DeviceModel.Regular;
             generation = DeviceGeneration.First;
             break;
         case "M8737":
         case "M8740":
         case "M8738":
         case "M8741":
             model = DeviceModel.Regular;
             generation = DeviceGeneration.Second;
             break;
         case "M8976":
         case "M8946":
         case "M9460":
         case "M9244":
         case "M8948":
         case "M9245":
             model = DeviceModel.Regular;
             generation = DeviceGeneration.Third;
             break;
         case "M9282":
         case "M9787":
         case "M9268":
         case "MA079":
         case "MA127":
         case "ME436": //HP iPod
             model = DeviceModel.Regular;
             generation = DeviceGeneration.Fourth;
             break;
         case "M9160":
             model = DeviceModel.Mini;
             generation = DeviceGeneration.First;
             break;
         case "M9436":
             model = DeviceModel.MiniBlue;
             generation = DeviceGeneration.First;
             break;
         case "M9435":
             model = DeviceModel.MiniPink;
             generation = DeviceGeneration.First;
             break;
         case "M9434":
             model = DeviceModel.MiniGreen;
             generation = DeviceGeneration.First;
             break;
         case "M9437":
             model = DeviceModel.MiniGold;
             generation = DeviceGeneration.First;
             break;
         case "M9800":
         case "M9801":
             model = DeviceModel.Mini;
             generation = DeviceGeneration.Second;
             break;
         case "M9802":
         case "M9803":
             model = DeviceModel.MiniBlue;
             generation = DeviceGeneration.Second;
             break;
         case "M9804":
         case "M9805":
             model = DeviceModel.MiniPink;
             generation = DeviceGeneration.Second;
             break;
         case "M9806":
         case "M9807":
             model = DeviceModel.MiniGreen;
             generation = DeviceGeneration.Second;
             break;
         case "M9829":
         case "M9585":
         case "M9586":
         case "M9830":
             model = DeviceModel.Color;
             generation = DeviceGeneration.Fourth;
             break;
         case "M9724":
         case "M9725":
             model = DeviceModel.Shuffle;
             generation = DeviceGeneration.First;
             break;
         case "MA546":
             model = DeviceModel.ShuffleSilver;
             generation = DeviceGeneration.Second;
             break;
         case "MA947":
             model = DeviceModel.ShufflePink;
             generation = DeviceGeneration.Second;
             break;
         case "MA949":
             model = DeviceModel.ShuffleBlue;
             generation = DeviceGeneration.Second;
             break;
         case "MA951":
             model = DeviceModel.ShuffleGreen;
             generation = DeviceGeneration.Second;
             break;
         case "MA953":
             model = DeviceModel.ShuffleOrange;
             generation = DeviceGeneration.Second;
             break;
         case "MA350":
         case "MA004":
         case "MA005":
             model = DeviceModel.NanoWhite;
             generation = DeviceGeneration.First;
             break;
         case "MA352":
         case "MA009":
         case "MA107":
             model = DeviceModel.NanoBlack;
             generation = DeviceGeneration.First;
             break;
         case "MA477":
         case "MA426":
             model = DeviceModel.NanoSilver;
             generation = DeviceGeneration.Second;
             break;
         case "MA428":
             model = DeviceModel.NanoBlue;
             generation = DeviceGeneration.Second;
             break;
         case "MA487":
             model = DeviceModel.NanoGreen;
             generation = DeviceGeneration.Second;
             break;
         case "MA489":
             model = DeviceModel.NanoPink;
             generation = DeviceGeneration.Second;
             break;
         case "MA725":
         case "MA726":
             model = DeviceModel.NanoProductRed;
             generation = DeviceGeneration.Second;
             break;
         case "MA497":
             model = DeviceModel.NanoBlack;
             generation = DeviceGeneration.Second;
             break;
         case "MA002":
         case "MA003":
         case "MA444":
             model = DeviceModel.VideoWhite;
             generation = DeviceGeneration.Fifth;
             break;
         case "MA146":
         case "MA147":
         case "MA448":
         case "MA450": /* Possibly Video U2? */
         case "MA446": /* Video U2 */
             model = DeviceModel.VideoBlack;
             generation = DeviceGeneration.Fifth;
             break;
         default:
             model = DeviceModel.Unknown;
             generation = DeviceGeneration.Unknown;
             break;
     }
 }