Merge remote-tracking branch 'origin/dev_lishuo' into dev

This commit is contained in:
suntao committed 2021-06-08 13:07:48 +08:00
commit 1020632757
15 files changed
+139 -67

No files matched your search

+3 -2
View File
@@ -3,6 +3,7 @@ using Assets.Scenes.Ride.Scripts.Model;
using Assets.Scripts.Apis.Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -91,7 +92,7 @@ namespace Assets.Scripts.Apis
public async Task<JsonResult<List<NearRouteModel>>> GetNearRouteAsync(float lat, float lng, float zoom, string bounds)
{
var res = await GetAsync<JsonResult<List<NearRouteModel>>>($"/Map/GetNearRoute?lat={ lat }&lng={ lng }&zoom={zoom}&bounds={ bounds }");
var res = await GetAsync<JsonResult<List<NearRouteModel>>>($"/Map/GetNearRoute?lat={ lat.ToString(CultureInfo.InvariantCulture) }&lng={ lng.ToString(CultureInfo.InvariantCulture) }&zoom={zoom.ToString(CultureInfo.InvariantCulture)}&bounds={ bounds }");
//var result = System.Text.Encoding.UTF8.GetString(res);
return res;
@@ -142,7 +143,7 @@ namespace Assets.Scripts.Apis
public async Task<JsonResult<object>> GetEarthData(double lat, double lon)
{
//CultureInfo.InvariantCulture
var result = await GetAsync<JsonResult<object>>($"Map/GetEarthData?lat={ lat }&lon={ lon }");
var result = await GetAsync<JsonResult<object>>($"Map/GetEarthData?lat={ lat.ToString(CultureInfo.InvariantCulture) }&lon={ lon.ToString(CultureInfo.InvariantCulture) }");
return result;
}
+2 -1
View File
@@ -2,6 +2,7 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
@@ -18,7 +19,7 @@ namespace Assets.Scripts.Apis
}
public async Task<Stream> GetMapImage(IpToGeoModel locationInfo)
{
return await GetThirdPartStreamAsync($"https://api.mapbox.com/styles/v1/juzetest/ckmkdjwsa1nvt17nr1ps4fqgs/static/{locationInfo.longitude},{locationInfo.latitude},12,0/1280x1280?access_token=pk.eyJ1IjoianV6ZXRlc3QiLCJhIjoiY2ttazhsbnpiMGVrdjJucGhyNnh6eXcxYSJ9.6zj2U9eFCNJRMljNlMxjVg");
return await GetThirdPartStreamAsync($"https://api.mapbox.com/styles/v1/juzetest/ckmkdjwsa1nvt17nr1ps4fqgs/static/{locationInfo.longitude.ToString(CultureInfo.InvariantCulture)},{locationInfo.latitude.ToString(CultureInfo.InvariantCulture)},12,0/1280x1280?access_token=pk.eyJ1IjoianV6ZXRlc3QiLCJhIjoiY2ttazhsbnpiMGVrdjJucGhyNnh6eXcxYSJ9.6zj2U9eFCNJRMljNlMxjVg");
//pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA
//pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA
}
+4 -4
View File
@@ -65,10 +65,10 @@ public static class App
static App()
{
CultureInfo currentCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
currentCulture.NumberFormat.NumberDecimalSeparator = ".";
Thread.CurrentThread.CurrentCulture = currentCulture;
System.Globalization.CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
//CultureInfo currentCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
//currentCulture.NumberFormat.NumberDecimalSeparator = ".";
//Thread.CurrentThread.CurrentCulture = currentCulture;
//System.Globalization.CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
#if !UNITY_EDITOR
// Host = "http://pf.juze.pro/";
// UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000);
+2 -1
View File
@@ -11,11 +11,12 @@ using UnityEngine;
namespace Assets.Scripts.Devices.Ble.Devices
{
public class Tacx : BleDevice, IPowerDevice, ICadenceDevice, ISpeedDevice, ITrainerDevice
public class Tacx : BleDevice, IPowerDevice, ICadenceDevice, ISpeedDevice, ITrainerDevice, IRequiresRiderWeight
{
public int Power { get => tacxFecNotify.Power; set => throw new NotImplementedException(); }
public int Cadence { get => tacxFecNotify.Cadence; set => throw new NotImplementedException(); }
public double Speed { get => tacxFecNotify.Speed; set => throw new NotImplementedException(); }
public double RiderWeight { get; set; }
private List<BleServiceInfo> Services;
+20 -1
View File
@@ -1,4 +1,5 @@
using System;
using Assets.Scripts.Devices.Ant;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -171,6 +172,24 @@ namespace Assets.Scripts.Ble
return ServiceUuids.Services.Single(s => s.IdByteArray == type);
}
public static Guid GetBySensor(SensorType sensor)
{
switch (sensor)
{
case SensorType.Cadence:
case SensorType.SpeedCadence:
return Get(ServiceUuids.CyclingSpeedCadence).IdGuid;
case SensorType.HeartRate:
return Get(ServiceUuids.HeartRate).IdGuid;
case SensorType.Power:
return Get(ServiceUuids.PowerBeam).IdGuid;
case SensorType.Trainer:
return Get(ServiceUuids.TacxBle).IdGuid;
default:
return Guid.Empty;
}
}
public static class Characteristics
{
@@ -16,6 +16,7 @@ using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using Mapbox.Examples;
using DG.Tweening;
using System.Globalization;
public class BigMapController : PFUIPanel
{
@@ -241,7 +242,7 @@ public class BigMapController : PFUIPanel
//Screen.width
//map.WorldToGeoPosition(start)
var bounds = $"{ start.y },{ start.x };{ end.y },{ end.x }";
var bounds = $"{ start.y.ToString(CultureInfo.InvariantCulture) },{ start.x.ToString(CultureInfo.InvariantCulture) };{ end.y.ToString(CultureInfo.InvariantCulture) },{ end.x.ToString(CultureInfo.InvariantCulture) }";
var res = await mapApi.GetNearRouteAsync((float)mapManager.CenterLatitudeLongitude.x, (float)mapManager.CenterLatitudeLongitude.y,
mapManager.Zoom, bounds);
if(res.result == false)
@@ -243,8 +243,8 @@ public class EarthController : PFUIPanel
{
//Debug.Log("click");
Vector2 latLon = Conversion.GetLatLonFromSpherePoint(sphereLocation);
Debug.Log("Clicked on Latitude: " + latLon.x + ", Longitude: " + latLon.y);
//Vector2 latLon = Conversion.GetLatLonFromSpherePoint(sphereLocation);
//Debug.Log("Clicked on Latitude: " + latLon.x + ", Longitude: " + latLon.y);
}
@@ -7,6 +7,7 @@ using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using UnityEngine;
@@ -308,12 +309,12 @@ public class EditUserController : PFUIPanel
Utils.showToast(gameObject, "Please fill in the information");//请填写相关信息
return;
}
user.FTP = int.Parse(mFTP.Text);
user.Height = int.Parse(mHeight.Text);
user.Weight = double.Parse(mWeight.Text);
user.MaxHeartRate = int.Parse(mMHR.Text);
user.BicycleWeight = double.Parse(mBW.Text);
user.WheelDiameter = int.Parse(mWD.Text);
user.FTP = Convert.ToInt32(mFTP.Text, CultureInfo.InstalledUICulture); //int.Parse(mFTP.Text);
user.Height = Convert.ToInt32(mHeight.Text, CultureInfo.InstalledUICulture); //int.Parse(mHeight.Text);
user.Weight = Convert.ToDouble(mWeight.Text, CultureInfo.InstalledUICulture); //double.Parse(mWeight.Text);
user.MaxHeartRate = Convert.ToInt32(mMHR.Text, CultureInfo.InstalledUICulture); //int.Parse(mMHR.Text);
user.BicycleWeight = Convert.ToDouble(mBW.Text, CultureInfo.InstalledUICulture); //double.Parse(mBW.Text);
user.WheelDiameter = Convert.ToInt32(mWD.Text, CultureInfo.InstalledUICulture); //int.Parse(mWD.Text);
user.Unit = mUnitDropdown.SelectedIndex;
user.Contact = mName.Text;
user.ContactPhone = mPhone.Text;