Ejemplo n.º 1
0
        public IEnumerable<object> HandleMessages(string session, IEnumerable<Message> msgs)
        {
            Connection conn;

              if (allConnections.ContainsKey(session))
              {
            var x = allConnections[session];
            x.Time = DateTime.Now;
            conn = x.Conn;
              }
              else
              {
            conn = new Connection(lastId++);

            // First notify other connections...
            game.Connections.OnNext(conn);
            // ...then add to allConnections (so newPlayer isn't send to own connection)
            allConnections.Add(session, new TimeConnection { Time = DateTime.Now, Conn = conn });
              }

              foreach (var msg in msgs)
            conn.Messages.OnNext(msg);

              return conn.GenerateOutput();
              //return game.HandleMessages(session, msgs);
        }
Ejemplo n.º 2
0
        public IEnumerable<object> HandleMessages(string session, IEnumerable<Message> msgs)
        {
            Connection conn;

              if (allConnections.ContainsKey(session))
              {
            conn = allConnections[session];
              }
              else
              {
            conn = new Connection(lastId++);

            // First notify other connections...
            connectionJoins.OnNext(conn);
            // ...then add to allConnections (so newPlayer isn't send to own connection)
            allConnections.Add(session, conn);
              }

              foreach (var msg in msgs)
            conn.Messages.OnNext(msg);

              conn.LastCheckin = DateTime.Now;

              return conn.GenerateOutput();
        }