日志包

This commit is contained in:
Caiyanpeng committed 2022-06-02 15:52:10 +08:00
1 parent 71c9907c89
commit d498dd9148
6 files changed
+52 -25

No files matched your search

@@ -256,6 +256,7 @@ public class RowerHomeScript : PFUIPanel
}, false);
var c2 = new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/记录"), () =>
{
if (checkRowing()) return;
UIManager.ShowResultListPanel();
}, false);
btnStart = transform.Find("MainNav-mobile/Custom2").gameObject;
@@ -314,9 +315,26 @@ public class RowerHomeScript : PFUIPanel
bottom.Find("Expected/Title").GetComponent<Text>().text = $"{App.GetLocalString("EST")}{dw}";
}
}
private void DeleteCacheDir()
{
//删除实时记录
try
{
var dir = $"{PFConstants.RowerRecordCacheFolder}/{App.CurrentUser.Id}/";
if (Directory.Exists(dir))
{
Helper.DelectDir(dir);
//Directory.Delete(dir, true);
}
}
catch (Exception e)
{
Debug.LogError(e.ToString());
}
}
private void Discard()
{
openTimer = false;
if (Application.internetReachability == NetworkReachability.NotReachable)
{
transform.Find("Stopped").gameObject.SetActive(true);
@@ -324,8 +342,9 @@ public class RowerHomeScript : PFUIPanel
return;
}
transform.Find("Stopped").gameObject.SetActive(false);
openTimer = false;
isPause = true;
DeleteCacheDir();
historyTime = 0;
if (C2RowerData.IsEnabled == true)
{
Utils.showToast(null, "Press \"Menu\" to save.", int.MaxValue, stopFunc: () => C2RowerData.isReadyStatus, endCallback: Init);
@@ -479,6 +498,7 @@ public class RowerHomeScript : PFUIPanel
{
File.Delete(files[0]);
}
DeleteCacheDir();
}
catch (Exception ex)
{
@@ -572,14 +592,14 @@ public class RowerHomeScript : PFUIPanel
private void Init()
{
print("初始化");
if (Rower != null)
{
Rower.Reset();
}
if (RowerData != null)
{
RowerData.Reset();
}
if (Rower != null)
{
Rower.Reset();
}
GetComponent<RowerMultiModeScript>().GetShadowList(rowerType, reRowData);
btnStart.tag = "Start";
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
@@ -936,11 +956,7 @@ public class RowerHomeScript : PFUIPanel
if (!string.IsNullOrEmpty(_re))
{
var datas = _re.Split(',');
historyStrokeCount = int.Parse(datas[0]);
historyDistance = int.Parse(datas[2]);
historyTime = int.Parse(datas[10]);
seconds = historyTime;
historyEnergy = int.Parse(datas[8]);
var historyRowerType = PlayerPrefs.GetString("historyRowerType");
if (!string.IsNullOrEmpty(historyRowerType))
{
@@ -948,6 +964,11 @@ public class RowerHomeScript : PFUIPanel
rowerType = new RowerType() { type = int.Parse(typeObject[0]), value = float.Parse(typeObject[1]) };
HandleSelectType();
}
historyTime = int.Parse(datas[10]);
historyStrokeCount = int.Parse(datas[0]);
historyDistance = int.Parse(datas[2]);
seconds = historyTime;
historyEnergy = int.Parse(datas[8]);
}
}
Helper.DelectDir(dir);
@@ -977,6 +998,7 @@ public class RowerHomeScript : PFUIPanel
Directory.CreateDirectory(dir);
}
File.WriteAllText(path, string.Join("\r\n", records));
File.WriteAllText($"{PFConstants.RowerRecordCacheFolder}/cache.txt", string.Join("\r\n", App.cacheList));
PlayerPrefs.SetString("historyRowerType", $"{rowerType.type},{rowerType.value}");
}
catch (Exception e)
@@ -1010,10 +1032,10 @@ public class RowerHomeScript : PFUIPanel
float curTime = 0f;
void PaintPullCurve(ushort y)
{
if (curTime-preTime < 0.1f)
{
return;
}
//if (y!=0 && curTime-preTime < 0.1f)
//{
// return;
//}
preTime = curTime;
Debug.Log("收到拉力" + y + ","+ DateTime.Now.Ticks);
//#if !UNITY_EDITOR
@@ -1153,9 +1175,9 @@ public class RowerHomeScript : PFUIPanel
var power = RowerData.InstantaneousPower;
var rate = RowerData.StrokeRate;
var pace = RowerData.InstantaneousPace;
var strokeCount = RowerData.StrokeCount;
var distance = (int)RowerData.TotalDistance;
var energy = RowerData.TotalEnergy;
var strokeCount = RowerData.StrokeCount + historyStrokeCount;
var distance = (int)RowerData.TotalDistance + historyDistance;
var energy = RowerData.TotalEnergy + historyEnergy;
var heartRate = HeartRate ?? 0;
if (rowerType.type == 1 && totalDistance >=rowerType.value && !createTime.HasValue)
{