Esempio n. 1
0
        private void OnBrowserResolutionChanged(Resolution resolution)
        {
            PerformanceKit.SetResolution(PerformanceKit.GetResolution());

            this.RecommendedQualityLevel.text = string.Format(
                "Recommended quality level: {0}",
                PerformanceKit.GetRecommendedQualityLevel()
                );
            this.RecommendedResolution.text = string.Format(
                "Recommended resolution: {0}",
                PerformanceKit.GetRecommendedResolution()
                );
            var gameResolution = PerformanceKit.GetResolution();

            this.Resolution.text        = string.Format("Resolution: {0}", gameResolution);
            this.DisplayResolution.text = string.Format(
                "Display resolution: {0}",
                PerformanceKit.GetDisplayResolution()
                );

            this.commonResolutionsData = PerformanceKit.GetCommonResolutions();
            this.CommonResolutions.ClearOptions();
            for (int i = 0; i < commonResolutionsData.Length; i++)
            {
                var res = commonResolutionsData[i];
                this.CommonResolutions.options.Add(new Dropdown.OptionData(res.ToString()));
                if (res.Width == gameResolution.Width && res.Height == gameResolution.Height)
                {
                    this.CommonResolutions.value = i;
                }
            }
            this.CommonResolutions.RefreshShownValue();
        }
Esempio n. 2
0
        public void OnGameResolutionSelected()
        {
            Debug.LogFormat("Selected game resolution {0}", this.CommonResolutions.value);
            if (this.CommonResolutions.value < 0 || this.commonResolutionsData == null)
            {
                return;
            }

            var resolution = this.commonResolutionsData[this.CommonResolutions.value];

            Debug.LogFormat("Setting game resolution to {0}", resolution.ToString());
            PerformanceKit.SetResolution(resolution, false, false);
            this.Resolution.text = string.Format("Resolution: {0}", resolution);
        }