Keep config disabled after stopping server
This commit is contained in:
@@ -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;
|
||||||
@@ -64,7 +65,7 @@ namespace Torch.Server
|
|||||||
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;
|
||||||
|
@@ -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/>
|
||||||
|
Reference in New Issue
Block a user