public void SetScreen(Texture overlayTexture, ScreenData screenData)
        {
            m_OverlayTexture = overlayTexture;
            m_ScreenData     = screenData;

            CancelAllTouches();
        }
Beispiel #2
0
        public void ChangeScreen(int screenIndex)
        {
            m_Screen = m_DeviceInfo.screens[screenIndex];
            FindSupportedOrientations();

            if (!m_WasResolutionSet)
            {
                m_RequestDefaultResolution = true;
            }
        }
Beispiel #3
0
        public void ChangeScreen(int screenIndex)
        {
            m_Screen = m_DeviceInfo.screens[screenIndex];

            FindSupportedOrientations();

            if (!m_WasResolutionSet)
            {
                CalculateResolutionWithInsets(out int tempWidth, out int tempHeight);
                SetResolution(tempWidth, tempHeight);
            }
        }
Beispiel #4
0
        public ScreenSimulation(DeviceInfo device, SimulationPlayerSettings playerSettings, int screenIndex)
        {
            m_PlayerSettings = playerSettings;
            m_DeviceInfo     = device;
            m_Screen         = device.screens[screenIndex];

            FindSupportedOrientations();

            m_AllowedAutoRotation = new Dictionary <ScreenOrientation, bool>();
            m_AllowedAutoRotation.Add(ScreenOrientation.Portrait, m_PlayerSettings.allowedPortrait);
            m_AllowedAutoRotation.Add(ScreenOrientation.PortraitUpsideDown, m_PlayerSettings.allowedPortraitUpsideDown);
            m_AllowedAutoRotation.Add(ScreenOrientation.LandscapeLeft, m_PlayerSettings.allowedLandscapeLeft);
            m_AllowedAutoRotation.Add(ScreenOrientation.LandscapeRight, m_PlayerSettings.allowedLandscapeRight);

            // Set the full screen mode.
            m_IsFullScreen               = !m_DeviceInfo.IsAndroidDevice() || m_PlayerSettings.androidStartInFullscreen;
            m_RequestedFullScreen        = m_IsFullScreen;
            m_IsRenderingOutsideSafeArea = !m_DeviceInfo.IsAndroidDevice() || m_PlayerSettings.androidRenderOutsideSafeArea;

            // Calculate the right orientation.
            var settingOrientation = SimulatorUtilities.ToScreenOrientation(m_PlayerSettings.defaultOrientation);

            if (settingOrientation == ScreenOrientation.AutoRotation)
            {
                m_AutoRotation = true;
                SetFirstAvailableAutoOrientation();
            }
            else if (m_SupportedOrientations.ContainsKey(settingOrientation))
            {
                m_AutoRotation = false;
                RequestOrientation(settingOrientation);
            }
            else
            {
                // The real iPhone X responds to this absolute corner case by crashing, we will not do that.
                m_AutoRotation = false;
                RequestOrientation(m_SupportedOrientations.Keys.ToArray()[0]);
            }

            m_RequestInsetUpdate       = true;
            m_RequestDefaultResolution = true;

            ShimManager.UseShim(this);
        }
        public ScreenSimulation(DeviceInfo device, SimulationPlayerSettings playerSettings)
        {
            m_DeviceInfo = device;
            m_Screen     = device.screens[0];

            m_SupportedOrientations = new Dictionary <ScreenOrientation, OrientationData>();
            foreach (var o in m_Screen.orientations)
            {
                m_SupportedOrientations.Add(o.orientation, o);
            }

            m_AllowedAutoRotation = new Dictionary <ScreenOrientation, bool>();
            m_AllowedAutoRotation.Add(ScreenOrientation.Portrait, playerSettings.allowedPortrait);
            m_AllowedAutoRotation.Add(ScreenOrientation.PortraitUpsideDown, playerSettings.allowedPortraitUpsideDown);
            m_AllowedAutoRotation.Add(ScreenOrientation.LandscapeLeft, playerSettings.allowedLandscapeLeft);
            m_AllowedAutoRotation.Add(ScreenOrientation.LandscapeRight, playerSettings.allowedLandscapeRight);

            // Set the full screen mode.
            m_IsFullScreen = !m_DeviceInfo.IsAndroidDevice() || playerSettings.androidStartInFullscreen;

            // Calculate the right orientation.
            var settingOrientation = SimulatorUtilities.ToScreenOrientation(playerSettings.defaultOrientation);

            if (settingOrientation == ScreenOrientation.AutoRotation)
            {
                m_AutoRotation = true;
                SetFirstAvailableAutoOrientation();
            }
            else if (m_SupportedOrientations.ContainsKey(settingOrientation))
            {
                m_AutoRotation = false;
                ForceNewOrientation(settingOrientation);
            }
            else
            {
                // The real iPhone X responds to this absolute corner case by crashing, we will not do that.
                m_AutoRotation = false;
                ForceNewOrientation(m_SupportedOrientations.Keys.ToArray()[0]);
            }

            // Calculate the right resolution.
            var initWidth  = m_Screen.width;
            var initHeight = m_Screen.height;

            if (playerSettings.resolutionScalingMode == ResolutionScalingMode.FixedDpi && playerSettings.targetDpi < m_Screen.dpi)
            {
                m_DpiRatio = playerSettings.targetDpi / m_Screen.dpi;
                initWidth  = (int)(initWidth * m_DpiRatio);
                initHeight = (int)(initHeight * m_DpiRatio);
            }
            m_CurrentWidth  = IsRenderingLandscape ? initHeight : initWidth;
            m_CurrentHeight = IsRenderingLandscape ? initWidth : initHeight;

            if (!m_IsFullScreen)
            {
                CalculateScreenResolutionForScreenMode(out m_CurrentWidth, out m_CurrentHeight);
                CalculateInsets();
            }
            CalculateSafeAreaAndCutouts();

            ShimManager.UseShim(this);
        }