diff --git a/Assets/Resources/UI/Prefab/Panel/Mobile/ResultListPanel.prefab b/Assets/Resources/UI/Prefab/Panel/Mobile/ResultListPanel.prefab index 98f95e80..6f861216 100644 --- a/Assets/Resources/UI/Prefab/Panel/Mobile/ResultListPanel.prefab +++ b/Assets/Resources/UI/Prefab/Panel/Mobile/ResultListPanel.prefab @@ -95,7 +95,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &3111753855602397197 RectTransform: m_ObjectHideFlags: 0 @@ -1615,7 +1615,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &1724308109339741718 RectTransform: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/UI/Prefab/Rower.meta b/Assets/Resources/UI/Prefab/Rower.meta deleted file mode 100644 index fdaa594c..00000000 --- a/Assets/Resources/UI/Prefab/Rower.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c3d55e1747cadce45aef1d770b8f95bd -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Resources/UI/Prefab/Rower/Mobile.meta b/Assets/Resources/UI/Prefab/Rower/Mobile.meta deleted file mode 100644 index 68400ef3..00000000 --- a/Assets/Resources/UI/Prefab/Rower/Mobile.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a1e43bb033650884fa2d63c2b3705140 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Apis/Models/DeviceDetail.cs b/Assets/Scripts/Apis/Models/DeviceDetail.cs new file mode 100644 index 00000000..1ae0f6e0 --- /dev/null +++ b/Assets/Scripts/Apis/Models/DeviceDetail.cs @@ -0,0 +1,30 @@ +using System; + +namespace Assets.Scripts.Apis.Models +{ + public class DeviceDetail + { + public int Id { get; set; } + + public string Name { get; set; } + + public int? AntManufacturerId { get; set; } + + public int? AntModelId { get; set; } + + public string AdvertisingData { get; set; } + + public bool SupportsBluetooth { get; set; } + + public bool SupportsAnt { get; set; } + + //public SensorType SensorType { get; set; } + + public int? PairingHelpId { get; set; } + + public int? BestPracticesId { get; set; } + + public DateTime Updated { get; set; } + + } +} diff --git a/Assets/Scripts/Apis/Models/DeviceDetail.cs.meta b/Assets/Scripts/Apis/Models/DeviceDetail.cs.meta new file mode 100644 index 00000000..8d10e962 --- /dev/null +++ b/Assets/Scripts/Apis/Models/DeviceDetail.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7d697543a3cdf6f46adc75828232116d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Apis/UserApi.cs b/Assets/Scripts/Apis/UserApi.cs index 2913f6f3..d3074cb8 100644 --- a/Assets/Scripts/Apis/UserApi.cs +++ b/Assets/Scripts/Apis/UserApi.cs @@ -293,6 +293,10 @@ namespace Assets.Scripts.Apis { return await GetAsync>("/home/getversions"); } + public async Task>> GetDeviceList() + { + return await GetAsync>>("/home/GetDeviceList"); + } public async Task> ResetPassword(string phone, string captcha, string newPwd) { return await PostAsync>("NoAuth/v1/ResetPassword", new {phone,captcha,newPwd }); diff --git a/Assets/Scripts/App.cs b/Assets/Scripts/App.cs index 1c5f3fa5..e24719d3 100644 --- a/Assets/Scripts/App.cs +++ b/Assets/Scripts/App.cs @@ -1,21 +1,13 @@ using Assets.Scripts.Apis.Models; -using Assets.Scripts.UI.Prefab.Login; -using Assets.Scenes.Ride.Scripts.Model; -using System.Collections; +using Assets.Scenes.Ride.Scripts.Model; using System.Collections.Generic; using UnityEngine; using System.Net; -using System.Globalization; -using System.Threading; using Assets.Scripts.Devices; -using Assets.Scripts; using System; -using System.Threading.Tasks; -using System.Timers; using Newtonsoft.Json; using Facebook.Unity; using Assets.Scenes.Ride.Scripts; -using System.Linq; public delegate void ChangeLanguageDelegate(); @@ -61,6 +53,8 @@ public static class App //全局用,弹多个广告 public static Queue adQueue; + public static List deviceList; + public static RideSetting RideSetting = new RideSetting(); public static string pageName { get; set; } public static int firstEnter { get; set; } diff --git a/Assets/Scripts/Scenes/MainController.cs b/Assets/Scripts/Scenes/MainController.cs index 7d262f8f..5235a4a2 100644 --- a/Assets/Scripts/Scenes/MainController.cs +++ b/Assets/Scripts/Scenes/MainController.cs @@ -365,9 +365,17 @@ public class MainController : BaseScene } ShowGameRoomInviteConfirm(); UIManager.UpdateJoinCompetition();//查询当前我参加的赛事 + //await GetDeviceListAsync(); PC品牌 } - + private async Task GetDeviceListAsync() + { + var result = await ConfigHelper.userApi.GetDeviceList(); + if (result != null && result.result) + { + App.deviceList = result.data; + } + } float emptyt = 0;//用于无消息计时 float t = 1f; float scanTicks = 0; diff --git a/Assets/Scripts/Scenes/Ride/Scripts/AbstractPlayer.cs b/Assets/Scripts/Scenes/Ride/Scripts/AbstractPlayer.cs index d16e0b2a..73bc90e7 100644 --- a/Assets/Scripts/Scenes/Ride/Scripts/AbstractPlayer.cs +++ b/Assets/Scripts/Scenes/Ride/Scripts/AbstractPlayer.cs @@ -293,7 +293,7 @@ namespace Assets.Scenes.Ride.Scripts currentSlope = pointList[CurrentIndex].Grade; //格式化坡度最大不能超过15,-15 PreSlope = PreSlope > 0 ?Math.Min(PreSlope, 15) : Math.Max(PreSlope, -15); - currentSlope = currentSlope > 0? Math.Min(PreSlope, 15) : Math.Max(PreSlope, -15); + currentSlope = currentSlope > 0? Math.Min(currentSlope, 15) : Math.Max(currentSlope, -15); CurrentDistance = pointList[CurrentIndex].Distance; //计算下一个海拔和坡度&当前区间距离 nextSlope = pointList[nextIndex].Grade > 0 ? Math.Min(pointList[nextIndex].Grade, 15) : Math.Max(pointList[nextIndex].Grade, -15); diff --git a/Assets/Scripts/Scenes/Ride/Scripts/DeviceServiceMonoBase.cs b/Assets/Scripts/Scenes/Ride/Scripts/DeviceServiceMonoBase.cs index 30647738..20959527 100644 --- a/Assets/Scripts/Scenes/Ride/Scripts/DeviceServiceMonoBase.cs +++ b/Assets/Scripts/Scenes/Ride/Scripts/DeviceServiceMonoBase.cs @@ -38,25 +38,36 @@ namespace Assets.Scenes.Ride.Scripts { (_device as IRequiresRiderWeight).RiderWeight = App.CurrentUser.Weight; } - if (_device.Network == NetworkType.ANT) - { - var antDevice = _device as AbstractAntDevice; - ManufacturerId = antDevice.ManufacturerId; - AntModelId = antDevice.AntModelId; - DeviceNumber = $"{ antDevice.DeviceNumber },{ antDevice.DeviceType}"; - } - else - { - var bleDevice = _device as BleDevice; - DeviceNumber = $"{ Helper.FormateMacAddress(bleDevice.Address) },{ ServiceUuids.GetBySensor(bleDevice.Sensor) }"; - ManufacturerName = bleDevice.Name + "," + bleDevice.Network + "," + bleDevice.Sensor; - } + SetDeviceInfo(); } return _device; } } + private void SetDeviceInfo() + { + if (_device.Network == NetworkType.ANT) + { + var antDevice = _device as AbstractAntDevice; + if (antDevice != null) + { + ManufacturerId = antDevice.ManufacturerId > 0 ? antDevice.ManufacturerId : ManufacturerId; + AntModelId = antDevice.AntModelId > 0 ? antDevice.AntModelId : AntModelId; + DeviceNumber = $"{ antDevice.DeviceNumber },{ antDevice.DeviceType}"; + } + } + else + { + var bleDevice = _device as BleDevice; + if (bleDevice != null) + { + DeviceNumber = $"{ Helper.FormateMacAddress(bleDevice.Address) },{ ServiceUuids.GetBySensor(bleDevice.Sensor) }"; + ManufacturerName = bleDevice.Name + "," + bleDevice.Network + "," + bleDevice.Sensor; + } + } + } + /// /// 更新速度(KM/H) /// @@ -130,6 +141,10 @@ namespace Assets.Scenes.Ride.Scripts public bool CheckAnt() { //_antConnector = AntConnector.Instance(); + if (_device == null || App.CurrentUser.FTP <= 0) + { + return false; + } var devices = App.MainDeviceAdapter.GetDevices().Where(d => d.State == DeviceState.Connected && (d.Sensor == SensorType.Trainer || d.Sensor == SensorType.Power)); if (devices.Count() > 0) { @@ -138,34 +153,12 @@ namespace Assets.Scenes.Ride.Scripts { (_device as IRequiresRiderWeight).RiderWeight = App.CurrentUser.Weight; } - if (_device.Network == NetworkType.ANT) - { - var antDevice = _device as AbstractAntDevice; - ManufacturerId = antDevice.ManufacturerId; - AntModelId = antDevice.AntModelId; - DeviceNumber = $"{ antDevice.DeviceNumber },{ antDevice.DeviceType}"; - } - else - { - var bleDevice =_device as BleDevice; - DeviceNumber = $"{ bleDevice.Address },{ bleDevice.Sensor }"; - ManufacturerName = bleDevice.Name + " " + bleDevice.Network + " " + bleDevice.Sensor; - } - + SetDeviceInfo(); } else { return false; } - if (App.CurrentUser.FTP <= 0) - { - return false; - } - if (_device == null) - { - - return false; - } return true; } //设备列表 diff --git a/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs b/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs index 11f72da3..30c8d410 100644 --- a/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs +++ b/Assets/Scripts/Scenes/Ride/Scripts/PlayerController.cs @@ -1,13 +1,8 @@ using UnityEngine; -using Assets.Scenes.Ride.Scripts.Model; -using UnityEngine.SceneManagement; -using System.Collections.Generic; -using System.Linq; -using Assets.Scenes.Ride.Scripts.Model.RiderModels; using System; -using ChartAndGraph; using DG.Tweening; using System.Collections; +using Assets.Scenes.Ride.Scripts.Model; using Assets.Scenes.Ride.Scripts.Model.CyclingModels; namespace Assets.Scenes.Ride.Scripts @@ -159,10 +154,6 @@ namespace Assets.Scenes.Ride.Scripts } #endregion - //public void InitGraph(int index) - //{ - // chartDataSourceScript.InitHorizontalScrolling(index); - //} //移动海拔图头像 protected override void MoveGraphHead(bool init = false) { diff --git a/Assets/Scripts/UI/Prefab/ResultList/ResultListController.cs b/Assets/Scripts/UI/Prefab/ResultList/ResultListController.cs index 32bfdd6b..279835d7 100644 --- a/Assets/Scripts/UI/Prefab/ResultList/ResultListController.cs +++ b/Assets/Scripts/UI/Prefab/ResultList/ResultListController.cs @@ -96,26 +96,16 @@ public class ResultListController : PFUIPanel UIManager.AddEvent(matchScroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag); } scrolls = new Transform[] { routeScroll, matchScroll}; - //GetList(0); + GetList(0); GetList(1); -#if UNITY_ANDROID || UNITY_IOS - GetList(2); -#endif } public void Load() { - Debug.Log("刷新show"); - //Refresh(contents[0]); - if (contents != null && contents.Length == 3) + if (contents != null && contents.Length == 2) { - Debug.Log("刷新show进入"); Refresh(contents[scrollIndex]); } - //if (scroll!=null) - //{ - // scroll.transform.Find("Error").gameObject.SetActive(false); - //} } private void OnEndDrag(BaseEventData e)