Esempio n. 1
0
        private void DrawSettingWindow(int windowID)
        {
            GUILayout.Label("系统时间:" + DateTime.Now.ToShortTimeString());
#if UNITY_ANDROUD
            GUILayout.Label("剩余电量:" + GetBatteryLevel());
#elif UNITY_IPHONE
            GUILayout.Label("剩余电量:" + GetBatteryLevel());
#elif UNITY_EDITOR || UNITY_STANDALONE_WIN
            GUILayout.Label("剩余电量:" + "***移动端可测");
#endif
            GUILayout.Label("网络状态:" + NetState());
            GUILayout.Label("当前帧数:" + m_FPS.ToString("F1"));
            GUILayout.Label("窗口化/全屏");
            screenFull = GUILayout.SelectionGrid(screenFull, new string[] { "全屏", "窗口化" }, 2);
            GUILayout.Label("屏幕分辨率");
            screenSize = GUILayout.SelectionGrid(screenSize, new string[] { "800*600", "1280*720", "1366*768", "1920*1080" }, 4);
            GUILayout.Label("帧数设置");
            vSyncCount = GUILayout.SelectionGrid(vSyncCount, new string[] { "不封顶", "60", "30" }, 3);
            GUILayout.Label("抗锯齿");
            antiAliasing = GUILayout.SelectionGrid(antiAliasing, new string[] { "关闭", "2倍", "4倍", "8倍" }, 4);
            GUILayout.Label("贴图纹理质量");
            textureQuality = GUILayout.SelectionGrid(textureQuality, new string[] { "极致", "良", "中", "不忍直视" }, 4);
            GUILayout.Label("实时阴影");
            shadowType = GUILayout.SelectionGrid(shadowType, new string[] { "关闭", "硬阴影", "软硬兼具" }, 3);
            GUILayout.Label("阴影质量");
            shadowQuality = GUILayout.SelectionGrid(shadowQuality, new string[] { "不忍直视", "中", "高", "极致" }, 4);
            GUILayout.Label("阴影距离");
            shadowDistanceIndex = GUILayout.SelectionGrid(shadowDistanceIndex, new string[] { "低", "中", "高" }, 3);
            if (GUILayout.Button("确定修改"))
            {
                QualitySettings.vSyncCount         = vSyncCount;
                QualitySettings.antiAliasing       = antiAliasingSetting[antiAliasing];
                QualitySettings.masterTextureLimit = textureQuality;
                Screen.fullScreen = screenFull.Equals(0);
                ScreenResolution size = screenSizes[screenSize];
                Screen.SetResolution(size.width, size.height, Screen.fullScreen);
                QualitySettings.shadows          = (ShadowQuality)shadowType;
                QualitySettings.shadowResolution = (ShadowResolution)shadowQuality;
                QualitySettings.shadowDistance   = shadowDistances[shadowDistanceIndex];
                Write2PlayerPrefs();
            }
            if (GUILayout.Button("取消"))
            {
                m_showSettingWindow = false;
            }
        }
Esempio n. 2
0
        public override void Open()
        {
            m_showSettingWindow = true;
            // 打开时更新GUI数据
            screenFull = Screen.fullScreen ? 0 : 1;
            ScreenResolution resolution = new ScreenResolution()
            {
                width = Screen.width, height = Screen.height
            };

            for (int i = 0; i < screenSizes.Count; i++)
            {
                if (screenSizes[i] == resolution)
                {
                    screenSize = i;
                    break;
                }
            }
            vSyncCount = QualitySettings.vSyncCount;
            for (int i = 0; i < antiAliasingSetting.Length; i++)
            {
                if (antiAliasingSetting[i] == QualitySettings.antiAliasing)
                {
                    antiAliasing = i;
                }
            }
            textureQuality = QualitySettings.masterTextureLimit;
            shadowType     = (int)QualitySettings.shadows;
            shadowQuality  = (int)QualitySettings.shadowResolution;
            for (int i = 0; i < shadowDistances.Length; i++)
            {
                if (Math.Abs(shadowDistances[i] - QualitySettings.shadowDistance) <= 0)
                {
                    shadowDistanceIndex = i;
                }
            }
        }
Esempio n. 3
0
 protected bool Equals(ScreenResolution other)
 {
     return(width == other.width && height == other.height);
 }