划船机其他细节
This commit is contained in:
1 parent
a4e17a56d0
commit
eb21914fb7
8 files changed
+1949
-1667
No files matched your search
@@ -34,7 +34,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
get
|
||||
{
|
||||
var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType.Rower);
|
||||
var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected) && d.Sensor == SensorType.Rower);
|
||||
if (device != null)
|
||||
{
|
||||
return ((IRowerDevice)device).rowerData;
|
||||
@@ -152,14 +152,19 @@ public class RowerHomeScript : PFUIPanel
|
||||
}
|
||||
App.MainDeviceAdapter.StopScan();
|
||||
}
|
||||
void HandleDiscardDirect()
|
||||
{
|
||||
openTimer = false;
|
||||
isPause = true;
|
||||
Debug.Log(RowerData);
|
||||
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
|
||||
btnStart.tag = "Start";
|
||||
Init();
|
||||
}
|
||||
void HandleSaveDirect()
|
||||
{
|
||||
openTimer = false;
|
||||
isPause = true;
|
||||
if (RowerData != null)
|
||||
{
|
||||
RowerData.PullChanged -= PaintPullCurveDelegate;
|
||||
}
|
||||
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
|
||||
btnStart.tag = "Start";
|
||||
Save();
|
||||
@@ -182,11 +187,11 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
if (RowerData != null)
|
||||
{
|
||||
RowerData.PullChanged -= PaintPullCurveDelegate;
|
||||
RowerData.PullChanged += PaintPullCurveDelegate;
|
||||
}
|
||||
if (!isPause)
|
||||
{
|
||||
|
||||
startTime = UIManager.Now.GetDateTime();
|
||||
}
|
||||
TimerTicks();
|
||||
@@ -207,10 +212,6 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
openTimer = false;
|
||||
isPause = true;
|
||||
if (RowerData != null)
|
||||
{
|
||||
RowerData.PullChanged -= PaintPullCurveDelegate;
|
||||
}
|
||||
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
|
||||
btnStart.tag = "Start";
|
||||
UIManager.ShowConfirm3("Quit", "Do you want to keep the record?",
|
||||
@@ -303,7 +304,6 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
if (RowerData != null)
|
||||
{
|
||||
RowerData.PullChanged -= PaintPullCurveDelegate;
|
||||
RowerData.Reset();
|
||||
}
|
||||
if (Rower != null)
|
||||
@@ -321,6 +321,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
openTimer = false;
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("TrueTime/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("W/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("W/AvgValue").GetComponent<Text>().text = "---";
|
||||
@@ -354,15 +355,20 @@ public class RowerHomeScript : PFUIPanel
|
||||
double x = 0f;
|
||||
|
||||
|
||||
List<ushort> tempList = new List<ushort>()
|
||||
{
|
||||
0,1,4,500,12,13,16,0,0,0,20,30,40,50,60,500
|
||||
};
|
||||
int tempx = 0;
|
||||
//List<ushort> tempList = new List<ushort>()
|
||||
//{
|
||||
// 0,1,4,500,12,13,16,0,0,0,20,30,40,50,60,500
|
||||
//};
|
||||
//int tempx = 0;
|
||||
void TimerTicks()
|
||||
{
|
||||
//Debug.Log(123);
|
||||
PaintPullCurve(tempList[(tempx++) % tempList.Count]);
|
||||
//PaintPullCurve(tempList[(tempx++) % tempList.Count]);
|
||||
if (Rower == null)
|
||||
{
|
||||
HandleDiscardDirect();
|
||||
return;
|
||||
}
|
||||
if (RowerData == null) return;
|
||||
var heartRate = HeartRate ?? 0;
|
||||
bottom.Find("BPM/Value").GetComponent<Text>().text = heartRate.ToString();
|
||||
@@ -380,20 +386,25 @@ public class RowerHomeScript : PFUIPanel
|
||||
Debug.Log("保存");
|
||||
HandleSaveDirect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (stopSeconds == 86)
|
||||
{
|
||||
Utils.showToast(null, "Record will be saved!", duration: 5, stopFunc: () => stopSeconds < 6, isLowest: true);
|
||||
return;
|
||||
}
|
||||
else if (stopSeconds >= 6)
|
||||
{
|
||||
if (stopSeconds == 6)
|
||||
if (stopSeconds == 6)
|
||||
{
|
||||
Utils.showToast(null, "Please keep rowing...",duration:5);
|
||||
Utils.showToast(null, "Please keep rowing...", duration: 10, stopFunc: () => stopSeconds < 6, isLowest: true);
|
||||
}
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToString();
|
||||
bottom.Find("W/Value").GetComponent<Text>().text = "--";
|
||||
bottom.Find("W/AvgValue").GetComponent<Text>().text = "--";
|
||||
bottom.Find("500/Value").GetComponent<Text>().text = "--";
|
||||
bottom.Find("500/AvgValue").GetComponent<Text>().text = "--";
|
||||
bottom.Find("MS/Value").GetComponent<Text>().text = "--";
|
||||
bottom.Find("MS/AvgValue").GetComponent<Text>().text = "--";
|
||||
bottom.Find("W/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("W/AvgValue").GetComponent<Text>().text = "---";
|
||||
bottom.Find("500/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("500/AvgValue").GetComponent<Text>().text = "---";
|
||||
bottom.Find("MS/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("MS/AvgValue").GetComponent<Text>().text = "---";
|
||||
records.Add($"{RowerData.StrokeCount},{RowerData.ElapsedTime},{RowerData.TotalDistance},0,0,0,{RowerData.ResistanceLevel},{heartRate}");
|
||||
values.Add(new TempRowerCalc() { pace = 0, power = 0, rate = 0, heartRate = heartRate });
|
||||
return;
|
||||
@@ -402,6 +413,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
totalDistance = RowerData.TotalDistance;
|
||||
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToString();
|
||||
bottom.Find("TrueTime/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(RowerData.ElapsedTime).ToString();
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = totalDistance.ToString();
|
||||
var power = RowerData.InstantaneousPower;
|
||||
bottom.Find("W/Value").GetComponent<Text>().text = power.ToString();
|
||||
@@ -437,6 +449,12 @@ public class RowerHomeScript : PFUIPanel
|
||||
bool isPlay = false;
|
||||
void PaintPullCurve(ushort y)
|
||||
{
|
||||
Debug.Log("收到拉力" + y);
|
||||
if (!openTimer)
|
||||
{
|
||||
RowerData.PullChanged -= PaintPullCurveDelegate;
|
||||
return;
|
||||
}
|
||||
if (y > 1200) y = 1200;
|
||||
//拉力条
|
||||
var rate = ((float)y) * 2 / 1200;
|
||||
@@ -465,10 +483,14 @@ public class RowerHomeScript : PFUIPanel
|
||||
isPlay = true;
|
||||
pullList.Add(new DoubleVector2(x, y));
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(new List<DoubleVector2> ());
|
||||
//}
|
||||
else
|
||||
{
|
||||
//只有0并且两秒没拉,曲线消失
|
||||
if (stopSeconds == 1)
|
||||
{
|
||||
transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(new List<DoubleVector2>());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user