//[TestMethod] public void CanOpenAndCloseStarMade() { using (var commander = new ClientCommander()) { commander.OpenCommandPrompt(); bool serverStarted = commander.RunStarMadeServer(); Assert.IsTrue(serverStarted); // Allow it to run for about two minutes, // to be sure that the game has started up // and will accept commands. Thread.Sleep(120000); commander.Shutdown(30); Assert.IsFalse(commander.IsClientAlive); } }
public IEnumerator DoInit() { yield return(ResourceManager.Init()); yield return(_LifeCycle.Singletons.InitCoroutine(0, RefreshProgress)); GameEnv._InputManager = new GameObject("_InputManager").AddComponent <InputManager>(); string mapPath = "Game/Map/CactusPack/World"; yield return(World.DoLoadMap(mapPath)); //这里先客户端生成一个local player _localPlayer = new GameObject("_localPlayer").AddComponent <Player>(); // _clientCommander = gameObject.AddComponent <ClientCommander>(); }
internal static void Main(string[] args) { Console.WriteLine("Penumbra is started."); using (var commander = new ClientCommander()) { DaemonLord.CreateThread(); try { commander.OpenCommandPrompt(); commander.RunStarMadeServer(); commander.PerformStartupActions(); Console.WriteLine("\r\nStarMade is running."); Console.WriteLine("Admins can use !RESTART [Duration] and !SHUTDOWN [Duration] from a StarMade client."); // Block the process from ending until the commander // is ready to 'die' off. while (commander.ShouldKeepLiving) { } DaemonLord.RunDaemons = false; } catch (Exception ex) { Console.WriteLine($"Exception: {ex.Message}"); Console.WriteLine($"Stack Trace: {ex.StackTrace}"); Console.WriteLine("\r\nPress any key to exit."); Console.ReadLine(); } finally { // TODO: Dispatch Error Email or create server log dump. DaemonLord.Thread.Abort(); commander.ForceKill(); } } Console.WriteLine("Penumbra is shut down. Press Enter to exit."); Console.ReadLine(); }