适配v1表头,性能优化一波

This commit is contained in:
CaiYanPeng 2022-05-11 17:11:48 +08:00
parent edc629ed75
commit be687d6b77
10 changed files with 282 additions and 162 deletions

View File

@ -21,7 +21,7 @@ public delegate void ChangeLanguageDelegate();
public static class App
{
public static string Host = "http://192.168.0.101:5087/";
public static string Host = "http://192.168.0.101:5083/";
public static string AppVersion = Application.version;

View File

@ -13,6 +13,6 @@ namespace Assets.Scripts.Devices.Ant.Interfaces
FtmsRowerData rowerData { get; }
void Reset();
void SetResistanceLevel(ushort v);
void C2GetStatus();
void C2GetStatus(byte[] bs);
}
}

View File

@ -11,7 +11,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
{
public class C2RowerData : ICharacteristic, IRowerCommonData
{
public Guid Uuid => ServiceUuids.Characteristics.C2RowerData;
public Guid Uuid => ServiceUuids.Characteristics.C2RowerData35;
public Guid ServiceUuid => ServiceUuids.Characteristics.C2Service;
@ -56,25 +56,29 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
public void HandleAttributeReceived(byte[] data)
{
Debug.Log("数据" + string.Join(",", data));
if (data[0] == 53)
if (data[0] == 0x35)
{
PeakDriveForce = LbsToNewton(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 13)) / 10,true);
PeakDriveForce = LbsToNewton(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 13)) / 10, true);
AverageDriveForce = LbsToNewton(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 15)) / 10, true);
ElapsedTime = (int)(Convert.ToDouble(BitConvertHelper.ToUInt24(data, 1)) / 100);
TotalDistance = (uint)(Convert.ToDouble(BitConvertHelper.ToUInt24(data, 4)) / 10);
StrokeCount = BitConvertHelper.ToUInt16(data, 19);
Debug.Log($"峰力值:{PeakDriveForce} 均力值{AverageDriveForce}");
}
else if (data[0] == 61)
else if (data[0] == 0x3d)
{
//老款表头不支持
List<ushort> r = new List<ushort>();
for (int i = 3; i < data.Length; i += 2)
{
ushort pull = data[i] < 10 ? (ushort)0 : Convert.ToUInt16(Math.Round(LbsToNewton(data[i], true)));
ushort pull = Convert.ToUInt16(Math.Round(LbsToNewton(data[i], true)));//data[i] < 10 ? (ushort)0 : Convert.ToUInt16(Math.Round(LbsToNewton(data[i], true)));
r.Add(pull);
PullValue = pull;
}
Debug.Log("拉力曲线:" + string.Join(",", r));
}
else if (data[0] == 49)
else if (data[0] == 0x31)
{
byte status = data[18];
int value = (data[17] << 16) + (data[16] << 8) + data[15];
@ -90,26 +94,114 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
rowerType.type = 2;
rowerType.value = value / 100;
}
else
else
{
rowerType = null;
}
//isReadyStatus = data[9] == 0;
var time = ((data[3] << 16) + (data[2] << 8) + data[1]) / 100;
Debug.Log("划船时间"+time);
Debug.Log("划船时间" + time);
isReadyStatus = data[9] == 0;
if (RowerResChanged != null)
{
RowerResChanged.Invoke(data[19], new EventArgs());
}
ResistanceLevel = data[19];
//isReadyStatus = data[2] == 1 || data[2] == 129;
}
else if (data[0] == 0x32)
{
InstantaneousPace = (ushort)(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 8)) / 100);
AveragePace = (ushort)(Convert.ToDouble(BitConvertHelper.ToUInt16(data, 10)) / 100);
//AveragePower = BitConvertHelper.ToUInt16(data, 17);
StrokeRate = (uint)data[6];
}
else if (data[0] == 0x33)
{
TotalEnergy = BitConvertHelper.ToUInt16(data, 7);
AveragePower = BitConvertHelper.ToUInt16(data, 5);
}
else if (data[0] == 0x36)
{
InstantaneousPower = BitConvertHelper.ToUInt16(data, 4);
//TotalEnergy = BitConvertHelper.ToUInt16(data, 6);
}
//else if (data[0] == 0x39)
//{
// AverageStrokeRate = (int)data[11];
// ResistanceLevel = (int)data[16];
//}
//else if (data[0] == 34)
//{
// isReadyStatus = data[2] == 1 || data[2] == 129;
//}
}
public event EventHandler StartEvent;
private double LbsToNewton(double lbs,bool isKg = false) => 4.4482216 * lbs * (isKg ? (1f / 9.8f) : 1f);
public void SetUnavailable()
{
//throw new NotImplementedException();
}
/// <summary>
/// 划桨频率
/// </summary>
public uint StrokeRate { get; set; } = 0;
/// <summary>
/// 划桨次数
/// </summary>
public UInt16 StrokeCount { get; set; } = 0;
/// <summary>
/// 平均划桨频率
/// </summary>
public int AverageStrokeRate { get; set; } = 0;
public UInt32 TotalDistance { get; set; } = 0;
public UInt16 _instantaneousPace = 0;
/// <summary>
/// 即时配速
/// </summary>
public UInt16 InstantaneousPace {
get => _instantaneousPace;
set
{
if (_instantaneousPace == 0 && value != 0 && StartEvent != null)
{
StartEvent.Invoke(null, new EventArgs());
}
_instantaneousPace = value;
}
}
/// <summary>
/// 平均配速
/// </summary>
public UInt16 AveragePace { get; set; } = 0;
public int InstantaneousPower { get; set; } = 0;
public int AveragePower { get; set; } = 0;
public int ElapsedTime { get; set; } = 0;
public int TotalEnergy { get; set; } = 0;
public int EnergyPerHour { get; set; } = 0;
public int EnergyPerMinute { get; set; } = 0;
public event EventHandler RowerResChanged;
public int ResistanceLevel { get; set; } = 0;
public void Reset()
{
this.StrokeRate = 0;
this.StrokeCount = 0;
this.AverageStrokeRate = 0;
this.TotalDistance = 0;
this.InstantaneousPace = 0;
this.AveragePace = 0;
this.InstantaneousPower = 0;
this.AveragePower = 0;
this.ResistanceLevel = 0;
this.TotalEnergy = 0;
this.EnergyPerHour = 0;
this.EnergyPerMinute = 0;
this.ElapsedTime = 0;
}
}
}

View File

@ -15,30 +15,42 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
/// <summary>
/// 划桨频率
/// </summary>
public uint StrokeRate { get; private set; } = 0;
public uint StrokeRate { get; set; } = 0;
/// <summary>
/// 划桨次数
/// </summary>
public UInt16 StrokeCount { get; private set; } = 0;
public UInt16 StrokeCount { get; set; } = 0;
/// <summary>
/// 平均划桨频率
/// </summary>
public int AverageStrokeRate { get; private set; } = 0;
public int AverageStrokeRate { get; set; } = 0;
public UInt32 TotalDistance { get; private set; } = 0;
public UInt32 TotalDistance { get; set; } = 0;
public UInt16 _instantaneousPace = 0;
/// <summary>
/// 即时配速
/// </summary>
public UInt16 InstantaneousPace { get; private set; } = 0;
public UInt16 InstantaneousPace
{
get => _instantaneousPace;
set
{
if (_instantaneousPace == 0 && value != 0 && StartEvent != null)
{
StartEvent.Invoke(null, new EventArgs());
}
_instantaneousPace = value;
}
}
/// <summary>
/// 平均配速
/// </summary>
public UInt16 AveragePace { get; private set; } = 0;
public UInt16 AveragePace { get; set; } = 0;
public int InstantaneousPower { get; private set; } = 0;
public int InstantaneousPower { get; set; } = 0;
public int AveragePower { get; private set; } = 0;
public static event EventHandler RowerResChanged;
public int AveragePower { get; set; } = 0;
public event EventHandler RowerResChanged;
private int commonRes = 50;
private int thinkRes = 50;
@ -57,17 +69,15 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
return commonRes;
}
}
set { }
}
/// <summary>
/// 运行时间
/// </summary>
public int ElapsedTime { get; private set; } = 0;
public int TotalEnergy { get; private set; } = 0;
public int EnergyPerHour { get; private set; } = 0;
public int EnergyPerMinute { get; private set; } = 0;
public int ElapsedTime { get; set; } = 0;
public int TotalEnergy { get; set; } = 0;
public int EnergyPerHour { get; set; } = 0;
public int EnergyPerMinute { get; set; } = 0;
public double PeakDriveForce { get; set; } = 0;
public double AverageDriveForce { get; set; } = 0;
@ -80,6 +90,8 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
public RowerDataFlag Flags;
//拉力相关
public event EventHandler PullChanged;
//开始事件
public event EventHandler StartEvent;
private ushort _pullValue;
public ushort PullValue
{

View File

@ -59,18 +59,34 @@ namespace Assets.Scripts.Devices.Ble.Devices
Debug.Log("ftms划船机" + service.Id);
this.hwInterface.SubscribeCharacteristic(character, null);
}
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerData))
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerData35))
{
Debug.Log("c2划船机基本数据" + service.Id);
//C2RowerData.IsEnabled = true;
this.hwInterface.SubscribeCharacteristic(character, null);
}
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerData1))
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerData3d))
{
Debug.Log("c2划船机拉力数据" + service.Id);
//C2RowerData.IsEnabled = true;
this.hwInterface.SubscribeCharacteristic(character, null);
}
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerData32))
{
this.hwInterface.SubscribeCharacteristic(character, null);
}
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerData33))
{
this.hwInterface.SubscribeCharacteristic(character, null);
}
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerData36))
{
this.hwInterface.SubscribeCharacteristic(character, null);
}
else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerData39))
{
this.hwInterface.SubscribeCharacteristic(character, null);
}
//else if (character.MatchGuid(ServiceUuids.Characteristics.C2RowerStatus))
//{
// Debug.Log("c2划船机响应数据" + service.Id);
@ -109,7 +125,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
}
else
{
var c = base.Characteristics.SingleOrDefault(x => x.Uuid == ServiceUuids.Characteristics.C2RowerData);
var c = base.Characteristics.SingleOrDefault(x => x.Uuid == ServiceUuids.Characteristics.C2RowerData35);
if (c != null)
{
var data = new byte[] { characteristic.Id.ToByteArray()[0] }.Concat(response.Data).ToArray();
@ -134,25 +150,24 @@ namespace Assets.Scripts.Devices.Ble.Devices
// }
//}
}
public void C2GetStatus()
public void C2GetStatus(byte[] bs)
{
if (C2RowerData.IsEnabled == true)
{
//等对csafe协议研究透彻后写
//if (this.c2Control != null)
//{
// var cmd = new byte[] { 0x80, 0xe8 };
// byte a = cmd[0];
// for (int i = 1; i < cmd.Length; i++)
// {
// a ^= cmd[i];
// }
// cmd = new byte[] { 0xf1 }.Concat(cmd).Concat(new byte[] { a, 0xf2 }).ToArray();
// Debug.Log("发送获取命令" + string.Join(",", cmd));
// hwInterface.WriteCharacteristic(this.c2Control, cmd);
// //hwInterface.WriteCharacteristic(this.c2Control, new byte[] { 0xF1, 0x81, 0x81, 0xF2 });
//}
if (this.c2Control != null)
{
var cmd = bs;
byte a = cmd[0];
for (int i = 1; i < cmd.Length; i++)
{
a ^= cmd[i];
}
cmd = new byte[] { 0xf1 }.Concat(cmd).Concat(new byte[] { a, 0xf2 }).ToArray();
Debug.Log("发送获取命令" + string.Join(",", cmd));
hwInterface.WriteCharacteristic(this.c2Control, cmd);
//hwInterface.WriteCharacteristic(this.c2Control, new byte[] { 0xF1, 0x81, 0x81, 0xF2 });
}
}
}

View File

@ -12,5 +12,39 @@ namespace Assets.Scripts.Devices.Ble.Interfaces
ushort PullValue { get; set; }
double PeakDriveForce { get; set; }
double AverageDriveForce { get; set; }
/// <summary>
/// 划桨频率
/// </summary>
uint StrokeRate { get; set; }
/// <summary>
/// 划桨次数
/// </summary>
UInt16 StrokeCount { get; set;}
/// <summary>
/// 平均划桨频率
/// </summary>
int AverageStrokeRate { get; set; }
UInt32 TotalDistance { get; set; }
/// <summary>
/// 即时配速
/// </summary>
UInt16 InstantaneousPace { get; set; }
/// <summary>
/// 平均配速
/// </summary>
UInt16 AveragePace { get; set; }
int InstantaneousPower { get; set; }
int AveragePower { get; set; }
int ElapsedTime { get; set; }
int TotalEnergy { get; set; }
int EnergyPerHour { get; set; }
int EnergyPerMinute { get; set; }
int ResistanceLevel { get; set; }
void Reset();
event EventHandler StartEvent;
event EventHandler RowerResChanged;
}
}

View File

@ -168,7 +168,7 @@ namespace Assets.Scripts.Ble
new ServiceUuid(new Guid("6e40fec1-b5a3-f393-e0a9-e50e24dcca9e"), ServiceUuids.TacxBle, true),
new ServiceUuid(new Guid("01007b34-3576-8b40-8918-8ff3949ce592"), ServiceUuids.Elite, true),
new ServiceUuid(new Guid("3a01f4c0-37a8-6541-bab9-654ef70747c6"), ServiceUuids.PowerBeam, true),
//new ServiceUuid(new Guid("CE060000-43E5-11E4-916C-0800200C9A66"), ServiceUuids.C2Rower,true),
new ServiceUuid(new Guid("CE060000-43E5-11E4-916C-0800200C9A66"), ServiceUuids.C2Rower,true),
};
public static readonly IReadOnlyList<ServiceUuid> CyclingServices = ServiceUuids.Services.Where(s => s.IsCycling).ToList();
@ -376,13 +376,17 @@ namespace Assets.Scripts.Ble
public static Guid C2RowerControl = new Guid("ce060021-43e5-11e4-916c-0800200c9a66");
//0x35 有峰力值和均力值
public static Guid C2RowerData = new Guid("ce060035-43e5-11e4-916c-0800200c9a66");
public static Guid C2RowerData35 = new Guid("ce060035-43e5-11e4-916c-0800200c9a66");
//拉力曲线
public static Guid C2RowerData1 = new Guid("ce06003D-43e5-11e4-916c-0800200c9a66");
public static Guid C2RowerData3d = new Guid("ce06003D-43e5-11e4-916c-0800200c9a66");
//c2划船机状态
public static Guid C2RowerStatus = new Guid("ce060022-43e5-11e4-916c-0800200c9a66");
//c2划船机课程
public static Guid C2RowerCourse = new Guid("CE060031-43E5-11E4-916C-0800200C9A66");
public static Guid C2RowerData32 = new Guid("CE060032-43E5-11E4-916C-0800200C9A66");
public static Guid C2RowerData33 = new Guid("CE060033-43E5-11E4-916C-0800200C9A66");
public static Guid C2RowerData36 = new Guid("CE060036-43E5-11E4-916C-0800200C9A66");
public static Guid C2RowerData39 = new Guid("CE060039-43E5-11E4-916C-0800200C9A66");
public static Guid C2Service = new Guid("CE060030-43E5-11E4-916C-0800200C9A66");
//ce060030-43e5-11e4-916c-0800200c9a66
}

View File

@ -35,29 +35,30 @@ public class RowerHomeScript : PFUIPanel
/// <summary>
/// 划船机数据
/// </summary>
private FtmsRowerData RowerData
private IRowerCommonData RowerData
{
get
{
var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected) && d.Sensor == SensorType.Rower);
if (device != null)
{
return ((IRowerDevice)device).rowerData;
}
return null;
return Rower != null ? (C2RowerData.IsEnabled == true ? (IRowerCommonData)Rower.c2RowerData : (IRowerCommonData)Rower.rowerData) : null;
//var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected) && d.Sensor == SensorType.Rower);
//if (device != null)
//{
// return ((IRowerDevice)device).rowerData;
//}
//return null;
}
}
protected override void OnDestroy()
{
Debug.Log("銷毀");
if (RowerCommonDataInstance != null)
if (RowerData != null)
{
RowerCommonDataInstance.PullChanged -= PaintPullCurve;
RowerData.PullChanged -= PaintPullCurve;
RowerData.StartEvent -= StartFunc;
RowerData.RowerResChanged -= ResChanged;
}
C2RowerData.EnableChanged -= ModeChanged;
FtmsRowerData.RowerResChanged -= ResChanged;
}
private IRowerDevice Rower
{
@ -89,7 +90,7 @@ public class RowerHomeScript : PFUIPanel
GameObject btnStart;
Transform left, bottom, mid,rmydata;
float timer = 1.0f;
List<DoubleVector2> pullList = new List<DoubleVector2>(), historyPullList = new List<DoubleVector2>();
List<DoubleVector2> pullList, historyPullList;
public Dictionary<object, Sprite> spriteDict,spriteDict2;
List<string> records;
List<TempRowerCalc> values;
@ -157,7 +158,10 @@ public class RowerHomeScript : PFUIPanel
};
GetComponent<RectTransform>().localScale = Vector3.one;
GetComponent<RectTransform>().localPosition = Vector3.zero;
records = new List<string>();
values = new List<TempRowerCalc>();
pullList = new List<DoubleVector2>();
historyPullList = new List<DoubleVector2>();
//mainNav.ShowExit();
left = transform.Find("Rower/Modes/Scroll/M1/Left");
@ -221,10 +225,6 @@ public class RowerHomeScript : PFUIPanel
HandleSelectType();
},rowerType);
}, false);
//var c2 = new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/ICON_continue_44"), () =>
//{
// HandleStartOrPause();
//});
btnStart = transform.Find("MainNav-mobile/Custom2").gameObject;
var c3 = new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/ICON_mode_44"), () =>
{
@ -243,10 +243,12 @@ public class RowerHomeScript : PFUIPanel
{
Discard();
});
if (RowerCommonDataInstance != null)
if (RowerData != null)
{
RowerCommonDataInstance.PullChanged -= PaintPullCurve;
RowerCommonDataInstance.PullChanged += PaintPullCurve;
RowerData.PullChanged -= PaintPullCurve;
RowerData.PullChanged += PaintPullCurve;
RowerData.StartEvent -= StartFunc;
RowerData.StartEvent += StartFunc;
}
Init();
}
@ -385,74 +387,11 @@ public class RowerHomeScript : PFUIPanel
f.Invoke();
}
}
private IRowerCommonData RowerCommonDataInstance => Rower != null ? (C2RowerData.IsEnabled == true ? (IRowerCommonData)Rower.c2RowerData : (IRowerCommonData)Rower.rowerData) : null;
private void HandleStartOrPause()
{
//UIManager.ShowRowerResult();
//return;
if (rowerType == null)
{
Utils.showToast(null, "Please select the course!", isLowest: true);
return;
}
if (btnStart.CompareTag("Start"))
{
#if !UNITY_EDITOR
if (RowerData == null)
{
Utils.showToast(null, "Please connect the device!", isLowest: true);
return;
}
#endif
UIManager.ShowCountDownAnimation(() =>
{
#if !UNITY_EDITOR
if (RowerCommonDataInstance != null)
{
RowerCommonDataInstance.PullChanged -= PaintPullCurve;
RowerCommonDataInstance.PullChanged += PaintPullCurve;
}
#endif
StartFunc();
},
()=>
{
Debug.Log(222);
if (Rower != null && !isPause)
{
Rower.Reset();
}
});
}
else
{
openTimer = false;
isPause = true;
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
btnStart.tag = "Start";
UIManager.ShowConfirm3("Quit", "Do you want to keep the record?",
() =>
{
UIManager.CloseConfirm3();
Save();
Init();
},
()=>
{
Init();
},
()=>
{
});
}
Debug.Log(RowerData);
//StartCoroutine();
}
int truelyTime = 0;
private void StartFunc()
private void StartFunc(object sender, EventArgs e)
{
if (openTimer) return;
if (transform.parent.parent.Find("ModalPanel/RowerWelldone(Clone)") && transform.parent.parent.Find("ModalPanel/RowerWelldone(Clone)").gameObject.activeInHierarchy)
{
return;
@ -602,8 +541,8 @@ public class RowerHomeScript : PFUIPanel
left.Find("Times/Value").GetComponent<Text>().text = "---";
left.Find("Calories/Value").GetComponent<Text>().text = "---";
rmydata.Find("Calories/Value").GetComponent<Text>().text = "---";
pullList = new List<DoubleVector2>();
historyPullList = new List<DoubleVector2>();
pullList.Clear();
historyPullList.Clear();
SetChartData(pullList, historyPullList);
//mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
openTimer = false;
@ -638,8 +577,9 @@ public class RowerHomeScript : PFUIPanel
rmydata.Find("AvgForce/Value").GetComponent<Text>().text = "---";
mid.Find("PeakForce/Value").GetComponent<Text>().text = "---";
rmydata.Find("PeakForce/Value").GetComponent<Text>().text = "---";
records = new List<string>();
values = new List<TempRowerCalc>();
records.Clear();// = new List<string>();
values.Clear(); //= new List<TempRowerCalc>();
Kj = 0;
x = 0;
seconds = 0;
@ -651,8 +591,13 @@ public class RowerHomeScript : PFUIPanel
#endif
C2RowerData.EnableChanged -= ModeChanged;
C2RowerData.EnableChanged += ModeChanged;
FtmsRowerData.RowerResChanged -= ResChanged;
FtmsRowerData.RowerResChanged += ResChanged;
if (RowerData != null)
{
RowerData.RowerResChanged -= ResChanged;
RowerData.RowerResChanged += ResChanged;
}
//FtmsRowerData.RowerResChanged -= ResChanged;
//FtmsRowerData.RowerResChanged += ResChanged;
//标志线复位
Transform leftLine = transform.Find("Rower/Modes/Scroll/M2/Track/TraceContainer/LineMeterLeft"),
rightLine = transform.Find("Rower/Modes/Scroll/M2/Track/TraceContainer/LineMeterRight"),
@ -660,14 +605,22 @@ public class RowerHomeScript : PFUIPanel
leftLine.localPosition = new Vector3(-207.5f+43, leftLine.localPosition.y, leftLine.localPosition.z);
rightLine.localPosition = new Vector3(164.5f+43, rightLine.localPosition.y, rightLine.localPosition.z);
finishLine.localPosition = new Vector3(-237.5f+43, finishLine.localPosition.y, finishLine.localPosition.z);
Resources.UnloadUnusedAssets();
GC.Collect();
}
private void ModeChanged(object sender, EventArgs e)
{
if (RowerCommonDataInstance != null)
if (RowerData != null)
{
RowerCommonDataInstance.PullChanged -= PaintPullCurve;
RowerCommonDataInstance.PullChanged += PaintPullCurve;
RowerData.PullChanged -= PaintPullCurve;
RowerData.PullChanged += PaintPullCurve;
RowerData.StartEvent -= StartFunc;
RowerData.StartEvent += StartFunc;
RowerData.RowerResChanged -= ResChanged;
RowerData.RowerResChanged += ResChanged;
}
slider.GetComponent<Slider>().interactable = !(bool)sender;
transform.Find("ResBar/BtnSub").GetComponent<Button>().interactable = !(bool)sender;
@ -799,10 +752,10 @@ public class RowerHomeScript : PFUIPanel
left.Find("Times/Value").GetComponent<Text>().text = strokeCount.ToString();
left.Find("Calories/Value").GetComponent<Text>().text = energy.ToString();
rmydata.Find("Calories/Value").GetComponent<Text>().text = energy.ToString();
mid.Find("AvgForce/Value").GetComponent<Text>().text = RowerCommonDataInstance.AverageDriveForce.ToString("#0");
rmydata.Find("AvgForce/Value").GetComponent<Text>().text = RowerCommonDataInstance.AverageDriveForce.ToString("#0");
mid.Find("PeakForce/Value").GetComponent<Text>().text = RowerCommonDataInstance.PeakDriveForce.ToString("#0");
rmydata.Find("PeakForce/Value").GetComponent<Text>().text = RowerCommonDataInstance.PeakDriveForce.ToString("#0");
mid.Find("AvgForce/Value").GetComponent<Text>().text = RowerData.AverageDriveForce.ToString("#0");
rmydata.Find("AvgForce/Value").GetComponent<Text>().text = RowerData.AverageDriveForce.ToString("#0");
mid.Find("PeakForce/Value").GetComponent<Text>().text = RowerData.PeakDriveForce.ToString("#0");
rmydata.Find("PeakForce/Value").GetComponent<Text>().text = RowerData.PeakDriveForce.ToString("#0");
if (pace != 0)
{
if (rowerType.type == 1)
@ -905,21 +858,19 @@ public class RowerHomeScript : PFUIPanel
void PaintPullCurve(ushort y)
{
Debug.Log("收到拉力" + y + ","+ DateTime.Now.Ticks);
#if !UNITY_EDITOR
if (!openTimer)
{
if (y > 0 && !isPause)
{
//RowerCommonDataInstance.PullChanged -= PaintPullCurve;
//RowerCommonDataInstance.PullChanged += PaintPullCurve;
StartFunc();
}
else
{
return;
}
}
#endif
//#if !UNITY_EDITOR
// if (!openTimer)
// {
// if (y > 0 && !isPause)
// {
// StartFunc();
// }
// else
// {
// return;
// }
// }
//#endif
//if (y > 1200) y = 1200;
//拉力条
var rate = ((float)y) * 2 / 120;
@ -966,7 +917,7 @@ public class RowerHomeScript : PFUIPanel
{
Debug.Log("开始动画");
isPlay = false;
left.Find("Rower").GetComponent<RowerAnimation>().StartAnimation();
//left.Find("Rower").GetComponent<RowerAnimation>().StartAnimation();
}
SetChartData(pullList, historyPullList);
}
@ -1028,7 +979,6 @@ public class RowerHomeScript : PFUIPanel
// shortTimer += 0.5f;
//}
}
void ShortUpdateData()
{
if (RowerData == null) return;
@ -1058,6 +1008,7 @@ public class RowerHomeScript : PFUIPanel
rmydata.Find("W/Value").GetComponent<Text>().text = power.ToString();
bottom.Find("500/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(pace).ToPFString();
bottom.Find("MS/Value").GetComponent<Text>().text = rate.ToString();
}
void HandleStatic()
{
@ -1076,6 +1027,10 @@ public class RowerHomeScript : PFUIPanel
rowerType = C2RowerData.rowerType;
HandleSelectType();
}
//if (C2RowerData.IsEnabled)
//{
// Rower.C2GetStatus(new byte[] { 0xc1 });
//}
}
}
}

View File

@ -1,6 +1,7 @@
{
"dependencies": {
"com.coffee.softmask-for-ugui": "https://github.com/mob-sakai/SoftMaskForUGUI.git",
"com.oddworm.heapexplorer": "https://github.com/pschraut/UnityHeapExplorer.git#4.0.0",
"com.unity.2d.sprite": "1.0.0",
"com.unity.cinemachine": "2.6.3",
"com.unity.collab-proxy": "1.2.16",

View File

@ -7,6 +7,13 @@
"dependencies": {},
"hash": "f59d147fe04be6a84b3cd7eb93bce149410911be"
},
"com.oddworm.heapexplorer": {
"version": "https://github.com/pschraut/UnityHeapExplorer.git#4.0.0",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "b00fee6b4415cb66cfe1664c47e8aa683b834565"
},
"com.unity.2d.sprite": {
"version": "1.0.0",
"depth": 0,