Fix NetworkManager, add more entity management, default command permission level to "Admin"

This commit is contained in:
John Gross
2017-06-02 19:40:52 -07:00
parent 8ad9ecf2bb
commit c40b17ac30
37 changed files with 489 additions and 114 deletions

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sandbox.ModAPI;
using Sandbox.ModAPI.Interfaces;
namespace Torch.Server.ViewModels.Blocks
{
public class PropertyViewModel<T> : PropertyViewModel
{
private readonly ITerminalProperty<T> _prop;
public string Name { get; }
public Type PropertyType => typeof(T);
public T Value
{
get
{
var val = default(T);
TorchBase.Instance.InvokeBlocking(() => val = _prop.GetValue(Block.Block));
return val;
}
set
{
TorchBase.Instance.InvokeBlocking(() => _prop.SetValue(Block.Block, value));
OnPropertyChanged();
Block.RefreshModel();
}
}
public PropertyViewModel(ITerminalProperty<T> property, BlockViewModel blockViewModel) : base(blockViewModel)
{
Name = property.Id;
_prop = property;
}
}
public class PropertyViewModel : ViewModel
{
protected readonly BlockViewModel Block;
public PropertyViewModel(BlockViewModel blockViewModel)
{
Block = blockViewModel;
}
}
}