划船机停止逻辑,切换图标
This commit is contained in:
1 parent
e503443f22
commit
a4e17a56d0
59 files changed
+4288
-1554
No files matched your search
@@ -13,7 +13,7 @@ using System;
|
||||
|
||||
public static class App
|
||||
{
|
||||
public static string Host = "http://192.168.0.101:5085/";
|
||||
public static string Host = "http://192.168.0.101:5084/";
|
||||
|
||||
public static string AppVersion = Application.version;
|
||||
|
||||
@@ -96,6 +96,8 @@ public static class App
|
||||
public readonly static double height = Screen.height;
|
||||
public readonly static bool isFullScreen = width / height > 1.8;
|
||||
public static float canvasWidth { get; set; }
|
||||
public static string WorkoutsUrl { get; internal set; }
|
||||
|
||||
static App()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Assets.Scripts.Ble
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Debug.Log($"設備信息,{item.IdGuid},{string.Join(";",item.IdByteArray)}" );
|
||||
//Debug.Log($"設備信息,{item.IdGuid},{string.Join(";",item.IdByteArray)}" );
|
||||
if (item.IdByteArray == ServiceUuids.Ftms)
|
||||
{
|
||||
if (App.IsRowerMode == true)
|
||||
|
||||
@@ -48,11 +48,14 @@ public class LoginControllerMobile : MonoBehaviour, INativeOnMobileWxLoginResp
|
||||
|
||||
private async void CheckUpdate()
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
transform.Find("Panel/LoginContainer/LoginScrollView/Viewport/Content/FormContainer-Login/Mask/FormContainer/BtnThirdLogin")
|
||||
.gameObject.SetActive(true);
|
||||
#endif
|
||||
var r = await ConfigHelper.userApi.GetVersions();
|
||||
if (r.result)
|
||||
{
|
||||
|
||||
#if UNITY_ANDROID
|
||||
#if UNITY_ANDROID
|
||||
var info = r.data.Value<JObject>("UnityApk");
|
||||
Debug.Log(info.Value<string>("Version"));
|
||||
if (Utils.isUpdate(App.AppVersion, info.Value<string>("Version")))
|
||||
@@ -61,6 +64,7 @@ public class LoginControllerMobile : MonoBehaviour, INativeOnMobileWxLoginResp
|
||||
transform.Find("Version").gameObject.SetActive(false);
|
||||
UIManager.ShowAndroidUpdate(info);
|
||||
}
|
||||
|
||||
#elif UNITY_IOS
|
||||
var sw = r.data.Value<string>("ThirdPartSwitch");
|
||||
transform.Find("Panel/LoginContainer/LoginScrollView/Viewport/Content/FormContainer-Login/Mask/FormContainer/BtnThirdLogin")
|
||||
@@ -72,6 +76,7 @@ public class LoginControllerMobile : MonoBehaviour, INativeOnMobileWxLoginResp
|
||||
Application.Quit();
|
||||
}
|
||||
#endif
|
||||
App.WorkoutsUrl = info.Value<string>("Url");
|
||||
}
|
||||
//if (r.result)
|
||||
//{
|
||||
|
||||
@@ -50,6 +50,7 @@ public class EditUserController : PFUIPanel, INativeOnMobileImageSelect
|
||||
Transform panel;
|
||||
float? panelTop = null;
|
||||
UIGradient g1, g2;
|
||||
TKPanRecognizer pan;
|
||||
protected override void Awake()
|
||||
{
|
||||
Debug.Log(Utils.GetIP(Utils.ADDRESSFAM.IPv4));
|
||||
@@ -71,7 +72,7 @@ public class EditUserController : PFUIPanel, INativeOnMobileImageSelect
|
||||
setMobilePanelPosition(false);
|
||||
});
|
||||
Debug.Log(panel.localPosition);
|
||||
TKPanRecognizer pan = new TKPanRecognizer();
|
||||
pan = new TKPanRecognizer();
|
||||
var delta = Vector3.zero;
|
||||
var rect = this.transform.Find("Panel").GetComponent<RectTransform>();
|
||||
var startLocation = Vector2.zero;
|
||||
@@ -107,7 +108,7 @@ public class EditUserController : PFUIPanel, INativeOnMobileImageSelect
|
||||
//Debug.Log($"{panel.localPosition.y},{panelTop}");
|
||||
//Debug.Log(r.deltaTranslation);
|
||||
};
|
||||
TouchKit.addGestureRecognizer(pan);
|
||||
//TouchKit.addGestureRecognizer(pan);
|
||||
#endif
|
||||
mID = panel.Find("IDNumber").Find("input").Find("Text").GetComponent<Text>();
|
||||
mSexDropdown = panel.Find("SexDropdown").GetComponent<PFUIDropdown>();
|
||||
|
||||
@@ -150,7 +150,7 @@ public class HomeController : PFUIPanel
|
||||
UIManager.ShowConfirm("Workouts not installed", "Go to the official website to download?", () =>
|
||||
{
|
||||
UIManager.CloseConfirm();
|
||||
Application.OpenURL("http://www.powerfun.com/Download");
|
||||
Application.OpenURL(App.WorkoutsUrl);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -86,9 +86,15 @@ public class RowerHomeScript : PFUIPanel
|
||||
double Kj = 0;
|
||||
int seconds = 0;
|
||||
bool isPause = false;
|
||||
/// <summary>
|
||||
/// 计算停止的秒数,如果超过5秒,除了累加值都变成--,这些值记录为0,提示用户如果超过90秒,将直接保存数据
|
||||
/// 如果5-90秒有拉力,则继续滑行
|
||||
/// 如果超过90秒都没有拉力,则直接保存
|
||||
/// </summary>
|
||||
int stopSeconds = 0;
|
||||
uint totalDistance = 0;
|
||||
protected override void Awake()
|
||||
{
|
||||
|
||||
spriteDict = new Dictionary<object, Sprite>()
|
||||
{
|
||||
{"Start",Resources.Load<Sprite>("Images/Rower/System_play")},
|
||||
@@ -130,6 +136,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
var mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
|
||||
mainNav.ShowRowerTab();
|
||||
transform.MyDOFade();
|
||||
Debug.Log("140,开始扫描");
|
||||
App.MainDeviceAdapter.StartScan();
|
||||
Init();
|
||||
//transform.Find("Left/Rower").GetComponent<RowerAnimation>().StartAnimation();
|
||||
@@ -145,6 +152,19 @@ public class RowerHomeScript : PFUIPanel
|
||||
}
|
||||
App.MainDeviceAdapter.StopScan();
|
||||
}
|
||||
void HandleSaveDirect()
|
||||
{
|
||||
openTimer = false;
|
||||
isPause = true;
|
||||
if (RowerData != null)
|
||||
{
|
||||
RowerData.PullChanged -= PaintPullCurveDelegate;
|
||||
}
|
||||
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
|
||||
btnStart.tag = "Start";
|
||||
Save();
|
||||
Init();
|
||||
}
|
||||
private void HandleStartOrPause()
|
||||
{
|
||||
//UIManager.ShowRowerResult();
|
||||
@@ -314,6 +334,8 @@ public class RowerHomeScript : PFUIPanel
|
||||
Kj = 0;
|
||||
x = 0;
|
||||
seconds = 0;
|
||||
totalDistance = 0;
|
||||
stopSeconds = 0;
|
||||
isPause = false;
|
||||
}
|
||||
private void ReturnHome()
|
||||
@@ -330,19 +352,57 @@ public class RowerHomeScript : PFUIPanel
|
||||
// Update is called once per frame
|
||||
bool openTimer = false;
|
||||
double x = 0f;
|
||||
//List<ushort> tempList = new List<ushort>()
|
||||
//{
|
||||
// 0,1,4,500,12,13,16//,20,30,40,50,60,500
|
||||
//};
|
||||
//int tempx = 0;
|
||||
|
||||
|
||||
List<ushort> tempList = new List<ushort>()
|
||||
{
|
||||
0,1,4,500,12,13,16,0,0,0,20,30,40,50,60,500
|
||||
};
|
||||
int tempx = 0;
|
||||
void TimerTicks()
|
||||
{
|
||||
//Debug.Log(123);
|
||||
//PaintPullCurve(tempList[(tempx++) % tempList.Count]);
|
||||
PaintPullCurve(tempList[(tempx++) % tempList.Count]);
|
||||
if (RowerData == null) return;
|
||||
|
||||
var heartRate = HeartRate ?? 0;
|
||||
bottom.Find("BPM/Value").GetComponent<Text>().text = heartRate.ToString();
|
||||
if (totalDistance == RowerData.TotalDistance)
|
||||
{
|
||||
//判定一次停止
|
||||
stopSeconds++;
|
||||
}
|
||||
else
|
||||
{
|
||||
stopSeconds = 0;
|
||||
}
|
||||
if (stopSeconds >= 91)
|
||||
{
|
||||
Debug.Log("保存");
|
||||
HandleSaveDirect();
|
||||
return;
|
||||
}
|
||||
else if (stopSeconds >= 6)
|
||||
{
|
||||
if (stopSeconds == 6)
|
||||
{
|
||||
Utils.showToast(null, "Please keep rowing...",duration:5);
|
||||
}
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToString();
|
||||
bottom.Find("W/Value").GetComponent<Text>().text = "--";
|
||||
bottom.Find("W/AvgValue").GetComponent<Text>().text = "--";
|
||||
bottom.Find("500/Value").GetComponent<Text>().text = "--";
|
||||
bottom.Find("500/AvgValue").GetComponent<Text>().text = "--";
|
||||
bottom.Find("MS/Value").GetComponent<Text>().text = "--";
|
||||
bottom.Find("MS/AvgValue").GetComponent<Text>().text = "--";
|
||||
records.Add($"{RowerData.StrokeCount},{RowerData.ElapsedTime},{RowerData.TotalDistance},0,0,0,{RowerData.ResistanceLevel},{heartRate}");
|
||||
values.Add(new TempRowerCalc() { pace = 0, power = 0, rate = 0, heartRate = heartRate });
|
||||
return;
|
||||
}
|
||||
|
||||
totalDistance = RowerData.TotalDistance;
|
||||
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToString();
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = RowerData.TotalDistance.ToString();
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = totalDistance.ToString();
|
||||
var power = RowerData.InstantaneousPower;
|
||||
bottom.Find("W/Value").GetComponent<Text>().text = power.ToString();
|
||||
bottom.Find("W/AvgValue").GetComponent<Text>().text = RowerData.AveragePower.ToString();
|
||||
@@ -352,8 +412,6 @@ public class RowerHomeScript : PFUIPanel
|
||||
var rate = RowerData.StrokeRate;
|
||||
bottom.Find("MS/Value").GetComponent<Text>().text = rate.ToString();
|
||||
bottom.Find("MS/AvgValue").GetComponent<Text>().text = RowerData.AverageStrokeRate.ToString();
|
||||
var heartRate = HeartRate ?? 0;
|
||||
bottom.Find("BPM/Value").GetComponent<Text>().text = heartRate.ToString();
|
||||
var strokeCount = RowerData.StrokeCount;
|
||||
//if (ushort.TryParse(left.Find("Times/Value").GetComponent<Text>().text, out ushort originStroke))
|
||||
//{
|
||||
@@ -368,20 +426,20 @@ public class RowerHomeScript : PFUIPanel
|
||||
values.Add(new TempRowerCalc() { pace = pace, power = power, rate = rate,heartRate = heartRate });
|
||||
//Debug.Log(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PaintPullCurve(object sender, EventArgs e)
|
||||
{
|
||||
var ftms = (FtmsRowerData)sender;
|
||||
Debug.Log(ftms.PullValue);
|
||||
//Debug.Log(ftms.PullValue);
|
||||
PaintPullCurve(ftms.PullValue);
|
||||
}
|
||||
bool isPlay = false;
|
||||
void PaintPullCurve(ushort y)
|
||||
{
|
||||
if (y > 1000) y = 1000;
|
||||
if (y > 1200) y = 1200;
|
||||
//拉力条
|
||||
var rate = ((float)y) * 2 / 1000;
|
||||
var rate = ((float)y) * 2 / 1200;
|
||||
if (rate > 1) rate = 1f;
|
||||
left.Find("LeftImage/Value").GetComponent<Image>().fillAmount = rate;
|
||||
left.Find("RightImage/Value").GetComponent<Image>().fillAmount = rate;
|
||||
@@ -397,7 +455,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
pullList.Add(new DoubleVector2(x, y));
|
||||
transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
}
|
||||
else
|
||||
else if (pullList.Count > 1)
|
||||
{
|
||||
x += 0.1;
|
||||
pullList.Add(new DoubleVector2(x, y));
|
||||
@@ -407,6 +465,10 @@ public class RowerHomeScript : PFUIPanel
|
||||
isPlay = true;
|
||||
pullList.Add(new DoubleVector2(x, y));
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(new List<DoubleVector2> ());
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -421,7 +483,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
|
||||
}
|
||||
Debug.Log($"{x},{y}");
|
||||
//Debug.Log($"{x},{y}");
|
||||
//transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
//pullList.Add(new DoubleVector2(x, y));
|
||||
//if (pullList.Count >= 75)
|
||||
|
||||
Reference in new issue
Block a user