Network tab + net.interp_ratio slider (#6918)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
|
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
|
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
|
||||||
@@ -26,5 +26,4 @@
|
|||||||
|
|
||||||
<Import Project="..\RobustToolbox\MSBuild\XamlIL.targets" />
|
<Import Project="..\RobustToolbox\MSBuild\XamlIL.targets" />
|
||||||
<Import Project="..\RobustToolbox\MSBuild\Robust.Analyzers.targets" />
|
<Import Project="..\RobustToolbox\MSBuild\Robust.Analyzers.targets" />
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<DefaultWindow xmlns="https://spacestation14.io"
|
<DefaultWindow xmlns="https://spacestation14.io"
|
||||||
xmlns:tabs="clr-namespace:Content.Client.EscapeMenu.UI.Tabs"
|
xmlns:tabs="clr-namespace:Content.Client.EscapeMenu.UI.Tabs"
|
||||||
Title="{Loc 'ui-options-title'}"
|
Title="{Loc 'ui-options-title'}"
|
||||||
MinSize="800 450">
|
MinSize="800 450">
|
||||||
@@ -6,5 +6,6 @@
|
|||||||
<tabs:GraphicsTab />
|
<tabs:GraphicsTab />
|
||||||
<tabs:KeyRebindTab />
|
<tabs:KeyRebindTab />
|
||||||
<tabs:AudioTab />
|
<tabs:AudioTab />
|
||||||
|
<tabs:NetworkTab/>
|
||||||
</TabContainer>
|
</TabContainer>
|
||||||
</DefaultWindow>
|
</DefaultWindow>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -17,6 +17,7 @@ namespace Content.Client.EscapeMenu.UI
|
|||||||
Tabs.SetTabTitle(0, Loc.GetString("ui-options-tab-graphics"));
|
Tabs.SetTabTitle(0, Loc.GetString("ui-options-tab-graphics"));
|
||||||
Tabs.SetTabTitle(1, Loc.GetString("ui-options-tab-controls"));
|
Tabs.SetTabTitle(1, Loc.GetString("ui-options-tab-controls"));
|
||||||
Tabs.SetTabTitle(2, Loc.GetString("ui-options-tab-audio"));
|
Tabs.SetTabTitle(2, Loc.GetString("ui-options-tab-audio"));
|
||||||
|
Tabs.SetTabTitle(3, Loc.GetString("ui-options-tab-network"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
39
Content.Client/EscapeMenu/UI/Tabs/NetworkTab.xaml
Normal file
39
Content.Client/EscapeMenu/UI/Tabs/NetworkTab.xaml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<Control xmlns="https://spacestation14.io"
|
||||||
|
xmlns:hudUi="clr-namespace:Content.Client.HUD.UI"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
x:Class="Content.Client.EscapeMenu.UI.Tabs.NetworkTab">
|
||||||
|
<BoxContainer Orientation="Vertical">
|
||||||
|
<BoxContainer Orientation="Vertical" Margin="8 8 8 8" VerticalExpand="True">
|
||||||
|
<BoxContainer Orientation="Horizontal" Margin="5 0 0 0">
|
||||||
|
<Label Text="{Loc 'ui-options-net-interp-ratio'}" />
|
||||||
|
<Control MinSize="8 0" />
|
||||||
|
<Slider Name="NetInterpRatioSlider"
|
||||||
|
MinValue="0"
|
||||||
|
MaxValue="6"
|
||||||
|
HorizontalExpand="True"
|
||||||
|
MinSize="80 0"
|
||||||
|
Rounded="True" />
|
||||||
|
<Control MinSize="8 0" />
|
||||||
|
<Label Name="NetInterpRatioLabel" MinSize="48 0" Align="Right" />
|
||||||
|
<Control MinSize="4 0"/>
|
||||||
|
</BoxContainer>
|
||||||
|
</BoxContainer>
|
||||||
|
<hudUi:StripeBack HasBottomEdge="False" HasMargins="False">
|
||||||
|
<BoxContainer Orientation="Horizontal"
|
||||||
|
Align="End"
|
||||||
|
HorizontalExpand="True"
|
||||||
|
VerticalExpand="True">
|
||||||
|
<Button Name="ResetButton"
|
||||||
|
Text="{Loc 'ui-options-reset-all'}"
|
||||||
|
StyleClasses="Caution"
|
||||||
|
HorizontalExpand="True"
|
||||||
|
HorizontalAlignment="Right" />
|
||||||
|
<Control MinSize="2 0" />
|
||||||
|
<Button Name="ApplyButton"
|
||||||
|
Text="{Loc 'ui-options-apply'}"
|
||||||
|
TextAlign="Center"
|
||||||
|
HorizontalAlignment="Right" />
|
||||||
|
</BoxContainer>
|
||||||
|
</hudUi:StripeBack>
|
||||||
|
</BoxContainer>
|
||||||
|
</Control>
|
||||||
72
Content.Client/EscapeMenu/UI/Tabs/NetworkTab.xaml.cs
Normal file
72
Content.Client/EscapeMenu/UI/Tabs/NetworkTab.xaml.cs
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
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.Shared.IoC;
|
||||||
|
using Robust.Shared.Localization;
|
||||||
|
|
||||||
|
namespace Content.Client.EscapeMenu.UI.Tabs
|
||||||
|
{
|
||||||
|
[GenerateTypedNameReferences]
|
||||||
|
public sealed partial class NetworkTab : Control
|
||||||
|
{
|
||||||
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
|
|
||||||
|
public NetworkTab()
|
||||||
|
{
|
||||||
|
RobustXamlLoader.Load(this);
|
||||||
|
IoCManager.InjectDependencies(this);
|
||||||
|
|
||||||
|
ApplyButton.OnPressed += OnApplyButtonPressed;
|
||||||
|
ResetButton.OnPressed += OnResetButtonPressed;
|
||||||
|
NetInterpRatioSlider.OnValueChanged += OnNetInterpRatioSliderChanged;
|
||||||
|
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
ApplyButton.OnPressed -= OnApplyButtonPressed;
|
||||||
|
ResetButton.OnPressed -= OnResetButtonPressed;
|
||||||
|
NetInterpRatioSlider.OnValueChanged -= OnNetInterpRatioSliderChanged;
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnNetInterpRatioSliderChanged(Robust.Client.UserInterface.Controls.Range range)
|
||||||
|
{
|
||||||
|
UpdateChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
|
||||||
|
{
|
||||||
|
_cfg.SetCVar(CVars.NetInterpRatio, (int) NetInterpRatioSlider.Value);
|
||||||
|
_cfg.SaveToFile();
|
||||||
|
UpdateChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnResetButtonPressed(BaseButton.ButtonEventArgs args)
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Reset()
|
||||||
|
{
|
||||||
|
NetInterpRatioSlider.Value = _cfg.GetCVar(CVars.NetInterpRatio);
|
||||||
|
UpdateChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateChanges()
|
||||||
|
{
|
||||||
|
var isEverythingSame = NetInterpRatioSlider.Value == _cfg.GetCVar(CVars.NetInterpRatio);
|
||||||
|
ApplyButton.Disabled = isEverythingSame;
|
||||||
|
ResetButton.Disabled = isEverythingSame;
|
||||||
|
NetInterpRatioLabel.Text = NetInterpRatioSlider.Value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ ui-options-title = Game Options
|
|||||||
ui-options-tab-graphics = Graphics
|
ui-options-tab-graphics = Graphics
|
||||||
ui-options-tab-controls = Controls
|
ui-options-tab-controls = Controls
|
||||||
ui-options-tab-audio = Audio
|
ui-options-tab-audio = Audio
|
||||||
|
ui-options-tab-network = Network
|
||||||
|
|
||||||
ui-options-apply = Apply
|
ui-options-apply = Apply
|
||||||
ui-options-reset-all = Reset All
|
ui-options-reset-all = Reset All
|
||||||
@@ -148,3 +149,7 @@ ui-options-function-loadout6 = Hotbar Loadout 6
|
|||||||
ui-options-function-loadout7 = Hotbar Loadout 7
|
ui-options-function-loadout7 = Hotbar Loadout 7
|
||||||
ui-options-function-loadout8 = Hotbar Loadout 8
|
ui-options-function-loadout8 = Hotbar Loadout 8
|
||||||
ui-options-function-loadout9 = Hotbar Loadout 9
|
ui-options-function-loadout9 = Hotbar Loadout 9
|
||||||
|
|
||||||
|
## Network menu
|
||||||
|
|
||||||
|
ui-options-net-interp-ratio = Network Smoothing
|
||||||
Reference in New Issue
Block a user