public void doGameTransition() { GameStateMars gsm = new GameStateMars(Content, game); network.setGSM(gsm); network.unloadBufferedMap(); game.doStateTransition(gsm); }
public NetworkInterface(string address, ContentManager c) { Console.WriteLine("Hello"); bufferedMap = new List<string>(); bufferedPlayers = new List<string>(); messagesReceived = 0; sock = new WebSocket(address); game = null; Content = c; connected = false; mapLoaded = false; roomNumber = -1; sock.OnMessage += (sender, e) => { byte[] r = e.RawData; string s = System.Text.Encoding.UTF8.GetString(r); doNetworkInput(s); }; sock.OnOpen += (sender, e) => { connected = true; startTime = DateTime.Now; Console.WriteLine("Connected"); }; sock.OnClose += (sender, e) => { Console.WriteLine("Ran onclose"); connected = false; mapLoaded = false; }; sock.OnError += (sender, e) => { if (e.Message == "An error has occurred while connecting.") { connected = false; generateMap(); onReady(); } }; sock.ConnectAsync(); }
public void setGSM(GameStateMars gsm) { game = gsm; gsm.setNetworkInterface(this); }