Keep config disabled after stopping server

This commit is contained in:
John Gross
2019-12-21 12:22:29 -08:00
parent 540b17448a
commit a1f397f9bf
2 changed files with 5 additions and 4 deletions

View File

@@ -39,6 +39,7 @@ namespace Torch.Server
{ {
public class TorchServer : TorchBase, ITorchServer public class TorchServer : TorchBase, ITorchServer
{ {
private bool _hasRun;
private bool _canRun; private bool _canRun;
private TimeSpan _elapsedPlayTime; private TimeSpan _elapsedPlayTime;
private bool _isRunning; private bool _isRunning;
@@ -63,8 +64,8 @@ namespace Torch.Server
var sessionManager = Managers.GetManager<ITorchSessionManager>(); var sessionManager = Managers.GetManager<ITorchSessionManager>();
sessionManager.AddFactory(x => new MultiplayerManagerDedicated(this)); sessionManager.AddFactory(x => new MultiplayerManagerDedicated(this));
} }
public bool HasRun { get; private set; } public bool HasRun { get => _hasRun; set => SetValue(ref _hasRun, value); }
/// <inheritdoc /> /// <inheritdoc />
public float SimulationRatio { get => _simRatio; set => SetValue(ref _simRatio, value); } public float SimulationRatio { get => _simRatio; set => SetValue(ref _simRatio, value); }
@@ -129,6 +130,7 @@ namespace Torch.Server
State = ServerState.Starting; State = ServerState.Starting;
IsRunning = true; IsRunning = true;
HasRun = true;
CanRun = false; CanRun = false;
Log.Info("Starting server."); Log.Info("Starting server.");
MySandboxGame.ConfigDedicated = DedicatedInstance.DedicatedConfig.Model; MySandboxGame.ConfigDedicated = DedicatedInstance.DedicatedConfig.Model;
@@ -144,7 +146,6 @@ namespace Torch.Server
Log.Error("Server is already stopped"); Log.Error("Server is already stopped");
Log.Info("Stopping server."); Log.Info("Stopping server.");
base.Stop(); base.Stop();
HasRun = true;
Log.Info("Server stopped."); Log.Info("Server stopped.");
State = ServerState.Stopped; State = ServerState.Stopped;

View File

@@ -66,7 +66,7 @@
<RichTextBox x:Name="ConsoleText" VerticalScrollBarVisibility="Visible" FontFamily="Consolas" IsReadOnly="True"/> <RichTextBox x:Name="ConsoleText" VerticalScrollBarVisibility="Visible" FontFamily="Consolas" IsReadOnly="True"/>
</TabItem> </TabItem>
<TabItem Header="Configuration"> <TabItem Header="Configuration">
<Grid IsEnabled="{Binding CanRun}"> <Grid IsEnabled="{Binding Path=HasRun, Converter={StaticResource InverseBool}}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition/> <RowDefinition/>