static async Task RunServer() { Game game = new Game(); Task gameLoop = game.MainLoop(); Console.WriteLine("game started"); using (var server = new Acoross.Network.Rpc.RpcServer(System.Net.IPAddress.Any, 7777)) { server.SetSessionBuilder(sock => { var session = new TWSession(game, sock); session.OnEnd(t => { session.OnEnd2(); }); Console.WriteLine($"{sock.RemoteEndPoint} connected"); return(session); }); Task serverTask = server.Start(); Console.WriteLine("server started"); await Task.WhenAll(serverTask, gameLoop); } }
public PlayerObject(Game game, TWSession session, string name) : base(game) { this.session = session; this.name = name; }