骑行页面消息通知
在线用户和影子选手用图片显示,缩放等功能按钮微调
This commit is contained in:
1 parent
2b4b2c4f70
commit
8f0598580d
37 files changed
+5951
-3153
No files matched your search
@@ -1,9 +1,12 @@
|
||||
using Assets.Scenes.Ride.Scripts.Model;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using ChartAndGraph;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Linq;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
@@ -12,15 +15,28 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public PlayerController _playerController;
|
||||
RawImage head;
|
||||
GameObject headPanel;
|
||||
|
||||
|
||||
Image arrowImage;
|
||||
GameObject reviewInfoPanel;
|
||||
Transform uiObject;
|
||||
|
||||
GraphChartBase graph;
|
||||
ChartDataSourceScript chartDataSourceScript;
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
currentlatlong = mainController.GetCenterCoordinate();
|
||||
_playerController = FindObjectOfType<PlayerController>();
|
||||
var cuurentLocalPos = map.GeoToWorldPosition(currentlatlong);
|
||||
cuurentLocalPos.y += transform.localScale.y;
|
||||
transform.localPosition = cuurentLocalPos;
|
||||
graph = transform.parent.Find("SingleUI/Panel/GraphChart").GetComponent<GraphChartBase>();
|
||||
chartDataSourceScript = transform.parent.Find("SingleUI/Panel/GraphChart").GetComponent<ChartDataSourceScript>();
|
||||
|
||||
//创建UI
|
||||
uiObject = transform.parent.Find("SingleUI/Panel/ArrowList");
|
||||
arrowImage = Instantiate(Resources.Load<Image>("UI/Prefab/Ride/ReviewArrow"), uiObject);
|
||||
arrowImage.color = new Color(0.1529412f, 0.8745098f, 0.8901961f);
|
||||
|
||||
|
||||
}
|
||||
protected override bool GetStart()
|
||||
{
|
||||
@@ -28,8 +44,12 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
protected override void Compute()
|
||||
{
|
||||
Debug.Log("31" + totalDistance.ToString());
|
||||
currentlatlong = mainController.Along(totalDistance);//下一个坐标
|
||||
//var currentUser = cyclingExcutor.riders.Where(c => c.UserId == UserId).FirstOrDefault();
|
||||
//if (currentUser == null)
|
||||
//{
|
||||
// RemoveSelf();
|
||||
//}
|
||||
}
|
||||
|
||||
public void SetDistance(double _distance)
|
||||
@@ -38,22 +58,46 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
public void SetTotalDistance(double _totalDistance, double _distance)
|
||||
{
|
||||
Debug.Log("41" + _totalDistance.ToString());
|
||||
totalDistance = _totalDistance;
|
||||
distance = _distance;
|
||||
}
|
||||
|
||||
public int GetCurrentIndex(double endistance,MapDataModel mapDataModel)
|
||||
{
|
||||
var pointList = mapDataModel.List;
|
||||
int onIndex = 0;
|
||||
var sumDistance = 0D;
|
||||
for (int i = 0; i < pointList.Count; i++)
|
||||
{
|
||||
sumDistance += pointList[i].Distance;
|
||||
if (endistance * 1000 <= sumDistance)
|
||||
{
|
||||
onIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return onIndex;
|
||||
}
|
||||
|
||||
private string headUrl;
|
||||
public void SetHead(string url )
|
||||
{
|
||||
headUrl = url;
|
||||
}
|
||||
public void MoveHead(Transform parent,Vector3 nextPosition)
|
||||
public void MoveHead(Transform parent)
|
||||
{
|
||||
var itemIndex = chartDataSourceScript.GetViewIndex(GetCurrentIndex(TotalDistance, mainController.GetMapData())) + 1;
|
||||
var m = graph.DataSource.GetPoint("Player 2", itemIndex);
|
||||
graph.PointToWorldSpace(out Vector3 itemPosition, m.x, m.y, "Player 2");
|
||||
itemPosition.x -= 12f;
|
||||
itemPosition.y += 5f;
|
||||
|
||||
if (headPanel == null)
|
||||
{
|
||||
headPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Ride/HeadPanel"));
|
||||
headPanel.transform.parent = parent;
|
||||
headPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Ride/OnlineHeadPanel"));
|
||||
headPanel.transform.SetParent(parent);
|
||||
headPanel.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
|
||||
headPanel.transform.position = itemPosition;
|
||||
}
|
||||
if (head == null)
|
||||
{
|
||||
@@ -63,7 +107,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Utils.DisplayImage(head, headUrl, true);
|
||||
}
|
||||
}
|
||||
headPanel.transform.DOMove(new Vector3(nextPosition.x, nextPosition.y, 0), 1);
|
||||
|
||||
headPanel.transform.DOMove(new Vector3(itemPosition.x, itemPosition.y, 0), 1);
|
||||
}
|
||||
|
||||
public void RemoveSelf()
|
||||
@@ -71,5 +116,10 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
transform.gameObject.Destroy();
|
||||
headPanel.Destroy();
|
||||
}
|
||||
protected override void AfterExcute()
|
||||
{
|
||||
((RectTransform)arrowImage.transform).position = Camera.main.WorldToScreenPoint(transform.position);
|
||||
MoveHead(graph.transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user