人物动画调整&网页url移除#号&riding time 差一秒的问题

This commit is contained in:
lishuo 2021-08-11 10:30:23 +08:00
parent c717b93169
commit 3fcc6c0489
5 changed files with 36 additions and 32 deletions

View File

@ -1227,7 +1227,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -831, y: 621}
m_AnchoredPosition: {x: -847.5, y: 621}
m_SizeDelta: {x: 84, y: 28}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6673787635055784084
@ -6135,7 +6135,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -835, y: 644}
m_AnchoredPosition: {x: -851.5, y: 644}
m_SizeDelta: {x: 61, y: 17}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &927843223585017441

View File

@ -1,6 +1,7 @@
using Assets.Scripts;
using Assets.Scripts.Apis;
using Assets.Scripts.Apis.Models;
using DG.Tweening;
using System;
using System.Collections.Generic;
using UnityEngine;
@ -189,16 +190,17 @@ namespace Assets.Scenes.Ride.Scripts
{
Utils.DisplayImage(SponsorLogoImage, competition.SponsorCoverage, true);
}
//赛事详情
//if (!string.IsNullOrEmpty(competition.ShortPreview))
//{
// LeftBack.SetActive(false);
// MiddleBack.SetActive(false);
// Utils.DisplayImage(CompetitionDesc, competition.ShortPreview, true);
// var canvasGroup = CompetitionDesc.GetComponent<CanvasGroup>();
// canvasGroup.DOFade(1, 1);
//}
//else
//赛事简介
if (!string.IsNullOrEmpty(competition.ShortPreview))
{
LeftBack.SetActive(false);
MiddleBack.SetActive(false);
Utils.DisplayImage(CompetitionDesc, competition.ShortPreview, true);
var canvasGroup = CompetitionDesc.GetComponent<CanvasGroup>();
canvasGroup.DOFade(1, 1);
AddProcess(10);
}
else
{
//异步请求mapbox画出当前路书路线图
DrawMapRouteAsync(route.Id, 1);
@ -234,7 +236,7 @@ namespace Assets.Scenes.Ride.Scripts
//查看赛事详情
protected void ReadCompetitionPreview(BaseEventData baseEvent)
{
Application.OpenURL(App.CurrentUser.WebHost + $"/Mine/MatchPreview?id={cyclingController.competitionId}&Token={App.CurrentUser.cookie}");
Application.OpenURL(App.CurrentUser.WebHost + $"Mine/MatchPreview?id={cyclingController.competitionId}&Token={App.CurrentUser.cookie}");
}
protected override void StartRide(BaseEventData baseEvent)
{
@ -262,7 +264,7 @@ namespace Assets.Scenes.Ride.Scripts
}
protected void GoDetail(BaseEventData baseEvent)
{
Application.OpenURL(App.CurrentUser.WebHost + $"/Mine/MatchPreview?id={cyclingController.competitionId}&Token={App.CurrentUser.cookie}");
Application.OpenURL(App.CurrentUser.WebHost + $"Mine/MatchPreview?id={cyclingController.competitionId}&Token={App.CurrentUser.cookie}");
}
private void UpdateCompetition()

View File

@ -50,7 +50,7 @@ namespace Assets.Scenes.Ride.Scripts
protected double power;
protected double elevation;
protected double cadance;
protected int heartRate;
protected int? heartRate { get; set; }
public int ticks;
protected double totalDistance;
protected double currentSlope;
@ -66,7 +66,7 @@ namespace Assets.Scenes.Ride.Scripts
public double Speed { get => speed; }
public double Power { get => power; }
public double Cadance { get => cadance; }
public double HeartRate { get => heartRate; }
public int? HeartRate { get => heartRate; }
public int TotalTicks { get => ticks; }
public double TotalDistance { get => totalDistance; }
public double Distance { get => distance; }
@ -93,7 +93,7 @@ namespace Assets.Scenes.Ride.Scripts
//StartCoroutine("TestExcute");
}
void Update()
void FixedUpdate()
{
Excute();
AfterExcute();
@ -164,14 +164,14 @@ namespace Assets.Scenes.Ride.Scripts
characterAnimator.SetFloat("Slope", (float)currentSlope);
if (currentSlope > 5)
{
characterAnimator.speed = 0.5f;
}
characterAnimator.speed = 0.2f;
}
else
{
characterAnimator.speed = 1f;
characterAnimator.speed = 0.45f;
}
if (totalDistance >= mapData.TotalDistance)
if (totalDistance >= mapData.TotalDistance)
{
characterAnimator.SetBool("ReachEnd", true);//到达终点
}
@ -180,8 +180,10 @@ namespace Assets.Scenes.Ride.Scripts
//开始骑行
if (GetStart())
{
ticks++;
if (!stopRecord)
{
ticks++;
}
Compute();//接受蓝牙设备数据计算
//计算累计爬升
if (CurrentIndex > 0)
@ -196,7 +198,7 @@ namespace Assets.Scenes.Ride.Scripts
}
}
}
if (totalDistance > mapData.TotalDistance)
if (totalDistance >= mapData.TotalDistance)
{
distance = totalDistance - mapData.TotalDistance;
totalDistance = mapData.TotalDistance;

View File

@ -50,20 +50,20 @@ namespace Assets.Scenes.Ride.Scripts
//speed = mainController.UpDateSpeed();
try
{
heartRate = mainController.UpDateHeart() ?? 0;
heartRate = mainController.UpDateHeart();
power = mainController.UpdatePower();
cadance = mainController.UpdateCadence();
weight = App.CurrentUser.Weight;
bicycleWeight = App.CurrentUser.BicycleWeight;
#if UNITY_EDITOR
power = 50;
#endif
//#if UNITY_EDITOR
power = 500;
//#endif
mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100);
}
catch (Exception ex)
{
Debug.Log(ex.Message);
heartRate = 0;
//heartRate = 0;
power = 0;
cadance = 0;
}
@ -116,7 +116,7 @@ namespace Assets.Scenes.Ride.Scripts
recorderData.EndDistance = Math.Round(targetData._Distance,6,MidpointRounding.AwayFromZero);
recorderData.RiderDatas.Add(targetData);
//实时计算MaxAp
mainController.ComputeMaxAP(Power, ticks);
//mainController.ComputeMaxAP(Power, ticks);
}
}

View File

@ -64,7 +64,7 @@ public class UserInfoController : PFUIPanel
var createBtn = summaryPanel.Find("CreateBtn").gameObject;
UIManager.AddEvent(createBtn, EventTriggerType.PointerClick, (b) =>
{
Application.OpenURL(App.CurrentUser.WebHost + "/Mine/EditMatch?Token=" + App.CurrentUser.cookie);
Application.OpenURL(App.CurrentUser.WebHost + "Mine/EditMatch?Token=" + App.CurrentUser.cookie);
});
}