界面调整
This commit is contained in:
1 parent
a96d538dc1
commit
922f66bb75
14 files changed
+6087
-4079
No files matched your search
@@ -13,6 +13,7 @@ using System.Collections.Generic;
|
||||
using Assets.Cyp.Common;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine.EventSystems;
|
||||
using ChartAndGraph;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
@@ -65,7 +66,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
LineChart elevationChart;//海拔图
|
||||
RawImage img;//海拔图头像
|
||||
RawImage miniMap;//小地图
|
||||
|
||||
RawImage altitudeGraph;//海拔图
|
||||
#endregion
|
||||
|
||||
#region 控制器
|
||||
@@ -79,6 +80,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
private int count = 0;
|
||||
Image arrow;
|
||||
AbstractMap map;
|
||||
Transform t;
|
||||
void Awake()
|
||||
{
|
||||
#region 控件获取与事件绑定
|
||||
@@ -108,7 +110,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
mapName = transform.Find("Panel/TitlePanel/MapName").GetComponent<Text>();
|
||||
totalClimb = transform.Find("Panel/ComputerPanel/TotalClimbView/TotalClimb").GetComponent<Text>();
|
||||
elevationChart = transform.Find("Panel/ElevationChart").GetComponent<LineChart>();
|
||||
img = transform.Find("Panel/ElevationChart/HeadImage").GetComponent<RawImage>();
|
||||
//img = transform.Find("Panel/ElevationChart/HeadImage").GetComponent<RawImage>();
|
||||
img = transform.Find("Panel/GraphChart/Head").GetComponent<RawImage>();
|
||||
t = transform.Find("Panel/GraphChart/Button");
|
||||
miniMap = transform.Find("Panel/MiniMap").GetComponent<RawImage>();
|
||||
|
||||
selectPanel = transform.Find("Panel/SelectPanel").gameObject;
|
||||
@@ -127,6 +131,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
cancelQuitButton = transform.Find("Panel/QuitPanel/CancelButton").GetComponent<Button>();
|
||||
closeQuitButton = transform.Find("Panel/QuitPanel/CloseButton").GetComponent<Button>();
|
||||
viewButton =transform.Find("Panel/ViewButton").GetComponent<Button>();
|
||||
altitudeGraph = transform.Find("Panel/TitlePanel/AltitudeGraph").GetComponent<RawImage>();
|
||||
|
||||
target = transform.parent.Find("Target").gameObject;
|
||||
|
||||
@@ -194,6 +199,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var route = mainController.GetRoute();
|
||||
mapName.text = route.RouteInstance.Name;
|
||||
totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 1).ToString() + "KM";//总里程
|
||||
Utils.DisplayImage(StartCoroutine, altitudeGraph, route.RouteInstance.AltitudeGraph);//渲染海拔图
|
||||
RenderChart();
|
||||
startIndex = playerController.CurrentIndex;
|
||||
//继续骑行如果有伴侣就自动进入伴侣骑行
|
||||
@@ -257,6 +263,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
currentSlopeText.text = Math.Round(playerController.CurrentSlope, 1).ToString() + "%";
|
||||
currentSlopeDistanceText.text = Math.Round(playerController.CurrentSlopeDistance, 0).ToString() + "M";
|
||||
totalClimb.text = Math.Round(playerController.TotalClimb, 0).ToString();
|
||||
//动态显示当前人物移动动画
|
||||
|
||||
//移动海拔图头像 TODO:移动所有人的头像
|
||||
|
||||
//MoveChartMarkPoint();
|
||||
@@ -394,9 +402,12 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
private int startIndex;//选中玩家起始索引
|
||||
private int interval = 50;//选中玩家移动索引个数
|
||||
private float[] elevationList;
|
||||
GraphChartBase graph;
|
||||
//初始化海拔图
|
||||
void RenderChart()
|
||||
{
|
||||
|
||||
|
||||
//elevationChart.ClearData();
|
||||
//elevationList = mainController.GetLineChartData();
|
||||
//totalCount = elevationList.Length;
|
||||
@@ -437,6 +448,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
dd.Add(item.Elevation);
|
||||
}
|
||||
var sc = transform.Find("Panel/GraphChart").GetComponent<ChartDataSourceScript>();
|
||||
|
||||
graph = transform.Find("Panel/GraphChart").GetComponent<GraphChartBase>();
|
||||
|
||||
sc.SetDataSource(dd.ToArray());
|
||||
|
||||
if (App.CurrentUser != null)
|
||||
@@ -496,8 +510,29 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
}
|
||||
public GameObject testButton;
|
||||
//挪到人物脚本中处理
|
||||
void MoveChartMarkPoint()
|
||||
{
|
||||
Vector3 prePosition = img.transform.position;
|
||||
int nextIndex = playerController.CurrentIndex;
|
||||
double ditance = playerController.Distance;//当前移动距离
|
||||
double currentDistance = playerController.CurrentDistance;//当前区间距离
|
||||
var t = currentDistance != 0 ? ditance*1000 / currentDistance : 0;
|
||||
var n = graph.DataSource.GetPoint("Player 2", nextIndex);
|
||||
|
||||
graph.PointToWorldSpace(out Vector3 nextPosition, n.x, n.y, "Player 2");
|
||||
|
||||
var currentPos = Vector3.Lerp(prePosition, nextPosition, (float)t);
|
||||
img.transform.DOMove(currentPos, 1);
|
||||
|
||||
//人物移动到中间的时候,线开始向左边平滑移动
|
||||
//int del = (int)Math.Round(graph.DataSource.HorizontalViewSize / 2, 0);
|
||||
//if (playerController.CurrentIndex % del == 0)
|
||||
//{
|
||||
// graph.HorizontalScrolling += 1;
|
||||
//}
|
||||
|
||||
#region 注释
|
||||
//var dataPoints = elevationChart.series.list[0].dataPoints.OrderBy(c => c.x).ToList();
|
||||
//if (dataPoints.Count > 0)
|
||||
//{
|
||||
@@ -508,8 +543,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
//if (pointMap.ContainsKey(playerController.CurrentIndex-1) )
|
||||
//{
|
||||
|
||||
|
||||
|
||||
|
||||
// Vector3 mousePos;
|
||||
// //testButton.transform.localPosition = new Vector3(pointMap[playerController.CurrentIndex - 1].x, pointMap[playerController.CurrentIndex - 1].y, 0);
|
||||
// //RectTransformUtility.ScreenPointToLocalPointInRectangle(transform.parent.GetComponent<RectTransform>(), new Vector3(pointMap[playerController.CurrentIndex - 1].x , pointMap[playerController.CurrentIndex - 1].y, 0), null, out mousePos);
|
||||
@@ -520,6 +555,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
// //testButton.transform.DOLocalMove(new Vector3(pointMap[playerController.CurrentIndex - 1].x-Screen.width/2, pointMap[playerController.CurrentIndex - 1].y, 0),0.5f);
|
||||
// //pointMap.Remove(playerController.CurrentIndex - 1);
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user