public GraphicsTab() { IoCManager.InjectDependencies(this); RobustXamlLoader.Load(this); VSyncCheckBox.OnToggled += OnCheckBoxToggled; FullscreenCheckBox.OnToggled += OnCheckBoxToggled; LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-very-low")); LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-low")); LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-medium")); LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-high")); LightingPresetOption.OnItemSelected += OnLightingQualityChanged; UIScaleOption.AddItem(Loc.GetString("ui-options-scale-auto", ("scale", UserInterfaceManager.DefaultUIScale))); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-75")); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-100")); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-125")); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-150")); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-175")); UIScaleOption.AddItem(Loc.GetString("ui-options-scale-200")); UIScaleOption.OnItemSelected += OnUIScaleChanged; foreach (var gear in _prototypeManager.EnumeratePrototypes <HudThemePrototype>()) { HudThemeOption.AddItem(Loc.GetString(gear.Name)); } HudThemeOption.OnItemSelected += OnHudThemeChanged; ViewportStretchCheckBox.OnToggled += _ => { UpdateViewportScale(); UpdateApplyButton(); }; ViewportScaleSlider.OnValueChanged += _ => { UpdateApplyButton(); UpdateViewportScale(); }; ShowHeldItemCheckBox.OnToggled += OnCheckBoxToggled; IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled; ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled; ApplyButton.OnPressed += OnApplyButtonPressed; VSyncCheckBox.Pressed = _cfg.GetCVar(CVars.DisplayVSync); FullscreenCheckBox.Pressed = ConfigIsFullscreen; LightingPresetOption.SelectId(GetConfigLightingQuality()); UIScaleOption.SelectId(GetConfigUIScalePreset(ConfigUIScale)); HudThemeOption.SelectId(_cfg.GetCVar(CCVars.HudTheme)); ViewportScaleSlider.Value = _cfg.GetCVar(CCVars.ViewportFixedScaleFactor); ViewportStretchCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportStretch); IntegerScalingCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportSnapToleranceMargin) != 0; ViewportLowResCheckBox.Pressed = !_cfg.GetCVar(CCVars.ViewportScaleRender); ShowHeldItemCheckBox.Pressed = _cfg.GetCVar(CCVars.HudHeldItemShow); UpdateViewportScale(); UpdateApplyButton(); }
private void OnUIScaleChanged(OptionButton.ItemSelectedEventArgs args) { UIScaleOption.SelectId(args.Id); UpdateApplyButton(); }