public override void Load() { Task.Run(() => { if (!Initialized) { Ressources.Load(); REGISTRY.Initialize(); Directory.CreateDirectory(Game.GetSaveFolder()); Rise.Ui.DefaultFont = Ressources.FontRomulus; Rise.Ui.DebugFont = Ressources.FontHack; Initialized = true; } _loadingDone = true; }); _sb = Rise.Graphic.CreateSpriteBatch(); }
private static void Main() { Rise.InitializeNoGraphic(new ServerPlatform()); Directory.CreateDirectory(Game.GetSaveFolder()); Ressources.Load(); REGISTRY.Initialize(); Console.WriteLine("\n"); while (true) { Console.WriteLine($"{Game.Name} Server v{Game.Version}\n"); var saves = Directory.GetDirectories(Game.GetSaveFolder()); for (int i = 0; i < saves.Length; i++) { Console.WriteLine($"{i}: {saves[i]}"); } Console.WriteLine(); Console.WriteLine("0-99: load world."); Console.WriteLine(" n: new world."); Console.WriteLine(" d: delete world."); Console.Write("\n> "); string input = Console.ReadLine(); if (input.ToLower() == "n") { Console.WriteLine(); Console.Write("World name: "); var worldName = Console.ReadLine(); Console.Write("World seed: "); var worldSeed = Console.ReadLine(); int seed = 0; if (!int.TryParse(worldSeed, out seed)) { seed = worldSeed.GetHashCode(); } GameState gameState = (GameState)Jobs.GenerateWorld .SetArguments(new Jobs.WorldGeneratorInfo(Game.GetSaveFolder() + worldName, seed, GENERATOR.DEFAULT)) .Start(false) .Result; gameState.Initialize(); var repport = Job.NewEmpty("SaveWorld"); repport.StatusChanged += (sender, e) => { Console.WriteLine(e); }; Jobs.SaveWorld .SetArguments(new Jobs.WorldSaveInfo(Game.GetSaveFolder() + worldName, gameState)) .Start(false); } else if (int.TryParse(input, out var levelindex)) { } Console.Clear(); } }