骑行界面字体
This commit is contained in:
parent
af63072f29
commit
82923fe4f8
@ -30,7 +30,7 @@ Transform:
|
||||
m_GameObject: {fileID: 3777003654129381334}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 5, y: 5, z: 5}
|
||||
m_LocalScale: {x: 3, y: 3, z: 3}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
|
||||
@ -150,9 +150,9 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Font: {fileID: 12800000, guid: 1db9e217733971041be26b076fda6083, type: 3}
|
||||
m_FontSize: 12
|
||||
m_FontStyle: 1
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
@ -162,7 +162,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: 3.5k/w
|
||||
m_Text: 0k/w
|
||||
--- !u!1 &4351825891595637247
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -313,9 +313,9 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Font: {fileID: 12800000, guid: 9428f2aab98e9c34d923a9174035a197, type: 3}
|
||||
m_FontSize: 16
|
||||
m_FontStyle: 1
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
@ -325,7 +325,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Devin Andrews
|
||||
m_Text:
|
||||
--- !u!1 &5549514346458199295
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -391,9 +391,9 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Font: {fileID: 12800000, guid: 1db9e217733971041be26b076fda6083, type: 3}
|
||||
m_FontSize: 12
|
||||
m_FontStyle: 1
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
@ -403,7 +403,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: 180KM
|
||||
m_Text: 0KM
|
||||
--- !u!1 &5549514346831226102
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -136,9 +136,9 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Font: {fileID: 12800000, guid: 1db9e217733971041be26b076fda6083, type: 3}
|
||||
m_FontSize: 12
|
||||
m_FontStyle: 1
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
@ -148,7 +148,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: 3.5k/w
|
||||
m_Text: 0k/w
|
||||
--- !u!1 &4351825891595637247
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -254,8 +254,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 114, y: -20}
|
||||
m_SizeDelta: {x: 122, y: 22}
|
||||
m_AnchoredPosition: {x: 120.89, y: -20}
|
||||
m_SizeDelta: {x: 135.78821, y: 22}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5549514346347886655
|
||||
CanvasRenderer:
|
||||
@ -285,19 +285,19 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Font: {fileID: 12800000, guid: 9428f2aab98e9c34d923a9174035a197, type: 3}
|
||||
m_FontSize: 16
|
||||
m_FontStyle: 1
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 3
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_HorizontalOverflow: 1
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Devin Andrews
|
||||
m_Text:
|
||||
--- !u!1 &5549514346458199295
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -363,9 +363,9 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Font: {fileID: 12800000, guid: 1db9e217733971041be26b076fda6083, type: 3}
|
||||
m_FontSize: 12
|
||||
m_FontStyle: 1
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
|
||||
@ -139,9 +139,9 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Font: {fileID: 12800000, guid: 1db9e217733971041be26b076fda6083, type: 3}
|
||||
m_FontSize: 24
|
||||
m_FontStyle: 1
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 2
|
||||
m_MaxSize: 40
|
||||
@ -217,16 +217,16 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Font: {fileID: 12800000, guid: 9428f2aab98e9c34d923a9174035a197, type: 3}
|
||||
m_FontSize: 12
|
||||
m_FontStyle: 1
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 3
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_HorizontalOverflow: 1
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: sddsad
|
||||
|
||||
@ -219,6 +219,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 1a77881c6394b0947b40b398dcdcc7db, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
isSelected: 0
|
||||
--- !u!1 &8411558193619762831
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -284,9 +285,9 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Font: {fileID: 12800000, guid: 9428f2aab98e9c34d923a9174035a197, type: 3}
|
||||
m_FontSize: 12
|
||||
m_FontStyle: 1
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
@ -362,9 +363,9 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Font: {fileID: 12800000, guid: 1db9e217733971041be26b076fda6083, type: 3}
|
||||
m_FontSize: 16
|
||||
m_FontStyle: 1
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
|
||||
@ -13,9 +13,9 @@ RenderTexture:
|
||||
m_ForcedFallbackFormat: 4
|
||||
m_DownscaleFallback: 0
|
||||
serializedVersion: 3
|
||||
m_Width: 256
|
||||
m_Height: 256
|
||||
m_AntiAliasing: 1
|
||||
m_Width: 1600
|
||||
m_Height: 900
|
||||
m_AntiAliasing: 4
|
||||
m_MipCount: -1
|
||||
m_DepthFormat: 2
|
||||
m_ColorFormat: 8
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -75,31 +75,6 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public Vector2d Currentlatlong { get => currentlatlong; }
|
||||
#endregion
|
||||
|
||||
#region 游戏状态控制
|
||||
//开始骑行
|
||||
public void SetStart()
|
||||
{
|
||||
mainController.isStart = true;
|
||||
startTime = DateTime.Now;
|
||||
}
|
||||
//继续骑行
|
||||
public void SetContinue()
|
||||
{
|
||||
mainController.isStart = true;
|
||||
}
|
||||
//暂停骑行
|
||||
public void SetPause()
|
||||
{
|
||||
mainController.isStart = false;
|
||||
//characterAnimator.SetBool("IsRide", false);
|
||||
}
|
||||
//退出或者完成骑行
|
||||
public void SetQuit()
|
||||
{
|
||||
isQuit = true;
|
||||
endTime.AddSeconds(ticks);//计算结束时间
|
||||
}
|
||||
#endregion
|
||||
|
||||
void Start()
|
||||
{
|
||||
@ -207,43 +182,14 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
StopCoroutine("LateUpload");
|
||||
}
|
||||
|
||||
protected string CaptureCamera(Camera camera, Rect rect)
|
||||
{
|
||||
// 创建一个RenderTexture对象
|
||||
RenderTexture rt = new RenderTexture((int)rect.width, (int)rect.height, 0);
|
||||
// 临时设置相关相机的targetTexture为rt, 并手动渲染相关相机
|
||||
camera.targetTexture = rt;
|
||||
camera.Render();
|
||||
//ps: --- 如果这样加上第二个相机,可以实现只截图某几个指定的相机一起看到的图像。
|
||||
//ps: camera2.targetTexture = rt;
|
||||
//ps: camera2.Render();
|
||||
//ps: -------------------------------------------------------------------
|
||||
|
||||
// 激活这个rt, 并从中中读取像素。
|
||||
RenderTexture.active = rt;
|
||||
Texture2D screenShot = new Texture2D((int)rect.width, (int)rect.height, TextureFormat.RGB24, false);
|
||||
screenShot.ReadPixels(rect, 0, 0);// 注:这个时候,它是从RenderTexture.active中读取像素
|
||||
screenShot.Apply();
|
||||
|
||||
// 重置相关参数,以使用camera继续在屏幕上显示
|
||||
camera.targetTexture = null;
|
||||
//ps: camera2.targetTexture = null;
|
||||
RenderTexture.active = null; // JC: added to avoid errors
|
||||
GameObject.Destroy(rt);
|
||||
// 最后将这些纹理数据,成一个图片文件
|
||||
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;
|
||||
}
|
||||
|
||||
public int CurrentIndex;
|
||||
private int index;
|
||||
//当前距离所在的海拔/坡度/距离 下一个点的坡度以及剩余距离
|
||||
void ComputeNextSlope()
|
||||
{
|
||||
double sumDistance = 0;
|
||||
if (mapData == null)
|
||||
return;
|
||||
var pointList = mapData.List;
|
||||
int preIndex = 0;
|
||||
for (int i = 0; i < pointList.Count; i++)
|
||||
@ -265,10 +211,6 @@ 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)
|
||||
|
||||
@ -22,6 +22,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
public GameObject UIObject;
|
||||
public RouteResultParam selectParamModel;
|
||||
public RouteResult routeResult;
|
||||
|
||||
public int preticks;
|
||||
|
||||
#region 参数
|
||||
@ -35,6 +36,10 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
|
||||
private MapApi mapApi;
|
||||
private Route mapRoute;
|
||||
public DateTime startTime;
|
||||
public DateTime endTime;
|
||||
public bool isQuit;
|
||||
public bool isPause;
|
||||
#endregion
|
||||
GameObject loadingcanvas;
|
||||
void Awake()
|
||||
@ -111,6 +116,40 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
}
|
||||
}
|
||||
|
||||
#region 游戏状态控制
|
||||
//开始骑行
|
||||
public void SetStart()
|
||||
{
|
||||
if (!isPause)
|
||||
{
|
||||
isStart = true;
|
||||
startTime = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetContinue();
|
||||
}
|
||||
}
|
||||
//继续骑行
|
||||
public void SetContinue()
|
||||
{
|
||||
isStart = true;
|
||||
isPause = false;
|
||||
}
|
||||
//暂停骑行
|
||||
public void SetPause()
|
||||
{
|
||||
isStart = false;
|
||||
isPause = true;
|
||||
}
|
||||
//退出或者完成骑行
|
||||
public void SetQuit()
|
||||
{
|
||||
isStart = false;
|
||||
isQuit = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据处理
|
||||
/// <summary>
|
||||
/// 当前骑行数据的记录器
|
||||
@ -131,6 +170,50 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
{
|
||||
return mapData;
|
||||
}
|
||||
public void Save(double totalDistance)
|
||||
{
|
||||
isStart = false;
|
||||
string imageFileName = CaptureCamera(Camera.main, new Rect(Screen.width * 0f, Screen.height * 0f, Screen.width * 0.5f, Screen.height * 0.5f));
|
||||
cyclingController.recorderData.StartTime = startTime;
|
||||
cyclingController.recorderData.IsCompleted = totalDistance == mapData.TotalDistance;
|
||||
cyclingController.recorderData.EndDistance = totalDistance;
|
||||
cyclingController.recorderData.AntModelId = AntModelId;
|
||||
cyclingController.recorderData.ManufacturerId = ManufacturerId;
|
||||
cyclingController.recorderData.DeviceNumber = DeviceNumber;
|
||||
cyclingController.recorderData.SaveData(cyclingModel, selectParamModel, imageFileName);
|
||||
}
|
||||
|
||||
protected string CaptureCamera(Camera camera, Rect rect)
|
||||
{
|
||||
// 创建一个RenderTexture对象
|
||||
RenderTexture rt = new RenderTexture((int)rect.width, (int)rect.height, 0);
|
||||
// 临时设置相关相机的targetTexture为rt, 并手动渲染相关相机
|
||||
camera.targetTexture = rt;
|
||||
camera.Render();
|
||||
//ps: --- 如果这样加上第二个相机,可以实现只截图某几个指定的相机一起看到的图像。
|
||||
//ps: camera2.targetTexture = rt;
|
||||
//ps: camera2.Render();
|
||||
//ps: -------------------------------------------------------------------
|
||||
|
||||
// 激活这个rt, 并从中中读取像素。
|
||||
RenderTexture.active = rt;
|
||||
Texture2D screenShot = new Texture2D((int)rect.width, (int)rect.height, TextureFormat.RGB24, false);
|
||||
screenShot.ReadPixels(rect, 0, 0);// 注:这个时候,它是从RenderTexture.active中读取像素
|
||||
screenShot.Apply();
|
||||
|
||||
// 重置相关参数,以使用camera继续在屏幕上显示
|
||||
camera.targetTexture = null;
|
||||
//ps: camera2.targetTexture = null;
|
||||
RenderTexture.active = null; // JC: added to avoid errors
|
||||
GameObject.Destroy(rt);
|
||||
// 最后将这些纹理数据,成一个图片文件
|
||||
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;
|
||||
}
|
||||
|
||||
public Vector2d GetCenterCoordinate()
|
||||
{
|
||||
return coordiantes;
|
||||
|
||||
@ -32,6 +32,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
panel = transform.Find("Panel").gameObject;
|
||||
mapName = transform.Find("Panel/MapName").GetComponent<Text>();
|
||||
distance = transform.Find("Panel/Distance").GetComponent<Text>();
|
||||
level = transform.Find("Panel/level/Text").GetComponent<Text>();
|
||||
elevaction = transform.Find("Panel/Elevaction").GetComponent<Text>();
|
||||
slope = transform.Find("Panel/Slope").GetComponent<Text>();
|
||||
@ -48,13 +49,12 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var map = mapApi.GetById(routeId);
|
||||
var route = map.data;
|
||||
|
||||
|
||||
mapName.text = route.Name;
|
||||
level.text = route.Hard;
|
||||
elevaction.text = route.EleDifference.ToString("g0");
|
||||
elevaction.text = Math.Round(route.EleDifference,0).ToString()+"FT";
|
||||
slope.text = Math.Round(route.AverageGrade,2).ToString() + "%";
|
||||
rideNum.text = route.TheHeat.ToString();
|
||||
|
||||
distance.text = route.Distance.ToString("f1")+"KM";
|
||||
var userList = mapApi.GetOnlineUserInfo(new int[] { route.UserId }).data;
|
||||
if (userList.Count > 0)
|
||||
{
|
||||
@ -101,18 +101,18 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetAlpha != canvasGroup.alpha && depressFlag)
|
||||
{
|
||||
canvasGroup.alpha = Mathf.Lerp(canvasGroup.alpha, targetAlpha, alphaSpeed * Time.deltaTime);
|
||||
if (Mathf.Abs(targetAlpha - canvasGroup.alpha) <= 0.01f)
|
||||
{
|
||||
canvasGroup.alpha = targetAlpha;
|
||||
}
|
||||
if (canvasGroup.alpha == 0)
|
||||
{
|
||||
transform.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (targetAlpha != canvasGroup.alpha && depressFlag)
|
||||
{
|
||||
canvasGroup.alpha = Mathf.Lerp(canvasGroup.alpha, targetAlpha, alphaSpeed * Time.deltaTime);
|
||||
if (Mathf.Abs(targetAlpha - canvasGroup.alpha) <= 0.01f)
|
||||
{
|
||||
canvasGroup.alpha = targetAlpha;
|
||||
}
|
||||
if (canvasGroup.alpha == 0)
|
||||
{
|
||||
transform.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +1,10 @@
|
||||
using UnityEngine;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System;
|
||||
using Assets.Scripts.Apis;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Assets.Scenes.Ride.Scripts.Model;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
public class PlayerController : AbstractPlayer
|
||||
public class PlayerController : AbstractPlayer
|
||||
{
|
||||
#region 骑行逻辑
|
||||
|
||||
@ -74,16 +67,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//上传数据
|
||||
public override void Upload()
|
||||
{
|
||||
mainController.isStart = false;
|
||||
string imageFileName = base.CaptureCamera(Camera.main, new Rect(Screen.width * 0f, Screen.height * 0f, Screen.width * 0.5f, Screen.height * 0.5f));
|
||||
mainController.cyclingController.recorderData.StartTime = startTime;
|
||||
mainController.cyclingController.recorderData.IsCompleted = totalDistance == mapData.TotalDistance;
|
||||
mainController.cyclingController.recorderData.EndDistance = totalDistance;
|
||||
mainController.cyclingController.recorderData.AntModelId = mainController.AntModelId;
|
||||
mainController.cyclingController.recorderData.ManufacturerId = mainController.ManufacturerId;
|
||||
mainController.cyclingController.recorderData.DeviceNumber = mainController.DeviceNumber;
|
||||
mainController.cyclingController.recorderData.SaveData(mainController.cyclingModel, mainController.selectParamModel, imageFileName);
|
||||
|
||||
mainController.Save(TotalDistance);
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
mainController = FindObjectOfType<CyclingController>();
|
||||
var route = mainController.GetRoute();
|
||||
mapName.text = route.RouteInstance.Name;
|
||||
totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 2).ToString() + "KM";//总里程
|
||||
totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 1).ToString() + "KM";//总里程
|
||||
RenderChart();
|
||||
startIndex = playerController.CurrentIndex;
|
||||
//继续骑行如果有伴侣就自动进入伴侣骑行
|
||||
@ -193,10 +193,10 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
if (playerController != null)
|
||||
{
|
||||
//绑定UI
|
||||
speedTxt.text = $"{playerController.Speed}";
|
||||
speedTxt.text = $"{Math.Round(playerController.Speed,1)}";
|
||||
powerTxt.text = $"{playerController.Power}";
|
||||
timerTxt.text = Helper.FormatTicks(playerController.TotalTicks);
|
||||
ditance.text = Math.Round(playerController.TotalDistance, 2).ToString("f2")+"KM";
|
||||
ditance.text = Math.Round(playerController.TotalDistance, 1).ToString("f1");
|
||||
heartRate.text = $"{Math.Round(playerController.HeartRate, 0)}";
|
||||
candance.text = $"{Math.Round(playerController.Cadance, 0)}";
|
||||
//倒计时
|
||||
@ -208,7 +208,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
count--;
|
||||
if (count == 0)
|
||||
{
|
||||
playerController.SetStart();
|
||||
mainController.SetStart();
|
||||
countDownTxt.gameObject.SetActive(false);
|
||||
}
|
||||
timeRemaining = 1.0f;
|
||||
@ -270,13 +270,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//暂停游戏
|
||||
private void PauseRide(BaseEventData baseEventData)
|
||||
{
|
||||
playerController.SetPause();
|
||||
mainController.SetPause();
|
||||
startBtn.gameObject.SetActive(true);
|
||||
}
|
||||
private void SaveRide(BaseEventData baseEventData)
|
||||
{
|
||||
playerController.SetPause();
|
||||
if (playerController.TotalTicks > 0 && !playerController.isQuit )
|
||||
mainController.SetQuit();
|
||||
if (playerController.TotalTicks > 0 && !mainController.isQuit )
|
||||
{
|
||||
playerController.Upload();
|
||||
quitPanel.SetActive(false);
|
||||
|
||||
@ -91,6 +91,14 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
private void Ride()
|
||||
{
|
||||
App.RouteIdParam = map.Id;
|
||||
if (!App.MainSceneParam.ContainsKey("Name"))
|
||||
{
|
||||
App.MainSceneParam.Add("Name", "MapListPanel");
|
||||
}
|
||||
else
|
||||
{
|
||||
App.MainSceneParam["Name"] = "MapListPanel";
|
||||
}
|
||||
SceneManager.LoadScene("Ride");
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user