AR演示版本调优

This commit is contained in:
lishuo committed 2023-01-17 18:07:49 +08:00
1 parent 27d18d7d01
commit df936c4e04
27 files changed
+3143 -2980

No files matched your search

@@ -98,13 +98,16 @@ namespace Assets.Scripts.Scenes.VideoRide
Forward();
ComputeRecord();
ComputeVideo();
ComputeAnimator();//控制动画
}
else
{
animator.Play("idle");
power = 0;
OnlineSpeed = 0;
PreDistance = EndDistance;
speed = 0;
distance = 0;
}
ComputeAnimator();//控制动画
timer += 1f;
}
catch (Exception e)
@@ -204,7 +207,7 @@ namespace Assets.Scripts.Scenes.VideoRide
}
if (ratio < 1)
{
ratio = Math.Max(ratio, 0.6f);
ratio = Math.Max(ratio, 0.3f);
}
if (speed == 0)
{
@@ -212,7 +215,7 @@ namespace Assets.Scripts.Scenes.VideoRide
}
var info = animator.GetCurrentAnimatorClipInfo(0);
var currentClip = info.FirstOrDefault();
if (currentClip.clip != null && currentClip.clip.isLooping)
if (currentClip.clip != null)
{
animator.speed = ratio;
}
@@ -271,6 +274,11 @@ namespace Assets.Scripts.Scenes.VideoRide
{
head?.SetActive(false);
}
private void OnEnable()
{
head?.SetActive(true);
}
//显示人物海拔图的头像
protected virtual void CreateHeadImage()
{
@@ -282,6 +290,7 @@ namespace Assets.Scripts.Scenes.VideoRide
ftpImage = head.transform.Find("ftp").GetComponent<Image>();
headName = head.transform.Find("name").GetComponent<Text>();
headWkg = head.transform.Find("wkg").GetComponent<Text>();
}
}
if (head != null)
@@ -15,6 +15,7 @@ namespace Assets.Scripts.Scenes.VideoRide
public Text nameLabel;
public Text genderLabel;
public Text idLabel;
public Text powerLabel;
public GameObject master;
//Model
@@ -67,6 +68,7 @@ namespace Assets.Scripts.Scenes.VideoRide
nameLabel.text = contactInfo.Name;
genderLabel.text = contactInfo.Gender;
idLabel.text = contactInfo.id;
powerLabel.text = contactInfo.Power.ToString("f0") + "W";
//master.SetActive(manager.CurrentPlayer.UserId.ToString() == contactInfo.id);
}
public void UpdateItem(string name,string gender,string id)
@@ -15,6 +15,7 @@ namespace Assets.Scripts.Scenes.VideoRide
public string Name;
public string Gender;
public string id;
public double Power;
}
class NearVideoPlayerList : MonoBehaviour, IRecyclableScrollRectDataSource
{
@@ -56,6 +57,7 @@ namespace Assets.Scripts.Scenes.VideoRide
obj.Name = item.Name;
obj.Gender = "";
obj.id = item.Id.ToString();
obj.Power = item.Power;
_contactList.Add(obj);
}
}
@@ -234,15 +234,14 @@ namespace Assets.Scripts.Scenes.VideoRide
}
CurrentPlayer = videoPlayer.GetComponent<AbstractVideoPlayer>();
var vv = videoPlayer.GetComponent<VideoPlayer>();
vv.SetEndDistance(item.EndDistance);
var vp = videoPlayer.GetComponent<VideoPlayer>();
vp.SetEndDistance(item.EndDistance);
CurrentPlayer.SetStartDistance(item.EndDistance);
var rideObj = videoPlayer.GetComponent<RiderRenderer>();
rideObj.Distance = (float)CurrentPlayer.StartDistance;
rideObj.RouteDistance = rideObj.Distance;
rideObj.IsMain = true;
Debug.Log("IsMain = true");
rideObjs.Add(CurrentPlayer, rideObj);
visibleRiders.Add(CurrentPlayer);
+16 -6
View File
@@ -59,10 +59,12 @@ namespace Assets.Scripts.Scenes.VideoRide
power = manager.UpdatePower();
cadance = manager.UpdateCadence();
//#if UNITY_EDITOR
if(mockpower > 0)
power = mockpower;//TODO:动态
cadance = 50;
heartRate = 120;
if (mockpower > 0)
{
power = mockpower;
cadance = 50;
heartRate = 120;
}
//#endif
weight = App.CurrentUser.Weight;
bicycleWeight = App.CurrentUser.BicycleWeight;
@@ -125,7 +127,6 @@ namespace Assets.Scripts.Scenes.VideoRide
recorderData.PreDistance = Math.Round(preDistance, 6, MidpointRounding.AwayFromZero);
recorderData.EndDistance = Math.Round(targetData._Distance, 6, MidpointRounding.AwayFromZero);
recorderData.RiderDatas.Add(targetData);
Debug.Log(recorderData.RoomId);
//默认启用多圈
if (isSingle && totalDistance >= mapData.TotalDistance)
{
@@ -156,7 +157,16 @@ namespace Assets.Scripts.Scenes.VideoRide
}
this.PreDistance = preDistance * 1000;
this.EndDistance = endDistance * 1000;
this.OnlineSpeed = speed / 3.6;
if (manager.IsQuit())
{
this.OnlineSpeed = 0;
}
else
{
this.OnlineSpeed = speed / 3.6;
}
}
}
}
@@ -249,6 +249,15 @@ namespace Assets.Scripts.Scenes.VideoRide
}
private void QuitClick(BaseEventData e)
{
if (manager.CurrentPlayer.UserId == App.CurrentUser.Id && (manager.CurrentPlayer.ticks == 0 || manager.CurrentPlayer.EndDistance - manager.CurrentPlayer.StartDistance < 0.1f))
{
UIManager.ShowConfirm("Quit", App.GetLocalString("Current ride distance too short to save."), () => {
UIManager.CloseConfirm();
SceneManager.LoadSceneAsync("MainScene");
}, 2, () => { UIManager.CloseConfirm(); });
return;
}
if (manager._aRMode == VideoGameManager.ARMode.RIDE)
{