修改新设计稿,保存每次划船的影子id;修改细节,增加c2适配前暂存

This commit is contained in:
Caiyanpeng committed 2022-03-29 18:12:21 +08:00
1 parent ab653b994f
commit e0649f7ea1
20 files changed
+4964 -4083

No files matched your search

@@ -201,7 +201,7 @@ public class RowerHomeScript : PFUIPanel
{
ReturnHome();
}, false);
nav.SetButtonActive(new List<int> { 3, 7 }, null, c1, null, c3);
nav.SetButtonActive(new List<int> { 3, 7 }, null, c1, null, c3, false);
newNav = nav;
#endif
UIManager.AddEvent(transform.Find("Stopped/Confirm/BtnSave").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
@@ -224,8 +224,10 @@ public class RowerHomeScript : PFUIPanel
Rower.Reset();
}
//RowerPanel/Rower/Bottom/Expected/Title
var dw = rowerType.type == 1 ? $"{rowerType.value}M" : $"{(rowerType.value / 60).ToString("#0.00")}Min";
bottom.Find("Expected/Title").GetComponent<Text>().text = $"EST\n/ {dw}";
//var dw = rowerType.type == 1 ? $"{rowerType.value}M" : $"{(rowerType.value / 60).ToString("#0.00")}Min";
//bottom.Find("Expected/Title").GetComponent<Text>().text = $"EST\n/ {dw}";
var dw = rowerType.type == 1 ? $"" : $"\nM";
bottom.Find("Expected/Title").GetComponent<Text>().text = $"EST{dw}";
Init();
//Utils.showToast(null, "请滑动划船机并开始", isLowest: true, type: 1);
}
@@ -268,6 +270,7 @@ public class RowerHomeScript : PFUIPanel
isPause = true;
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
btnStart.tag = "Start";
transform.Find("Stopped").gameObject.SetActive(false);
Save();
Init();
}
@@ -389,6 +392,7 @@ public class RowerHomeScript : PFUIPanel
model.TotalDistance = RowerData.TotalDistance;
model.Type = rowerType.type == 0 ? (int?)null : rowerType.type;
model.TypeValue = rowerType.value == 0 ? (float?)null : rowerType.value;
model.ShadowIds = string.Join(",",GetComponent<RowerMultiModeScript>().shadowList.Select(x=>x.Nid));
var path = PFConstants.RowerRecordFolder + "/" + model.Id;
Helper.CreateDirectoryIfNotExsit(path);
var files = new List<string>();
@@ -416,7 +420,14 @@ public class RowerHomeScript : PFUIPanel
Debug.Log(ex.Message);
}
var res = ConfigHelper.rowerApi.Add(model, files);
UIManager.ShowRowerWelldone(model.Id);
if (res.result)
{
UIManager.ShowRowerWelldone(model.Id);
}
else
{
Utils.showToast(null, res.errMsg);
}
//Disconnect();
}
@@ -441,9 +452,25 @@ public class RowerHomeScript : PFUIPanel
pullList = new List<DoubleVector2>();
mid.Find("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 = "---";
if (rowerType.type == 0)
{
bottom.Find("Time/Value").GetComponent<Text>().text = "---";
bottom.Find("KM/Value").GetComponent<Text>().text = "---";
}
else
{
if (rowerType.type == 1)
{
bottom.Find("Time/Value").GetComponent<Text>().text = "---";
bottom.Find("KM/Value").GetComponent<Text>().text = $"{rowerType.value}M";
}
else
{
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(rowerType.value).ToPFString();
bottom.Find("KM/Value").GetComponent<Text>().text = "---";
}
}
mid.Find("W/Value").GetComponent<Text>().text = "---";
//bottom.Find("W/AvgValue").GetComponent<Text>().text = "---";
bottom.Find("500/Value").GetComponent<Text>().text = "---";
@@ -533,6 +560,8 @@ public class RowerHomeScript : PFUIPanel
var distance = (int)RowerData.TotalDistance;
var energy = RowerData.TotalEnergy;
var strokeCount = RowerData.StrokeCount;
var power = RowerData.InstantaneousPower;
var rate = RowerData.StrokeRate;
TempRowerCalc tmpdata = null;
if (totalDistance == RowerData.TotalDistance)
{
@@ -567,14 +596,19 @@ public class RowerHomeScript : PFUIPanel
var remainTime = rowerType.value - (seconds++);
if (remainTime == 0)
{
records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},0,0,0,{RowerData.ResistanceLevel},{heartRate},{energy}");
tmpdata = new TempRowerCalc() { strokeCount = strokeCount, pace = 0, power = 0, rate = 0, heartRate = heartRate, distance = distance, energy = energy };
values.Add(tmpdata);
SendDataToRace(tmpdata);
HandleSaveDirect();
return;
}
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(remainTime).ToString();
TimeSpan.FromSeconds(remainTime).ToPFString();
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(remainTime).ToPFString();
}
else
{
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToString();
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToPFString();
}
mid.Find("W/Value").GetComponent<Text>().text = "---";
//bottom.Find("W/AvgValue").GetComponent<Text>().text = "---";
@@ -598,21 +632,28 @@ public class RowerHomeScript : PFUIPanel
var remainTime = rowerType.value - (seconds++);
if (remainTime == 0)
{
records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},{RowerData.InstantaneousPower},{RowerData.InstantaneousPace},{RowerData.StrokeRate},{RowerData.ResistanceLevel},{heartRate},{energy}");
tmpdata = new TempRowerCalc() { strokeCount = strokeCount, pace = pace, power = power, rate = rate, heartRate = heartRate, distance = distance, energy = energy };
values.Add(tmpdata);
SendDataToRace(tmpdata);
HandleSaveDirect();
return;
}
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(remainTime).ToString();
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(remainTime).ToPFString();
}
else
{
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToString();
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToPFString();
}
//bottom.Find("TrueTime/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(RowerData.ElapsedTime).ToString();
if (rowerType.type == 1)
{
var remainDistance = rowerType.value - totalDistance;
if (remainDistance < 0)
{
records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},{RowerData.InstantaneousPower},{RowerData.InstantaneousPace},{RowerData.StrokeRate},{RowerData.ResistanceLevel},{heartRate},{energy}");
tmpdata = new TempRowerCalc() { strokeCount = strokeCount, pace = pace, power = power, rate = rate, heartRate = heartRate, distance = distance, energy = energy };
values.Add(tmpdata);
SendDataToRace(tmpdata);
HandleSaveDirect();
return;
}
@@ -629,33 +670,39 @@ public class RowerHomeScript : PFUIPanel
//设置里程时 显示预估时间 当前时间+剩余里程/配速(转换)
var remainDistance = rowerType.value - totalDistance;
var time = values.Count + (remainDistance / (500f / pace));
bottom.Find("Expected/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(time).ToString(@"hh\:mm\:ss");
bottom.Find("Expected/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(time).ToPFString();
}
else if (rowerType.type == 2)
{
var remainTime = rowerType.value - values.Count;
var dis = totalDistance + (remainTime * (500f / pace));
//设置时间时 显示预估里程 当前里程+剩余时间*配速
bottom.Find("Expected/Value").GetComponent<Text>().text = $"{dis.ToString("#0")}M";
bottom.Find("Expected/Value").GetComponent<Text>().text = $"{dis.ToString("#0")}";
}
else
{
//自由滑 显示30min里程 当前里程+剩余时间*配速
var remainTime = 30 * 60 - values.Count;
var dis = totalDistance + (remainTime * (500f / pace));
var count30 = ((int)Math.Ceiling(values.Count / 1800f));
var remainTime = count30 * 1800 - values.Count;
var dif = 0;
if (count30 > 1 && (count30 - 1) * 1800 - 1 < values.Count)
{
dif = values[(count30 - 1) * 1800 - 1].distance;
}
var dis = totalDistance - dif + (remainTime * (500f / pace));
//设置时间时 显示预估里程 当前里程+剩余时间*配速
bottom.Find("Expected/Value").GetComponent<Text>().text = $"{dis.ToString("#0")}M";
bottom.Find("Expected/Value").GetComponent<Text>().text = $"{dis.ToString("#0")}";
}
}
//RowerPanel/Rower/Bottom/Expected/Value
var power = RowerData.InstantaneousPower;
mid.Find("W/Value").GetComponent<Text>().text = power.ToString();
//bottom.Find("W/AvgValue").GetComponent<Text>().text = RowerData.AveragePower.ToString();
bottom.Find("500/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(pace).ToString(@"mm\:ss");
bottom.Find("500/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(pace).ToPFString();
//bottom.Find("500/AvgValue").GetComponent<Text>().text = TimeSpan.FromSeconds(RowerData.AveragePace).ToString(@"mm\:ss");
var rate = RowerData.StrokeRate;
bottom.Find("MS/Value").GetComponent<Text>().text = rate.ToString();
//bottom.Find("MS/AvgValue").GetComponent<Text>().text = RowerData.AverageStrokeRate.ToString();
//if (ushort.TryParse(left.Find("Times/Value").GetComponent<Text>().text, out ushort originStroke))
@@ -670,7 +717,6 @@ public class RowerHomeScript : PFUIPanel
mid.Find("AvgForce/Value").GetComponent<Text>().text = RowerCommonDataInstance.AverageDriveForce.ToString("#0");
mid.Find("PeakForce/Value").GetComponent<Text>().text = RowerCommonDataInstance.PeakDriveForce.ToString("#0");
records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},{RowerData.InstantaneousPower},{RowerData.InstantaneousPace},{RowerData.StrokeRate},{RowerData.ResistanceLevel},{heartRate},{energy}");
print(records.Count);
tmpdata = new TempRowerCalc() { strokeCount = strokeCount, pace = pace, power = power, rate = rate, heartRate = heartRate, distance = distance, energy = energy };
values.Add(tmpdata);
SendDataToRace(tmpdata);
@@ -802,8 +848,8 @@ public class RowerHomeScript : PFUIPanel
{
var flag = Rower != null && RowerData != null;
transform.Find("Ready/DeviceStatus").gameObject.SetActive(!flag);
transform.Find("Ready/Img").gameObject.SetActive(!flag);
transform.Find("Ready/Text").gameObject.SetActive(!flag);
transform.Find("Ready/Img").gameObject.SetActive(flag);
transform.Find("Ready/Text").gameObject.SetActive(flag);
transform.Find("Ready/DeviceStatusConnect").gameObject.SetActive(flag);
}
}