static void Main(string[] args) { // 创建数据库管理 DataMgr dataMgr = new DataMgr(); // 创建玩家管理实例 PlayerMgr playerMgr = new PlayerMgr(); //创建房间管理器实例 RoomMgr roomMgr = new RoomMgr(); // 创建服务器实例 GameServer serv = new GameServer(); // 打开服务器 serv.Start(7000, 7001); while (true) { string str = Console.ReadLine(); switch (str) { case "quit": serv.Close(); return; case "print": break; } } }
internal void LeaveGame() { if (GameServer != null) { GameServer.Close(); } if (GameClientConnection != null) { GameClientConnection.Close(); } }
public void Close() { if (client != null) { client.Dispose(); } if (server != null) { server.Close(); } if (multidataConnection != null) { multidataConnection.Dispose(); } if (syncIpConnection != null) { syncIpConnection.Dispose(); } }
public void Show(GameServer server, GameClient client) { while (true) { arena = ArenaGenerator.Generate(server.GameAssets, seed, biome_count); UpdateItems(); ConsoleBuffer mapbuf = arena.MapBuffer(tempView); buffer = new ConsoleBuffer(); buffer.InsertBuffer(mapbuf, 0, 0); buffer.SetCursorPosition(mapbuf.Width, 0); buffer.WriteVertical("".PadRight(25, '▌')); buffer.SetCursorPosition(mapbuf.Width, 7); buffer.Write("█".PadRight(30, '─')); buffer.SetCursorPosition(mapbuf.Width + 1, 1); this.ReadMenu(); if (Selected == proitems.Length - 1) { return; } if (Selected == proitems.Length - 2) { GameState gs = new GameState(arena, max_players, port, game_name); server.Open(gs); IPEndPoint ep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port); new ConnectingMenu().Show(client, ep); client.Close(); server.Close(); return; } } }
internal static void Shutdown() { Logger.LogInformation("Stopping network"); GameServer.Close(); }
public void OnDestroy() { GameServer.Close(); }
private void Window_Closed(object sender, EventArgs e) { GameServer.Close(); }