界面调整

This commit is contained in:
lishuo 2021-04-23 19:28:35 +08:00
parent a96d538dc1
commit 922f66bb75
14 changed files with 6087 additions and 4079 deletions

File diff suppressed because it is too large Load Diff

View File

@ -66,6 +66,7 @@ namespace Assets.Scenes.Ride.Scripts
public double HeartRate { get => heartRate; } public double HeartRate { get => heartRate; }
public int TotalTicks { get => ticks; } public int TotalTicks { get => ticks; }
public double TotalDistance { get => totalDistance; } public double TotalDistance { get => totalDistance; }
public double Distance { get => distance; }
public double CurrentSlope { get => currentSlope; } public double CurrentSlope { get => currentSlope; }
public double NextSlope { get => nextSlope; } public double NextSlope { get => nextSlope; }
public double NextSlopeDistance { get => nextSlopeDistance; } public double NextSlopeDistance { get => nextSlopeDistance; }
@ -190,6 +191,7 @@ namespace Assets.Scenes.Ride.Scripts
public int CurrentIndex; public int CurrentIndex;
private int index; private int index;
public double CurrentDistance;//当前所处区间距离
//当前距离所在的海拔/坡度/距离 下一个点的坡度以及剩余距离 //当前距离所在的海拔/坡度/距离 下一个点的坡度以及剩余距离
void ComputeNextSlope() void ComputeNextSlope()
{ {
@ -217,6 +219,8 @@ namespace Assets.Scenes.Ride.Scripts
nextSlope = pointList[nextIndex].Grade; nextSlope = pointList[nextIndex].Grade;
nextSlopeDistance = sumDistance - totalDistance * 1000; nextSlopeDistance = sumDistance - totalDistance * 1000;
currentSlopeDistance = totalDistance * 1000 - (sumDistance - pointList[index].Distance); currentSlopeDistance = totalDistance * 1000 - (sumDistance - pointList[index].Distance);
//计算当前区间距离
CurrentDistance = pointList[CurrentIndex].Grade;
} }
//根据距离计算坐标 //根据距离计算坐标
Vector2d Along(double endDistance) Vector2d Along(double endDistance)

View File

@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Assets.Scenes.Ride.Scripts
{
public class ArrowSpirteRenderScript:MonoBehaviour
{
List<Sprite> sprites;
Image image;
private void Start()
{
sprites = new List<Sprite>();
for (int i = 1; i < 51; i++)
{
sprites.Add(Resources.Load<Sprite>($"Images/Ride/Ride Bright/Ride_bright{i.ToString("0000")}"));
}
image = transform.GetComponent<Image>();
}
int index = 0;
float time = 0;
void Update()
{
time += Time.deltaTime;
if (time < 0.03)
{
return;
}
time = 0;
if (index % 49 == 0)
{
index = 0;
}
image.sprite = sprites[index];
index ++;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f34d1e1c66a3f8a418997dd9d78c8f29
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -43,10 +43,10 @@ namespace Assets.Scenes.Ride.Scripts
} }
} }
public int total;
void LoadWithDownSampling(int start, int end) void LoadWithDownSampling(int start, int end)
{ {
int total = end - start; total = end - start;
if (DownSampleToPoints >= total) if (DownSampleToPoints >= total)
{ {

View File

@ -62,7 +62,7 @@ public class CyclingController : DeviceServiceMonoBase
#endif #endif
//获取路书信息 //获取路书信息
mapApi = ConfigHelper.mapApi; mapApi = ConfigHelper.mapApi;
routeId = App.RouteIdParam > 0? App.RouteIdParam : 5492; routeId = App.RouteIdParam > 0? App.RouteIdParam : 2633;
mapRoute = mapApi.GetById(routeId).data; mapRoute = mapApi.GetById(routeId).data;
miniMap = transform.Find("MiniMap").gameObject;//小地图 miniMap = transform.Find("MiniMap").gameObject;//小地图
resultPanel = transform.Find("SingleUI/Panel/ResultPanel").gameObject; resultPanel = transform.Find("SingleUI/Panel/ResultPanel").gameObject;
@ -147,7 +147,7 @@ public class CyclingController : DeviceServiceMonoBase
loadingController.AddProcess(10); loadingController.AddProcess(10);
} }
//异步请求mapbox画出当前路书路线图 //异步请求mapbox画出当前路书路线图
//loadingController.DrawMapRoute(mapData); loadingController.DrawMapRoute(mapData);
loadingController.AddProcess(10); loadingController.AddProcess(10);
} }
//加载人物和地图以及UI界面 //加载人物和地图以及UI界面

View File

@ -344,7 +344,8 @@ namespace Assets.Scenes.Ride.Scripts
var polyline = Encode(result); var polyline = Encode(result);
var encodeline = UnityWebRequest.EscapeURL(polyline); //HttpUtility.UrlEncode(polyline); var encodeline = UnityWebRequest.EscapeURL(polyline); //HttpUtility.UrlEncode(polyline);
//获取封面图片 //获取封面图片
var url = $"https://api.mapbox.com/styles/v1/mapbox/dark-v10/static/path-4+35ace1-1({encodeline})/auto/1280x1280?access_token={App.MapBoxAccessToken}";
var url = $"https://api.mapbox.com/styles/v1/mapbox/dark-v10/static/path-4+35ace1-1({encodeline})/auto/1280x768?access_token={App.MapBoxAccessToken}&padding=200&pitch=60";
return url; return url;
} }
} }

View File

@ -66,7 +66,7 @@ namespace Assets.Scenes.Ride.Scripts
public void DrawMapRoute(MapDataModel mapData) public void DrawMapRoute(MapDataModel mapData)
{ {
var url = Helper.GetMapboxApiUrl(mapData.List); var url = Helper.GetMapboxApiUrl(mapData.List);
//Utils.DisplayImage(StartCoroutine, mapRouteImage, url); Utils.DisplayImage(StartCoroutine, mapRouteImage, url);
} }
//设定当前loading进度 //设定当前loading进度
public void AddProcess(float v) public void AddProcess(float v)

View File

@ -34,30 +34,30 @@ namespace Assets.Scenes.Ride.Scripts
bicycleWeight = App.CurrentUser.BicycleWeight; bicycleWeight = App.CurrentUser.BicycleWeight;
#if UNITY_EDITOR #if UNITY_EDITOR
power = Random.Range(1,2000);//测试功率 power = Random.Range(1,200);//测试功率
#endif #endif
mainController.TrackResistance(currentSlope);//TODO mainController.TrackResistance(currentSlope);//TODO
speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight); speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight);
distance = mainController.UpdateDistance(speed); distance = mainController.UpdateDistance(speed);
totalDistance += distance; totalDistance += distance;
//记录骑行数据 //记录骑行数据
var recorderData = mainController.cyclingController.recorderData; var recorderData = mainController.cyclingController.recorderData;
targetData = new TargetData targetData = new TargetData
{ {
Ticks = ticks, Ticks = ticks,
_Power = power, _Power = power,
_Speed = speed, _Speed = speed,
_Distance = totalDistance > mapData.TotalDistance ? mapData.TotalDistance : totalDistance, _Distance = totalDistance > mapData.TotalDistance ? mapData.TotalDistance : totalDistance,
_Cadence = cadance, _Cadence = cadance,
_HeartRate = heartRate, _HeartRate = heartRate,
_Lat = currentlatlong.x, _Lat = currentlatlong.x,
_Lon = currentlatlong.y, _Lon = currentlatlong.y,
_TotalClimb = totalClimb, _TotalClimb = totalClimb,
}; };
recorderData.RiderDatas.Add(targetData); recorderData.RiderDatas.Add(targetData);
} }
protected override void SendTcp() protected override void SendTcp()
{ {
if (mainController.cyclingController != null) if (mainController.cyclingController != null)

View File

@ -24,22 +24,35 @@ namespace Assets.Scenes.Ride.Scripts
Button cancelButton; Button cancelButton;
Button closeButton; Button closeButton;
Button searchButton; Button searchButton;
Button sortButton;
Image sortImage;
GameObject reviewPanel; GameObject reviewPanel;
GameObject noRecord;
InputField inputField; InputField inputField;
InputField startValue;
InputField endValue;
private int pageIndex = 0; private int pageIndex = 0;
private int pageSize = 10; private int pageSize = 8;
private int totalPages = 0; private int totalPages = 0;
private string seachName = string.Empty; private string seachName = string.Empty;
private double _startValue;
private double _endValue;
CyclingController cyclingController; CyclingController cyclingController;
public List<GameObject> gameObjects = new List<GameObject>(); public List<GameObject> gameObjects = new List<GameObject>();
List<SelectPlayerItemScript> selectPlayerItemScripts = new List<SelectPlayerItemScript>(); List<SelectPlayerItemScript> selectPlayerItemScripts = new List<SelectPlayerItemScript>();
MapApi mapApi; MapApi mapApi;
Sprite down;
Sprite up;
private void Awake() private void Awake()
{ {
mapApi = new MapApi(); mapApi = new MapApi();
cyclingController = FindObjectOfType<CyclingController>(); cyclingController = FindObjectOfType<CyclingController>();
//分页查询当前路数排行榜选手成绩列表 //分页查询当前路数排行榜选手成绩列表
prefab = Resources.Load<GameObject>("UI/Prefab/Ride/SelectPlayerItem"); prefab = Resources.Load<GameObject>("UI/Prefab/Ride/SelectPlayerItem");
down = Resources.Load<Sprite>("Images/DOWN");
up = Resources.Load<Sprite>("Images/UP");
scroll = transform.Find("Panel/PlayerList/Scroll View").gameObject; scroll = transform.Find("Panel/PlayerList/Scroll View").gameObject;
content = transform.Find("Panel/PlayerList/Scroll View/Viewport/Content"); content = transform.Find("Panel/PlayerList/Scroll View/Viewport/Content");
rideButton = transform.Find("Panel/RideButton").GetComponent<Button>(); rideButton = transform.Find("Panel/RideButton").GetComponent<Button>();
@ -47,22 +60,24 @@ namespace Assets.Scenes.Ride.Scripts
closeButton = transform.Find("Panel/Close").GetComponent<Button>(); closeButton = transform.Find("Panel/Close").GetComponent<Button>();
searchButton = transform.Find("Panel/SearchButton").GetComponent<Button>(); searchButton = transform.Find("Panel/SearchButton").GetComponent<Button>();
inputField = transform.Find("Panel/InputField").GetComponent<InputField>(); inputField = transform.Find("Panel/InputField").GetComponent<InputField>();
startValue = transform.Find("Panel/StartValue").GetComponent<InputField>();
endValue = transform.Find("Panel/EndValue").GetComponent<InputField>();
reviewPanel = transform.parent.Find("ReviewPanel").gameObject; reviewPanel = transform.parent.Find("ReviewPanel").gameObject;
selectPanel = transform.parent.Find("SelectPanel").gameObject; selectPanel = transform.parent.Find("SelectPanel").gameObject;
nearPanel = transform.parent.Find("NearPanel").gameObject; nearPanel = transform.parent.Find("NearPanel").gameObject;
noRecord = transform.Find("Panel/PlayerList/Scroll View/Viewport/NoRecord").gameObject;
sortButton = transform.Find("Panel/SortButton").GetComponent<Button>();
sortImage = transform.Find("Panel/SortButton/Image").GetComponent<Image>();
inputField.onValueChanged.AddListener(InputTextChanged); inputField.onValueChanged.AddListener(InputTextChanged);
//rideButton.onClick.AddListener(PreStart); startValue.onValueChanged.AddListener(StartvalueChanged);
//cancelButton.onClick.AddListener(Cancel); endValue.onValueChanged.AddListener(StartvalueChanged);
//closeButton.onClick.AddListener(Cancel);
//searchButton.onClick.AddListener(Search);
UIManager.AddEvent(rideButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, PreStart); UIManager.AddEvent(rideButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, PreStart);
UIManager.AddEvent(cancelButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, Cancel); UIManager.AddEvent(cancelButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, Cancel);
UIManager.AddEvent(closeButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, Cancel); UIManager.AddEvent(closeButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, Cancel);
UIManager.AddEvent(searchButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, Search); UIManager.AddEvent(searchButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, Search);
UIManager.AddEvent(sortButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, SortWKG);
UIManager.AddEvent(scroll, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag); UIManager.AddEvent(scroll, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
gameObjects.Add(transform.Find("Panel/Player1").gameObject); gameObjects.Add(transform.Find("Panel/Player1").gameObject);
@ -71,11 +86,34 @@ namespace Assets.Scenes.Ride.Scripts
gameObjects.Add(transform.Find("Panel/Player4").gameObject); gameObjects.Add(transform.Find("Panel/Player4").gameObject);
gameObjects.Add(transform.Find("Panel/Player5").gameObject); gameObjects.Add(transform.Find("Panel/Player5").gameObject);
} }
private void StartvalueChanged(string input)
{
_startValue = Convert.ToDouble(input);
}
private void EndvalueChanged(string input)
{
_endValue = Convert.ToDouble(input);
}
private void InputTextChanged(string input) private void InputTextChanged(string input)
{ {
seachName = input; seachName = input;
} }
private int sort = 0;//0:正序 1降序
private void SortWKG(BaseEventData baseEventData)
{
if (sort == 0)
{
sortImage.sprite = up;
sort = 1;
}
else
{
sort = 0;
sortImage.sprite = down;
}
Utils.DestroyChildren(content);
Refresh();
}
private void Search(BaseEventData baseEventData) private void Search(BaseEventData baseEventData)
{ {
Utils.DestroyChildren(content); Utils.DestroyChildren(content);
@ -124,10 +162,27 @@ namespace Assets.Scenes.Ride.Scripts
{ {
var list = mapApi.GetRouteRanking(App.RouteIdParam, "1", pageIndex, pageSize, seachName); var list = mapApi.GetRouteRanking(App.RouteIdParam, "1", pageIndex, pageSize, seachName);
totalPages = list.data.TotalPages; totalPages = list.data.TotalPages;
CreateGameObject(list.data.list); var data = list.data.list.Where(c => c.WeightKg >= _startValue && c.WeightKg <= _endValue).ToList();
if (sort == 0)
{
data = data.OrderBy(c => c.WeightKg).ToList();
}
else
{
data = data.OrderByDescending(c => c.WeightKg).ToList();
}
CreateGameObject(data);
} }
private void CreateGameObject(List<MapRouteRanking> list) private void CreateGameObject(List<MapRouteRanking> list)
{ {
if (list.Count == 0)
{
noRecord.SetActive(true);
}
else
{
noRecord.SetActive(false);
}
var parent = transform.Find("Panel/PlayerList/Scroll View/Viewport/Content"); var parent = transform.Find("Panel/PlayerList/Scroll View/Viewport/Content");
foreach (var item in list) foreach (var item in list)
{ {

View File

@ -13,6 +13,7 @@ using System.Collections.Generic;
using Assets.Cyp.Common; using Assets.Cyp.Common;
using System.Threading.Tasks; using System.Threading.Tasks;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using ChartAndGraph;
namespace Assets.Scenes.Ride.Scripts namespace Assets.Scenes.Ride.Scripts
{ {
@ -65,7 +66,7 @@ namespace Assets.Scenes.Ride.Scripts
LineChart elevationChart;//海拔图 LineChart elevationChart;//海拔图
RawImage img;//海拔图头像 RawImage img;//海拔图头像
RawImage miniMap;//小地图 RawImage miniMap;//小地图
RawImage altitudeGraph;//海拔图
#endregion #endregion
#region #region
@ -79,6 +80,7 @@ namespace Assets.Scenes.Ride.Scripts
private int count = 0; private int count = 0;
Image arrow; Image arrow;
AbstractMap map; AbstractMap map;
Transform t;
void Awake() void Awake()
{ {
#region #region
@ -108,7 +110,9 @@ namespace Assets.Scenes.Ride.Scripts
mapName = transform.Find("Panel/TitlePanel/MapName").GetComponent<Text>(); mapName = transform.Find("Panel/TitlePanel/MapName").GetComponent<Text>();
totalClimb = transform.Find("Panel/ComputerPanel/TotalClimbView/TotalClimb").GetComponent<Text>(); totalClimb = transform.Find("Panel/ComputerPanel/TotalClimbView/TotalClimb").GetComponent<Text>();
elevationChart = transform.Find("Panel/ElevationChart").GetComponent<LineChart>(); 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>(); miniMap = transform.Find("Panel/MiniMap").GetComponent<RawImage>();
selectPanel = transform.Find("Panel/SelectPanel").gameObject; selectPanel = transform.Find("Panel/SelectPanel").gameObject;
@ -127,6 +131,7 @@ namespace Assets.Scenes.Ride.Scripts
cancelQuitButton = transform.Find("Panel/QuitPanel/CancelButton").GetComponent<Button>(); cancelQuitButton = transform.Find("Panel/QuitPanel/CancelButton").GetComponent<Button>();
closeQuitButton = transform.Find("Panel/QuitPanel/CloseButton").GetComponent<Button>(); closeQuitButton = transform.Find("Panel/QuitPanel/CloseButton").GetComponent<Button>();
viewButton =transform.Find("Panel/ViewButton").GetComponent<Button>(); viewButton =transform.Find("Panel/ViewButton").GetComponent<Button>();
altitudeGraph = transform.Find("Panel/TitlePanel/AltitudeGraph").GetComponent<RawImage>();
target = transform.parent.Find("Target").gameObject; target = transform.parent.Find("Target").gameObject;
@ -194,6 +199,7 @@ namespace Assets.Scenes.Ride.Scripts
var route = mainController.GetRoute(); var route = mainController.GetRoute();
mapName.text = route.RouteInstance.Name; mapName.text = route.RouteInstance.Name;
totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 1).ToString() + "KM";//总里程 totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 1).ToString() + "KM";//总里程
Utils.DisplayImage(StartCoroutine, altitudeGraph, route.RouteInstance.AltitudeGraph);//渲染海拔图
RenderChart(); RenderChart();
startIndex = playerController.CurrentIndex; startIndex = playerController.CurrentIndex;
//继续骑行如果有伴侣就自动进入伴侣骑行 //继续骑行如果有伴侣就自动进入伴侣骑行
@ -257,6 +263,8 @@ namespace Assets.Scenes.Ride.Scripts
currentSlopeText.text = Math.Round(playerController.CurrentSlope, 1).ToString() + "%"; currentSlopeText.text = Math.Round(playerController.CurrentSlope, 1).ToString() + "%";
currentSlopeDistanceText.text = Math.Round(playerController.CurrentSlopeDistance, 0).ToString() + "M"; currentSlopeDistanceText.text = Math.Round(playerController.CurrentSlopeDistance, 0).ToString() + "M";
totalClimb.text = Math.Round(playerController.TotalClimb, 0).ToString(); totalClimb.text = Math.Round(playerController.TotalClimb, 0).ToString();
//动态显示当前人物移动动画
//移动海拔图头像 TODO移动所有人的头像 //移动海拔图头像 TODO移动所有人的头像
//MoveChartMarkPoint(); //MoveChartMarkPoint();
@ -394,9 +402,12 @@ namespace Assets.Scenes.Ride.Scripts
private int startIndex;//选中玩家起始索引 private int startIndex;//选中玩家起始索引
private int interval = 50;//选中玩家移动索引个数 private int interval = 50;//选中玩家移动索引个数
private float[] elevationList; private float[] elevationList;
GraphChartBase graph;
//初始化海拔图 //初始化海拔图
void RenderChart() void RenderChart()
{ {
//elevationChart.ClearData(); //elevationChart.ClearData();
//elevationList = mainController.GetLineChartData(); //elevationList = mainController.GetLineChartData();
//totalCount = elevationList.Length; //totalCount = elevationList.Length;
@ -437,6 +448,9 @@ namespace Assets.Scenes.Ride.Scripts
dd.Add(item.Elevation); dd.Add(item.Elevation);
} }
var sc = transform.Find("Panel/GraphChart").GetComponent<ChartDataSourceScript>(); var sc = transform.Find("Panel/GraphChart").GetComponent<ChartDataSourceScript>();
graph = transform.Find("Panel/GraphChart").GetComponent<GraphChartBase>();
sc.SetDataSource(dd.ToArray()); sc.SetDataSource(dd.ToArray());
if (App.CurrentUser != null) if (App.CurrentUser != null)
@ -496,8 +510,29 @@ namespace Assets.Scenes.Ride.Scripts
} }
} }
public GameObject testButton; public GameObject testButton;
//挪到人物脚本中处理
void MoveChartMarkPoint() 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(); //var dataPoints = elevationChart.series.list[0].dataPoints.OrderBy(c => c.x).ToList();
//if (dataPoints.Count > 0) //if (dataPoints.Count > 0)
//{ //{
@ -508,8 +543,8 @@ namespace Assets.Scenes.Ride.Scripts
//if (pointMap.ContainsKey(playerController.CurrentIndex-1) ) //if (pointMap.ContainsKey(playerController.CurrentIndex-1) )
//{ //{
// Vector3 mousePos; // Vector3 mousePos;
// //testButton.transform.localPosition = new Vector3(pointMap[playerController.CurrentIndex - 1].x, pointMap[playerController.CurrentIndex - 1].y, 0); // //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); // //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); // //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); // //pointMap.Remove(playerController.CurrentIndex - 1);
//} //}
#endregion
} }
} }
} }

View File

@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Assets.Scenes.Ride.Scripts
{
public class SpirteRenderScript:MonoBehaviour
{
List<Sprite> sprites;
Image image;
private void Start()
{
sprites = new List<Sprite>();
for (int i = 1; i < 61; i++)
{
sprites.Add(Resources.Load<Sprite>($"Images/Ride/wave/wave{i.ToString("0000")}"));
}
image = transform.GetComponent<Image>();
}
int index = 0;
float time = 0;
void Update()
{
time += Time.deltaTime;
if (time < 0.03)
{
return;
}
time = 0;
if (index % 59 == 0)
{
index = 0;
}
image.sprite = sprites[index];
index ++;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d80d4c7bf8cc8e442a807231db86f84a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -73,10 +73,10 @@ namespace Assets.Scripts.Apis.Models
private void CalcDistance() private void CalcDistance()
{ {
_List[0].Distance = 0; _List[0].Distance = 0;
for (int i = 0; i < _List.Count - 1; i++) for (int i = 1; i < _List.Count - 1; i++)
{ {
var pt1 = Turf.Point(new double[] { _List[i].Point[1], _List[i].Point[0] }); var pt1 = Turf.Point(new double[] { _List[i-1].Point[1], _List[i-1].Point[0] });
var pt2 = Turf.Point(new double[] { _List[i+1].Point[1], _List[i+1].Point[0] }); var pt2 = Turf.Point(new double[] { _List[i].Point[1], _List[i].Point[0] });
var value = Turf.Distance(pt1, pt2, "kilometers") ; var value = Turf.Distance(pt1, pt2, "kilometers") ;
_List[i].Distance = Math.Round(value*1000, 2); _List[i].Distance = Math.Round(value*1000, 2);
} }