diff --git a/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs b/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs index 81f06acc..b692df2c 100644 --- a/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs +++ b/Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs @@ -39,7 +39,7 @@ public class RowerHomeScript : PFUIPanel { get { - return Rower != null ? (C2RowerData.IsEnabled == true ? Rower.c2RowerData : Rower.rowerData) : null; + return Rower != null ? (C2RowerData.IsEnabled == true ? (IRowerCommonData)(Rower.c2RowerData) : (IRowerCommonData)(Rower.rowerData)) : null; //var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected) && d.Sensor == SensorType.Rower); //if (device != null) //{ @@ -118,7 +118,8 @@ public class RowerHomeScript : PFUIPanel protected override void Awake() { Id = Guid.NewGuid().ToString(); - rowerType = new RowerType() { type=1,value=500}; + rowerType = new RowerType() { type = 1, value = 500 }; + spriteDict = new Dictionary() { {"Start",Resources.Load("Images/RowerNew/ICON_continue_44") }, @@ -716,7 +717,7 @@ public class RowerHomeScript : PFUIPanel TempRowerCalc tmpdata = null; //里程停止逻辑 - if (totalDistance == RowerData.TotalDistance) + if (totalDistance == RowerData.TotalDistance + historyDistance) { //判定一次停止 stopSeconds++; @@ -891,7 +892,15 @@ public class RowerHomeScript : PFUIPanel 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)) + { + var typeObject = historyRowerType.Split(','); + rowerType = new RowerType() { type = int.Parse(typeObject[0]), value = float.Parse(typeObject[1]) }; + HandleSelectType(); + } } } UIManager.CloseConfirm(); @@ -918,6 +927,7 @@ public class RowerHomeScript : PFUIPanel { var path = $"{PFConstants.RowerRecordCacheFolder}/{Id}.txt"; File.WriteAllText(path, string.Join("\r\n", records)); + PlayerPrefs.SetString("historyRowerType", $"{rowerType.type},{rowerType.value}"); } catch (Exception e) {