调整动画和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

@@ -47,10 +47,15 @@ public class RowerAnimation : PFUIPanel
IEnumerator Animation()
{
yield return new WaitForEndOfFrame();
for (int i = 0; i < 30; i++)
for (int i = 0; i < 15; i++)
{
image.sprite = sprites[i];
yield return new WaitForSeconds(0.08f);
yield return new WaitForSeconds(0.02f);
}
for (int i = 15; i < 30; i++)
{
image.sprite = sprites[i];
yield return new WaitForSeconds(0.04f);
}
}
@@ -205,6 +205,7 @@ public class RowerDeviceView : MonoBehaviour
sprite1 = Resources.Load<Sprite>("Images/Rower/设备 - 划船机 - 未连接");
sprite3 = Resources.Load<Sprite>("Images/Rower/设备 - 划船机");
powerUnit.text = "";
powerValue.text = "";
}
}
@@ -330,12 +331,12 @@ public class RowerDeviceView : MonoBehaviour
//noDevice.enabled = true;
noDevice.text = connectedDevice.Name +" "+ connectedDevice.DeviceNumber.ToString();
}
noDevice.color = Color.white;
noDevice.color = Utils.HexToColorHtml("#f93086");
if (powerValue != null)
{
powerValue.text = GetValue(connectedDevice);
}
//if (powerValue != null)
//{
// powerValue.text = GetValue(connectedDevice);
//}
}
//Debug.Log(Newtonsoft.Json.JsonConvert.SerializeObject(App.MainDeviceAdapter.GetDevices().Where(d => d.Sensor == SensorType)));
@@ -359,7 +360,7 @@ public class RowerDeviceView : MonoBehaviour
case SensorType.Trainer:
return "Smart Trainer";
case SensorType.Rower:
return "Rower Machine";
return "Rowing Machine";
case SensorType.VirtualPower:
break;
default:
@@ -40,16 +40,17 @@ public class RowerGraphChartFeed : MonoBehaviour
graph.Scrollable = false;
//graph.HorizontalValueToStringMap[0.0] = "Zero"; // example of how to set custom axis strings
graph.DataSource.StartBatch();
graph.DataSource.ClearAndMakeBezierCurve("Player 1");
graph.DataSource.ClearCategory("Player 1");
for (int i = 0; i < list.Count; i++)
{
var item = list[i];
if (i == 0)
graph.DataSource.SetCurveInitialPoint("Player 1", item.x, item.y);
else
graph.DataSource.AddLinearCurveToCategory("Player 1", new DoubleVector2(item.x, item.y));
graph.DataSource.AddPointToCategory("Player 1", item.x, item.y);
//if (i == 0)
// graph.DataSource.SetCurveInitialPoint("Player 1", item.x, item.y);
//else
// graph.DataSource.AddLinearCurveToCategory("Player 1", new DoubleVector2(item.x, item.y));
}
graph.DataSource.MakeCurveCategorySmooth("Player 1");
//graph.DataSource.MakeCurveCategorySmooth("Player 1");
graph.DataSource.EndBatch();
}
}
@@ -11,6 +11,8 @@ public partial class RowerHoverText : MonoBehaviour
public Text TextPrefab;
public int FontSize = 5;
public Vector3 TextOffset = new Vector3();
public string Title;
public string Unit;
int fractionDigits = 0;
AnyChart mChart;
@@ -135,9 +137,9 @@ public partial class RowerHoverText : MonoBehaviour
var point = graph.DataSource.GetPoint(args.Category, args.Index);
Vector3 position;
if(graph.PointToWorldSpace(out position, point.x, point.y, args.Category))
PopText($"({args.XString},{args.YString})", position, true);
PopText($"{Title}\n{args.YString} {Unit}", position, true);
else
PopText($"({args.XString},{args.YString})", args.Position,false);
PopText($"{Title}\n{args.YString} {Unit}", args.Position,false);
}
}
@@ -8,8 +8,8 @@ using System.IO;
public partial class RowerLargeDataFeed : MonoBehaviour, IComparer<DoubleVector2>
{
public string Category = "Player 1";
public int DownSampleToPoints = 100;
public List<DoubleVector2> mData = new List<DoubleVector2>(); // the data held by the chart
public int DownSampleToPoints = 1000;
List<DoubleVector2> mData = new List<DoubleVector2>(); // the data held by the chart
double pageSize = 2f;
double currentPagePosition = 0.0;
double currentZoom = 0f;
@@ -169,15 +169,7 @@ public partial class RowerLargeDataFeed : MonoBehaviour, IComparer<DoubleVector2
{
for (int i = start; i < end; i++) // load the data
{
if (i == 0)
{
graph.DataSource.SetCurveInitialPoint(Category, mData[i].x, mData[i].y);
}
else
{
graph.DataSource.AddLinearCurveToCategory(Category, new DoubleVector2(mData[i].x, mData[i].y));
}
//graph.DataSource.AddPointToCategory(Category, mData[i].x, mData[i].y);
graph.DataSource.AddPointToCategory(Category, mData[i].x, mData[i].y);
}
}
@@ -229,14 +221,11 @@ public partial class RowerLargeDataFeed : MonoBehaviour, IComparer<DoubleVector2
int start, end;
findPointsForPage(pagePosition, out start, out end); // get the page edges
graph.DataSource.ClearCategory(Category); // clear the cateogry
graph.DataSource.HorizontalViewSize = 500 > mData.Count ? mData.Count : 500;
graph.DataSource.HorizontalViewSize = mData.Count;
if (DownSampleToPoints <= 0)
LoadWithoutDownSampling(start, end);
else
LoadWithDownSampling(start, end);
//graph.DataSource.MakeCurveCategorySmooth(Category);
graph.DataSource.EndBatch();
graph.HorizontalScrolling = pagePosition;
}
@@ -39,9 +39,9 @@ public class RowerResult : PFUIPanel
//}
//transform.Find("Scroll View/Viewport/Content/Content/ChartPace/Chart").GetComponent<RowerLargeDataFeed>().SetData(a);
}
public async void Initial(string id)
{
transform.Find("Scroll View").GetComponent<ScrollRect>().verticalNormalizedPosition = 1;
GetComponent<CanvasGroup>().alpha = 0;
var res = await ConfigHelper.rowerApi.GetDetail(id);
if (res.result)
@@ -59,7 +59,7 @@ public class RowerResult : PFUIPanel
dataContent.Find("Table/AvgHR/Text").GetComponent<Text>().text
= $"{_model.AvgHeartRate} BPM";
dataContent.Find("Table/AvgRate/Text").GetComponent<Text>().text
= $"{_model.AvgRate.ToString("#0")} W";
= $"{_model.AvgRate.ToString("#0")} SPM";
dataContent.Find("Table/MaxPower/Text").GetComponent<Text>().text
= $"{TimeSpan.FromSeconds(_model.MaxPace).ToString(@"mm\:ss")} /500M";
dataContent.Find("Table/MaxHR/Text").GetComponent<Text>().text
@@ -85,7 +85,7 @@ public class RowerResult : PFUIPanel
//var b = _model.ChartList.Select((x, i) => new DoubleVector2(i, ChartDateUtility.TimeSpanToValue(TimeSpan.FromMinutes(x.Pace + UnityEngine.Random.value * 300)))).ToList();
//Debug.Log(_model.ChartList.Select((x, i) => new DoubleVector2(i, ChartDateUtility.TimeSpanToValue(TimeSpan.FromMinutes(x.Pace + UnityEngine.Random.value * 300)))).ToList());
//var a = new List<DoubleVector2>();
//for (int i = 0; i < 20000; i++)
//for (int i = 0; i < 100; i++)
//{
// a.Add(new DoubleVector2(i, UnityEngine.Random.value * 200));
//}
@@ -105,6 +105,7 @@ public class RowerResult : PFUIPanel
chartRate.GetComponent<RowerLargeDataFeed>()
.SetData(_model.ChartList.Select((x, i) => new DoubleVector2(i, x.Rate)).ToList());
chartHR.GetComponent<RowerLargeDataFeed>()
//.SetData(a);
.SetData(_model.ChartList.Select((x, i) => new DoubleVector2(i, x.HeartRate)).ToList());
}
GetComponent<CanvasGroup>().DOFade(1, 0.3f);