static GameOption LoadOrDefault(Type t) { GameOption option = Resources.Load <GameOption>(t.Name); if (option == null) { option = (GameOption)CreateInstance(t); } return(option); }
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)); }
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())); }
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); }
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); }
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; }
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}"); } } }
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))); }
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); }
void UpdateOptions(int value) { GameOption.Get <GraphicOption>().refreshRate = int.Parse(GetComponent <Dropdown>().options[value].text); }
void UpdateOptions(int value) { GameOption.Get <GraphicOption>().targetFrameRate = TargetFramerates[value]; }
void UpdateOptions(bool value) { GameOption.Get <GraphicOption>().vSync = value; UpdateTargetFramerate(value); }
void UpdateOptions(int value) { GameOption.Get <GraphicOption>().quality = value; }
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(); } }
void UpdateOptions(int value) { GameOption.Get <SpaceshipOptions>().fpsKeyboardScheme = (SpaceshipOptions.FPSKeyboardScheme)value; }
public void InitializeEntries() { GetComponent <Toggle>().isOn = GameOption.Get <GraphicOption>().vSync; }
void InitializeEntries(Slider slider) { slider.value = GameOption.Get <GraphicOption>().targetFrameRate; }
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); }
void UpdateOptions(float value) { GameOption.Get <AudioOption>().SetParameter(Parameter, SliderToParameter(value), ApplyParameter); }
void UpdateOptions(float value) { GameOption.Get <GraphicOption>().targetFrameRate = (int)value; }
private void OnEnable() { InitializeEntries(); GetComponent <Toggle>().onValueChanged.AddListener(UpdateOptions); UpdateTargetFramerate(GameOption.Get <GraphicOption>().vSync); }