Example #1
0
 private static void SetScreenResolution(ResolutionQualityGrade resolutionQuality, ref int currentScreenResolutionWidth, ref int currentScreenResolutionHeight)
 {
     if (!_hasSettingScreenResolution)
     {
         _originScreenResolution     = Screen.currentResolution;
         _hasSettingScreenResolution = true;
     }
     currentScreenResolutionWidth  = _originScreenResolution.width;
     currentScreenResolutionHeight = _originScreenResolution.height;
     if (resolutionQuality != ResolutionQualityGrade.High)
     {
         int resX = 0;
         int resY = 0;
         GetResolutionKeepScale(0x500, 720, _originScreenResolution.width, _originScreenResolution.height, ref resX, ref resY);
         Screen.SetResolution(resX, resY, Screen.fullScreen);
         currentScreenResolutionWidth  = resX;
         currentScreenResolutionHeight = resY;
     }
     else
     {
         Screen.SetResolution(_originScreenResolution.width, _originScreenResolution.height, Screen.fullScreen);
         currentScreenResolutionWidth  = _originScreenResolution.width;
         currentScreenResolutionHeight = _originScreenResolution.height;
     }
 }
Example #2
0
        public static void ApplyResolution(Dictionary <ResolutionQualityGrade, int> resolutionPercentage, ResolutionQualityGrade resolutionQuality, int recommendResX, int recommendResY)
        {
            ResolutionQualityGrade grade      = resolutionQuality;
            int currentScreenResolutionWidth  = 0;
            int currentScreenResolutionHeight = 0;

            SetScreenResolution(grade, ref currentScreenResolutionWidth, ref currentScreenResolutionHeight);
            int num3 = resolutionPercentage[grade];
            int resX = Mathf.RoundToInt(((float)(currentScreenResolutionWidth * num3)) / 100f);
            int resY = Mathf.RoundToInt(((float)(currentScreenResolutionHeight * num3)) / 100f);

            switch (grade)
            {
            case ResolutionQualityGrade.Middle:
            case ResolutionQualityGrade.Low:
                GetResolutionKeepScale(recommendResX, recommendResY, currentScreenResolutionWidth, currentScreenResolutionHeight, ref resX, ref resY);
                if (grade == ResolutionQualityGrade.Low)
                {
                    resX = Mathf.RoundToInt(((float)(resX * num3)) / 100f);
                    resY = Mathf.RoundToInt(((float)(resY * num3)) / 100f);
                }
                break;
            }
            _UsingNativeResolution = (resX == currentScreenResolutionWidth) && (resY == currentScreenResolutionHeight);
            _UsingResolutionX      = resX;
            _UsingResolutionY      = resY;
            PostFXWithResScale scale = UnityEngine.Object.FindObjectOfType <PostFXWithResScale>();

            if ((scale != null) && scale.enabled)
            {
                scale.CameraResWidth  = resX;
                scale.CameraResHeight = resY;
            }
            else
            {
                Screen.SetResolution(resX, resY, Screen.fullScreen);
            }
            GraphicsUtils.RebindAllRenderTexturesToCamera();
        }
Example #3
0
        private void ShowResolution(ResolutionQualityGrade resolutionGrade, bool isRecommend)
        {
            Transform transform  = base.transform.Find("Content/DetailSetting/FirstLine/Resolution");
            Transform transform2 = transform.Find("Mark");

            transform2.FindChild("Enable").gameObject.SetActive(!isRecommend);
            transform2.FindChild("Disable").gameObject.SetActive(isRecommend);
            Transform transform3 = transform.FindChild("Choice/Low");
            Transform transform4 = transform.FindChild("Choice/Middle");
            Transform transform5 = transform.FindChild("Choice/High");
            Transform transform6 = transform.FindChild("Label");
            Transform transform7 = transform3.FindChild("Text");
            Transform transform8 = transform4.FindChild("Text");
            Transform transform9 = transform5.FindChild("Text");

            if (isRecommend)
            {
                transform3.FindChild("Blue").gameObject.SetActive(false);
                transform3.FindChild("Grey").gameObject.SetActive(false);
                transform3.FindChild("Disable").gameObject.SetActive(true);
                transform4.FindChild("Blue").gameObject.SetActive(false);
                transform4.FindChild("Grey").gameObject.SetActive(false);
                transform4.FindChild("Disable").gameObject.SetActive(true);
                transform5.FindChild("Blue").gameObject.SetActive(false);
                transform5.FindChild("Grey").gameObject.SetActive(false);
                transform5.FindChild("Disable").gameObject.SetActive(true);
                transform6.GetComponent <Text>().color = MiscData.GetColor("GraphicsSettingDisableText");
                transform7.GetComponent <Text>().color = MiscData.GetColor("GraphicsSettingDisableText");
                transform8.GetComponent <Text>().color = MiscData.GetColor("GraphicsSettingDisableText");
                transform9.GetComponent <Text>().color = MiscData.GetColor("GraphicsSettingDisableText");
                transform3.FindChild("Check").GetComponent <Image>().color = MiscData.GetColor("GraphicsSettingDisableRadioboxCheck");
                transform4.FindChild("Check").GetComponent <Image>().color = MiscData.GetColor("GraphicsSettingDisableRadioboxCheck");
                transform5.FindChild("Check").GetComponent <Image>().color = MiscData.GetColor("GraphicsSettingDisableRadioboxCheck");
            }
            else
            {
                transform3.FindChild("Disable").gameObject.SetActive(false);
                transform4.FindChild("Disable").gameObject.SetActive(false);
                transform5.FindChild("Disable").gameObject.SetActive(false);
                transform6.GetComponent <Text>().color = Color.white;
                transform7.GetComponent <Text>().color = Color.white;
                transform8.GetComponent <Text>().color = Color.white;
                transform9.GetComponent <Text>().color = Color.white;
                transform3.FindChild("Check").GetComponent <Image>().color = Color.white;
                transform4.FindChild("Check").GetComponent <Image>().color = Color.white;
                transform5.FindChild("Check").GetComponent <Image>().color = Color.white;
            }
            if (resolutionGrade == ResolutionQualityGrade.High)
            {
                transform3.FindChild("Button").GetComponent <Button>().interactable = !isRecommend;
                transform4.FindChild("Button").GetComponent <Button>().interactable = !isRecommend;
                transform5.FindChild("Button").GetComponent <Button>().interactable = false;
                if (!isRecommend)
                {
                    transform3.FindChild("Blue").gameObject.SetActive(false);
                    transform3.FindChild("Grey").gameObject.SetActive(true);
                    transform4.FindChild("Blue").gameObject.SetActive(false);
                    transform4.FindChild("Grey").gameObject.SetActive(true);
                    transform5.FindChild("Blue").gameObject.SetActive(true);
                    transform5.FindChild("Grey").gameObject.SetActive(false);
                }
                transform3.FindChild("Check").gameObject.SetActive(false);
                transform4.FindChild("Check").gameObject.SetActive(false);
                transform5.FindChild("Check").gameObject.SetActive(true);
            }
            else if (resolutionGrade == ResolutionQualityGrade.Middle)
            {
                transform3.FindChild("Button").GetComponent <Button>().interactable = !isRecommend;
                transform4.FindChild("Button").GetComponent <Button>().interactable = false;
                transform5.FindChild("Button").GetComponent <Button>().interactable = !isRecommend;
                if (!isRecommend)
                {
                    transform3.FindChild("Blue").gameObject.SetActive(false);
                    transform3.FindChild("Grey").gameObject.SetActive(true);
                    transform4.FindChild("Blue").gameObject.SetActive(true);
                    transform4.FindChild("Grey").gameObject.SetActive(false);
                    transform5.FindChild("Blue").gameObject.SetActive(false);
                    transform5.FindChild("Grey").gameObject.SetActive(true);
                }
                transform3.FindChild("Check").gameObject.SetActive(false);
                transform4.FindChild("Check").gameObject.SetActive(true);
                transform5.FindChild("Check").gameObject.SetActive(false);
            }
            else
            {
                transform3.FindChild("Button").GetComponent <Button>().interactable = false;
                transform4.FindChild("Button").GetComponent <Button>().interactable = !isRecommend;
                transform5.FindChild("Button").GetComponent <Button>().interactable = !isRecommend;
                if (!isRecommend)
                {
                    transform5.FindChild("Blue").gameObject.SetActive(false);
                    transform5.FindChild("Grey").gameObject.SetActive(true);
                    transform4.FindChild("Blue").gameObject.SetActive(false);
                    transform4.FindChild("Grey").gameObject.SetActive(true);
                    transform3.FindChild("Blue").gameObject.SetActive(true);
                    transform3.FindChild("Grey").gameObject.SetActive(false);
                }
                transform5.FindChild("Check").gameObject.SetActive(false);
                transform4.FindChild("Check").gameObject.SetActive(false);
                transform3.FindChild("Check").gameObject.SetActive(true);
            }
        }