コード例 #1
0
        static GameOption LoadOrDefault(Type t)
        {
            GameOption option = Resources.Load <GameOption>(t.Name);

            if (option == null)
            {
                option = (GameOption)CreateInstance(t);
            }

            return(option);
        }
コード例 #2
0
        public void InitializeEntries(Dropdown dropdown)
        {
            dropdown.options.Clear();
            foreach (var percentage in Percentages)
            {
                dropdown.options.Add(new Dropdown.OptionData($"{percentage}% {(percentage == 100?"(Native)":"")}"));
            }

            int current = GameOption.Get <SpaceshipOptions>().screenPercentage;

            dropdown.SetValueWithoutNotify(Percentages.ToList().FindIndex(o => o == current));
        }
コード例 #3
0
        public void InitializeEntries(Dropdown dropdown)
        {
            dropdown.options.Clear();
            foreach (var framerate in TargetFramerates)
            {
                dropdown.options.Add(new Dropdown.OptionData(framerate == -1? InfiniteText : framerate.ToString()));
            }

            int current = GameOption.Get <GraphicOption>().targetFrameRate;

            dropdown.SetValueWithoutNotify(dropdown.options.FindIndex(o => o.text == current.ToString()));
        }
コード例 #4
0
        public void InitializeEntries(Dropdown dropdown)
        {
            dropdown.options.Clear();
            foreach (var label in Labels)
            {
                dropdown.options.Add(new Dropdown.OptionData(label));
            }

            int current = (int)GameOption.Get <SpaceshipOptions>().fpsKeyboardScheme;

            dropdown.SetValueWithoutNotify(current);
        }
コード例 #5
0
        public void InitializeEntries(Dropdown dropdown)
        {
            dropdown.options.Clear();

            foreach (var quality in QualitySettings.names)
            {
                dropdown.options.Add(new Dropdown.OptionData(quality));
            }

            int current = GameOption.Get <GraphicOption>().quality;

            dropdown.SetValueWithoutNotify(current);
        }
コード例 #6
0
        void UpdateOptions(int value)
        {
            SpaceshipOptions.UpsamplingMethod val = (SpaceshipOptions.UpsamplingMethod)value;

            if (val == SpaceshipOptions.UpsamplingMethod.TAAU)
            {
                GameOption.Get <HDRPCameraOption>().antiAliasing = HDAdditionalCameraData.AntialiasingMode.TemporalAntialiasing;

                // Force Refresh
                if (antiAliasingDropdown != null)
                {
                    antiAliasingDropdown.enabled = false;
                    antiAliasingDropdown.enabled = true;
                }
            }

            GameOption.Get <SpaceshipOptions>().upsamplingMethod = val;
        }
コード例 #7
0
 static void Load()
 {
     foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
     {
         try
         {
             foreach (var type in assembly.GetTypes())
             {
                 if (type.IsSubclassOf(typeof(GameOption)) && !type.IsAbstract)
                 {
                     GameOption.Add(type);
                 }
             }
         }
         catch
         {
             Debug.LogWarning($"Could not load any game option from assembly {assembly.FullName}");
         }
     }
 }
コード例 #8
0
        private void OnEnable()
        {
            var slider = GetComponent <Slider>();

            slider.onValueChanged.AddListener(UpdateOptions);

            if (LogarithmicScale)
            {
                slider.minValue = 0.0f;
                slider.maxValue = 1.0f;
            }
            else
            {
                slider.minValue = MinMaxSliderValue.x;
                slider.maxValue = MinMaxSliderValue.y;
            }

            slider.wholeNumbers = IntegerSliderValues;
            slider.SetValueWithoutNotify(ParameterToSlider(GameOption.Get <AudioOption>().GetParameter(Parameter)));
        }
コード例 #9
0
        public void InitializeEntries(Dropdown dropdown)
        {
            dropdown.options.Clear();
            foreach (var method in Methods)
            {
                if (!method.Contains("DLSS"))
                {
                    dropdown.options.Add(new Dropdown.OptionData(method));
                }
                else
                {
                    // Add DLSS only if supported
                    if (HDDynamicResolutionPlatformCapabilities.DLSSDetected)
                    {
                        dropdown.options.Add(new Dropdown.OptionData(method));
                    }
                }
            }

            int current = (int)GameOption.Get <SpaceshipOptions>().upsamplingMethod;

            dropdown.SetValueWithoutNotify(current);
        }
コード例 #10
0
 void UpdateOptions(int value)
 {
     GameOption.Get <GraphicOption>().refreshRate = int.Parse(GetComponent <Dropdown>().options[value].text);
 }
コード例 #11
0
 void UpdateOptions(int value)
 {
     GameOption.Get <GraphicOption>().targetFrameRate = TargetFramerates[value];
 }
コード例 #12
0
 void UpdateOptions(bool value)
 {
     GameOption.Get <GraphicOption>().vSync = value;
     UpdateTargetFramerate(value);
 }
コード例 #13
0
 void UpdateOptions(int value)
 {
     GameOption.Get <GraphicOption>().quality = value;
 }
コード例 #14
0
        public void InitializeEntries()
        {
            var dropdown = GetComponent <Dropdown>();

            dropdown.options.Clear();
            int selected = 0;
            int i        = 0;

            foreach (var res in Screen.resolutions.OrderByDescending(o => o.width))
            {
                string option = $"{res.width}x{res.height}";

                if (!dropdown.options.Any(o => o.text == option))
                {
                    dropdown.options.Add(new Dropdown.OptionData(option));
                    if (res.width == GameOption.Get <GraphicOption>().width&& res.height == GameOption.Get <GraphicOption>().height)
                    {
                        selected = i;
                    }
                    i++;
                }
            }

            dropdown.SetValueWithoutNotify(selected);

            if (dropDownRefreshRate != null)
            {
                dropDownRefreshRate.InitializeEntries();
            }
        }
コード例 #15
0
 void UpdateOptions(int value)
 {
     GameOption.Get <SpaceshipOptions>().fpsKeyboardScheme = (SpaceshipOptions.FPSKeyboardScheme)value;
 }
コード例 #16
0
 public void InitializeEntries()
 {
     GetComponent <Toggle>().isOn = GameOption.Get <GraphicOption>().vSync;
 }
コード例 #17
0
 void InitializeEntries(Slider slider)
 {
     slider.value = GameOption.Get <GraphicOption>().targetFrameRate;
 }
コード例 #18
0
        public void InitializeEntries()
        {
            var dropdown = GetComponent <Dropdown>();

            dropdown.options.Clear();
            int selected = 0;
            int i        = 0;

            foreach (var res in Screen.resolutions)
            {
                if (res.width == GameOption.Get <GraphicOption>().width&& res.height == GameOption.Get <GraphicOption>().height)
                {
                    if (!dropdown.options.Any(o => o.text == res.refreshRate.ToString()))
                    {
                        dropdown.options.Add(new Dropdown.OptionData(res.refreshRate.ToString()));
                    }

                    if (GameOption.Get <GraphicOption>().refreshRate == res.refreshRate)
                    {
                        selected = i;
                    }

                    i++;
                }
            }
            dropdown.SetValueWithoutNotify(selected);
        }
コード例 #19
0
 void UpdateOptions(float value)
 {
     GameOption.Get <AudioOption>().SetParameter(Parameter, SliderToParameter(value), ApplyParameter);
 }
コード例 #20
0
 void UpdateOptions(float value)
 {
     GameOption.Get <GraphicOption>().targetFrameRate = (int)value;
 }
コード例 #21
0
 private void OnEnable()
 {
     InitializeEntries();
     GetComponent <Toggle>().onValueChanged.AddListener(UpdateOptions);
     UpdateTargetFramerate(GameOption.Get <GraphicOption>().vSync);
 }