Esempio n. 1
0
        public async void OnInsertPointReqAsync(InsertPointReq packet, User user)
        {
            var id = await Sql.Instance.InsertPointAsync(packet.ZoneId, packet.Lat, packet.Lng, packet.Index);

            _server.Send(user, new InsertPointAck()
            {
                PointId = id
            });

            lock (Server.Dto.Zones)
            {
                var zone = Server.Dto.Zones.First(z => z.Id == packet.ZoneId.ToString());
                zone.Geometry.Insert(packet.Index, new Geometry(packet.Lat, packet.Lng, id));
            }

            _server.SendToEveryoneExcept(new PointUpdatedAck()
            {
                Added   = true,
                PointId = id,
                Lat     = packet.Lat,
                Lng     = packet.Lng,
                ZoneId  = packet.ZoneId,
                Index   = packet.Index
            }, user.IpPort);
        }
Esempio n. 2
0
        public async void OnInsertPointReqAsync(InsertPointReq packet, string ipPort)
        {
            var id = await Sql.Instance.InsertPointAsync(packet.ZoneId, packet.Lat, packet.Lng, packet.Index);

            _server.Send(ipPort, new InsertPointAck()
            {
                PointId = id
            });

            _server.SendToEveryoneExcept(new PointUpdatedAck()
            {
                Added   = true,
                PointId = id,
                Lat     = packet.Lat,
                Lng     = packet.Lng,
                ZoneId  = packet.ZoneId,
                Index   = packet.Index
            }, ipPort);
        }