Exemplo n.º 1
0
 private void Init()
 {
     this._camera            = base.GetComponent <Camera>();
     this._origFarPlane      = this._camera.farClipPlane;
     this._postFXWithRescale = base.GetComponent <PostFXWithResScale>();
     this.GenerateDOFHexagon();
     this.CreateMaterials();
     this.CreateBackgourQuad();
     this.CreateFarCamera();
 }
Exemplo n.º 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();
        }