AR演示版本调优
This commit is contained in:
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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
||||
public class GameRoomMapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler, IPointerUpHandler,IProgress<float>
|
||||
public class GameRoomMapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler, IPointerUpHandler
|
||||
{
|
||||
public class PropNames
|
||||
{
|
||||
@@ -78,7 +78,21 @@ public class GameRoomMapItem : MonoBehaviour, IPointerExitHandler, IPointerEnter
|
||||
downloading.SetActive(true);
|
||||
downloadTxt.SetActive(false);
|
||||
slider.gameObject.SetActive(true);
|
||||
Loom.Download(map);
|
||||
var progress = Progress.Create<float>(x =>
|
||||
{
|
||||
Loom.DownLoadTaskList[map.FileName] = x;
|
||||
slider.value = x;
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)this.slider.transform);
|
||||
if (x == 1)
|
||||
{
|
||||
transform.Find("DownLoadModal").gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.Find("DownLoadModal").gameObject.SetActive(true);
|
||||
}
|
||||
});
|
||||
Loom.Download(map, progress);
|
||||
});
|
||||
|
||||
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
|
||||
@@ -303,24 +317,4 @@ public class GameRoomMapItem : MonoBehaviour, IPointerExitHandler, IPointerEnter
|
||||
{
|
||||
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
}
|
||||
|
||||
public void Report(float value)
|
||||
{
|
||||
if (gameObject != null)
|
||||
slider.value = value;
|
||||
if (Loom.DownLoadTaskList.ContainsKey(map.FileName))
|
||||
{
|
||||
Loom.DownLoadTaskList[map.FileName] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Loom.DownLoadTaskList.Add(map.FileName, value);
|
||||
}
|
||||
|
||||
if (value == 100)
|
||||
{
|
||||
Ride();
|
||||
transform.Find("DownLoadModal").gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
|
||||
var diff = tabContainer.Find("Diff");
|
||||
diff.Find("Text").GetComponent<Text>().text = myMap.Hard;
|
||||
tabContainer.Find("3d").gameObject.SetActive(!myMap.EnableAR && myMap.Enable3D);
|
||||
tabContainer.Find("AR").gameObject.SetActive(myMap.EnableAR);
|
||||
tabContainer.Find("AR")?.gameObject.SetActive(myMap.EnableAR);
|
||||
tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(myMap.CountryCode);
|
||||
transform.Find("CollectImg").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
transform.Find("CollectImg").GetComponent<Button>().onClick.AddListener(Collect);
|
||||
|
||||
@@ -274,13 +274,18 @@ public class GameRoomListController : PFUIPanel
|
||||
//LOOM中取数据渲染下载当前下载进度
|
||||
var downLoadList = transform.Find("DownLoadList").gameObject;
|
||||
var downloadPanel = transform.Find("DownloadPanel").gameObject;
|
||||
if (!downLoadList.activeSelf && !downloadPanel.activeSelf)
|
||||
if (Loom.DownLoadTaskList.Count>0)
|
||||
{
|
||||
var content = downLoadList.transform.Find("Viewport/Content");
|
||||
var taskList = FindObjectsOfType<GameRoomDownloadTask>();
|
||||
foreach (var item in Loom.DownLoadTaskList)
|
||||
{
|
||||
var newtask = Instantiate(_downLoadTask, content);
|
||||
newtask.GetComponent<GameRoomDownloadTask>().Init(0, item.Key, downloadPanel);
|
||||
var done = taskList.Where(c => c.FileName.Equals(item.Key)).Any();
|
||||
if (!done)
|
||||
{
|
||||
var newtask = Instantiate(_downLoadTask, content);
|
||||
newtask.GetComponent<GameRoomDownloadTask>().Init(0, item.Key, downloadPanel);
|
||||
}
|
||||
downLoadList.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,11 +179,8 @@ public class Loom : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public static async void Download(MapRoute route)
|
||||
public static async void Download(MapRoute route,IProgress<float> progress)
|
||||
{
|
||||
var progress = Progress.Create<float>(x =>
|
||||
DownLoadTaskList[route.FileName] = x
|
||||
);
|
||||
DownLoadTaskList.Add(route.FileName, 0);
|
||||
var path = PFConstants.VideoFolder;
|
||||
var localPath = PFConstants.ARFolder;
|
||||
|
||||
Reference in new issue
Block a user