Exemplo n.º 1
0
        public async Task <PlayerUpdateResponse> UpdatePlayerLocation(double latitude, double longitude, double altitude)
        {
            SetCoordinates(latitude, longitude, altitude);
            var message = new PlayerUpdateMessage
            {
                Latitude  = _client.CurrentLatitude,
                Longitude = _client.CurrentLongitude
            };

            var updatePlayerLocationRequestEnvelope = RequestBuilder.GetRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.PlayerUpdate,
                RequestMessage = message.ToByteString()
            });

            var updateResponse =
                await PostProtoPayload <Request, PlayerUpdateResponse>(updatePlayerLocationRequestEnvelope);

            lock (Client._lock)
            {
                _client._map.Invoke(new MethodInvoker(delegate {
                    var userOverlay = _client._map.Overlays[4];
                    userOverlay.Markers[0].Position = new GMap.NET.PointLatLng(_client.CurrentLatitude, _client.CurrentLongitude);
                }));
            }

            return(updateResponse);
        }
Exemplo n.º 2
0
        public async Task <PlayerUpdateResponse> UpdatePlayerLocation(double latitude, double longitude, double altitude)
        {
            //SetCoordinates(latitude, longitude, altitude);

            // This needs to me removed from here
            Client.CurrentLatitude  = latitude;
            Client.CurrentLongitude = longitude;
            Client.CurrentAltitude  = altitude;
            string latlngalt = latitude.ToString(CultureInfo.InvariantCulture) + ":" + longitude.ToString(CultureInfo.InvariantCulture) + ":" + altitude.ToString(CultureInfo.InvariantCulture);

            File.WriteAllText(Directory.GetCurrentDirectory() + "\\Configs\\LastCoords.txt", latlngalt);
            //

            var message = new PlayerUpdateMessage
            {
                Latitude  = Client.CurrentLatitude,
                Longitude = Client.CurrentLongitude
            };

            Logger.Debug($"Calling Request UpdatePlayerLocation -> {latitude} / {longitude} / {altitude}");
            var updatePlayerLocationRequestEnvelope = await GetRequestBuilder().GetRequestEnvelope(new Request[] {
                new Request
                {
                    RequestType    = RequestType.PlayerUpdate,
                    RequestMessage = message.ToByteString()
                }
            }).ConfigureAwait(false);

            return(await PostProtoPayload <Request, PlayerUpdateResponse>(updatePlayerLocationRequestEnvelope).ConfigureAwait(false));
        }
Exemplo n.º 3
0
        public async Task <PlayerUpdateResponse> UpdatePlayerLocation(double latitude, double longitude, double altitude)
        {
            SetCoordinates(latitude, longitude, altitude);
            var message = new PlayerUpdateMessage
            {
                Latitude  = Client.CurrentLatitude,
                Longitude = Client.CurrentLongitude
            };

            var updatePlayerLocationRequestEnvelope = RequestBuilder.GetRequestEnvelope(
                new Request
            {
                RequestType    = RequestType.PlayerUpdate,
                RequestMessage = message.ToByteString()
            });

            return(await PostProtoPayload <Request, PlayerUpdateResponse>(updatePlayerLocationRequestEnvelope));
        }
Exemplo n.º 4
0
        public async Task<PlayerUpdateResponse> UpdatePlayerLocation(double latitude, double longitude, double altitude)
        {
            SetCoordinates(latitude, longitude, altitude);
            var message = new PlayerUpdateMessage
            {
                Latitude = _client.CurrentLatitude,
                Longitude = _client.CurrentLongitude
            };

            var updatePlayerLocationRequestEnvelope = RequestBuilder.GetRequestEnvelope(
                new Request
                {
                    RequestType = RequestType.PlayerUpdate,
                    RequestMessage = message.ToByteString()
                });

            return await PostProtoPayload<Request, PlayerUpdateResponse>(updatePlayerLocationRequestEnvelope);
        }