继骑&重骑骑行结果页细节调整
This commit is contained in:
1 parent
018699c944
commit
afba150d91
34 files changed
+3601
-2379
No files matched your search
@@ -4,8 +4,9 @@
|
|||||||
Material:
|
Material:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: MapboxBlue
|
m_Name: MapboxBlue
|
||||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_ShaderKeywords: _EMISSION
|
m_ShaderKeywords: _EMISSION
|
||||||
@@ -72,5 +73,5 @@ Material:
|
|||||||
- _UVSec: 0
|
- _UVSec: 0
|
||||||
- _ZWrite: 1
|
- _ZWrite: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- _Color: {r: 0.25882354, g: 0.39215687, b: 0.9843137, a: 1}
|
- _Color: {r: 0.9764706, g: 0.1882353, b: 0.5254902, a: 0.6509804}
|
||||||
- _EmissionColor: {r: 0.1551394, g: 0.23505972, b: 0.59, a: 1}
|
- _EmissionColor: {r: 0.00024361434, g: 0.00029474328, b: 0.00019549299, a: 1}
|
||||||
@@ -4,8 +4,9 @@
|
|||||||
Material:
|
Material:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: MapboxWhite
|
m_Name: MapboxWhite
|
||||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_ShaderKeywords: _EMISSION
|
m_ShaderKeywords: _EMISSION
|
||||||
@@ -73,4 +74,4 @@ Material:
|
|||||||
- _ZWrite: 1
|
- _ZWrite: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- _Color: {r: 0.7764706, g: 0.8235294, b: 0.88235295, a: 1}
|
- _Color: {r: 0.7764706, g: 0.8235294, b: 0.88235295, a: 1}
|
||||||
- _EmissionColor: {r: 0.331, g: 0.30893335, b: 0.29001904, a: 1}
|
- _EmissionColor: {r: 0.0354168, g: 0.034315474, b: 0.043327622, a: 1}
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
{
|
{
|
||||||
//初始化map
|
//初始化map
|
||||||
var point = mainController.GetCenterCoordinate();
|
var point = mainController.GetCenterCoordinate();
|
||||||
_map.Initialize(new Utils.Vector2d(point[0], point[1]), _map.AbsoluteZoom);
|
_map.Initialize(point, _map.AbsoluteZoom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9281e8bf86b8d70459ba6c65898fee31
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6dd204d295b8fd5418483cecb462bd25
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
@@ -0,0 +1,104 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 037c4aef6618d6d44ad457dedbc3a5e8
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -30,7 +30,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 3777003654129381334}
|
m_GameObject: {fileID: 3777003654129381334}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 2, y: 5, z: 2}
|
m_LocalScale: {x: 5, y: 5, z: 5}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@@ -61,7 +61,7 @@ MeshRenderer:
|
|||||||
m_RenderingLayerMask: 1
|
m_RenderingLayerMask: 1
|
||||||
m_RendererPriority: 0
|
m_RendererPriority: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
- {fileID: 2100000, guid: 9c84f71e98b0047259dedc9428260078, type: 2}
|
- {fileID: 2100000, guid: bdad3ccf6401a414188827874d8999aa, type: 2}
|
||||||
m_StaticBatchInfo:
|
m_StaticBatchInfo:
|
||||||
firstSubMesh: 0
|
firstSubMesh: 0
|
||||||
subMeshCount: 0
|
subMeshCount: 0
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 1056360222971152080}
|
m_GameObject: {fileID: 1056360222971152080}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@@ -108,4 +108,9 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
character: {fileID: 1056360222971152080}
|
character: {fileID: 1056360222971152080}
|
||||||
characterAnimator: {fileID: 0}
|
characterAnimator: {fileID: 0}
|
||||||
|
isQuit: 0
|
||||||
CurrentIndex: 0
|
CurrentIndex: 0
|
||||||
|
record: []
|
||||||
|
_reviewItemScript: {fileID: 0}
|
||||||
|
_playerController: {fileID: 0}
|
||||||
|
LastTicks: 0
|
||||||
+2883
-2155
File diff suppressed because it is too large.
Load diff
@@ -33,6 +33,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
|
|
||||||
#region 选手骑行数据
|
#region 选手骑行数据
|
||||||
protected Vector2d nextlatlong; //下一个点的坐标
|
protected Vector2d nextlatlong; //下一个点的坐标
|
||||||
|
protected Vector2d currentlatlong; //当前坐标
|
||||||
//protected bool isStart;//开始或者暂停
|
//protected bool isStart;//开始或者暂停
|
||||||
public bool isQuit;//true 中途退出 或者到达终点
|
public bool isQuit;//true 中途退出 或者到达终点
|
||||||
protected bool isMajor;//是否是主人公
|
protected bool isMajor;//是否是主人公
|
||||||
@@ -71,7 +72,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
public double CurrentSlopeDistance { get => currentSlopeDistance; }
|
public double CurrentSlopeDistance { get => currentSlopeDistance; }
|
||||||
public double Elevation { get => elevation; }
|
public double Elevation { get => elevation; }
|
||||||
public double LastEndDistance { get => lastEndDistance; }
|
public double LastEndDistance { get => lastEndDistance; }
|
||||||
public Vector2d Nextlatlong { get => nextlatlong; }
|
public Vector2d Currentlatlong { get => currentlatlong; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 游戏状态控制
|
#region 游戏状态控制
|
||||||
@@ -116,12 +117,10 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
protected BaseCycling cyclingExcutor;
|
protected BaseCycling cyclingExcutor;
|
||||||
protected virtual void Init()
|
protected virtual void Init()
|
||||||
{
|
{
|
||||||
characterAnimator = GetComponentInChildren<Animator>();
|
//characterAnimator = GetComponentInChildren<Animator>();
|
||||||
mainController = transform.parent.GetComponent<CyclingController>();
|
mainController = transform.parent.GetComponent<CyclingController>();
|
||||||
map = transform.parent.Find("Map").GetComponent<AbstractMap>();
|
map = transform.parent.Find("Map").GetComponent<AbstractMap>();
|
||||||
mapData = mainController.GetMapData();//获取路书信息
|
mapData = mainController.GetMapData();//获取路书信息
|
||||||
nextlatlong = new Vector2d(mapData.List[0].Point[0], mapData.List[0].Point[1]);//初始化人物位置 TODO加上之前骑行距离
|
|
||||||
cyclingExcutor = mainController.cyclingController;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Excute()
|
protected virtual void Excute()
|
||||||
@@ -163,14 +162,14 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
distance = totalDistance - mapData.TotalDistance;
|
distance = totalDistance - mapData.TotalDistance;
|
||||||
totalDistance = mapData.TotalDistance;
|
totalDistance = mapData.TotalDistance;
|
||||||
//characterAnimator.SetBool("ReachEnd", true);//到达终点
|
//characterAnimator.SetBool("ReachEnd", true);//到达终点
|
||||||
Upload();
|
StartCoroutine("LateUpload");
|
||||||
isQuit = true;
|
isQuit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//数据处理
|
//数据处理
|
||||||
nextlatlong = Along(totalDistance);//下一个坐标
|
currentlatlong = Along(totalDistance);//下一个坐标
|
||||||
nextPos = map.GeoToWorldPosition(nextlatlong);//下一个点
|
nextPos = map.GeoToWorldPosition(currentlatlong);//下一个点
|
||||||
nextPos.y += 0.5f;//提高y轴让人物站在地图上面
|
nextPos.y += 0.6f;//提高y轴让人物站在地图上面
|
||||||
prePos = transform.localPosition;//当前点
|
prePos = transform.localPosition;//当前点
|
||||||
thisRotation = transform.localRotation;
|
thisRotation = transform.localRotation;
|
||||||
//动画控制
|
//动画控制
|
||||||
@@ -201,6 +200,13 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
|
|
||||||
#region 工具类
|
#region 工具类
|
||||||
|
|
||||||
|
IEnumerator LateUpload()
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(1);
|
||||||
|
Upload();
|
||||||
|
StopCoroutine("LateUpload");
|
||||||
|
}
|
||||||
|
|
||||||
protected string CaptureCamera(Camera camera, Rect rect)
|
protected string CaptureCamera(Camera camera, Rect rect)
|
||||||
{
|
{
|
||||||
// 创建一个RenderTexture对象
|
// 创建一个RenderTexture对象
|
||||||
@@ -225,8 +231,8 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
RenderTexture.active = null; // JC: added to avoid errors
|
RenderTexture.active = null; // JC: added to avoid errors
|
||||||
GameObject.Destroy(rt);
|
GameObject.Destroy(rt);
|
||||||
// 最后将这些纹理数据,成一个图片文件
|
// 最后将这些纹理数据,成一个图片文件
|
||||||
byte[] bytes = screenShot.EncodeToJPG();
|
byte[] bytes = screenShot.EncodeToPNG();
|
||||||
string filename = Application.dataPath + "/"+Guid.NewGuid().ToString() +".jpg";
|
string filename = Application.dataPath + "/"+Guid.NewGuid().ToString() +".png";
|
||||||
System.IO.File.WriteAllBytes(filename, bytes);
|
System.IO.File.WriteAllBytes(filename, bytes);
|
||||||
//Debug.Log(string.Format("截屏了一张照片: {0}", filename));
|
//Debug.Log(string.Format("截屏了一张照片: {0}", filename));
|
||||||
return filename;
|
return filename;
|
||||||
@@ -259,6 +265,10 @@ 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);
|
||||||
|
////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)
|
Vector2d Along(double endDistance)
|
||||||
@@ -271,7 +281,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
var ll = ((GeographicPosition)((GeoJSON.Net.Geometry.Point)pt1.Geometry).Coordinates);
|
var ll = ((GeographicPosition)((GeoJSON.Net.Geometry.Point)pt1.Geometry).Coordinates);
|
||||||
return new Vector2d(ll.Latitude, ll.Longitude);
|
return new Vector2d(ll.Latitude, ll.Longitude);
|
||||||
}
|
}
|
||||||
return nextlatlong;
|
return currentlatlong;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -10,81 +10,49 @@ using Assets.Scenes.Ride.Scripts.Model.CyclingModels;
|
|||||||
using Assets.Scenes.Ride.Scripts;
|
using Assets.Scenes.Ride.Scripts;
|
||||||
using Mapbox.Unity.Map;
|
using Mapbox.Unity.Map;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using GeoJSON.Net.Geometry;
|
||||||
|
using TurfCS;
|
||||||
|
using Mapbox.Utils;
|
||||||
|
using Assets.Scripts;
|
||||||
|
|
||||||
public class CyclingController : DeviceServiceMonoBase
|
public class CyclingController : DeviceServiceMonoBase
|
||||||
{
|
{
|
||||||
|
|
||||||
public AbstractMap map;
|
public AbstractMap map;
|
||||||
public GameObject player;
|
public GameObject player;
|
||||||
public GameObject UIObject;
|
public GameObject UIObject;
|
||||||
public SelectParamModel selectParamModel;
|
public RouteResultParam selectParamModel;
|
||||||
|
public RouteResult routeResult;
|
||||||
|
public int preticks;
|
||||||
|
|
||||||
#region 参数
|
#region 参数
|
||||||
private MapDataModel mapData;//当前路书数据
|
private MapDataModel mapData;//当前路书数据
|
||||||
private double[] coordiantes;//当前地图中心
|
private Vector2d coordiantes;//当前地图中心
|
||||||
private int currentUserId;//当前选中的用户id
|
|
||||||
public bool isStart;//当前游戏是否开始
|
|
||||||
private DateTime startTime;//开始时间
|
|
||||||
|
|
||||||
|
public bool isStart;//当前游戏是否开始
|
||||||
public CyclingModel cyclingModel;//当前骑行模式
|
public CyclingModel cyclingModel;//当前骑行模式
|
||||||
public BaseCycling cyclingController { get; set; }
|
public BaseCycling cyclingController { get; set; }
|
||||||
private int RouteId;
|
private int RouteId;
|
||||||
|
|
||||||
private MapApi mapApi;
|
private MapApi mapApi;
|
||||||
private Route mapRoute;
|
private Route mapRoute;
|
||||||
#endregion
|
#endregion
|
||||||
GameObject loadingcanvas;
|
GameObject loadingcanvas;
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
cyclingModel = CyclingModel.Single;
|
|
||||||
InitParam();
|
|
||||||
//获取路书信息
|
//获取路书信息
|
||||||
mapApi = new MapApi();
|
mapApi = ConfigHelper.mapApi;
|
||||||
RouteId = App.RouteIdParam > 0? App.RouteIdParam : 376;
|
RouteId = App.RouteIdParam > 0? App.RouteIdParam : 376;
|
||||||
//var result = GetTestData();
|
|
||||||
MapDataModel result = mapApi.GetData(RouteId);
|
MapDataModel result = mapApi.GetData(RouteId);
|
||||||
//player = transform.Find("Player").gameObject;
|
|
||||||
//loadingcanvas = transform.Find("LoadingCanvas").gameObject;
|
|
||||||
var antConnected = CheckAnt();//初始化ant+设备
|
|
||||||
|
|
||||||
//if (!antConnected)
|
|
||||||
//{
|
|
||||||
// throw new Exception("请先连接设备");
|
|
||||||
//}
|
|
||||||
//StartCoroutine(requset());
|
|
||||||
|
|
||||||
var param = mapApi.GetById(RouteId);
|
|
||||||
mapRoute = GetNewInstace(RouteId);//获取一个路书所有的数据
|
mapRoute = GetNewInstace(RouteId);//获取一个路书所有的数据
|
||||||
MapUDPService.Init();
|
MapUDPService.Init();//初始化TCP
|
||||||
switch (cyclingModel)
|
|
||||||
|
if (result != null )
|
||||||
{
|
{
|
||||||
case CyclingModel.Single:
|
Init(result);
|
||||||
cyclingController = new SingleModel(mapRoute);
|
|
||||||
//cyclingModel.OpenCyclingWindow();
|
|
||||||
break;
|
|
||||||
//case CyclingModel.Online:
|
|
||||||
// CyclingModel = new OnlineModel(Route, param);
|
|
||||||
// cyclingModel.OpenCyclingWindow();
|
|
||||||
// break;
|
|
||||||
//case CyclingModel.Review:
|
|
||||||
// if (selectParamModel.RankingsId.Count == 0)
|
|
||||||
// {
|
|
||||||
// //TODO:弹窗请选择跟随骑行的人
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// CyclingModel = new ReviewModel(Route, param);
|
|
||||||
//cyclingModel.OpenCyclingWindow();
|
|
||||||
// break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result != null )//&& mapRoute != null)
|
|
||||||
{
|
|
||||||
mapData = result;
|
|
||||||
coordiantes = result.List[0].Point;//TODO计算当前用户所处的位置
|
|
||||||
Init();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new System.Exception("fail to get route data");
|
Debug.LogError("获取地图数据失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void Start()
|
private void Start()
|
||||||
@@ -92,21 +60,57 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
UIManager.Instance.MainPanel = this.transform.Find("SingleUI/Panel").GetComponent<PFUIPanel>();
|
UIManager.Instance.MainPanel = this.transform.Find("SingleUI/Panel").GetComponent<PFUIPanel>();
|
||||||
UIManager.Instance.ModalsPanel = this.transform.Find("SingleUI/ModalPanel").GetComponent<PFUIPanel>();
|
UIManager.Instance.ModalsPanel = this.transform.Find("SingleUI/ModalPanel").GetComponent<PFUIPanel>();
|
||||||
}
|
}
|
||||||
|
//加载人物和地图以及UI界面
|
||||||
|
private void Init(MapDataModel result)
|
||||||
|
{
|
||||||
|
if (App.routeResult != null )
|
||||||
|
{
|
||||||
|
routeResult = App.routeResult;
|
||||||
|
selectParamModel = App.routeResult.ContinueCyclingParam;
|
||||||
|
preticks = App.routeResult.Ticks;
|
||||||
|
}
|
||||||
|
if (selectParamModel == null)
|
||||||
|
{
|
||||||
|
selectParamModel = new RouteResultParam
|
||||||
|
{
|
||||||
|
CompetitionId = 0,
|
||||||
|
ContinueIndex = 0,
|
||||||
|
ContinueMark = "",
|
||||||
|
GlobalContinue = false,
|
||||||
|
EndDistance = 0,
|
||||||
|
RankingsId = new List<string>(),
|
||||||
|
OnlineUserId = 0,
|
||||||
|
RouteId = App.RouteIdParam
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
App.routeResult = null;
|
||||||
|
|
||||||
|
mapData = result;
|
||||||
|
double endDistance = 0;
|
||||||
|
endDistance = selectParamModel.EndDistance;
|
||||||
|
coordiantes = Along(endDistance);
|
||||||
|
|
||||||
private void InitParam()
|
|
||||||
{
|
|
||||||
selectParamModel = new SelectParamModel();
|
|
||||||
selectParamModel.RouteId = App.RouteIdParam;
|
|
||||||
selectParamModel.RankingsId = new List<string>();
|
|
||||||
}
|
|
||||||
private void Init()
|
|
||||||
{
|
|
||||||
//加载人物和地图以及UI界面
|
|
||||||
map.gameObject.SetActive(true);
|
map.gameObject.SetActive(true);
|
||||||
player.SetActive(true);
|
player.SetActive(true);
|
||||||
UIObject.SetActive(true);
|
UIObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetCyclingModel(CyclingModel mode)
|
||||||
|
{
|
||||||
|
this.cyclingModel = mode;
|
||||||
|
|
||||||
|
switch (cyclingModel)
|
||||||
|
{
|
||||||
|
case CyclingModel.Single:
|
||||||
|
cyclingController = new SingleModel(mapRoute, selectParamModel);
|
||||||
|
break;
|
||||||
|
case CyclingModel.Review:
|
||||||
|
cyclingController = new SingleModel(mapRoute, selectParamModel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region 数据处理
|
#region 数据处理
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前骑行数据的记录器
|
/// 当前骑行数据的记录器
|
||||||
@@ -127,7 +131,7 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
{
|
{
|
||||||
return mapData;
|
return mapData;
|
||||||
}
|
}
|
||||||
public double[] GetCenterCoordinate()
|
public Vector2d GetCenterCoordinate()
|
||||||
{
|
{
|
||||||
return coordiantes;
|
return coordiantes;
|
||||||
}
|
}
|
||||||
@@ -141,16 +145,20 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
var jsonData = mapApi.GetData(RouteId);
|
var jsonData = mapApi.GetData(RouteId);
|
||||||
return new Route(jsonData, routeInstance.data);
|
return new Route(jsonData, routeInstance.data);
|
||||||
}
|
}
|
||||||
/// <summary>
|
public Vector2d Along(double endDistance)
|
||||||
/// 获取模拟的骑行记录
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public MapDataModel GetTestData()
|
|
||||||
{
|
{
|
||||||
string json = "{'Type':'LineString','TotalDistance':19.17906,'List':[{'Point':[26.092100000000002,119.33686000000002],'Elevation':7.6198},{'Point':[26.09211,119.33749000000002],'Elevation':7.5859},{'Point':[26.092170000000003,119.33840000000001],'Elevation':7.421},{'Point':[26.092260000000003,119.33921000000001],'Elevation':7.3133},{'Point':[26.092270002098761,119.33999000005943],'Elevation':7.2394},{'Point':[26.092280000000002,119.34077],'Elevation':7.2701},{'Point':[26.092240000956789,119.34129500009136],'Elevation':7.3416},{'Point':[26.092200000000002,119.34182000000001],'Elevation':7.4177},{'Point':[26.092083338752424,119.34270666844074],'Elevation':7.5033},{'Point':[26.09196667208499,119.34359333511317],'Elevation':7.2596},{'Point':[26.09185,119.34448],'Elevation':6.8727},{'Point':[26.091680000000004,119.34505000000001],'Elevation':6.4546},{'Point':[26.091536672044878,119.34593333550309],'Elevation':6.0312},{'Point':[26.091393338710645,119.34681666884185],'Elevation':5.751},{'Point':[26.091250000000002,119.3477],'Elevation':5.6373},{'Point':[26.091230000000003,119.34794000000001],'Elevation':5.6052},{'Point':[26.091225001411136,119.3485800001182],'Elevation':5.5997},{'Point':[26.091220000000003,119.34922000000002],'Elevation':5.6907},{'Point':[26.091330000000003,119.34997000000001],'Elevation':6.0231},{'Point':[26.091440000000002,119.35021],'Elevation':6.4916},{'Point':[26.09157,119.35095000000001],'Elevation':7.0092},{'Point':[26.091600000000003,119.3516],'Elevation':7.3641},{'Point':[26.091767507390937,119.35244499640774],'Elevation':7.4909},{'Point':[26.091935009859512,119.353289995235],'Elevation':6.9736},{'Point':[26.092102507405667,119.35413499648182],'Elevation':6.7797},{'Point':[26.092270000000003,119.35498000000001],'Elevation':6.5711},{'Point':[26.092405001867032,119.35571999903352],'Elevation':6.4206},{'Point':[26.092540000000003,119.35646000000001],'Elevation':6.3653},{'Point':[26.09269,119.35732000000002],'Elevation':7.251},{'Point':[26.092710000000004,119.35761000000001],'Elevation':8.2263},{'Point':[26.092703339253426,119.35853666675888],'Elevation':9.8464},{'Point':[26.092696672586847,119.35946333341218],'Elevation':11.8545},{'Point':[26.09269,119.36039000000001],'Elevation':13.6159},{'Point':[26.092665001414368,119.36103000007358],'Elevation':15.1102},{'Point':[26.092640000000003,119.36167],'Elevation':16.3984},{'Point':[26.0925,119.36225],'Elevation':17.1179},{'Point':[26.092270000000003,119.36289000000001],'Elevation':17.3805},{'Point':[26.092200000000002,119.36334000000001],'Elevation':17.3022},{'Point':[26.092180000000003,119.36363000000001],'Elevation':17.2282},{'Point':[26.092190000000002,119.36396],'Elevation':17.2224},{'Point':[26.092290000000002,119.36435000000002],'Elevation':17.1729},{'Point':[26.092100000000002,119.36453000000002],'Elevation':17.1065},{'Point':[26.092000000000002,119.36473000000001],'Elevation':17.0503},{'Point':[26.091910000000002,119.36502000000002],'Elevation':17.1392},{'Point':[26.09193,119.36525],'Elevation':17.2636},{'Point':[26.092150000000004,119.36569000000001],'Elevation':17.4486},{'Point':[26.09233,119.36581000000001],'Elevation':17.7034},{'Point':[26.092540000000003,119.36588],'Elevation':18.1077},{'Point':[26.092750000000002,119.36589000000001],'Elevation':18.5083},{'Point':[26.092950000000002,119.36582000000001],'Elevation':18.892},{'Point':[26.093110000000003,119.36572000000001],'Elevation':19.2643},{'Point':[26.09335,119.36544],'Elevation':19.6256},{'Point':[26.094033333311039,119.36542333352864],'Elevation':20.1707},{'Point':[26.094716666620165,119.36540666686258],'Elevation':21.2487},{'Point':[26.0954,119.36539],'Elevation':22.396},{'Point':[26.09605,119.36548],'Elevation':23.9715},{'Point':[26.09615,119.36567000000001],'Elevation':25.3392},{'Point':[26.096753333417059,119.36562333380944],'Elevation':26.626},{'Point':[26.097356666819095,119.36557666713746],'Elevation':28.1709},{'Point':[26.09796,119.36553],'Elevation':30.077},{'Point':[26.098260000000003,119.36556000000002],'Elevation':32.1094},{'Point':[26.09888000013564,119.36572999910875],'Elevation':34.3101},{'Point':[26.099500000000003,119.36590000000001],'Elevation':36.7362},{'Point':[26.099970000000003,119.36599000000001],'Elevation':39.7763},{'Point':[26.100720000000003,119.36591000000001],'Elevation':43.1691},{'Point':[26.101160000000004,119.36591000000001],'Elevation':46.6581},{'Point':[26.10181,119.36598000000001],'Elevation':50.4232},{'Point':[26.10208,119.36621000000001],'Elevation':53.9898},{'Point':[26.102210000000003,119.36674000000001],'Elevation':57.5845},{'Point':[26.101960000000002,119.36725000000001],'Elevation':61.2459},{'Point':[26.101530000000004,119.36721000000001],'Elevation':64.7154},{'Point':[26.100900000000003,119.36697000000001],'Elevation':68.1881},{'Point':[26.100415000136522,119.36697500001934],'Elevation':71.7923},{'Point':[26.09993,119.36698000000001],'Elevation':75.4172},{'Point':[26.099330000000002,119.36702000000001],'Elevation':79.066},{'Poin
Line truncated
|
if (mapData != null)
|
||||||
//string json = "{'Type':'LineString','TotalDistance':22.201689999999992,'List':[{'Point':[32.060793,118.808228],'Elevation':14.5598},{'Point':[32.061604,118.808548],'Elevation':14.3954},{'Point':[32.063085,118.809059],'Elevation':14.0074},{'Point':[32.064306,118.80951],'Elevation':14.2812},{'Point':[32.065217,118.809841],'Elevation':14.701},{'Point':[32.066188,118.810121],'Elevation':15.2048},{'Point':[32.066558,118.810492],'Elevation':15.4843},{'Point':[32.067079,118.810983],'Elevation':15.5637},{'Point':[32.06756,118.811344],'Elevation':15.507},{'Point':[32.067931,118.811574],'Elevation':15.469},{'Point':[32.068451,118.811845],'Elevation':15.5912},{'Point':[32.068852,118.812085],'Elevation':15.6546},{'Point':[32.069433,118.812766],'Elevation':15.8589},{'Point':[32.070115,118.813588],'Elevation':16.2968},{'Point':[32.070646,118.814229],'Elevation':16.9136},{'Point':[32.071368,118.815101],'Elevation':17.4104},{'Point':[32.07228,118.816213],'Elevation':17.7138},{'Point':[32.072561,118.816554],'Elevation':17.9888},{'Point':[32.072821,118.816885],'Elevation':18.502},{'Point':[32.073483,118.817706],'Elevation':19.5909},{'Point':[32.073844,118.818147],'Elevation':20.596},{'Point':[32.074305,118.818729],'Elevation':21.2868},{'Point':[32.074786,118.81927],'Elevation':21.6856},{'Point':[32.074987,118.81951],'Elevation':22.0494},{'Point':[32.075448,118.819991],'Elevation':22.3838},{'Point':[32.075909,118.820492],'Elevation':22.6512},{'Point':[32.076069,118.820662],'Elevation':22.8796},{'Point':[32.07637,118.821003],'Elevation':23.0857},{'Point':[32.07659,118.821133],'Elevation':23.2517},{'Point':[32.076831,118.821384],'Elevation':23.532},{'Point':[32.077212,118.822025],'Elevation':24.0643},{'Point':[32.077494,118.822867],'Elevation':24.8455},{'Point':[32.077645,118.823438],'Elevation':25.8294},{'Point':[32.077756,118.823879],'Elevation':26.909},{'Point':[32.077896,118.82422],'Elevation':28.0635},{'Point':[32.078037,118.82448],'Elevation':29.1886},{'Point':[32.078267,118.824781],'Elevation':30.2586},{'Point':[32.078418,118.824941],'Elevation':31.1856},{'Point':[32.078728,118.825232],'Elevation':31.9239},{'Point':[32.078969,118.825332],'Elevation':32.549},{'Point':[32.079169,118.825322],'Elevation':33.0782},{'Point':[32.079498,118.825202],'Elevation':33.544},{'Point':[32.079958,118.825021],'Elevation':33.9813},{'Point':[32.080328,118.824941],'Elevation':34.3312},{'Point':[32.081018,118.824861],'Elevation':34.4341},{'Point':[32.081618,118.824811],'Elevation':34.2067},{'Point':[32.081948,118.824811],'Elevation':33.8412},{'Point':[32.082178,118.824841],'Elevation':33.428},{'Point':[32.082369,118.824911],'Elevation':33.0365},{'Point':[32.082579,118.825051],'Elevation':32.6545},{'Point':[32.082769,118.825191],'Elevation':32.2689},{'Point':[32.08304,118.825442],'Elevation':31.9885},{'Point':[32.08319,118.825652],'Elevation':31.8223},{'Point':[32.083331,118.825893],'Elevation':31.7163},{'Point':[32.083742,118.826624],'Elevation':31.7409},{'Point':[32.083973,118.826975],'Elevation':31.8967},{'Point':[32.084113,118.827135],'Elevation':32.0943},{'Point':[32.084354,118.827376],'Elevation':32.289},{'Point':[32.084504,118.827496],'Elevation':32.4791},{'Point':[32.084884,118.827727],'Elevation':32.7283},{'Point':[32.085155,118.827887],'Elevation':32.9179},{'Point':[32.085435,118.828047],'Elevation':32.9931},{'Point':[32.085675,118.828198],'Elevation':32.9919},{'Point':[32.085976,118.828348],'Elevation':32.8424},{'Point':[32.086397,118.829079],'Elevation':32.7725},{'Point':[32.086608,118.82946],'Elevation':32.6947},{'Point':[32.086819,118.829821],'Elevation':32.5996},{'Point':[32.086969,118.830122],'Elevation':32.5681},{'Point':[32.08711,118.830472],'Elevation':32.4398},{'Point':[32.087201,118.830753],'Elevation':32.2517},{'Point':[32.087271,118.831033],'Elevation':32.042},{'Point':[32.087402,118.831615],'Elevation':31.912},{'Point':[32.087463,118.831905],'Elevation':31.9259},{'Point':[32.087503,118.832196],'Elevation':32.0906},{'Point':[32.087554,118.832547],'Elevation':32.2625},{'Point':[32.087584,118.832757],'Elevation':32.4019},{'Point':[32.087645,118.833007],'Elevation':32.4994},{'Point':[32.087725,118.833358],'Elevation':32.605},{'Point':[32.087846,118.833609],'Elevation':32.7142},{'Point':[32.088017,118.8344],'Elevation':32.8226},{'Point':[32.08833,118.835633],'Elevation':33.1344},{'Point':[32.08842,118.835994],'Elevation':33.5805},{'Point':[32.088511,118.836384],'Elevation':34.1777},{'Point':[32.088582,118.836615],'Elevation':34.8768},{'Point':[32.088762,118.837006],'Elevation':35.7894},{'Point':[32.089103,118.837386],'Elevation':36.8831},{'Point':[32.089364,118.837667],'Elevation':37.9825},{'Point':[32.090856,118.838889],'Elevation':38.9346},{'Point':[32.091077,118.8391],'Elevation':39.674},{'Point':[32.091227,118.83925],'Elevation':40.1489},{'Point':[32.091377,118.83944],'Elevation':40.3744},{'Point':[32.091628,118.839951],'Elevation':40.1874},{'Point':[32.091899,118.840653],'Elevation':39.8998},{'Point':[32.0920Line truncated
|
{
|
||||||
//string json = @"{'Type':'LineString','TotalDistance':3.4100999999999995,'List':[{'Point':[31.351249,119.021848],'Elevation':28.3692},{'Point':[31.35127,119.021529],'Elevation':28.4163},{'Point':[31.351322,119.020791],'Elevation':29.5811},{'Point':[31.351364,119.019914],'Elevation':31.2764},{'Point':[31.351458,119.018399],'Elevation':32.102},{'Point':[31.351501,119.017512],'Elevation':32.5486},{'Point':[31.351512,119.017203],'Elevation':33.0451},{'Point':[31.351522,119.016914],'Elevation':33.5963},{'Point':[31.351564,119.016386],'Elevation':34.58},{'Point':[31.351606,119.015788],'Elevation':36.0089},{'Point':[31.351626,119.015539],'Elevation':37.4491},{'Point':[31.351647,119.01529],'Elevation':38.8925},{'Point':[31.351187,119.01521],'Elevation':39.5386},{'Point':[31.350858,119.01514],'Elevation':39.7551},{'Point':[31.350438,119.015051],'Elevation':40.1219},{'Point':[31.350199,119.014891],'Elevation':40.7157},{'Point':[31.350019,119.014742],'Elevation':41.4673},{'Point':[31.34974,119.014622],'Elevation':42.0818},{'Point':[31.34951,119.014553],'Elevation':42.4744},{'Point':[31.349201,119.014363],'Elevation':42.707},{'Point':[31.349051,119.014164],'Elevation':42.9748},{'Point':[31.348563,119.013506],'Elevation':43.4829},{'Point':[31.348384,119.013287],'Elevation':43.7515},{'Point':[31.348095,119.013078],'Elevation':43.711},{'Point':[31.347905,119.012988],'Elevation':43.6298},{'Point':[31.347596,119.012789],'Elevation':43.5441},{'Point':[31.347416,119.012639],'Elevation':43.5661},{'Point':[31.347257,119.01249],'Elevation':43.7661},{'Point':[31.347017,119.012271],'Elevation':44.173},{'Point':[31.346778,119.012071],'Elevation':44.6846},{'Point':[31.346569,119.011932],'Elevation':45.0536},{'Point':[31.346349,119.011862],'Elevation':45.1835},{'Point':[31.346169,119.011822],'Elevation':45.1202},{'Point':[31.34597,119.011573],'Elevation':44.9227},{'Point':[31.345872,119.010926],'Elevation':44.769},{'Point':[31.345823,119.010517],'Elevation':44.825},{'Point':[31.345724,119.010198],'Elevation':45.0025},{'Point':[31.345595,119.009999],'Elevation':45.0965},{'Point':[31.345306,119.00966],'Elevation':44.9105},{'Point':[31.345056,119.009421],'Elevation':44.6363},{'Point':[31.344847,119.009281],'Elevation':44.3001},{'Point':[31.344627,119.009122],'Elevation':43.9679},{'Point':[31.344468,119.008983],'Elevation':43.7442},{'Point':[31.344199,119.008694],'Elevation':43.6926},{'Point':[31.34396,119.008345],'Elevation':43.9002},{'Point':[31.343711,119.007976],'Elevation':44.3907},{'Point':[31.343333,119.007488],'Elevation':45.4845},{'Point':[31.343173,119.007289],'Elevation':46.704},{'Point':[31.342834,119.007109],'Elevation':47.9561},{'Point':[31.342485,119.00698],'Elevation':48.9071},{'Point':[31.342285,119.00687],'Elevation':49.4839},{'Point':[31.342155,119.006721],'Elevation':49.8479},{'Point':[31.342026,119.006472],'Elevation':50.1356},{'Point':[31.342057,119.006253],'Elevation':50.7142},{'Point':[31.342257,119.006223],'Elevation':51.7425},{'Point':[31.342547,119.006332],'Elevation':53.1767},{'Point':[31.342737,119.006213],'Elevation':54.8684},{'Point':[31.342818,119.005894],'Elevation':56.8442},{'Point':[31.342909,119.005625],'Elevation':58.8701},{'Point':[31.342989,119.005415],'Elevation':60.9597},{'Point':[31.343199,119.005276],'Elevation':63.4359},{'Point':[31.34363,119.005166],'Elevation':66.2565},{'Point':[31.34396,119.005087],'Elevation':69.0464},{'Point':[31.34469,119.004897],'Elevation':72.3644},{'Point':[31.34492,119.004817],'Elevation':75.7088},{'Point':[31.345151,119.004578],'Elevation':79.2975},{'Point':[31.345452,119.004329],'Elevation':83.0134},{'Point':[31.345722,119.00413],'Elevation':87.0387},{'Point':[31.345882,119.00397],'Elevation':90.9773},{'Point':[31.346003,119.003701],'Elevation':94.1804},{'Point':[31.346134,119.003492],'Elevation':96.7123},{'Point':[31.346334,119.003412],'Elevation':99.1538},{'Point':[31.346604,119.003522],'Elevation':102.4359},{'Point':[31.346853,119.003552],'Elevation':106.1954},{'Point':[31.347143,119.003502],'Elevation':110.2601},{'Point':[31.347344,119.003432],'Elevation':114.1717},{'Point':[31.347564,119.003313],'Elevation':117.6072},{'Point':[31.347754,119.003103],'Elevation':120.1657},{'Point':[31.347925,119.002874],'Elevation':121.9901},{'Point':[31.348095,119.002765],'Elevation':123.592},{'Point':[31.348285,119.002914],'Elevation':125.0265},{'Point':[31.348434,119.003312],'Elevation':127.3454},{'Point':[31.348573,119.003621],'Elevation':130.5107},{'Point':[31.348782,119.00391],'Elevation':134.3053},{'Point':[31.349021,119.004129],'Elevation':138.0121},{'Point':[31.34935,119.004279],'Elevation':141.3069},{'Point':[31.34952,119.004369],'Elevation':144.2481},{'Point':[31.34974,119.004468],'Elevation':146.7968},{'Point':[31.349909,119.004548],'Elevation':148.9758},{'Point':[31.349989,119.004737],'Elevation':151.0985},{'Point':[31.349759,119.004727],'Elevation':153.2488},{'Point':[31.349539,119.004638],'Elevation':155.3186},{'Point':[31.34922,119.004568],'Elevation':157Line truncated
|
var list = mapData.List.Select(p => new GeoJSON.Net.Geometry.GeographicPosition(p.Point[0], p.Point[1]));
|
||||||
return Newtonsoft.Json.JsonConvert.DeserializeObject<MapDataModel>(json);
|
LineString lineString = new LineString(list);
|
||||||
|
var pt1 = Turf.Along(lineString, endDistance);
|
||||||
|
var ll = ((GeographicPosition)((GeoJSON.Net.Geometry.Point)pt1.Geometry).Coordinates);
|
||||||
|
return new Vector2d(ll.Latitude, ll.Longitude);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new Vector2d(0,0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 海拔图数据
|
/// 海拔图数据
|
||||||
|
|||||||
@@ -11,10 +11,15 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
public void TrackResistance(double grade)
|
public void TrackResistance(double grade)
|
||||||
{
|
{
|
||||||
//if (!ConfigHelper.IsNeedContectedToDevice)
|
if (grade > 10)
|
||||||
//{
|
{
|
||||||
// return;
|
grade = 10;
|
||||||
//}
|
}
|
||||||
|
if (grade <-10 )
|
||||||
|
{
|
||||||
|
grade = -10;
|
||||||
|
}
|
||||||
|
|
||||||
var device = (_device as FitDevice);
|
var device = (_device as FitDevice);
|
||||||
if (device != null)
|
if (device != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
var mapdata = cyclingCotroller.GetMapData();
|
var mapdata = cyclingCotroller.GetMapData();
|
||||||
//初始化map
|
//初始化map
|
||||||
var point = cyclingCotroller.GetCenterCoordinate();
|
//var point = cyclingCotroller.GetCenterCoordinate();
|
||||||
if (_map != null && mapdata !=null)
|
if (_map != null && mapdata !=null)
|
||||||
{
|
{
|
||||||
_map.OnInitialized += _map_OnInitialized;
|
_map.OnInitialized += _map_OnInitialized;
|
||||||
@@ -46,7 +46,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
if (playerController != null)
|
if (playerController != null)
|
||||||
{
|
{
|
||||||
_player.transform.localPosition = _map.GeoToWorldPosition(playerController.Nextlatlong);
|
_player.transform.localPosition = _map.GeoToWorldPosition(playerController.Currentlatlong);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private bool init = false;
|
private bool init = false;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
if (_player != null)
|
if (_player != null)
|
||||||
{
|
{
|
||||||
transform.localPosition = _map.GeoToWorldPosition(_player.Nextlatlong);
|
transform.localPosition = _map.GeoToWorldPosition(_player.Currentlatlong);
|
||||||
}
|
}
|
||||||
t = 1;
|
t = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
using Assets.Scenes.Ride.Scripts.Model.RiderModels;
|
||||||
|
using Assets.Scripts;
|
||||||
|
using Assets.Scripts.Apis.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||||
|
{
|
||||||
|
public class ReviewModel : BaseCycling
|
||||||
|
{
|
||||||
|
public List<MapRecordRanking> rankings;
|
||||||
|
|
||||||
|
public ReviewModel(Route route1, RouteResultParam param)
|
||||||
|
: base(route1, CyclingModel.Review)
|
||||||
|
{
|
||||||
|
riders = new List<BaseRider>();
|
||||||
|
riders.Add(new OnlineRiderModel()
|
||||||
|
{
|
||||||
|
NickName = App.CurrentUser.Nickname,
|
||||||
|
UserId = App.CurrentUser.Id,
|
||||||
|
WxHeadImg = App.CurrentUser.WxHeadImg,
|
||||||
|
Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1])
|
||||||
|
});
|
||||||
|
|
||||||
|
recorderData = new RecorderDataModel()
|
||||||
|
{
|
||||||
|
CurrentUser = App.CurrentUser,
|
||||||
|
Competitionid = 0,
|
||||||
|
ContinueIndex = 0,
|
||||||
|
ContinueMark = Guid.NewGuid().ToString(),
|
||||||
|
EndDistance = 0,
|
||||||
|
PreDistance = 0,
|
||||||
|
IsCompleted = false,
|
||||||
|
IsNeedRanking = true,
|
||||||
|
CyclingState = CyclingStateEnum.Prepare,
|
||||||
|
CurrentRoute = route,
|
||||||
|
CurrentRouteStartDistance = 0,
|
||||||
|
};
|
||||||
|
this.IsRecord = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Run(TargetData targetData)
|
||||||
|
{
|
||||||
|
|
||||||
|
riders.RemoveAll(r => r.IsSelf == false);
|
||||||
|
var onlineUsers = MapUDPService.GetOnlineUsers(recorderData.CurrentRoute.RouteInstance.Id).Where(d => d.IsSelf == false)
|
||||||
|
.ToList();
|
||||||
|
foreach (var item in onlineUsers)
|
||||||
|
{
|
||||||
|
riders.Add(new OnlineRiderModel()
|
||||||
|
{
|
||||||
|
NickName = item.Name,
|
||||||
|
UserId = item.Id,
|
||||||
|
WxHeadImg = item.HeadImage,
|
||||||
|
Point = new GeoJSON.Net.Geometry.GeographicPosition(item.Point[0], item.Point[1]),
|
||||||
|
EndDistance = item.EndDistance,
|
||||||
|
PreDistance = item.PreDistance,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Run(targetData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 363f64631c874c84198aa481f8899911
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Assets.Scenes.Ride.Scripts.Model.RiderModels;
|
using Assets.Scenes.Ride.Scripts.Model.RiderModels;
|
||||||
|
using Assets.Scripts.Apis.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -9,50 +10,43 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
{
|
{
|
||||||
public class SingleModel : BaseCycling
|
public class SingleModel : BaseCycling
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
///
|
public SingleModel(Route route,RouteResultParam param)
|
||||||
/// </summary>
|
: base(route, CyclingModel.Single)
|
||||||
/// <param name="route1"></param>
|
|
||||||
/// <param name="manufacturerId"></param>
|
|
||||||
/// <param name="deviceNumber"></param>
|
|
||||||
/// <param name="antModelId"></param>
|
|
||||||
public SingleModel(Route route1) //SelectParamModel param)
|
|
||||||
: base(route1, CyclingModel.Single)
|
|
||||||
{
|
{
|
||||||
//recorderData = recorderData1;
|
|
||||||
this.IsRecord = true;
|
this.IsRecord = true;
|
||||||
recorderData = new RecorderDataModel()
|
recorderData = new RecorderDataModel()
|
||||||
{
|
{
|
||||||
CurrentUser = App.CurrentUser,
|
CurrentUser = App.CurrentUser,
|
||||||
//BelongUserId = App.CurrentUser.Id,
|
|
||||||
Competitionid = 0,
|
Competitionid = 0,
|
||||||
ContinueIndex = 0,
|
ContinueIndex = 0,
|
||||||
ContinueMark = Guid.NewGuid().ToString(),
|
ContinueMark = Guid.NewGuid().ToString(),
|
||||||
EndDistance = 0,
|
EndDistance = 0,
|
||||||
IsCompleted = false,
|
IsCompleted = false,
|
||||||
IsNeedRanking = true,
|
IsNeedRanking = true,
|
||||||
CyclingState = CyclingStateEnum.Prepare,
|
CyclingState = CyclingStateEnum.Prepare,
|
||||||
//ManufacturerId = manufacturerId, //ManufacturerId,
|
|
||||||
CurrentRoute = route,
|
CurrentRoute = route,
|
||||||
CurrentRouteStartDistance = 0,
|
CurrentRouteStartDistance = 0,
|
||||||
//DeviceNumber = deviceNumber,//DeviceNumber
|
|
||||||
//AntModelId = antModelId,
|
|
||||||
StartTime = DateTime.Now
|
StartTime = DateTime.Now
|
||||||
};
|
};
|
||||||
#region TODO 线路上的人
|
|
||||||
//if (param != null)
|
if (param != null)
|
||||||
//{
|
{
|
||||||
// recorderData.EndDistance = param.EndDistance;
|
recorderData.EndDistance = param.EndDistance;
|
||||||
// recorderData.CurrentRouteStartDistance = param.EndDistance;
|
recorderData.CurrentRouteStartDistance = param.EndDistance;
|
||||||
// if (!string.IsNullOrWhiteSpace(param.ContinueMark))
|
if (!string.IsNullOrWhiteSpace(param.ContinueMark))
|
||||||
// {
|
{
|
||||||
// recorderData.ContinueMark = param.ContinueMark;
|
recorderData.ContinueMark = param.ContinueMark;
|
||||||
// }
|
}
|
||||||
// recorderData.ContinueIndex = param.ContinueIndex.GetValueOrDefault(0);
|
else
|
||||||
//}
|
{
|
||||||
//recorderData.PreDistance = recorderData.EndDistance;
|
param.ContinueMark = recorderData.ContinueMark;
|
||||||
|
}
|
||||||
|
recorderData.ContinueIndex = param.ContinueIndex.GetValueOrDefault(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
recorderData.PreDistance = recorderData.EndDistance;
|
||||||
|
|
||||||
//TODO 附件的人列表加上自己
|
|
||||||
riders = new List<BaseRider>();
|
riders = new List<BaseRider>();
|
||||||
var rider = new OnlineRiderModel()
|
var rider = new OnlineRiderModel()
|
||||||
{
|
{
|
||||||
@@ -65,7 +59,7 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
rider.Point = _turfHelper.Along(rider.EndDistance);
|
rider.Point = _turfHelper.Along(rider.EndDistance);
|
||||||
|
|
||||||
riders.Add(rider);
|
riders.Add(rider);
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Run(TargetData targetData)
|
public override void Run(TargetData targetData)
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="base64Image"></param>
|
/// <param name="base64Image"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public JsonResult<AddMapRecordResultModel> SaveData(CyclingModel cyclingModel, SelectParamModel selectParam, string imageName = "")
|
public JsonResult<AddMapRecordResultModel> SaveData(CyclingModel cyclingModel, RouteResultParam selectParam, string imageName = "")
|
||||||
{
|
{
|
||||||
if (RiderDatas.Count <= 0)
|
if (RiderDatas.Count <= 0)
|
||||||
{
|
{
|
||||||
@@ -124,7 +124,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
double TSS = (RiderDatas.Count * NP * IF) / (FTP * 3600) * 100;
|
double TSS = (RiderDatas.Count * NP * IF) / (FTP * 3600) * 100;
|
||||||
var averagePower = Helper.AveragePower(RiderDatas);
|
var averagePower = Helper.AveragePower(RiderDatas);
|
||||||
MapInterruptRecordApi service = new MapInterruptRecordApi();
|
MapInterruptRecordApi service = new MapInterruptRecordApi();
|
||||||
//AntManufacturer manufacturer = service.GetAntManufacturer(ManufacturerId);
|
// AntManufacturer manufacturer = service.GetAntManufacturer(ManufacturerId).data;
|
||||||
var recordId = Guid.NewGuid().ToString();
|
var recordId = Guid.NewGuid().ToString();
|
||||||
var ticks = RiderDatas.Last().Ticks;
|
var ticks = RiderDatas.Last().Ticks;
|
||||||
var interruptRecord = new MapInterruptRecord
|
var interruptRecord = new MapInterruptRecord
|
||||||
@@ -133,7 +133,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
RouteId = CurrentRoute.RouteInstance.Id,
|
RouteId = CurrentRoute.RouteInstance.Id,
|
||||||
RouteName = CurrentRoute.RouteInstance.Name,
|
RouteName = CurrentRoute.RouteInstance.Name,
|
||||||
TotalDistance = CurrentRoute.RouteInstance.Distance,
|
TotalDistance = CurrentRoute.RouteInstance.Distance,
|
||||||
UserId = 10688,//BelongUserId,
|
UserId = BelongUserId,
|
||||||
RecordFileName = newFileName + ".txt",
|
RecordFileName = newFileName + ".txt",
|
||||||
Ftp = FTP,//FTP设置
|
Ftp = FTP,//FTP设置
|
||||||
IF = Math.Round(IF, 2),
|
IF = Math.Round(IF, 2),
|
||||||
@@ -147,13 +147,13 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
AveragePower = averagePower,//平均功率
|
AveragePower = averagePower,//平均功率
|
||||||
MaxPower = RiderDatas.Max(a => a._Power),//最大功率
|
MaxPower = RiderDatas.Max(a => a._Power),//最大功率
|
||||||
WeightKg = Math.Round(averagePower / 65, 2),
|
WeightKg = Math.Round(averagePower / 65, 2),
|
||||||
Weight = 65, //App.CurrentUser.Weight,
|
Weight = App.CurrentUser.Weight,
|
||||||
BicycleWeight =7, //App.CurrentUser.BicycleWeight,
|
BicycleWeight = App.CurrentUser.BicycleWeight,
|
||||||
ContinueMark = ContinueMark,
|
ContinueMark = ContinueMark,
|
||||||
ContinueIndex = ContinueIndex,
|
ContinueIndex = ContinueIndex,
|
||||||
IsDelete = false,
|
IsDelete = false,
|
||||||
MapCompetitionId = Competitionid,
|
MapCompetitionId = Competitionid,
|
||||||
ManufacturerName = "TODO",//manufacturer == null ? "" : manufacturer.Name,
|
ManufacturerName = "",//manufacturer == null ? "" : manufacturer.Name,
|
||||||
DeviceNumber = DeviceNumber,
|
DeviceNumber = DeviceNumber,
|
||||||
IsRanking = IsNeedRanking,
|
IsRanking = IsNeedRanking,
|
||||||
CurrentRouteStartDistance = CurrentRouteStartDistance,
|
CurrentRouteStartDistance = CurrentRouteStartDistance,
|
||||||
@@ -163,8 +163,8 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
CreateTime = StartTime.AddSeconds(ticks),
|
CreateTime = StartTime.AddSeconds(ticks),
|
||||||
Ticks = ticks,
|
Ticks = ticks,
|
||||||
Mode = cyclingModel.ToString(),
|
Mode = cyclingModel.ToString(),
|
||||||
//Param = Newtonsoft.Json.JsonConvert.SerializeObject(selectParam),
|
Param = Newtonsoft.Json.JsonConvert.SerializeObject(selectParam),
|
||||||
//GlobalCyclingId = selectParam.GlobalCyclingId
|
GlobalCyclingId = 0
|
||||||
};
|
};
|
||||||
//var range = new MapSpeedRange().GetSpeedRange(RiderDatas, CurrentRoute.RouteInstance.Distance);
|
//var range = new MapSpeedRange().GetSpeedRange(RiderDatas, CurrentRoute.RouteInstance.Distance);
|
||||||
interruptRecord.SpeedRange = null; //JsonConvert.SerializeObject(range);
|
interruptRecord.SpeedRange = null; //JsonConvert.SerializeObject(range);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
while (t < 0)
|
while (t < 0)
|
||||||
{
|
{
|
||||||
Utils.DestroyChildren(transform);
|
Utils.DestroyChildren(transform);
|
||||||
var nearList = MapUDPService.GetNearRiderData(pageIndex, pageSize, new double[] { playerController.Nextlatlong.x, playerController.Nextlatlong.y });
|
var nearList = MapUDPService.GetNearRiderData(pageIndex, pageSize, new double[] { playerController.Currentlatlong.x, playerController.Currentlatlong.y });
|
||||||
|
|
||||||
for (int i = 0; i < nearList.Count(); i++)
|
for (int i = 0; i < nearList.Count(); i++)
|
||||||
{
|
{
|
||||||
@@ -70,7 +70,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
|
|
||||||
private void RefreshList()
|
private void RefreshList()
|
||||||
{
|
{
|
||||||
var nearList = MapUDPService.GetNearRiderData(pageIndex, pageSize, new double[] { playerController.Nextlatlong.x, playerController.Nextlatlong.y });
|
var nearList = MapUDPService.GetNearRiderData(pageIndex, pageSize, new double[] { playerController.Currentlatlong.x, playerController.Currentlatlong.y });
|
||||||
|
|
||||||
for (int i = 0; i < nearList.Count(); i++)
|
for (int i = 0; i < nearList.Count(); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Assets.Scenes.Ride.Scripts.Model;
|
using Assets.Scenes.Ride.Scripts.Model;
|
||||||
using System;
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
{
|
{
|
||||||
@@ -8,16 +9,20 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
public string[] record;
|
public string[] record;
|
||||||
public ReviewItemScript _reviewItemScript;
|
public ReviewItemScript _reviewItemScript;
|
||||||
public PlayerController _playerController;
|
public PlayerController _playerController;
|
||||||
|
|
||||||
|
public int tickOffset = 0;
|
||||||
protected override void Init()
|
protected override void Init()
|
||||||
{
|
{
|
||||||
base.Init();
|
base.Init();
|
||||||
|
_playerController = FindObjectOfType<PlayerController>();
|
||||||
|
tickOffset = mainController.preticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Compute()
|
protected override void Compute()
|
||||||
{
|
{
|
||||||
if (ticks < record.Length)
|
if (tickOffset + ticks < record.Length)
|
||||||
{
|
{
|
||||||
var data = TargetData.Read(record[ticks-1]);
|
var data = TargetData.Read(record[tickOffset + ticks - 1]);
|
||||||
distance = data._Speed/3600;
|
distance = data._Speed/3600;
|
||||||
totalDistance = data._Distance;
|
totalDistance = data._Distance;
|
||||||
}
|
}
|
||||||
@@ -30,10 +35,9 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
var diff = Math.Round(totalDistance - _playerController.TotalDistance, 3) * 1000;
|
var diff = Math.Round(totalDistance - _playerController.TotalDistance, 3) * 1000;
|
||||||
_reviewItemScript.SetDistance(diff);
|
_reviewItemScript.SetDistance(diff);
|
||||||
}
|
}
|
||||||
public void SetController(ReviewItemScript reviewItemScript, PlayerController playerController)
|
public void SetController(ReviewItemScript reviewItemScript)
|
||||||
{
|
{
|
||||||
_reviewItemScript = reviewItemScript;
|
_reviewItemScript = reviewItemScript;
|
||||||
_playerController = playerController;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Assets.Scenes.Ride.Scripts.Model;
|
using Assets.Scenes.Ride.Scripts.Model;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
{
|
{
|
||||||
@@ -17,6 +18,13 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
protected override void Init()
|
protected override void Init()
|
||||||
{
|
{
|
||||||
base.Init();
|
base.Init();
|
||||||
|
totalDistance = mainController.selectParamModel.EndDistance;
|
||||||
|
currentlatlong = mainController.GetCenterCoordinate();
|
||||||
|
TrailRenderer trail = FindObjectOfType<TrailRenderer>();
|
||||||
|
trail.startWidth = 0.6f;
|
||||||
|
trail.endWidth = 0.6f;
|
||||||
|
trail.startColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 0.65f);
|
||||||
|
trail.endColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 0.65f);
|
||||||
}
|
}
|
||||||
TargetData targetData;
|
TargetData targetData;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -31,17 +39,17 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
cadance = mainController.UpdateCadence();
|
cadance = mainController.UpdateCadence();
|
||||||
weight = App.CurrentUser.Weight;
|
weight = App.CurrentUser.Weight;
|
||||||
bicycleWeight = App.CurrentUser.BicycleWeight;
|
bicycleWeight = App.CurrentUser.BicycleWeight;
|
||||||
Debug.Log(power);
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
power = 2000;//测试功率
|
power = 2000;//测试功率
|
||||||
#endif
|
#endif
|
||||||
mainController.TrackResistance(currentSlope);
|
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 = cyclingExcutor.recorderData;
|
var recorderData = mainController.cyclingController.recorderData;
|
||||||
targetData = new TargetData
|
targetData = new TargetData
|
||||||
{
|
{
|
||||||
Ticks = ticks,
|
Ticks = ticks,
|
||||||
@@ -50,24 +58,31 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
_Distance = totalDistance > mapData.TotalDistance ? mapData.TotalDistance : totalDistance,
|
_Distance = totalDistance > mapData.TotalDistance ? mapData.TotalDistance : totalDistance,
|
||||||
_Cadence = cadance,
|
_Cadence = cadance,
|
||||||
_HeartRate = heartRate,
|
_HeartRate = heartRate,
|
||||||
_Lat = nextlatlong.x,
|
_Lat = currentlatlong.x,
|
||||||
_Lon = nextlatlong.y
|
_Lon = currentlatlong.y
|
||||||
};
|
};
|
||||||
recorderData.RiderDatas.Add(targetData);
|
recorderData.RiderDatas.Add(targetData);
|
||||||
|
|
||||||
}
|
}
|
||||||
protected override void SendTcp()
|
protected override void SendTcp()
|
||||||
{
|
{
|
||||||
mainController.cyclingController.Run(null);
|
if (mainController.cyclingController != null)
|
||||||
|
{
|
||||||
|
mainController.cyclingController.Run(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//上传数据
|
//上传数据
|
||||||
public override void Upload()
|
public override void Upload()
|
||||||
{
|
{
|
||||||
mainController.isStart = false;
|
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));
|
string imageFileName = base.CaptureCamera(Camera.main, new Rect(Screen.width * 0f, Screen.height * 0f, Screen.width * 0.5f, Screen.height * 0.5f));
|
||||||
cyclingExcutor.recorderData.IsCompleted = totalDistance == mapData.TotalDistance;
|
mainController.cyclingController.recorderData.StartTime = startTime;
|
||||||
cyclingExcutor.recorderData.EndDistance = totalDistance;
|
mainController.cyclingController.recorderData.IsCompleted = totalDistance == mapData.TotalDistance;
|
||||||
cyclingExcutor.recorderData.SaveData(cyclingExcutor.Mode,null, imageFileName);
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -49,18 +49,12 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
case Model.CyclingModel.Single:
|
case Model.CyclingModel.Single:
|
||||||
singleArea.SetActive(true);
|
singleArea.SetActive(true);
|
||||||
break;
|
reviewScrollView.SetActive(false);
|
||||||
case Model.CyclingModel.Online:
|
|
||||||
break;
|
break;
|
||||||
case Model.CyclingModel.Review:
|
case Model.CyclingModel.Review:
|
||||||
|
singleArea.SetActive(false);
|
||||||
InitReview();
|
InitReview();
|
||||||
break;
|
break;
|
||||||
case Model.CyclingModel.Competition:
|
|
||||||
break;
|
|
||||||
case Model.CyclingModel.GlobalCycling:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float t = 1;
|
float t = 1;
|
||||||
@@ -100,7 +94,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
var otherPlayerController = otherPlayerObj.GetComponent<OtherPlayerController>();
|
var otherPlayerController = otherPlayerObj.GetComponent<OtherPlayerController>();
|
||||||
otherList.Add(otherPlayerController);
|
otherList.Add(otherPlayerController);
|
||||||
otherPlayerController.record = item.record;
|
otherPlayerController.record = item.record;
|
||||||
otherPlayerController.SetController(reviewItemScript, playerController);
|
otherPlayerController.SetController(reviewItemScript);
|
||||||
GameObject miniPlayer = (GameObject)Instantiate(miniMapPlayer, transform.parent.parent.parent);
|
GameObject miniPlayer = (GameObject)Instantiate(miniMapPlayer, transform.parent.parent.parent);
|
||||||
var miniController = miniPlayer.GetComponent<MiniMapPlayerController>();
|
var miniController = miniPlayer.GetComponent<MiniMapPlayerController>();
|
||||||
miniController.SetController(otherPlayerController);
|
miniController.SetController(otherPlayerController);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
|
|
||||||
GameObject _directionsGO;
|
GameObject _directionsGO;
|
||||||
GameObject _mipMapRoute;
|
GameObject _mipMapRoute;
|
||||||
|
GameObject _pathRoute;
|
||||||
CyclingController cyclingCotroller;
|
CyclingController cyclingCotroller;
|
||||||
private bool initComplete = false;
|
private bool initComplete = false;
|
||||||
|
|
||||||
@@ -95,6 +96,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
var meshData = new MeshData();
|
var meshData = new MeshData();
|
||||||
var dat = new List<Vector3>();
|
var dat = new List<Vector3>();
|
||||||
|
var path = new List<Vector3>();
|
||||||
|
|
||||||
var mapData = cyclingCotroller.GetMapData();
|
var mapData = cyclingCotroller.GetMapData();
|
||||||
if (mapData != null)
|
if (mapData != null)
|
||||||
@@ -105,21 +107,33 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
var point = mapData.List[i].Point;
|
var point = mapData.List[i].Point;
|
||||||
Vector3 item = _map.GeoToWorldPosition(new Vector2d(point[0], point[1]));
|
Vector3 item = _map.GeoToWorldPosition(new Vector2d(point[0], point[1]));
|
||||||
item.y += 0.3f;
|
item.y += 0.3f;
|
||||||
if (!posInScreen(item) && i > playerController.CurrentIndex)
|
//if (!posInScreen(item) && i > playerController.CurrentIndex)
|
||||||
{
|
//{
|
||||||
break;
|
// break;
|
||||||
}
|
//}
|
||||||
else if (posInScreen(item))
|
//else if (posInScreen(item))
|
||||||
|
//{
|
||||||
|
// dat.Add(item);
|
||||||
|
//}
|
||||||
|
//前后取50个点
|
||||||
|
decimal diff = i - playerController.CurrentIndex;
|
||||||
|
decimal diffAbs = Math.Abs(diff);
|
||||||
|
if (diffAbs <= 50)
|
||||||
{
|
{
|
||||||
dat.Add(item);
|
dat.Add(item);
|
||||||
}
|
}
|
||||||
|
if (diff < 0 && diff > -100)
|
||||||
|
{
|
||||||
|
item.y += 0.30001f;
|
||||||
|
path.Add(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var feat = new VectorFeatureUnity();
|
var feat = new VectorFeatureUnity();
|
||||||
feat.Points.Add(dat);
|
feat.Points.Add(dat);
|
||||||
//处理海拔高度的问题
|
//处理海拔高度的问题
|
||||||
//SnapModifier.Run(feat, meshData, tile);
|
//SnapModifier.Run(feat, meshData, tile);
|
||||||
CreatMapRoute(feat);//创建路线
|
CreatMapRoute(feat);//创建路线
|
||||||
//CreateMiniMapRoute(feat);//创建小地图路线
|
CreatPathRoute(path);//创建骑行过的线路
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,7 +143,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
Vector3 viewPos = Camera.main.WorldToViewportPoint(position);
|
Vector3 viewPos = Camera.main.WorldToViewportPoint(position);
|
||||||
Vector3 dir = (position - camreatra.localPosition).normalized;
|
Vector3 dir = (position - camreatra.localPosition).normalized;
|
||||||
float dot = Vector3.Dot(camreatra.forward, dir);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -176,23 +190,44 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
||||||
var dat = feat.Points[0];
|
var dat = feat.Points[0];
|
||||||
ColorUtility.TryParseHtmlString("#FF2742", out Color c);
|
ColorUtility.TryParseHtmlString("#FF2742", out Color c);
|
||||||
lineRender.endColor = c;
|
lineRender.endColor = new Color(1,1,1,0.65f);
|
||||||
lineRender.startColor = c;
|
lineRender.startColor = new Color(1, 1, 1, 0.65f);
|
||||||
|
|
||||||
//设置宽度
|
//设置宽度
|
||||||
lineRender.SetWidth(0.5f, 0.5f);
|
lineRender.startWidth = 0.6f;
|
||||||
lineRender.SetVertexCount(dat.Count);
|
lineRender.endWidth = 0.6f;
|
||||||
|
lineRender.positionCount = dat.Count;
|
||||||
lineRender.SetPositions(feat.Points[0].ToArray());
|
lineRender.SetPositions(feat.Points[0].ToArray());
|
||||||
lineRender.loop = false;
|
lineRender.loop = false;
|
||||||
lineRender.numCapVertices = 90;
|
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;
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,7 @@ using UnityEngine.SceneManagement;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Assets.Cyp.Common;
|
using Assets.Cyp.Common;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
{
|
{
|
||||||
@@ -74,11 +75,14 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
|
|
||||||
private float timeRemaining = 1f;
|
private float timeRemaining = 1f;
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
Image arrow;
|
||||||
|
AbstractMap map;
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
#region 控件获取与事件绑定
|
#region 控件获取与事件绑定
|
||||||
fps = transform.Find("Panel/FPS").GetComponent<Text>();
|
fps = transform.Find("Panel/FPS").GetComponent<Text>();
|
||||||
|
arrow = transform.Find("Panel/Arrow").GetComponent<Image>();
|
||||||
|
map = transform.parent.Find("Map").GetComponent<AbstractMap>();
|
||||||
leftPanel = transform.Find("Panel/ReviewPanel").gameObject;
|
leftPanel = transform.Find("Panel/ReviewPanel").gameObject;
|
||||||
rightPanel = transform.Find("Panel/NearPanel").gameObject;
|
rightPanel = transform.Find("Panel/NearPanel").gameObject;
|
||||||
startBtn = transform.Find("Panel/StartButton").GetComponent<Button>();
|
startBtn = transform.Find("Panel/StartButton").GetComponent<Button>();
|
||||||
@@ -121,18 +125,31 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
|
|
||||||
target = transform.parent.Find("Target").gameObject;
|
target = transform.parent.Find("Target").gameObject;
|
||||||
|
|
||||||
startBtn.onClick.AddListener(StartRide);
|
UIManager.AddEvent(startBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, StartRide);
|
||||||
simpleBtn.onClick.AddListener(ClearPanel);
|
UIManager.AddEvent(simpleBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ClearPanel);
|
||||||
pauseButton.onClick.AddListener(PauseRide);
|
UIManager.AddEvent(pauseButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, PauseRide);
|
||||||
settingButton.onClick.AddListener(ShowSettingPanel);
|
UIManager.AddEvent(settingButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowSettingPanel);
|
||||||
deviceButton.onClick.AddListener(ShowDevicePanel);
|
UIManager.AddEvent(deviceButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowDevicePanel);
|
||||||
exitButton.onClick.AddListener(StopRide);
|
UIManager.AddEvent(exitButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, StopRide);
|
||||||
singleButton.onClick.AddListener(SingleRide);
|
UIManager.AddEvent(singleButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, SingleRide);
|
||||||
shadowButton.onClick.AddListener(ShadowRide);
|
UIManager.AddEvent(shadowButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShadowRide);
|
||||||
addButton.onClick.AddListener(ShowSelectPlayer);
|
UIManager.AddEvent(addButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowSelectPlayer);
|
||||||
saveButton.onClick.AddListener(SaveRide);
|
UIManager.AddEvent(saveButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, SaveRide);
|
||||||
cancelQuitButton.onClick.AddListener(CancelQuit);
|
UIManager.AddEvent(cancelQuitButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, CancelQuit);
|
||||||
closeQuitButton.onClick.AddListener(CloseQuit);
|
UIManager.AddEvent(closeQuitButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, CloseQuit);
|
||||||
|
|
||||||
|
//startBtn.onClick.AddListener(StartRide);
|
||||||
|
//simpleBtn.onClick.AddListener(ClearPanel);
|
||||||
|
//pauseButton.onClick.AddListener(PauseRide);
|
||||||
|
//settingButton.onClick.AddListener(ShowSettingPanel);
|
||||||
|
//deviceButton.onClick.AddListener(ShowDevicePanel);
|
||||||
|
//exitButton.onClick.AddListener(StopRide);
|
||||||
|
//singleButton.onClick.AddListener(SingleRide);
|
||||||
|
//shadowButton.onClick.AddListener(ShadowRide);
|
||||||
|
//addButton.onClick.AddListener(ShowSelectPlayer);
|
||||||
|
//saveButton.onClick.AddListener(SaveRide);
|
||||||
|
//cancelQuitButton.onClick.AddListener(CancelQuit);
|
||||||
|
//closeQuitButton.onClick.AddListener(CloseQuit);
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,6 +162,22 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 2).ToString() + "KM";//总里程
|
totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 2).ToString() + "KM";//总里程
|
||||||
RenderChart();
|
RenderChart();
|
||||||
startIndex = playerController.CurrentIndex;
|
startIndex = playerController.CurrentIndex;
|
||||||
|
//继续骑行如果有伴侣就自动进入伴侣骑行
|
||||||
|
if (mainController.routeResult != null)
|
||||||
|
{
|
||||||
|
if (mainController.routeResult.Mode == CyclingModel.Review.ToString())
|
||||||
|
{
|
||||||
|
mainController.SetCyclingModel(CyclingModel.Review);
|
||||||
|
selectPanel.SetActive(false);
|
||||||
|
var reviewFactory = reviewPanel.transform.GetComponent<ReviewFactory>();
|
||||||
|
reviewFactory.Refresh();
|
||||||
|
}
|
||||||
|
else if (mainController.routeResult.Mode == CyclingModel.Single.ToString())
|
||||||
|
{
|
||||||
|
mainController.SetCyclingModel(CyclingModel.Single);
|
||||||
|
selectPanel.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
float tt = 1f;
|
float tt = 1f;
|
||||||
@@ -153,6 +186,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
tt -= Time.deltaTime;
|
tt -= Time.deltaTime;
|
||||||
while (tt < 0) {
|
while (tt < 0) {
|
||||||
fps.text = (1 / Time.deltaTime).ToString();
|
fps.text = (1 / Time.deltaTime).ToString();
|
||||||
|
MoveChartMarkPoint();
|
||||||
tt = 1;
|
tt = 1;
|
||||||
}
|
}
|
||||||
//获取当前选中玩家绑定当前UI
|
//获取当前选中玩家绑定当前UI
|
||||||
@@ -188,40 +222,45 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
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:移动所有人的头像
|
||||||
UpdateRealTimeChart();
|
|
||||||
//MoveChartMarkPoint();
|
//MoveChartMarkPoint();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void LateUpdate()
|
|
||||||
{
|
|
||||||
if (target != null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
target.transform.position = playerController.transform.position; //new Vector3((float)Math.Round(player.transform.position.x,1), 0, (float)Math.Round(player.transform.position.z,1));
|
target.transform.position = playerController.transform.position; //new Vector3((float)Math.Round(player.transform.position.x,1), 0, (float)Math.Round(player.transform.position.z,1));
|
||||||
//target.transform.rotation = playerController.transform.rotation;//new Quaternion(playerController.transform.rotation.x, playerController.transform.rotation.y +1f, playerController.transform.rotation.z, playerController.transform.rotation.w);
|
//target.transform.rotation = playerController.transform.rotation;//new Quaternion(playerController.transform.rotation.x, playerController.transform.rotation.y +1f, playerController.transform.rotation.z, playerController.transform.rotation.w);
|
||||||
target.transform.eulerAngles = new Vector3(0, playerController.transform.eulerAngles.y + 180f, 0);
|
target.transform.eulerAngles = new Vector3(0, playerController.transform.eulerAngles.y + 180f, 0);
|
||||||
|
//控制照片移动
|
||||||
|
((RectTransform)arrow.transform).position = Camera.main.WorldToScreenPoint(target.transform.position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void SingleRide()
|
|
||||||
|
private void SingleRide(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
selectPanel.SetActive(false);
|
selectPanel.SetActive(false);
|
||||||
mainController.cyclingModel = CyclingModel.Single;
|
mainController.SetCyclingModel(CyclingModel.Single);
|
||||||
//显示单人骑行列表
|
//显示单人骑行列表
|
||||||
reviewPanel.SetActive(true);
|
reviewPanel.SetActive(true);
|
||||||
}
|
}
|
||||||
private void ShadowRide()
|
private void ShadowRide(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
mainController.cyclingModel = CyclingModel.Review;
|
mainController.SetCyclingModel(CyclingModel.Review);
|
||||||
selectPanel.SetActive(false);
|
selectPanel.SetActive(false);
|
||||||
//显示影子选手骑行列表
|
//显示影子选手骑行列表
|
||||||
selectPlayer.SetActive(true);
|
selectPlayer.SetActive(true);
|
||||||
}
|
}
|
||||||
private void ShowSelectPlayer()
|
private void ShowSelectPlayer(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
selectPlayer.SetActive(true);
|
selectPlayer.SetActive(true);
|
||||||
}
|
}
|
||||||
private void StartRide()
|
private void StartRide(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
|
var antConnected = mainController.CheckAnt();//初始化ant+设备
|
||||||
|
//if (!antConnected)
|
||||||
|
//{
|
||||||
|
// throw new Exception("请先连接设备");
|
||||||
|
//}
|
||||||
//加个5秒钟倒计时
|
//加个5秒钟倒计时
|
||||||
count = 5;
|
count = 5;
|
||||||
startBtn.gameObject.SetActive(false);
|
startBtn.gameObject.SetActive(false);
|
||||||
@@ -229,12 +268,12 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
countDownTxt.text = count.ToString();
|
countDownTxt.text = count.ToString();
|
||||||
}
|
}
|
||||||
//暂停游戏
|
//暂停游戏
|
||||||
private void PauseRide()
|
private void PauseRide(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
playerController.SetPause();
|
playerController.SetPause();
|
||||||
startBtn.gameObject.SetActive(true);
|
startBtn.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
private void SaveRide()
|
private void SaveRide(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
playerController.SetPause();
|
playerController.SetPause();
|
||||||
if (playerController.TotalTicks > 0 && !playerController.isQuit )
|
if (playerController.TotalTicks > 0 && !playerController.isQuit )
|
||||||
@@ -244,18 +283,18 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
}
|
}
|
||||||
SceneManager.LoadScene("MainScene");
|
SceneManager.LoadScene("MainScene");
|
||||||
}
|
}
|
||||||
private void CancelQuit()
|
private void CancelQuit(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
quitPanel.SetActive(false);
|
quitPanel.SetActive(false);
|
||||||
SceneManager.LoadScene("MainScene");
|
SceneManager.LoadScene("MainScene");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseQuit()
|
private void CloseQuit(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
quitPanel.SetActive(false);
|
quitPanel.SetActive(false);
|
||||||
}
|
}
|
||||||
//结束游戏
|
//结束游戏
|
||||||
private void StopRide()
|
private void StopRide(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
if (playerController.TotalTicks > 0)
|
if (playerController.TotalTicks > 0)
|
||||||
{
|
{
|
||||||
@@ -267,18 +306,18 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//显示设备连接
|
//显示设备连接
|
||||||
private void ShowDevicePanel()
|
private void ShowDevicePanel(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
UIManager.Show(UIManager.Instance.DevicePanel, transform.Find("Panel").GetComponent<PFUIPanel>());
|
UIManager.Show(UIManager.Instance.DevicePanel, transform.Find("Panel").GetComponent<PFUIPanel>());
|
||||||
}
|
}
|
||||||
//显示设置
|
//显示设置
|
||||||
private void ShowSettingPanel()
|
private void ShowSettingPanel(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
int isSimple = 1;
|
int isSimple = 1;
|
||||||
|
|
||||||
private bool clearLock = true;
|
private bool clearLock = true;
|
||||||
private void ClearPanel()
|
private void ClearPanel(BaseEventData baseEventData)
|
||||||
{
|
{
|
||||||
if (clearLock)
|
if (clearLock)
|
||||||
{
|
{
|
||||||
@@ -311,7 +350,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
// elevationChart.AddData(0, elevationList[i]);
|
// elevationChart.AddData(0, elevationList[i]);
|
||||||
//}
|
//}
|
||||||
//elevationChart.RefreshChart();
|
//elevationChart.RefreshChart();
|
||||||
|
ElevationToScreenPoint();
|
||||||
var endIndex = playerController.CurrentIndex;
|
var endIndex = playerController.CurrentIndex;
|
||||||
var s = endIndex / maxCacheDataNumber;
|
var s = endIndex / maxCacheDataNumber;
|
||||||
var v = endIndex % maxCacheDataNumber;
|
var v = endIndex % maxCacheDataNumber;
|
||||||
@@ -324,7 +363,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
if (initCount > maxCacheDataNumber) break;
|
if (initCount > maxCacheDataNumber) break;
|
||||||
AddOneData(s * maxCacheDataNumber + v + i);
|
AddOneData(s * maxCacheDataNumber + v + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
elevationChart.RefreshChart();
|
elevationChart.RefreshChart();
|
||||||
if (App.CurrentUser != null)
|
if (App.CurrentUser != null)
|
||||||
{
|
{
|
||||||
@@ -352,28 +391,59 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
chartAddNum++;
|
chartAddNum++;
|
||||||
}
|
}
|
||||||
var v = (endIndex - chartAddNum) % maxCacheDataNumber;
|
var v = (endIndex - chartAddNum) % maxCacheDataNumber;
|
||||||
MoveChartMarkPoint(v);
|
//MoveChartMarkPoint(v);
|
||||||
App.CurrentUserHeadTexture = img.texture;
|
App.CurrentUserHeadTexture = img.texture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void AddOneData(int index)
|
void AddOneData(int index)
|
||||||
{
|
{
|
||||||
string category = index.ToString();
|
string category = index.ToString();
|
||||||
|
|
||||||
elevationChart.AddData(0, elevationList[index]);
|
elevationChart.AddData(0, elevationList[index]);
|
||||||
//elevationChart.AddXAxisData(category);
|
//elevationChart.AddXAxisData(category);
|
||||||
//elevationChart.AddXAxisData(index.ToString(), index);
|
//elevationChart.AddXAxisData(index.ToString(), index);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private Dictionary<int, Vector2> pointMap = new Dictionary<int, Vector2>();
|
||||||
void MoveChartMarkPoint(int index)
|
void ElevationToScreenPoint()
|
||||||
{
|
{
|
||||||
var dataPoints = elevationChart.series.list[0].dataPoints.OrderBy(c=>c.x).ToList();
|
|
||||||
if (dataPoints.Count > 0)
|
var xUnit =(float) Math.Round(854f * (Screen.width/1600f) / elevationList.Length);//x单位
|
||||||
|
var maxelev = (float)elevationList.Max();
|
||||||
|
var yUnit =(float)Math.Round(46f * (Screen.height / 900f) / maxelev);//y单位
|
||||||
|
var xoffset = 373f * (Screen.width / 1600f);
|
||||||
|
var yoffset = 175f * (Screen.height / 900f);
|
||||||
|
for (int i = 0; i < elevationList.Length; i++)
|
||||||
{
|
{
|
||||||
var pinLoction = dataPoints[index];
|
var c = new Vector2(i*xUnit+ xoffset, elevationList[i]*yUnit + yoffset);
|
||||||
pinLoction.y = img.transform.localPosition.y;
|
pointMap.Add(i, c);
|
||||||
img.transform.localPosition = pinLoction;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public GameObject testButton;
|
||||||
|
void MoveChartMarkPoint()
|
||||||
|
{
|
||||||
|
//var dataPoints = elevationChart.series.list[0].dataPoints.OrderBy(c => c.x).ToList();
|
||||||
|
//if (dataPoints.Count > 0)
|
||||||
|
//{
|
||||||
|
// var pinLoction = dataPoints[index];
|
||||||
|
// pinLoction.y = img.transform.localPosition.y;
|
||||||
|
// img.transform.localPosition = pinLoction;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//if (pointMap.ContainsKey(playerController.CurrentIndex-1) )
|
||||||
|
//{
|
||||||
|
|
||||||
|
|
||||||
|
// Vector3 mousePos;
|
||||||
|
// //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);
|
||||||
|
// ((RectTransform)testButton.transform).position = new Vector3(pointMap[playerController.CurrentIndex - 1].x, pointMap[playerController.CurrentIndex - 1].y, 0);
|
||||||
|
// //testButton.transform.position = new Vector3( pointMap[index].x, 229f, 0);
|
||||||
|
// //testButton.transform.position = new Vector3(pointMap[playerController.CurrentIndex-1].x, pointMap[playerController.CurrentIndex-1].y, 0);
|
||||||
|
// //testButton.transform.DOMove(new Vector3(pointMap[playerController.CurrentIndex].x, pointMap[playerController.CurrentIndex].y,0),1).on;
|
||||||
|
// //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);
|
||||||
|
//}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,104 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c9578634924eb2b46a53ba662941dba6
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -46,5 +46,14 @@ namespace Assets.Scripts.Apis
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 通过ID获取设备商
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public JsonResult<AntManufacturer> GetAntManufacturer(int id)
|
||||||
|
{
|
||||||
|
return Get<JsonResult<AntManufacturer>>($"MapRecord/GetAntManufacturerById?id={id}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Assets.Scripts.Apis.Models
|
||||||
|
{
|
||||||
|
public class AntManufacturer
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public long Updated { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b7ac153dd8cf59f4ea4ff6ceb0c85823
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -35,11 +35,11 @@ namespace Assets.Scripts.Apis.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RankingsId { get; set; }
|
public List<string> RankingsId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GlobalContinue { get; set; }
|
public bool GlobalContinue { get; set; }
|
||||||
}
|
}
|
||||||
public class RouteResult
|
public class RouteResult
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
public static class App
|
public static class App
|
||||||
{
|
{
|
||||||
public static string Host = "http://192.168.0.101:5082/";
|
public static string Host = "http://192.168.0.97:5082/";
|
||||||
|
|
||||||
public static string AppVersion = "1.0.0";
|
public static string AppVersion = "1.0.0";
|
||||||
|
|
||||||
@@ -25,5 +25,5 @@ public static class App
|
|||||||
public static System.Collections.Generic.Dictionary<string, string> MainSceneParam = new Dictionary<string, string>();
|
public static System.Collections.Generic.Dictionary<string, string> MainSceneParam = new Dictionary<string, string>();
|
||||||
public static IDictionary<string,Texture> TextureCache = new Dictionary<string, Texture>();
|
public static IDictionary<string,Texture> TextureCache = new Dictionary<string, Texture>();
|
||||||
public static Texture CurrentUserHeadTexture;
|
public static Texture CurrentUserHeadTexture;
|
||||||
public static SelectParamModel selectParam;
|
public static RouteResult routeResult;//骑行记录向骑行场景传值
|
||||||
}
|
}
|
||||||
@@ -74,6 +74,8 @@ namespace Assets.Scripts.UI.Prefab.Login
|
|||||||
}
|
}
|
||||||
public int GetCountryIndexByCode(string code)
|
public int GetCountryIndexByCode(string code)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(code))
|
||||||
|
return countryDefaultValue;
|
||||||
var c = countryList.FindIndex(x => x.abbreviation.ToLower() == code.ToLower());
|
var c = countryList.FindIndex(x => x.abbreviation.ToLower() == code.ToLower());
|
||||||
if (c == -1) return countryDefaultValue;
|
if (c == -1) return countryDefaultValue;
|
||||||
return c;
|
return c;
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||||
{
|
{
|
||||||
|
RouteResult routeResult;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
Transform left,row1,row2,right;
|
Transform left,row1,row2,right;
|
||||||
Transform btnReRide, btnContinue, btnDelete;
|
Transform btnReRide, btnContinue, btnDelete;
|
||||||
@@ -25,6 +27,7 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
|||||||
string titleColor = "#5c5c6e";
|
string titleColor = "#5c5c6e";
|
||||||
public void Initial(RouteResult result)
|
public void Initial(RouteResult result)
|
||||||
{
|
{
|
||||||
|
routeResult = result;
|
||||||
left = transform.Find("Left");
|
left = transform.Find("Left");
|
||||||
row1 = left.Find("Main").Find("Row1");
|
row1 = left.Find("Main").Find("Row1");
|
||||||
row2 = left.Find("Main").Find("Row2");
|
row2 = left.Find("Main").Find("Row2");
|
||||||
@@ -66,12 +69,20 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
|||||||
|
|
||||||
private void GoReRide()
|
private void GoReRide()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
App.RouteIdParam = routeResult.RouteId;
|
||||||
|
App.routeResult = routeResult;
|
||||||
|
App.routeResult.ContinueCyclingParam = null;
|
||||||
|
SceneManager.LoadScene("Ride");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GoContinue()
|
private void GoContinue()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (routeResult.ContinueCyclingParam != null)
|
||||||
|
{
|
||||||
|
App.RouteIdParam = routeResult.RouteId;
|
||||||
|
App.routeResult = routeResult;
|
||||||
|
SceneManager.LoadScene("Ride");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPointerExit(PointerEventData eventData)
|
public void OnPointerExit(PointerEventData eventData)
|
||||||
|
|||||||
Reference in new issue
Block a user