拉力曲线性能优化&解决划船时间误差问题

This commit is contained in:
lishuo committed 2022-06-21 17:49:43 +08:00
1 parent 6c9b3f825a
commit 573b96d86c
7 files changed
+122 -77

No files matched your search

@@ -132,7 +132,7 @@ public class RowerDeviceView : MonoBehaviour
var device = GetDevice();
if (device != null && device.State == DeviceState.Connected)
{
UIManager.ShowConfirm("警告", "是否断开该设备?", () =>
UIManager.ShowConfirm(App.GetLocalString("Warning"), App.GetLocalString("Disconnect the device?"), () =>
{
device.Disconnect(false);
DeviceCache.Remove(device);
@@ -147,7 +147,7 @@ public class RowerDeviceView : MonoBehaviour
}
});
UIManager.AddEvent(mDisconnectButton, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
UIManager.ShowConfirm("警告", "是否断开该设备?", () =>
UIManager.ShowConfirm(App.GetLocalString("Warning"), App.GetLocalString("Disconnect the device?"), () =>
{
var device = GetDevice();
if (device != null && device.State == DeviceState.Connected)
@@ -2,6 +2,7 @@
using UnityEngine;
using ChartAndGraph;
using System.Collections;
using System.Linq;
using System.Collections.Generic;
public class RowerGraphChartFeed : MonoBehaviour
@@ -42,25 +43,44 @@ public class RowerGraphChartFeed : MonoBehaviour
}
public void SetCurrentPoint(double x,double y)
{
if(dataSource != null)
x += dataSource.HorizontalViewOrigin;
Debug.Log($"SetCurrentPoint:{x}-{y}");
dataSource?.AddPointToCategoryRealtime("Player 2", x, y);
}
public void ClearChart(string cat = "Player 2")
public void ClearChart()
{
dataSource?.ClearCategory(cat);
}
public void SetHistoryData(List<DoubleVector2> list2 = null)
{
if (list2 != null)
if (dataSource != null)
{
dataSource?.ClearCategory("Player 1");
dataSource.HorizontalViewOrigin += 10;
SetCurrentPoint(0, 0);
}
}
public void SetHistoryData(double x,List<DoubleVector2> list2 = null)
{
if (list2 != null && list2.Count > 0)
{
var offset = dataSource.HorizontalViewOrigin;
graph.DataSource.AddPointToCategoryRealtime("Player 1", offset, 0);
for (int i = 0; i < list2.Count; i++)
{
var item = list2[i];
graph.DataSource.AddPointToCategoryRealtime("Player 1", item.x, item.y);
graph.DataSource.AddPointToCategoryRealtime("Player 1", item.x + offset, item.y);
}
}
}
public void ResetChart()
{
if (dataSource != null)
{
dataSource.HorizontalViewOrigin = -0.03;
dataSource.ClearCategory("Player 1");
dataSource.ClearCategory("Player 2");
}
}
public void SetData(List<DoubleVector2> list,List<DoubleVector2> list2 = null)
{