继骑&重骑骑行结果页细节调整
This commit is contained in:
1 parent
018699c944
commit
afba150d91
34 files changed
+3601
-2379
No files matched your search
@@ -27,6 +27,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
GameObject _directionsGO;
|
||||
GameObject _mipMapRoute;
|
||||
GameObject _pathRoute;
|
||||
CyclingController cyclingCotroller;
|
||||
private bool initComplete = false;
|
||||
|
||||
@@ -95,6 +96,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
var meshData = new MeshData();
|
||||
var dat = new List<Vector3>();
|
||||
var path = new List<Vector3>();
|
||||
|
||||
var mapData = cyclingCotroller.GetMapData();
|
||||
if (mapData != null)
|
||||
@@ -105,21 +107,33 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var point = mapData.List[i].Point;
|
||||
Vector3 item = _map.GeoToWorldPosition(new Vector2d(point[0], point[1]));
|
||||
item.y += 0.3f;
|
||||
if (!posInScreen(item) && i > playerController.CurrentIndex)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (posInScreen(item))
|
||||
//if (!posInScreen(item) && i > playerController.CurrentIndex)
|
||||
//{
|
||||
// break;
|
||||
//}
|
||||
//else if (posInScreen(item))
|
||||
//{
|
||||
// dat.Add(item);
|
||||
//}
|
||||
//前后取50个点
|
||||
decimal diff = i - playerController.CurrentIndex;
|
||||
decimal diffAbs = Math.Abs(diff);
|
||||
if (diffAbs <= 50)
|
||||
{
|
||||
dat.Add(item);
|
||||
}
|
||||
if (diff < 0 && diff > -100)
|
||||
{
|
||||
item.y += 0.30001f;
|
||||
path.Add(item);
|
||||
}
|
||||
}
|
||||
var feat = new VectorFeatureUnity();
|
||||
feat.Points.Add(dat);
|
||||
//处理海拔高度的问题
|
||||
//SnapModifier.Run(feat, meshData, tile);
|
||||
CreatMapRoute(feat);//创建路线
|
||||
//CreateMiniMapRoute(feat);//创建小地图路线
|
||||
CreatPathRoute(path);//创建骑行过的线路
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +143,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Vector3 viewPos = Camera.main.WorldToViewportPoint(position);
|
||||
Vector3 dir = (position - camreatra.localPosition).normalized;
|
||||
float dot = Vector3.Dot(camreatra.forward, dir);
|
||||
if (dot > -0.1 && viewPos.x >= -0.1 && viewPos.x <= 1.1 && viewPos.y >= -0.1 && viewPos.y <= 1.1)
|
||||
if (dot > 0 && viewPos.x >= 0 && viewPos.x <= 1.5 && viewPos.y >= 0 && viewPos.y <= 1.5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -176,23 +190,44 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
||||
var dat = feat.Points[0];
|
||||
ColorUtility.TryParseHtmlString("#FF2742", out Color c);
|
||||
lineRender.endColor = c;
|
||||
lineRender.startColor = c;
|
||||
lineRender.endColor = new Color(1,1,1,0.65f);
|
||||
lineRender.startColor = new Color(1, 1, 1, 0.65f);
|
||||
|
||||
//设置宽度
|
||||
lineRender.SetWidth(0.5f, 0.5f);
|
||||
lineRender.SetVertexCount(dat.Count);
|
||||
lineRender.startWidth = 0.6f;
|
||||
lineRender.endWidth = 0.6f;
|
||||
lineRender.positionCount = dat.Count;
|
||||
lineRender.SetPositions(feat.Points[0].ToArray());
|
||||
lineRender.loop = false;
|
||||
lineRender.numCapVertices = 90;
|
||||
float alpha = 1.0f;
|
||||
//Gradient gradient = new Gradient();
|
||||
//gradient.SetKeys(
|
||||
// new GradientColorKey[] { new GradientColorKey(Color.green, 0.0f), new GradientColorKey(Color.red, 1.0f) },
|
||||
// new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) }
|
||||
//);
|
||||
//lineRender.colorGradient = gradient;
|
||||
lineRender.numCornerVertices = 90;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CreatPathRoute(List<Vector3> feat)
|
||||
{
|
||||
if (_pathRoute != null)
|
||||
{
|
||||
_pathRoute.Destroy();
|
||||
}
|
||||
_pathRoute = new GameObject("MapPathRoute");
|
||||
_pathRoute.transform.parent = transform;
|
||||
var lineRender = _pathRoute.AddComponent<LineRenderer>();
|
||||
lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
||||
|
||||
lineRender.endColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 0.65f);
|
||||
lineRender.startColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 0.65f);
|
||||
|
||||
//设置宽度
|
||||
lineRender.startWidth = 0.61f;
|
||||
lineRender.endWidth = 0.61f;
|
||||
lineRender.positionCount = feat.Count;
|
||||
lineRender.SetPositions(feat.ToArray());
|
||||
lineRender.loop = false;
|
||||
lineRender.numCapVertices = 90;
|
||||
lineRender.numCornerVertices = 90;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user