小调整

This commit is contained in:
suntao 2021-05-12 10:42:26 +08:00
parent a7ea02f70a
commit 53ec9c60ac
10 changed files with 42 additions and 73 deletions

View File

@ -1,26 +0,0 @@
using Mapbox.Directions;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Assets.Scenes.Ride.Scripts
{
public class PlayerFactory : MonoBehaviour
{
[SerializeField]
public GameObject _playerPrefab;
// Start is called before the first frame update
void Start()
{
if (_playerPrefab != null)
{
for (int i = 0; i < 100; i++)
{
Instantiate(_playerPrefab, new Vector3(i, 1, 0), Quaternion.identity);
}
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d3579ed37837f6c4cb6197c19a9ef8af
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

Before

Width:  |  Height:  |  Size: 291 KiB

After

Width:  |  Height:  |  Size: 291 KiB

View File

@ -100,5 +100,5 @@ TextureImporter:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleName: ab
assetBundleVariant:

View File

@ -62,7 +62,7 @@ namespace Assets.Scripts.Apis
user.ContactPhone = ret.data.ContactPhone;
user.ContactAddress = ret.data.ContactAddress;
user.Sensitivity = ret.data.Sensitivity;
if (ret.data.ConnectedToStrava != null)
//if (ret.data.ConnectedToStrava != null)
{
user.ConnectedToStrava = ret.data.ConnectedToStrava;
}
@ -224,7 +224,7 @@ namespace Assets.Scripts.Apis
return Newtonsoft.Json.JsonConvert.DeserializeObject<JsonResult<object>>(res);
}
public async Task<JsonResult<object>> Update(UserResultModel currUser, string filePath = "")
public JsonResult<object> Update(UserResultModel currUser, string filePath = "")
{
//return await PostAsync<JsonResult<dynamic>>("User/UpdateUserSetting", new {
// UID = currUser.Id,

View File

@ -4,8 +4,6 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ANT_Managed_Library;
using Assets.Scripts.UI.Prefab.Device;
using UnityEngine;
namespace Assets.Scripts.Devices.Ant
{
@ -36,6 +34,9 @@ namespace Assets.Scripts.Devices.Ant
private bool IsBackgroundScanning { get; set; }
//int searchingDeviceIndex = -1;
/// <summary>
/// 可以搜索的设备
/// </summary>
private List<AbstractAntDevice> deviceList = new List<AbstractAntDevice>();
public bool IsAvailable = false;
@ -43,17 +44,28 @@ namespace Assets.Scripts.Devices.Ant
/// 设备号,频道编号
/// </summary>
public readonly List<UserdChannel> usedChannels = new List<UserdChannel>();
/// <summary>
/// 搜索到的设备
/// </summary>
public readonly List<AbstractAntDevice> discoveredDevices = new List<AbstractAntDevice>();
private Action<AbstractAntDevice> _action;
private static AntConnector _antConnector;
public static AntConnector Instance(Action<AbstractAntDevice> action = null)
private Action<object> _log;
/// <summary>
///
/// </summary>
/// <param name="action">探索到新的设备</param>
/// <returns></returns>
public static AntConnector Instance(Action<AbstractAntDevice> action = null,
Action<object> log = null)
{
if (_antConnector == null)
{
_antConnector = new AntConnector();
_antConnector._action = action;
_antConnector._log = log;
}
return _antConnector;
@ -226,7 +238,7 @@ namespace Assets.Scripts.Devices.Ant
//设备断开连接
else if (antEventId == ANT_ReferenceLibrary.ANTEventID.EVENT_RX_FAIL_GO_TO_SEARCH_0x08)
{
Debug.Log(antEventId.ToString() + ", " + string.Join(",", response.messageContents));
_log?.Invoke(antEventId.ToString() + ", " + string.Join(",", response.messageContents));
var cc1 = usedChannels.Where(d => d.Index == channelIndex).FirstOrDefault();
var dd1 = discoveredDevices.SingleOrDefault(d => d.searchProfile.deviceNumber.ToString() == cc1.DeviceNumber && d.searchProfile.deviceType.ToString() == cc1.DeviceTypeId);
@ -300,24 +312,20 @@ namespace Assets.Scripts.Devices.Ant
if (device2 != null)
{
//ReSearch();
_action?.Invoke(device2);
if (device2.State == DeviceState.Connected)
{
device2.handleChannelResponse(response);
return;
}
else if (device2.State == DeviceState.Disconnected)
{
//else if (device2.State == DeviceState.Disconnected)
//{
//var deviceInfo = deviceService.Get(App.CurrentUser.Id, $"{ device2.searchProfile.deviceNumber }:{ device2.searchProfile.deviceType }");
//if (deviceInfo != null && deviceInfo.Paired)
//{
// device2.Connect();
//}
if(_action != null)
{
_action(device2);
}
}
//}
//}
return;
}
var device1 = deviceList.SingleOrDefault(d => d.searchProfile.deviceType == deviceTypeId);

View File

@ -796,9 +796,9 @@ public class LoginController : MonoBehaviour
/// <summary>
/// 去最后一页准备进入主场景
/// </summary>
async void goRegEnd()
void goRegEnd()
{
if (!await UpdateInfo()) return;
if (!UpdateInfo()) return;
if (pageNums == 5)
{
this.StartScrollPanel(4);
@ -839,7 +839,7 @@ public class LoginController : MonoBehaviour
/// 注册页2 修改信息
/// </summary>
/// <returns></returns>
async Task<bool> UpdateInfo()
bool UpdateInfo()
{
if (userResult == null) return false;
var _days = signForm.days.GetComponent<PFUIDropdown>();
@ -874,7 +874,7 @@ public class LoginController : MonoBehaviour
{
userResult.Nickname = userResult.Phone;
}
var r = await ConfigHelper.userApi.Update(userResult);
var r = ConfigHelper.userApi.Update(userResult);
return r.result;
//userResult.Birthday.v
}

View File

@ -19,13 +19,17 @@ public class MainController : MonoBehaviour
DeviceCache.Init(PFConstants.DeviceCacheFolder);
AntConnector.Instance((device2) => {
//自动连接
if (DeviceCache.Exist(device2))
if (device2.State == DeviceState.Disconnected)
{
Debug.Log("自动连接" + device2.DeviceNumber);
device2.Connect();
//Debug.Log($"探索到新的设备{ device2.DeviceNumber }");
//自动连接
if (DeviceCache.Exist(device2))
{
Debug.Log("自动连接" + device2.DeviceNumber);
device2.Connect();
}
}
});
}, Debug.Log);
//Debug.Log(Application.dataPath);

View File

@ -290,22 +290,16 @@ public class DeviceView : MonoBehaviour
break;
case SensorType.Cadence:
return "Cadence Sensor";
break;
case SensorType.HeartRate:
return "Heart Rate Monitor";
break;
case SensorType.Power:
return "Power Meter";
break;
case SensorType.Speed:
break;
case SensorType.SpeedCadence:
return "Speed Meter";
break;
case SensorType.Trainer:
return "Smart Trainer";
break;
case SensorType.VirtualPower:
break;
default:

View File

@ -293,7 +293,7 @@ public class EditUserController : PFUIPanel
//UIManager.ShowAlert("result.errMsg");
}
async void SaveFunc()
void SaveFunc()
{
var user = JsonConvert.DeserializeObject<UserResultModel>(JsonConvert.SerializeObject(App.CurrentUser));
user.Birthday = new DateTime(int.Parse(mYearDropdown.SelectedItem), int.Parse(mMonthDropdown.SelectedItem), int.Parse(mDayDropdown.SelectedItem));
@ -324,7 +324,7 @@ public class EditUserController : PFUIPanel
user.Contact = mName.Text;
user.ContactPhone = mPhone.Text;
user.ContactAddress = mAddr.Text;
var result = await userApi.Update(user);
var result = userApi.Update(user);
App.isChanged = false;
if (result.result == false)
{
@ -348,9 +348,9 @@ public class EditUserController : PFUIPanel
LoadDataSync();
}
async void ChangeAvatar(string path)
void ChangeAvatar(string path)
{
var r = await userApi.Update(App.CurrentUser, path);
var r = userApi.Update(App.CurrentUser, path);
App.isChanged = false;
if (r.result)
{