Merge remote-tracking branch 'origin/dev_ani3' into dev_cyp
# Conflicts: # Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs
This commit is contained in:
commit
167a424505
3 files changed
+100
-22
No files matched your search
@@ -117,6 +117,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
}
|
||||
protected override void Awake()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString();
|
||||
rowerType = new RowerType() { type=1,value=500};
|
||||
spriteDict = new Dictionary<object, Sprite>()
|
||||
{
|
||||
@@ -342,6 +343,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
//Debug.Log("140,开始扫描");
|
||||
//App.MainDeviceAdapter.StartScan();
|
||||
Init();
|
||||
CheckLocalData();
|
||||
//transform.Find("Left/Rower").GetComponent<RowerAnimation>().StartAnimation();
|
||||
}
|
||||
void Disconnect()
|
||||
@@ -394,11 +396,12 @@ public class RowerHomeScript : PFUIPanel
|
||||
f.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private string Id { get; set; }
|
||||
int truelyTime = 0;
|
||||
private void StartFunc(object sender, EventArgs e)
|
||||
{
|
||||
if (openTimer) return;
|
||||
Id = Guid.NewGuid().ToString();
|
||||
if (transform.parent.parent.Find("ModalPanel/RowerWelldone(Clone)") && transform.parent.parent.Find("ModalPanel/RowerWelldone(Clone)").gameObject.activeInHierarchy)
|
||||
{
|
||||
return;
|
||||
@@ -443,6 +446,17 @@ public class RowerHomeScript : PFUIPanel
|
||||
if (res.result)
|
||||
{
|
||||
UIManager.ShowRowerWelldone(model.Id, Init);
|
||||
try
|
||||
{
|
||||
if (File.Exists(files[0]))
|
||||
{
|
||||
File.Delete(files[0]);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError(ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -472,7 +486,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
model.ManufacturerName = bleDevice.Name + " " + bleDevice.Network + " " + bleDevice.Sensor;
|
||||
model.DeviceNumber = $"{ bleDevice.Address },{ bleDevice.Sensor }";
|
||||
}
|
||||
model.Id = Guid.NewGuid().ToString();
|
||||
model.Id = Id;//Guid.NewGuid().ToString();
|
||||
model.Weight = App.CurrentUser.Weight;
|
||||
model.Kj = RowerData.TotalEnergy;
|
||||
model.StartTime = startTime;
|
||||
@@ -838,7 +852,60 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
HandleSaveDirect();
|
||||
}
|
||||
//Debug.Log(1);
|
||||
if (ticks % 5 == 0)
|
||||
{
|
||||
SaveRealTimes();//实时保存数据
|
||||
}
|
||||
}
|
||||
//检查本地数据
|
||||
private void CheckLocalData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var files = Directory.GetFiles(PFConstants.RowerRecordFolder);
|
||||
if (files.Length > 0)
|
||||
{
|
||||
UIManager.ShowConfirm(App.GetLocalString("Warn"), App.GetLocalString("continue a game?"), () =>
|
||||
{
|
||||
var str = File.ReadAllText(files[0]);
|
||||
var list = str.Replace("\r\n", " ").Split(' ');
|
||||
records.Clear();
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item))
|
||||
{
|
||||
records.Add(item);
|
||||
}
|
||||
}
|
||||
UIManager.CloseConfirm();
|
||||
}, 2,
|
||||
() =>
|
||||
{
|
||||
if (files.Length > 0)
|
||||
{
|
||||
File.Delete(files[0]);
|
||||
}
|
||||
UIManager.CloseConfirm();
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
}
|
||||
//5s钟保存
|
||||
private void SaveRealTimes()
|
||||
{
|
||||
try
|
||||
{
|
||||
var path = $"{PFConstants.RowerRecordFolder}/{Id}.txt";
|
||||
File.WriteAllText(path, string.Join("\r\n", records));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
}
|
||||
void SendDataToRace(TempRowerCalc tmpdata)
|
||||
{
|
||||
@@ -945,6 +1012,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
transform.Find("Rower/Modes/Scroll/M2/MyData/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(v1);
|
||||
}
|
||||
float staticTimer = 1f,shortTimer = 0.25f;
|
||||
int ticks { get; set; } = 0;
|
||||
void Update()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
@@ -963,6 +1031,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
if (openTimer && timer <= 0)
|
||||
{
|
||||
TimerTicks();
|
||||
ticks++;
|
||||
timer = 1f + timer;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user