Rename to Torch, add command system

This commit is contained in:
John Gross
2016-12-17 01:59:03 -08:00
parent 7d51ac9295
commit fb521abbda
85 changed files with 366 additions and 354 deletions

View File

@@ -0,0 +1,38 @@
using System;
namespace Torch.Server.ViewModels
{
public class ChatItemInfo : ViewModel
{
private PlayerInfo _sender;
private string _message;
private DateTime _timestamp;
public PlayerInfo Sender
{
get { return _sender; }
set { _sender = value; OnPropertyChanged(); }
}
public string Message
{
get { return _message; }
set { _message = value; OnPropertyChanged(); }
}
public DateTime Timestamp
{
get { return _timestamp; }
set { _timestamp = value; OnPropertyChanged(); }
}
public string Time => Timestamp.ToShortTimeString();
public ChatItemInfo(PlayerInfo sender, string message)
{
_sender = sender;
_message = message;
_timestamp = DateTime.Now;
}
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sandbox.Engine.Utils;
using VRage.Game;
using VRage.Game.ModAPI;
namespace Torch.Server.ViewModels
{
public class ConfigDedicatedViewModel : ViewModel
{
public IMyConfigDedicated Config { get; }
public MTObservableCollection<string> Administrators { get; } = new MTObservableCollection<string>();
public MTObservableCollection<ulong> BannedPlayers { get; } = new MTObservableCollection<ulong>();
public int AsteroidAmount
{
get { return Config.AsteroidAmount; }
set { Config.AsteroidAmount = value; OnPropertyChanged(); }
}
public ConfigDedicatedViewModel(IMyConfigDedicated config)
{
Config = config;
Config.Administrators.ForEach(x => Administrators.Add(x));
Config.Banned.ForEach(x => BannedPlayers.Add(x));
}
public void FlushConfig()
{
Config.Administrators = Administrators.ToList();
}
}
}