Revert PVS changes (#10735)

This commit is contained in:
Leon Friedrich
2022-08-21 07:27:41 +12:00
committed by GitHub
parent f99d0151e6
commit ff2a67bc74
7 changed files with 26 additions and 32 deletions

View File

@@ -1,10 +1,15 @@
using System;
using Content.Shared.CCVar;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared;
using Robust.Shared.Maths;
using Robust.Shared.Configuration;
using Robust.Client.GameStates;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Client.EscapeMenu.UI.Tabs
{
@@ -12,7 +17,6 @@ namespace Content.Client.EscapeMenu.UI.Tabs
public sealed partial class NetworkTab : Control
{
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IClientGameStateManager _stateMan = default!;
public NetworkTab()
{
@@ -22,7 +26,6 @@ namespace Content.Client.EscapeMenu.UI.Tabs
ApplyButton.OnPressed += OnApplyButtonPressed;
ResetButton.OnPressed += OnResetButtonPressed;
NetInterpRatioSlider.OnValueChanged += OnNetInterpRatioSliderChanged;
NetInterpRatioSlider.MinValue = _stateMan.MinBufferSize;
Reset();
}
@@ -42,7 +45,7 @@ namespace Content.Client.EscapeMenu.UI.Tabs
private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
{
_cfg.SetCVar(CVars.NetBufferSize, (int) NetInterpRatioSlider.Value - _stateMan.MinBufferSize);
_cfg.SetCVar(CVars.NetInterpRatio, (int) NetInterpRatioSlider.Value);
_cfg.SaveToFile();
UpdateChanges();
}
@@ -54,13 +57,13 @@ namespace Content.Client.EscapeMenu.UI.Tabs
private void Reset()
{
NetInterpRatioSlider.Value = _cfg.GetCVar(CVars.NetBufferSize) + _stateMan.MinBufferSize;
NetInterpRatioSlider.Value = _cfg.GetCVar(CVars.NetInterpRatio);
UpdateChanges();
}
private void UpdateChanges()
{
var isEverythingSame = NetInterpRatioSlider.Value == _cfg.GetCVar(CVars.NetBufferSize) + _stateMan.MinBufferSize;
var isEverythingSame = NetInterpRatioSlider.Value == _cfg.GetCVar(CVars.NetInterpRatio);
ApplyButton.Disabled = isEverythingSame;
ResetButton.Disabled = isEverythingSame;
NetInterpRatioLabel.Text = NetInterpRatioSlider.Value.ToString();