Add entity management viewmodels

This commit is contained in:
John Gross
2017-05-11 11:22:47 -07:00
parent 135d1f4be8
commit d4649ea8ef
21 changed files with 360 additions and 47 deletions

View File

@@ -20,6 +20,7 @@ using Sandbox;
using Sandbox.Engine.Networking;
using Sandbox.Engine.Utils;
using Torch.Server.ViewModels;
using Torch.Views;
using VRage.Dedicated;
using VRage.Game;
using Path = System.IO.Path;
@@ -43,18 +44,14 @@ namespace Torch.Server.Views
public void SaveConfig()
{
Config.Save(_configPath);
//TODO: make this work
try
{
var checkpoint = MyLocalCache.LoadCheckpoint(_viewModel.LoadWorld, out ulong size);
checkpoint.SessionName = _viewModel.WorldName;
checkpoint.Settings = _viewModel.SessionSettings;
checkpoint.Mods.Clear();
foreach (var modId in _viewModel.Mods)
checkpoint.Mods.Add(new MyObjectBuilder_Checkpoint.ModItem(modId));
Debug.Assert(checkpoint != null);
Debug.Assert(_viewModel.LoadWorld != null);
MyLocalCache.SaveCheckpoint(checkpoint, _viewModel.LoadWorld);
}
catch (Exception e)
@@ -106,5 +103,10 @@ namespace Torch.Server.Views
var editor = new CollectionEditor { Owner = Window.GetWindow(this) };
editor.Edit(_viewModel.Mods, "Mods");
}
private void Save_OnClick(object sender, RoutedEventArgs e)
{
SaveConfig();
}
}
}