继骑&重骑骑行结果页细节调整
This commit is contained in:
1 parent
018699c944
commit
afba150d91
34 files changed
+3601
-2379
No files matched your search
@@ -33,6 +33,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
#region 选手骑行数据
|
||||
protected Vector2d nextlatlong; //下一个点的坐标
|
||||
protected Vector2d currentlatlong; //当前坐标
|
||||
//protected bool isStart;//开始或者暂停
|
||||
public bool isQuit;//true 中途退出 或者到达终点
|
||||
protected bool isMajor;//是否是主人公
|
||||
@@ -71,7 +72,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public double CurrentSlopeDistance { get => currentSlopeDistance; }
|
||||
public double Elevation { get => elevation; }
|
||||
public double LastEndDistance { get => lastEndDistance; }
|
||||
public Vector2d Nextlatlong { get => nextlatlong; }
|
||||
public Vector2d Currentlatlong { get => currentlatlong; }
|
||||
#endregion
|
||||
|
||||
#region 游戏状态控制
|
||||
@@ -116,12 +117,10 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
protected BaseCycling cyclingExcutor;
|
||||
protected virtual void Init()
|
||||
{
|
||||
characterAnimator = GetComponentInChildren<Animator>();
|
||||
//characterAnimator = GetComponentInChildren<Animator>();
|
||||
mainController = transform.parent.GetComponent<CyclingController>();
|
||||
map = transform.parent.Find("Map").GetComponent<AbstractMap>();
|
||||
mapData = mainController.GetMapData();//获取路书信息
|
||||
nextlatlong = new Vector2d(mapData.List[0].Point[0], mapData.List[0].Point[1]);//初始化人物位置 TODO加上之前骑行距离
|
||||
cyclingExcutor = mainController.cyclingController;
|
||||
}
|
||||
|
||||
protected virtual void Excute()
|
||||
@@ -163,14 +162,14 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
distance = totalDistance - mapData.TotalDistance;
|
||||
totalDistance = mapData.TotalDistance;
|
||||
//characterAnimator.SetBool("ReachEnd", true);//到达终点
|
||||
Upload();
|
||||
StartCoroutine("LateUpload");
|
||||
isQuit = true;
|
||||
}
|
||||
|
||||
//数据处理
|
||||
nextlatlong = Along(totalDistance);//下一个坐标
|
||||
nextPos = map.GeoToWorldPosition(nextlatlong);//下一个点
|
||||
nextPos.y += 0.5f;//提高y轴让人物站在地图上面
|
||||
currentlatlong = Along(totalDistance);//下一个坐标
|
||||
nextPos = map.GeoToWorldPosition(currentlatlong);//下一个点
|
||||
nextPos.y += 0.6f;//提高y轴让人物站在地图上面
|
||||
prePos = transform.localPosition;//当前点
|
||||
thisRotation = transform.localRotation;
|
||||
//动画控制
|
||||
@@ -201,6 +200,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
#region 工具类
|
||||
|
||||
IEnumerator LateUpload()
|
||||
{
|
||||
yield return new WaitForSeconds(1);
|
||||
Upload();
|
||||
StopCoroutine("LateUpload");
|
||||
}
|
||||
|
||||
protected string CaptureCamera(Camera camera, Rect rect)
|
||||
{
|
||||
// 创建一个RenderTexture对象
|
||||
@@ -225,8 +231,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
RenderTexture.active = null; // JC: added to avoid errors
|
||||
GameObject.Destroy(rt);
|
||||
// 最后将这些纹理数据,成一个图片文件
|
||||
byte[] bytes = screenShot.EncodeToJPG();
|
||||
string filename = Application.dataPath + "/"+Guid.NewGuid().ToString() +".jpg";
|
||||
byte[] bytes = screenShot.EncodeToPNG();
|
||||
string filename = Application.dataPath + "/"+Guid.NewGuid().ToString() +".png";
|
||||
System.IO.File.WriteAllBytes(filename, bytes);
|
||||
//Debug.Log(string.Format("截屏了一张照片: {0}", filename));
|
||||
return filename;
|
||||
@@ -259,6 +265,10 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
nextSlope = pointList[nextIndex].Grade;
|
||||
nextSlopeDistance = sumDistance - totalDistance * 1000;
|
||||
currentSlopeDistance = totalDistance * 1000 - (sumDistance - pointList[index].Distance);
|
||||
////bearing
|
||||
//var nextpoint = Turf.Point(new double[] { pointList[nextIndex].Point[1], pointList[nextIndex].Point[0] });
|
||||
//var point = Turf.Point(new double[] { currentlatlong.y, currentlatlong.x });
|
||||
//bearing = TurfCS.Turf.Bearing(point, nextpoint);
|
||||
}
|
||||
//根据距离计算坐标
|
||||
Vector2d Along(double endDistance)
|
||||
@@ -271,7 +281,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var ll = ((GeographicPosition)((GeoJSON.Net.Geometry.Point)pt1.Geometry).Coordinates);
|
||||
return new Vector2d(ll.Latitude, ll.Longitude);
|
||||
}
|
||||
return nextlatlong;
|
||||
return currentlatlong;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in new issue
Block a user