예제 #1
0
    private Vector4 GetSafePadding()
    {
        Vector4 v_result = Vector4.zero;

#if UNITY_EDITOR
        if (FakeDevice == DeviceType.IPHONEX_L)
        {
            v_result.Set(48, 0, 0, 0);
        }
        else if (FakeDevice == DeviceType.IPHONEX_R)
        {
            v_result.Set(0, 0, 48, 0);
        }
        else if (FakeDevice == DeviceType.IPHONEX_LR)
        {
            v_result.Set(48, 0, 48, 0);
        }
#elif IN_GAME && UNITY_IOS
        float l, t, r, b;
        GetSafeOffsetImpl(out l, out t, out r, out b);
        v_result.Set(l, t, r, b);
#elif IN_GAME && UNITY_ANDROID
        float ratio     = 1.0f;
        bool  bHasNotch = AndroidUtil.HasNotchInScreen() && (!AndroidUtil.IgnoreNotchScreen());
        if (bHasNotch)
        {
            v_result.Set(48 * ratio, 0, 0, 0);
        }
#endif
        return(v_result);
    }