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(); }
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(); }