예제 #1
0
        public float GetPixelScale()
        {
            AxisAlignedBox2f uiBounds    = GetOrthoViewBounds();
            AxisAlignedBox2f pixelBounds = GetPixelViewBounds();
            float            fScale      = uiBounds.MaxDim / pixelBounds.MaxDim;

#if UNITY_STANDALONE_OSX
            if (UnityEngine.Screen.dpi > 100.0f && FPlatform.InUnityEditor() == false)
            {
                fScale /= 2.0f;
            }
#endif
#if UNITY_IOS || UNITY_ANDROID
            if (FPlatform.GetDeviceType() != FPlatform.fDeviceType.IPad)
            {
                fScale *= 0.8f;
            }
#endif
            if (FPlatform.InUnityEditor())
            {
                fScale *= FPlatform.EditorUIScaleFactor;
            }
            else
            {
                fScale *= FPlatform.UIScaleFactor;
            }
            return(fScale);
        }