4.14修改,设备连接去掉ftms骑行台

This commit is contained in:
Caiyanpeng committed 2022-04-14 19:18:44 +08:00
1 parent 29e7219c21
commit f383c54507
18 files changed
+2511 -10695

No files matched your search

@@ -45,7 +45,7 @@ public class HomeController : PFUIPanel
nav.SetButtonActive(new List<int> { 1, 3, 4, 6 },null,new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/ICON_mode_44"), () =>
{
UIManager.ShowRowerSelector();
}));
},false));
newNav = nav;
UIManager.AddEvent(transform.Find("TodayData/Datas/Distance").gameObject, EventTriggerType.PointerClick, b =>
{
@@ -227,6 +227,26 @@ public class RowerHomeScript : PFUIPanel
}
Init();
}
RowerResultModel reRowData = null;
public void ReRow(RowerResultModel r)
{
this.reRowData = r;
if (r!= null && r.Type.HasValue)
{
rowerType = new RowerType { type = r.Type.Value,value = (float)r.TypeValue.Value };
if (Rower != null)
{
Rower.Reset();
}
//RowerPanel/Rower/Bottom/Expected/Title
//var dw = rowerType.type == 1 ? $"{rowerType.value}M" : $"{(rowerType.value / 60).ToString("#0.00")}Min";
//bottom.Find("Expected/Title").GetComponent<Text>().text = $"EST\n/ {dw}";
var dw = rowerType.type == 1 ? $"" : $"\nM";
bottom.Find("Expected/Title").GetComponent<Text>().text = $"{App.GetLocalString("EST")}{dw}";
}
}
private void Discard()
{
transform.Find("Stopped").gameObject.SetActive(false);
@@ -264,8 +284,8 @@ public class RowerHomeScript : PFUIPanel
//mainNav.ShowRowerTab();
transform.MyDOFade();
Debug.Log("140,开始扫描");
App.MainDeviceAdapter.StartScan();
//Debug.Log("140,开始扫描");
//App.MainDeviceAdapter.StartScan();
Init();
//transform.Find("Left/Rower").GetComponent<RowerAnimation>().StartAnimation();
}
@@ -484,7 +504,7 @@ public class RowerHomeScript : PFUIPanel
{
Rower.Reset();
}
GetComponent<RowerMultiModeScript>().GetShadowList(rowerType);
GetComponent<RowerMultiModeScript>().GetShadowList(rowerType, reRowData);
btnStart.tag = "Start";
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
left.Find("Rower").GetComponent<Image>().sprite = spriteDict[0];
@@ -558,7 +578,7 @@ public class RowerHomeScript : PFUIPanel
private void ResChanged(object sender, EventArgs e)
{
print("收到阻力" + sender);
if ((Convert.ToSingle(sender) > 50) && slider)
if ((Convert.ToSingle(sender) >= 50) && slider)
{
slider.GetComponent<PFUISlider>().SetValue((Convert.ToSingle(sender) - 50) / 300f);
}
@@ -578,7 +598,7 @@ public class RowerHomeScript : PFUIPanel
private void ReturnHome()
{
if (checkRowing()) return;
Disconnect();
//Disconnect();
UIManager.ShowHomePanel();
UIManager.ShowRowerSelector();
}
@@ -141,7 +141,7 @@ public class RouteItem : MonoBehaviour
UIManager.ShowConfirm("Re-Rowing", "Rowing again?", () =>
{
UIManager.CloseConfirm();
UIManager.ShowRowerPanel();
UIManager.ShowRowerPanel(result);
});
});
}
@@ -1,4 +1,5 @@
using System.Collections;
using Assets.Scripts;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -16,6 +17,17 @@ public class RowerDevicePanel : PFUIPanel
void Start()
{
}
public override void Show()
{
base.Show();
print("开启扫描");
#if UNITY_ANDROID || UNITY_IOS
App.MainDeviceAdapter.StartScan();
#if UNITY_ANDROID
Utils.CallAndroidMethod("OpenLocationService");
#endif
#endif
}
float timer = 1f;
// Update is called once per frame
@@ -172,11 +172,11 @@ public class RowerMultiModeScript : MonoBehaviour
public int sumdiff { get; set; }
}
public Dictionary<int, RankDiff> rankDiffDict;
public async void GetShadowList(RowerTaskPanel.RowerType rowerType)
public async void GetShadowList(RowerTaskPanel.RowerType rowerType, RowerResultModel reRowData)
{
this.rowerType = rowerType;
currentSecond = -1;
var res = await ConfigHelper.rowerApi.GetShadowList(rowerType);
var res = reRowData ==null? await ConfigHelper.rowerApi.GetShadowList(rowerType): await ConfigHelper.rowerApi.GetReRowShadowList(reRowData.Id);
shadowList = res.data;
//foreach (var t in traceList)
//{
@@ -304,7 +304,7 @@ public class RowerMultiModeScript : MonoBehaviour
var width = t.Find("Main").GetComponent<RectTransform>().sizeDelta.x - t.Find("Main/Boat").GetComponent<RectTransform>().sizeDelta.x;
var diffWidth = data.currentDistance - mineData.currentDistance + 50;
if (data.currentDistance <= 50)
if (data.currentDistance <= 50 && mineData.currentDistance <= 50)
{
diffWidth = data.currentDistance;
}
@@ -335,22 +335,31 @@ public class RowerMultiModeScript : MonoBehaviour
{
var ani = DOTween.Sequence();
var _d = data.list[currentSecond];
if (currentSecond > 0)
if (currentSecond > 0 && _d.Pace > 0)
{
var _pred = data.list[currentSecond - 1];
if (_pred.StrokeCount != _d.StrokeCount)
var spDict = GetComponent<RowerHomeScript>().spriteDict;
int spDictIndex = 0;
ani.Join(DOTween.To(() => spDictIndex, x => t.Find("Main/Boat").GetComponent<Image>().sprite = spDict[x], 14, 0.2f));
ani.AppendCallback(() =>
{
//上次划桨次数和这次不一样 说明需要划桨一次
var spDict = GetComponent<RowerHomeScript>().spriteDict;
int spDictIndex = 0;
ani.Join(DOTween.To(() => spDictIndex, x => t.Find("Main/Boat").GetComponent<Image>().sprite = spDict[x], 14, 0.2f));
ani.AppendCallback(() =>
{
int spDictIndex2 = 14;
DOTween.To(() => spDictIndex2, x => t.Find("Main/Boat").GetComponent<Image>().sprite = spDict[x], 0, 0.4f);
});
ani.Play();
}
int spDictIndex2 = 14;
DOTween.To(() => spDictIndex2, x => t.Find("Main/Boat").GetComponent<Image>().sprite = spDict[x], 0, 0.4f);
});
ani.Play();
//var _pred = data.list[currentSecond - 1];
//if (_pred.StrokeCount != _d.StrokeCount)
//{
// //上次划桨次数和这次不一样 说明需要划桨一次
// var spDict = GetComponent<RowerHomeScript>().spriteDict;
// int spDictIndex = 0;
// ani.Join(DOTween.To(() => spDictIndex, x => t.Find("Main/Boat").GetComponent<Image>().sprite = spDict[x], 14, 0.2f));
// ani.AppendCallback(() =>
// {
// int spDictIndex2 = 14;
// DOTween.To(() => spDictIndex2, x => t.Find("Main/Boat").GetComponent<Image>().sprite = spDict[x], 0, 0.4f);
// });
// ani.Play();
//}
}
}
}
@@ -432,7 +441,17 @@ public class RowerMultiModeScript : MonoBehaviour
if (diff.diff != 0)
{
sq.Join(t.parent.DOLocalMoveY(-47 * (diff.rank - 1) - 21.5f, 0.9f).SetEase(Ease.OutBounce));
//if (diff.diff > 0)
//{
// t.parent.SetAsLastSibling();
//}
sq.Join(t.parent.DOLocalMoveY(-47 * (diff.rank - 1) - 21.5f, 0.9f));
var sq1 = DOTween.Sequence();
sq1.Append(t.GetComponent<CanvasGroup>().DOFade(0.2f, 0.45f));
sq1.Append(t.GetComponent<CanvasGroup>().DOFade(1f, 0.45f));
//sq1.SetEase(Ease.InOutCubic);
sq.Join(sq1);
sq.SetEase(Ease.InOutCubic);
//sq.Append(t.GetComponent)
}
t.parent.name = i.ToString();
@@ -701,12 +720,12 @@ public class RowerMultiModeScript : MonoBehaviour
{
game.transform.Find("Content/Rank").GetComponent<Text>().text = item.currentRank.ToString("00");
game.transform.Find("Content/NickName").GetComponent<Text>().text = item.NickName;
Utils.DisplayImageTempDict(game.transform.Find("Content/Avatar").GetComponent<RawImage>(), item.Avatar, caches);
var _c = countryList.FirstOrDefault(x => item.Country == x.country);
if (_c != null)
{
game.transform.Find("Content/Country").GetComponent<Image>().sprite = Resources.Load<Sprite>(_c.source);
}
//Utils.DisplayImageTempDict(game.transform.Find("Content/Avatar").GetComponent<RawImage>(), item.Avatar, caches);
//var _c = countryList.FirstOrDefault(x => item.Country == x.country);
//if (_c != null)
//{
// game.transform.Find("Content/Country").GetComponent<Image>().sprite = Resources.Load<Sprite>(_c.source);
//}
int _d = 0, _p = 0;
if (currentSecond < 0 || item.list.Count == 0)
{
@@ -955,6 +974,7 @@ public class RowerMultiModeScript : MonoBehaviour
void Update()
{
#if UNITY_EDITOR
//return;
timer -= Time.deltaTime;
if (timer < 0)
{