调整动画和chart图标细节,重置命令

This commit is contained in:
Caiyanpeng committed 2021-09-29 14:37:43 +08:00
1 parent 8d8fd59a80
commit 561ad993b8
15 files changed
+5543 -5278

No files matched your search

@@ -40,6 +40,18 @@ public class RowerHomeScript : PFUIPanel
return null;
}
}
private IRowerDevice Rower
{
get
{
var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType.Rower);
if (device != null)
{
return (IRowerDevice)device;
}
return null;
}
}
/// <summary>
/// 心率数据
/// </summary>
@@ -245,6 +257,10 @@ public class RowerHomeScript : PFUIPanel
RowerData.PullChanged -= PaintPullCurveDelegate;
RowerData.Reset();
}
if (Rower != null)
{
Rower.Reset();
}
btnStart.tag = "Start";
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
left.Find("Rower").GetComponent<Image>().sprite = spriteDict[0];
@@ -273,6 +289,11 @@ public class RowerHomeScript : PFUIPanel
}
private void ReturnHome()
{
if (seconds > 0)
{
Utils.showToast(null, "Please end this training.");
return;
}
UIManager.ShowHomePanel();
}
@@ -281,7 +302,7 @@ public class RowerHomeScript : PFUIPanel
double x = 0f;
//List<ushort> tempList = new List<ushort>()
//{
// 0,1,4,5,12,13,16,20,30,40,50,60,500
// 0,1,4,500,12,13,16//,20,30,40,50,60,500
//};
//int tempx = 0;
void TimerTicks()
@@ -304,13 +325,13 @@ public class RowerHomeScript : PFUIPanel
var heartRate = HeartRate ?? 0;
bottom.Find("BPM/Value").GetComponent<Text>().text = heartRate.ToString();
var strokeCount = RowerData.StrokeCount;
if (ushort.TryParse(left.Find("Times/Value").GetComponent<Text>().text, out ushort originStroke))
{
if (strokeCount != originStroke)
{
left.Find("Rower").GetComponent<RowerAnimation>().StartAnimation();
}
}
//if (ushort.TryParse(left.Find("Times/Value").GetComponent<Text>().text, out ushort originStroke))
//{
// if (strokeCount != originStroke)
// {
// left.Find("Rower").GetComponent<RowerAnimation>().StartAnimation();
// }
//}
left.Find("Times/Value").GetComponent<Text>().text = strokeCount.ToString();
left.Find("Calories/Value").GetComponent<Text>().text = RowerData.TotalEnergy.ToString();
records.Add($"{RowerData.StrokeCount},{RowerData.ElapsedTime},{RowerData.TotalDistance},{RowerData.InstantaneousPower},{RowerData.InstantaneousPace},{RowerData.StrokeRate},{RowerData.ResistanceLevel},{heartRate}");
@@ -325,12 +346,13 @@ public class RowerHomeScript : PFUIPanel
Debug.Log(ftms.PullValue);
PaintPullCurve(ftms.PullValue);
}
bool isPlay = false;
void PaintPullCurve(ushort y)
{
if (y > 1000) y = 1000;
//拉力条
var rate = ((float)y) * 2 / 1000;
if (rate > 1) rate = 1;
if (rate > 1) rate = 1f;
left.Find("LeftImage/Value").GetComponent<Image>().fillAmount = rate;
left.Find("RightImage/Value").GetComponent<Image>().fillAmount = rate;
//动画
@@ -340,6 +362,7 @@ public class RowerHomeScript : PFUIPanel
{
if (pullList.Count == 0)
{
isPlay = true;
x = 0;
pullList.Add(new DoubleVector2(x, y));
transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
@@ -351,6 +374,7 @@ public class RowerHomeScript : PFUIPanel
transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
pullList.Clear();
x = 0;
isPlay = true;
pullList.Add(new DoubleVector2(x, y));
}
}
@@ -358,7 +382,14 @@ public class RowerHomeScript : PFUIPanel
{
x += 0.1;
pullList.Add(new DoubleVector2(x, y));
if (pullList.Count > 5 && isPlay)
{
Debug.Log("开始动画");
isPlay = false;
left.Find("Rower").GetComponent<RowerAnimation>().StartAnimation();
}
transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
}
Debug.Log($"{x},{y}");
//transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);