心率,阻力逻辑调整

This commit is contained in:
lishuo committed 2022-06-14 18:37:58 +08:00
1 parent f25d0b7b8c
commit 0202814f67
5 files changed
+68 -29

No files matched your search

@@ -17,6 +17,7 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Android;
using UnityEngine.UI;
using static RowerTaskPanel;
@@ -220,11 +221,7 @@ public class RowerHomeScript : PFUIPanel
{
var v = (ushort)Math.Round((r * 300));
print("设置阻力" + v);
if (Rower != null)
{
Rower.SetResistanceLevel(v);
//RowerData.
}
StartCoroutine(SetResistanceLevel(v));
});
//transform.Find("Ready/DeviceStatus").gameObject.SetActive(!flag);
//transform.Find("Ready/DeviceStatusConnect").gameObject.SetActive(flag);
@@ -295,8 +292,6 @@ public class RowerHomeScript : PFUIPanel
RowerData.PullChanged += PaintPullCurve;
RowerData.StartEvent -= StartFunc;
RowerData.StartEvent += StartFunc;
RowerData.RowerResChanged -= ResChanged;
RowerData.RowerResChanged += ResChanged;
}
rowerType = new RowerType { type = 1, value = 500 };
HandleSelectType();
@@ -304,6 +299,15 @@ public class RowerHomeScript : PFUIPanel
isFirstReset = false;
}
IEnumerator SetResistanceLevel(ushort res)
{
yield return new WaitForSeconds(0.1f);
if (Rower != null)
{
Rower.SetResistanceLevel(res);
}
}
RowerResultModel reRowData = null;
public void ReRow(RowerResultModel r)
{
@@ -797,8 +801,9 @@ public class RowerHomeScript : PFUIPanel
private Text rmyPeakForceText { get; set; }
private bool interruptFlag{ get; set; }
void TimerTicks()
void TimerTicks()
{
var heartRate = HeartRate ?? 0;
#if UNITY_EDITOR
var a = tempList[(tempx++) % tempList.Count];
Debug.Log(a);
@@ -825,8 +830,6 @@ public class RowerHomeScript : PFUIPanel
if (interruptFlag) return;
if (RowerData == null) return;
//#endif
var heartRate = HeartRate ?? 0;
BPMText.text = heartRate.ToString();
//断线重连继续
var distance = (int)RowerData.TotalDistance + historyDistance;
var energy = RowerData.TotalEnergy + historyEnergy;
@@ -1265,6 +1268,8 @@ public class RowerHomeScript : PFUIPanel
staticTimer -= Time.deltaTime;
if (staticTimer <= 0)
{
var heartRate = HeartRate ?? 0;
BPMText.text = heartRate == 0 ? "---": heartRate.ToString();
HandleStatic();
staticTimer += 1f;
}
@@ -1323,7 +1328,8 @@ public class RowerHomeScript : PFUIPanel
if (flag && RowerData.TotalDistance != 0)
{
Rower.Reset();
//RowerData.Reset();
if(C2RowerData.IsEnabled)
RowerData.Reset();
}
}
if (transform.Find("Stopped").gameObject.activeInHierarchy)
@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Android;
using UnityEngine.UI;
public class RowerDevicePanel : PFUIPanel
@@ -26,6 +27,18 @@ public class RowerDevicePanel : PFUIPanel
#if UNITY_ANDROID || UNITY_IOS
#if UNITY_ANDROID
Utils.CallAndroidMethod("OpenLocationService");
if (!Permission.HasUserAuthorizedPermission(Permission.CoarseLocation))
{
Permission.RequestUserPermission(Permission.CoarseLocation);
Permission.RequestUserPermission(Permission.FineLocation);
UIManager.ShowConfirm(App.GetLocalString("Warning"), App.GetLocalString("Powerfun need location service permission,please open the location permission.")
, () => {
UIManager.CloseConfirm();
}, 2
, () => {
UIManager.CloseConfirm();
});
}
#endif
App.MainDeviceAdapter.StartScan();
#endif