场景加载处理一些卡顿的情况
This commit is contained in:
parent
e7a3214cb5
commit
65fc5b5c50
@ -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: HeavyTrafficMaterial
|
m_Name: HeavyTrafficMaterial
|
||||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_ShaderKeywords: _ALPHABLEND_ON
|
m_ShaderKeywords: _ALPHABLEND_ON
|
||||||
@ -42,7 +43,7 @@ Material:
|
|||||||
- _MainTex:
|
- _MainTex:
|
||||||
m_Texture: {fileID: 2800000, guid: 5d806cf3d5c4b28468ac8f0a359e5458, type: 3}
|
m_Texture: {fileID: 2800000, guid: 5d806cf3d5c4b28468ac8f0a359e5458, type: 3}
|
||||||
m_Scale: {x: 0.1, y: 1}
|
m_Scale: {x: 0.1, y: 1}
|
||||||
m_Offset: {x: 0.59010184, y: 0.2}
|
m_Offset: {x: 0.121369265, y: 0.2}
|
||||||
- _MetallicGlossMap:
|
- _MetallicGlossMap:
|
||||||
m_Texture: {fileID: 0}
|
m_Texture: {fileID: 0}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 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: LowTrafficMaterial
|
m_Name: LowTrafficMaterial
|
||||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_ShaderKeywords: _ALPHABLEND_ON
|
m_ShaderKeywords: _ALPHABLEND_ON
|
||||||
@ -42,7 +43,7 @@ Material:
|
|||||||
- _MainTex:
|
- _MainTex:
|
||||||
m_Texture: {fileID: 2800000, guid: a37d7ca3fd5634248b17100606fb3f8c, type: 3}
|
m_Texture: {fileID: 2800000, guid: a37d7ca3fd5634248b17100606fb3f8c, type: 3}
|
||||||
m_Scale: {x: 0.1, y: 1}
|
m_Scale: {x: 0.1, y: 1}
|
||||||
m_Offset: {x: 0.59010184, y: 0.2}
|
m_Offset: {x: 0.121369265, y: 0.2}
|
||||||
- _MetallicGlossMap:
|
- _MetallicGlossMap:
|
||||||
m_Texture: {fileID: 0}
|
m_Texture: {fileID: 0}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 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: ModerateTrafficMaterial
|
m_Name: ModerateTrafficMaterial
|
||||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_ShaderKeywords: _ALPHABLEND_ON
|
m_ShaderKeywords: _ALPHABLEND_ON
|
||||||
@ -42,7 +43,7 @@ Material:
|
|||||||
- _MainTex:
|
- _MainTex:
|
||||||
m_Texture: {fileID: 2800000, guid: 0845c42fade8c7146ad7292865320ac3, type: 3}
|
m_Texture: {fileID: 2800000, guid: 0845c42fade8c7146ad7292865320ac3, type: 3}
|
||||||
m_Scale: {x: 0.1, y: 1}
|
m_Scale: {x: 0.1, y: 1}
|
||||||
m_Offset: {x: 0.59010184, y: 0.2}
|
m_Offset: {x: 0.121369265, y: 0.2}
|
||||||
- _MetallicGlossMap:
|
- _MetallicGlossMap:
|
||||||
m_Texture: {fileID: 0}
|
m_Texture: {fileID: 0}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 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: SevereTrafficMaterial
|
m_Name: SevereTrafficMaterial
|
||||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_ShaderKeywords: _ALPHABLEND_ON
|
m_ShaderKeywords: _ALPHABLEND_ON
|
||||||
@ -42,7 +43,7 @@ Material:
|
|||||||
- _MainTex:
|
- _MainTex:
|
||||||
m_Texture: {fileID: 2800000, guid: f3d717cde2dd47041a338381f5757a7f, type: 3}
|
m_Texture: {fileID: 2800000, guid: f3d717cde2dd47041a338381f5757a7f, type: 3}
|
||||||
m_Scale: {x: 0.1, y: 1}
|
m_Scale: {x: 0.1, y: 1}
|
||||||
m_Offset: {x: 0.59010184, y: 0.2}
|
m_Offset: {x: 0.121369265, y: 0.2}
|
||||||
- _MetallicGlossMap:
|
- _MetallicGlossMap:
|
||||||
m_Texture: {fileID: 0}
|
m_Texture: {fileID: 0}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
|
|||||||
@ -64,7 +64,7 @@ namespace Mapbox.Unity.MeshGeneration.Modifiers
|
|||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
_scaledWidth = _options.Width;
|
_scaledWidth = 1;//_options.Width;
|
||||||
_vertexList = new List<Vector3>();
|
_vertexList = new List<Vector3>();
|
||||||
_normalList = new List<Vector3>();
|
_normalList = new List<Vector3>();
|
||||||
_triangleList = new List<int>();
|
_triangleList = new List<int>();
|
||||||
@ -80,13 +80,13 @@ namespace Mapbox.Unity.MeshGeneration.Modifiers
|
|||||||
|
|
||||||
public override void Run(VectorFeatureUnity feature, MeshData md, float scale)
|
public override void Run(VectorFeatureUnity feature, MeshData md, float scale)
|
||||||
{
|
{
|
||||||
_scaledWidth = _options.Width * scale;
|
_scaledWidth = 1 * scale;
|
||||||
ExtrudeLine(feature, md);
|
ExtrudeLine(feature, md);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Run(VectorFeatureUnity feature, MeshData md, UnityTile tile = null)
|
public override void Run(VectorFeatureUnity feature, MeshData md, UnityTile tile = null)
|
||||||
{
|
{
|
||||||
_scaledWidth = tile.TileScale * 20;// tile != null ? _options.Width * tile.TileScale : _options.Width;
|
_scaledWidth = tile.TileScale * 10;// tile != null ? _options.Width * tile.TileScale : _options.Width;
|
||||||
ExtrudeLine(feature, md);
|
ExtrudeLine(feature, md);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,108 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!114 &6765884926385918646
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 3139160886374094329}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 3b302b86be2917240a96a5b47007701d, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
character: {fileID: 3139160886374094329}
|
|
||||||
characterSpeed: 0
|
|
||||||
characterAnimator: {fileID: 3139160886383584827}
|
|
||||||
map: {fileID: 0}
|
|
||||||
rayPlane: {fileID: 0}
|
|
||||||
layerMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967295
|
|
||||||
cam: {fileID: 0}
|
|
||||||
--- !u!1001 &3139160886374126427
|
|
||||||
PrefabInstance:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Modification:
|
|
||||||
m_TransformParent: {fileID: 0}
|
|
||||||
m_Modifications:
|
|
||||||
- target: {fileID: 100002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_Name
|
|
||||||
value: Player
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_RootOrder
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalScale.x
|
|
||||||
value: 5
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalScale.y
|
|
||||||
value: 5
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalScale.z
|
|
||||||
value: 5
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.w
|
|
||||||
value: 1
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 400002, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 9500000, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
propertyPath: m_Controller
|
|
||||||
value:
|
|
||||||
objectReference: {fileID: 9100000, guid: 14e9d0801d59b004db16bd8b0057c8c9, type: 2}
|
|
||||||
m_RemovedComponents: []
|
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 383b41aea1ea4ee43b23a95bb413ebd8, type: 3}
|
|
||||||
--- !u!1 &3139160886374094329 stripped
|
|
||||||
GameObject:
|
|
||||||
m_CorrespondingSourceObject: {fileID: 100002, guid: 383b41aea1ea4ee43b23a95bb413ebd8,
|
|
||||||
type: 3}
|
|
||||||
m_PrefabInstance: {fileID: 3139160886374126427}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
--- !u!95 &3139160886383584827 stripped
|
|
||||||
Animator:
|
|
||||||
m_CorrespondingSourceObject: {fileID: 9500000, guid: 383b41aea1ea4ee43b23a95bb413ebd8,
|
|
||||||
type: 3}
|
|
||||||
m_PrefabInstance: {fileID: 3139160886374126427}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: b5bd00178c5556042b7381c948533d95
|
|
||||||
PrefabImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -325,7 +325,7 @@ AudioListener:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 728460487}
|
m_GameObject: {fileID: 728460487}
|
||||||
m_Enabled: 1
|
m_Enabled: 0
|
||||||
--- !u!20 &728460489
|
--- !u!20 &728460489
|
||||||
Camera:
|
Camera:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,5 @@
|
|||||||
using Assets.Scripts.Apis.Models;
|
using Assets.Scenes.Ride.Scripts.Model.CyclingModels;
|
||||||
|
using Assets.Scripts.Apis.Models;
|
||||||
using GeoJSON.Net.Geometry;
|
using GeoJSON.Net.Geometry;
|
||||||
using Mapbox.Unity.Map;
|
using Mapbox.Unity.Map;
|
||||||
using Mapbox.Utils;
|
using Mapbox.Utils;
|
||||||
@ -67,6 +68,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; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 游戏状态控制
|
#region 游戏状态控制
|
||||||
@ -85,6 +87,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
public void SetPause()
|
public void SetPause()
|
||||||
{
|
{
|
||||||
isStart = false;
|
isStart = false;
|
||||||
|
characterAnimator.SetBool("IsRide", false);
|
||||||
}
|
}
|
||||||
//退出或者完成骑行
|
//退出或者完成骑行
|
||||||
public void SetQuit()
|
public void SetQuit()
|
||||||
@ -101,17 +104,24 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
private void FixedUpdate()
|
||||||
|
{
|
||||||
Excute();
|
Excute();
|
||||||
}
|
}
|
||||||
#region 骑行逻辑
|
#region 骑行逻辑
|
||||||
//初始化骑行数据
|
//初始化骑行数据
|
||||||
|
protected CyclingController mainController;
|
||||||
|
protected BaseCycling cyclingExcutor;
|
||||||
protected virtual void Init()
|
protected virtual void Init()
|
||||||
{
|
{
|
||||||
characterAnimator = GetComponentInChildren<Animator>();
|
characterAnimator = GetComponentInChildren<Animator>();
|
||||||
var mainController = transform.parent.GetComponent<CyclingController>();
|
mainController = transform.parent.GetComponent<CyclingController>();
|
||||||
map = FindObjectOfType<AbstractMap>();
|
map = FindObjectOfType<AbstractMap>();
|
||||||
mapData = mainController.GetMapData();//获取路书信息
|
mapData = mainController.GetMapData();//获取路书信息
|
||||||
nextlatlong = new Vector2d(mapData.List[0].Point[0], mapData.List[0].Point[1]);//初始化人物位置 TODO加上之前骑行距离
|
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()
|
||||||
@ -135,32 +145,30 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
if (totalDistance <= mapData.TotalDistance)
|
if (totalDistance <= mapData.TotalDistance)
|
||||||
{
|
{
|
||||||
//数据处理
|
//数据处理
|
||||||
|
|
||||||
nextlatlong = Along(totalDistance);//下一个坐标
|
nextlatlong = Along(totalDistance);//下一个坐标
|
||||||
nextPos = map.GeoToWorldPosition(nextlatlong);//下一个点
|
nextPos = map.GeoToWorldPosition(nextlatlong);//下一个点
|
||||||
nextPos.y += 0.3f;//提高y轴让人物站在地图上面
|
nextPos.y += 0.3f;//提高y轴让人物站在地图上面
|
||||||
prePos = transform.localPosition;//当前点
|
prePos = transform.localPosition;//当前点
|
||||||
|
thisRotation = transform.localRotation;
|
||||||
//动画控制
|
//动画控制
|
||||||
if (distance > 0)
|
if (distance > 0)
|
||||||
{
|
{
|
||||||
characterAnimator.SetBool("IsRide", true);//开始移动动画
|
characterAnimator.SetBool("IsRide", true);//开始移动动画
|
||||||
StartCoroutine(LookAtNextPos());//转向
|
|
||||||
StartCoroutine(MoveTo());//移动
|
StartCoroutine(MoveTo());//移动
|
||||||
|
//transform.localPosition = nextPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
totalDistance = mapData.TotalDistance;
|
totalDistance = mapData.TotalDistance;
|
||||||
characterAnimator.SetBool("ReachEnd", true);//到达终点
|
characterAnimator.SetBool("ReachEnd", true);//到达终点
|
||||||
Task.Run(() => { Upload(); });//异步上传数据
|
//Task.Run(() => { });//异步上传数据
|
||||||
|
Upload();
|
||||||
isStart = false;
|
isStart = false;
|
||||||
isQuit = true;
|
isQuit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
characterAnimator.SetBool("IsRide", false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//计算功率 速度 当前骑行总里程(M)心率 踏频 等
|
//计算功率 速度 当前骑行总里程(M)心率 踏频 等
|
||||||
protected virtual void Compute()
|
protected virtual void Compute()
|
||||||
@ -220,15 +228,17 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 人物移动与转向控制
|
#region 人物移动与转向控制
|
||||||
|
|
||||||
|
Quaternion thisRotation;
|
||||||
IEnumerator LookAtNextPos()
|
IEnumerator LookAtNextPos()
|
||||||
{
|
{
|
||||||
Quaternion neededRotation = Quaternion.LookRotation(transform.localPosition - nextPos);
|
Quaternion neededRotation = Quaternion.LookRotation(prePos - nextPos);
|
||||||
Quaternion thisRotation = character.transform.localRotation;
|
//Quaternion thisRotation = character.transform.localRotation;
|
||||||
|
|
||||||
float t = 0;
|
float t = 0;
|
||||||
while (t < 1.0f)
|
while (t < 1.0f)
|
||||||
{
|
{
|
||||||
t += Time.deltaTime / 0.25f;
|
t += Time.deltaTime / 0.5f;
|
||||||
var rotationValue = Quaternion.Slerp(thisRotation, neededRotation, t);
|
var rotationValue = Quaternion.Slerp(thisRotation, neededRotation, t);
|
||||||
character.transform.rotation = Quaternion.Euler(0, rotationValue.eulerAngles.y, 0);
|
character.transform.rotation = Quaternion.Euler(0, rotationValue.eulerAngles.y, 0);
|
||||||
yield return null;
|
yield return null;
|
||||||
@ -238,15 +248,16 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
//人物移动控制
|
//人物移动控制
|
||||||
IEnumerator MoveTo()
|
IEnumerator MoveTo()
|
||||||
{
|
{
|
||||||
|
StartCoroutine(LookAtNextPos());//转向
|
||||||
//让人物移动分点增加动画的流畅度
|
//让人物移动分点增加动画的流畅度
|
||||||
float t = 0;
|
float t = 0;
|
||||||
while (t < 1)
|
while (t < 1)
|
||||||
{
|
{
|
||||||
t += Time.deltaTime;
|
t += Time.deltaTime;
|
||||||
Vector3 v = Vector3.Lerp(prePos, nextPos, t);
|
Vector3 v = Vector3.Lerp(prePos, nextPos, t);
|
||||||
transform.localPosition = v;
|
|
||||||
|
transform.localPosition = new Vector3((float)Math.Round(v.x,4), (float)Math.Round(v.y, 4), (float)Math.Round(v.z, 4));
|
||||||
//控制海拔图的位置
|
//控制海拔图的位置
|
||||||
|
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,15 +4,22 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
|
||||||
using XCharts;
|
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
using Assets.Scenes.Ride.Scripts.Model;
|
using Assets.Scenes.Ride.Scripts.Model;
|
||||||
using Assets.Scenes.Ride.Scripts.Model.CyclingModels;
|
using Assets.Scenes.Ride.Scripts.Model.CyclingModels;
|
||||||
using Assets.Scenes.Ride.Scripts.Interface;
|
using Assets.Scenes.Ride.Scripts;
|
||||||
|
using Mapbox.Unity.Map;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
public class CyclingController : MonoBehaviour
|
public class CyclingController : DeviceServiceMonoBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public AbstractMap map;
|
||||||
|
public GameObject player;
|
||||||
|
public GameObject UIObject;
|
||||||
|
public GameObject target;
|
||||||
|
|
||||||
|
|
||||||
#region 参数
|
#region 参数
|
||||||
private MapDataModel mapData;//当前路书数据
|
private MapDataModel mapData;//当前路书数据
|
||||||
private double[] coordiantes;//当前地图中心
|
private double[] coordiantes;//当前地图中心
|
||||||
@ -20,195 +27,100 @@ public class CyclingController : MonoBehaviour
|
|||||||
private bool isStart;//当前游戏是否开始
|
private bool isStart;//当前游戏是否开始
|
||||||
private DateTime startTime;//开始时间
|
private DateTime startTime;//开始时间
|
||||||
private bool initComplete;
|
private bool initComplete;
|
||||||
public CyclingModel cyclingModel;//当前骑行模式
|
private CyclingModel cyclingModel;//当前骑行模式
|
||||||
public BaseCycling cyclingController { get; set; }
|
public BaseCycling cyclingController { get; set; }
|
||||||
public int RouteId;
|
private int RouteId;
|
||||||
private MapApi mapApi;
|
private MapApi mapApi;
|
||||||
#endregion
|
private Route mapRoute;
|
||||||
|
|
||||||
#region 设备服务
|
|
||||||
//设备列表
|
|
||||||
///速率设备
|
|
||||||
ISpeedDevice SpeedDevice
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//get
|
|
||||||
//{
|
|
||||||
// //速度和踏频一体的传感器,里面的速度是不可以读的,只允许读 踏频,切记
|
|
||||||
// if (_antConnector == null)
|
|
||||||
// {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// var device = _antConnector.discoveredDevices.Where(d => d.State == DeviceState.Connected && d is ISpeedDevice).FirstOrDefault();
|
|
||||||
// if (device != null)
|
|
||||||
// {
|
|
||||||
// return (ISpeedDevice)device;
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 心率设备
|
|
||||||
/// </summary>
|
|
||||||
IHeartRateDevice HeartDevice
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//get
|
|
||||||
//{
|
|
||||||
// if (_antConnector == null)
|
|
||||||
// {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// var device = _antConnector.discoveredDevices.Where(d => d.State == DeviceState.Connected && d is IHeartRateDevice).FirstOrDefault();
|
|
||||||
// if (device != null)
|
|
||||||
// {
|
|
||||||
// return (IHeartRateDevice)device;
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 功率设备
|
|
||||||
/// </summary>
|
|
||||||
IPowerDevice PowerDevice
|
|
||||||
{
|
|
||||||
get {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//get
|
|
||||||
//{
|
|
||||||
// if (_antConnector == null)
|
|
||||||
// {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// var powerDevices = _antConnector.discoveredDevices.Where(d => d.State == DeviceState.Connected && d is IPowerDevice).ToList();
|
|
||||||
// var power = powerDevices.FirstOrDefault(d => d.Sensor == SensorType.Power);
|
|
||||||
// if (power != null)
|
|
||||||
// {
|
|
||||||
// return (IPowerDevice)power;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (powerDevices.Any())
|
|
||||||
// {
|
|
||||||
// return (IPowerDevice)powerDevices.FirstOrDefault();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return null;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 踏频设备
|
|
||||||
/// </summary>
|
|
||||||
private ICadenceDevice CadenceDevice
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//get
|
|
||||||
//{
|
|
||||||
// if (_antConnector == null)
|
|
||||||
// {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// var cadences = _antConnector.discoveredDevices.Where(d => d.State == DeviceState.Connected && d is ICadenceDevice).ToList();
|
|
||||||
// var cadence = cadences.FirstOrDefault(d => d.Sensor == SensorType.Cadence);
|
|
||||||
// if (cadence != null)
|
|
||||||
// {
|
|
||||||
// return (ICadenceDevice)cadence;
|
|
||||||
// }
|
|
||||||
// var spdCad = cadences.FirstOrDefault(d => d.Sensor == SensorType.SpeedCadence);
|
|
||||||
// if (spdCad != null)
|
|
||||||
// {
|
|
||||||
// return (ICadenceDevice)spdCad;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (cadences.Any())
|
|
||||||
// {
|
|
||||||
// return (ICadenceDevice)cadences.FirstOrDefault();
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
initComplete = false;
|
initComplete = false;
|
||||||
cyclingModel = CyclingModel.Single;
|
cyclingModel = CyclingModel.Single;
|
||||||
//获取当前用户信息 TODO
|
|
||||||
|
|
||||||
//获取路书信息
|
//获取路书信息
|
||||||
//MapApi mapApi = new MapApi();
|
|
||||||
mapApi = new MapApi();
|
mapApi = new MapApi();
|
||||||
RouteId = App.RouteIdParam;
|
RouteId = App.RouteIdParam;
|
||||||
//var result = GetTestData();
|
//var result = GetTestData();
|
||||||
var result = mapApi.GetData(RouteId);
|
MapDataModel result;
|
||||||
//StartCoroutine(requset());
|
if (RouteId > 0)
|
||||||
//获取UDP信息 TODO
|
{
|
||||||
|
result = mapApi.GetData(RouteId);
|
||||||
//var param = mapApi.GetById(RouteId);
|
}
|
||||||
//Route mapRoute = GetNewInstace(RouteId);//获取一个路书所有的数据
|
else
|
||||||
|
{
|
||||||
|
result = GetTestData();
|
||||||
//switch (cyclingModel)
|
}
|
||||||
|
var antConnected = CheckAnt();//初始化ant+设备
|
||||||
|
//if (!antConnected)
|
||||||
//{
|
//{
|
||||||
// case CyclingModel.Single:
|
// throw new Exception("请先连接设备");
|
||||||
// cyclingController = new SingleModel(mapRoute, null);
|
|
||||||
// //cyclingModel.OpenCyclingWindow();
|
|
||||||
// break;
|
|
||||||
// //case CyclingModel.Online:
|
|
||||||
// // CyclingModel = new OnlineModel(Route, param);
|
|
||||||
// // //cyclingModel.OpenCyclingWindow();
|
|
||||||
// // break;
|
|
||||||
// //case CyclingModel.Review:
|
|
||||||
// // if (param.RankingsId.Count == 0)
|
|
||||||
// // {
|
|
||||||
// // UIHelper.ShowError(View.GetLang("MapboxController.PSelectARider"));//请选择骑行人
|
|
||||||
// // return;
|
|
||||||
// // }
|
|
||||||
// // CyclingModel = new ReviewModel(Route, param);
|
|
||||||
// // //cyclingModel.OpenCyclingWindow();
|
|
||||||
// // break;
|
|
||||||
// //case Model.CyclingModel.Competition:
|
|
||||||
// // CyclingModel = new CompetitionModel(Route, param);
|
|
||||||
// // //cyclingModel.OpenCyclingWindow();
|
|
||||||
// // break;
|
|
||||||
// //case Model.CyclingModel.GlobalCycling:
|
|
||||||
// // CyclingModel = new GlobalCyclingModel(Route, param);
|
|
||||||
|
|
||||||
// // break;
|
|
||||||
// //default:
|
|
||||||
// // break;
|
|
||||||
//}
|
//}
|
||||||
//获取蓝牙设备信息 TODO
|
//StartCoroutine(requset());
|
||||||
|
|
||||||
if (result != null && result.List.Count > 0)
|
|
||||||
|
var param = mapApi.GetById(RouteId);
|
||||||
|
mapRoute = GetNewInstace(RouteId);//获取一个路书所有的数据
|
||||||
|
|
||||||
|
switch (cyclingModel)
|
||||||
|
{
|
||||||
|
case CyclingModel.Single:
|
||||||
|
cyclingController = new SingleModel(mapRoute);
|
||||||
|
//cyclingModel.OpenCyclingWindow();
|
||||||
|
break;
|
||||||
|
//case CyclingModel.Online:
|
||||||
|
// CyclingModel = new OnlineModel(Route, param);
|
||||||
|
// //cyclingModel.OpenCyclingWindow();
|
||||||
|
// break;
|
||||||
|
//case CyclingModel.Review:
|
||||||
|
// if (param.RankingsId.Count == 0)
|
||||||
|
// {
|
||||||
|
// UIHelper.ShowError(View.GetLang("MapboxController.PSelectARider"));//请选择骑行人
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// CyclingModel = new ReviewModel(Route, param);
|
||||||
|
// //cyclingModel.OpenCyclingWindow();
|
||||||
|
// break;
|
||||||
|
//case Model.CyclingModel.Competition:
|
||||||
|
// CyclingModel = new CompetitionModel(Route, param);
|
||||||
|
// //cyclingModel.OpenCyclingWindow();
|
||||||
|
// break;
|
||||||
|
//case Model.CyclingModel.GlobalCycling:
|
||||||
|
// CyclingModel = new GlobalCyclingModel(Route, param);
|
||||||
|
|
||||||
|
// break;
|
||||||
|
//default:
|
||||||
|
// break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != null && mapRoute != null)
|
||||||
{
|
{
|
||||||
mapData = result;
|
mapData = result;
|
||||||
coordiantes = result.List[0].Point;//TODO计算当前用户所处的位置
|
coordiantes = result.List[0].Point;//TODO计算当前用户所处的位置
|
||||||
initComplete = true;
|
initComplete = true;
|
||||||
|
Init();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new System.Exception("fail to get route data");
|
throw new System.Exception("fail to get route data");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void Init()
|
||||||
|
{
|
||||||
|
//加载人物和地图以及UI界面
|
||||||
|
map.gameObject.SetActive(true);
|
||||||
|
player.SetActive(true);
|
||||||
|
UIObject.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
//发送UDP
|
//发送UDP
|
||||||
|
target.transform.position = player.transform.position;
|
||||||
|
target.transform.rotation = player.transform.rotation; //player.transform.rotation.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 方法
|
#region 数据处理
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前骑行数据的记录器
|
/// 当前骑行数据的记录器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -219,6 +131,10 @@ public class CyclingController : MonoBehaviour
|
|||||||
return cyclingController?.recorderData;
|
return cyclingController?.recorderData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public Route GetRoute()
|
||||||
|
{
|
||||||
|
return mapRoute;
|
||||||
|
}
|
||||||
|
|
||||||
public MapDataModel GetMapData()
|
public MapDataModel GetMapData()
|
||||||
{
|
{
|
||||||
@ -238,54 +154,6 @@ public class CyclingController : MonoBehaviour
|
|||||||
var jsonData = mapApi.GetData(RouteId);
|
var jsonData = mapApi.GetData(RouteId);
|
||||||
return new Route(jsonData, routeInstance.data);
|
return new Route(jsonData, routeInstance.data);
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 更新速度(KM/H)
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
private double UpDateSpeed()
|
|
||||||
{
|
|
||||||
return SpeedDevice == null ? 0 : SpeedDevice.Speed;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 更新心率
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="heart"></param>
|
|
||||||
private int? UpDataHeart()
|
|
||||||
{
|
|
||||||
if (HeartDevice != null)
|
|
||||||
{
|
|
||||||
return HeartDevice.HeartRate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 更新功率
|
|
||||||
/// </summary>
|
|
||||||
private double UpdatePower()
|
|
||||||
{
|
|
||||||
return PowerDevice == null ? 0 : PowerDevice.Power;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 更新踏频
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cadence"></param>
|
|
||||||
private int UpdateCadence()
|
|
||||||
{
|
|
||||||
return CadenceDevice == null ? 0 : CadenceDevice.Cadence;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 更新距离(KM)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="distance"></param>
|
|
||||||
private double UpdateDistance(double speed)
|
|
||||||
{
|
|
||||||
return Math.Round(speed / 3600, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IEnumerator requset() {
|
IEnumerator requset() {
|
||||||
string url = @"http://192.168.0.97:5081/Map/GetData?routeid=5492&m=20";
|
string url = @"http://192.168.0.97:5081/Map/GetData?routeid=5492&m=20";
|
||||||
UnityWebRequest request = UnityWebRequest.Get(url);
|
UnityWebRequest request = UnityWebRequest.Get(url);
|
||||||
@ -332,4 +200,6 @@ public class CyclingController : MonoBehaviour
|
|||||||
return dist.ToArray();
|
return dist.ToArray();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
262
Assets/Scenes/Ride/Scripts/DeviceServiceMonoBase.cs
Normal file
262
Assets/Scenes/Ride/Scripts/DeviceServiceMonoBase.cs
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
using Assets.Scripts.Devices.Ant;
|
||||||
|
using Assets.Scripts.Devices.Ant.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
|
{
|
||||||
|
public class DeviceServiceMonoBase: MonoBehaviour
|
||||||
|
{
|
||||||
|
#region 获取设备数据
|
||||||
|
/// <summary>
|
||||||
|
/// 更新速度(KM/H)
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public double UpDateSpeed()
|
||||||
|
{
|
||||||
|
return SpeedDevice == null ? 0 : SpeedDevice.Speed;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 更新心率
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="heart"></param>
|
||||||
|
public int? UpDateHeart()
|
||||||
|
{
|
||||||
|
if (HeartDevice != null)
|
||||||
|
{
|
||||||
|
return HeartDevice.HeartRate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 更新功率
|
||||||
|
/// </summary>
|
||||||
|
public double UpdatePower()
|
||||||
|
{
|
||||||
|
return PowerDevice == null ? 0 : PowerDevice.Power;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 更新踏频
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cadence"></param>
|
||||||
|
public int UpdateCadence()
|
||||||
|
{
|
||||||
|
return CadenceDevice == null ? 0 : CadenceDevice.Cadence;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 更新距离(KM)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="distance"></param>
|
||||||
|
public double UpdateDistance(double speed)
|
||||||
|
{
|
||||||
|
return Math.Round(speed / 3600, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 设备接口
|
||||||
|
|
||||||
|
#region field
|
||||||
|
|
||||||
|
protected AbstractAntDevice _device;
|
||||||
|
protected AntConnector _antConnector;
|
||||||
|
|
||||||
|
public int ManufacturerId { get; private set; }
|
||||||
|
public string DeviceNumber { get; private set; }
|
||||||
|
public int? AntModelId { get; private set; }
|
||||||
|
|
||||||
|
private readonly static System.Collections.Generic.Dictionary<string, string> _routeDataCache = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#region 事件
|
||||||
|
|
||||||
|
//用户骑行界面非正常关闭(不清楚有哪些非正常),资源没有释放,导致定时器仍在运作。
|
||||||
|
public static bool baseExit { get; set; } = false;
|
||||||
|
#endregion
|
||||||
|
public bool CheckAnt()
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
//if (!ConfigHelper.IsNeedContectedToDevice)
|
||||||
|
//{
|
||||||
|
// return true;
|
||||||
|
//}
|
||||||
|
_antConnector = AntConnector.Instance();
|
||||||
|
var devices = _antConnector.discoveredDevices.Where(d => d.State == DeviceState.Connected && (d.Sensor == SensorType.Trainer || d.Sensor == SensorType.Power));
|
||||||
|
if (devices.Count() > 0)
|
||||||
|
{
|
||||||
|
_device = devices.OrderByDescending(d => d.Sensor == SensorType.Trainer).First();
|
||||||
|
if (_device != null && _device is IRequiresRiderWeight)
|
||||||
|
{
|
||||||
|
(_device as IRequiresRiderWeight).RiderWeight = 65;//TODO:PubCommData.CurrentUser.Weight;
|
||||||
|
}
|
||||||
|
ManufacturerId = _device.ManufacturerId;
|
||||||
|
DeviceNumber = $"{ _device.DeviceNumber },{ _device.DeviceType }";
|
||||||
|
AntModelId = _device.AntModelId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//if (PubCommData.CurrentUser.FTP <= 0)
|
||||||
|
//{
|
||||||
|
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
if (_device == null)
|
||||||
|
{
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//设备列表
|
||||||
|
///速率设备
|
||||||
|
protected ISpeedDevice SpeedDevice
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
//速度和踏频一体的传感器,里面的速度是不可以读的,只允许读 踏频,切记
|
||||||
|
if (_antConnector == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var device = _antConnector.discoveredDevices.Where(d => d.State == DeviceState.Connected && d is ISpeedDevice).FirstOrDefault();
|
||||||
|
if (device != null)
|
||||||
|
{
|
||||||
|
return (ISpeedDevice)device;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 心率设备
|
||||||
|
/// </summary>
|
||||||
|
protected IHeartRateDevice HeartDevice
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_antConnector == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var device = _antConnector.discoveredDevices.Where(d => d.State == DeviceState.Connected && d is IHeartRateDevice).FirstOrDefault();
|
||||||
|
if (device != null)
|
||||||
|
{
|
||||||
|
return (IHeartRateDevice)device;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 功率设备
|
||||||
|
/// </summary>
|
||||||
|
protected IPowerDevice PowerDevice
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_antConnector == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var powerDevices = _antConnector.discoveredDevices.Where(d => d.State == DeviceState.Connected && d is IPowerDevice).ToList();
|
||||||
|
var power = powerDevices.FirstOrDefault(d => d.Sensor == SensorType.Power);
|
||||||
|
if (power != null)
|
||||||
|
{
|
||||||
|
return (IPowerDevice)power;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (powerDevices.Any())
|
||||||
|
{
|
||||||
|
return (IPowerDevice)powerDevices.FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 踏频设备
|
||||||
|
/// </summary>
|
||||||
|
protected ICadenceDevice CadenceDevice
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_antConnector == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var cadences = _antConnector.discoveredDevices.Where(d => d.State == DeviceState.Connected && d is ICadenceDevice).ToList();
|
||||||
|
var cadence = cadences.FirstOrDefault(d => d.Sensor == SensorType.Cadence);
|
||||||
|
if (cadence != null)
|
||||||
|
{
|
||||||
|
return (ICadenceDevice)cadence;
|
||||||
|
}
|
||||||
|
var spdCad = cadences.FirstOrDefault(d => d.Sensor == SensorType.SpeedCadence);
|
||||||
|
if (spdCad != null)
|
||||||
|
{
|
||||||
|
return (ICadenceDevice)spdCad;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cadences.Any())
|
||||||
|
{
|
||||||
|
return (ICadenceDevice)cadences.FirstOrDefault();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 设备交互
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 设置骑行模式和骑行数据
|
||||||
|
///// </summary>
|
||||||
|
///// <param name="model">0自由骑,2阻力模式,3轨道模式</param>
|
||||||
|
///// <param name="data"></param>
|
||||||
|
//public void SetCyClingModelData(string model, double data)
|
||||||
|
//{
|
||||||
|
// if (recorderData == null)
|
||||||
|
// {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// switch (model)
|
||||||
|
// {
|
||||||
|
// case "0":
|
||||||
|
// recorderData.SendDataMode = SendDataMode.Freedom;
|
||||||
|
// SeedFecWindResistance();
|
||||||
|
// break;
|
||||||
|
// case "1":
|
||||||
|
// break;
|
||||||
|
// case "2":
|
||||||
|
// recorderData.SendDataMode = SendDataMode.Resistance;
|
||||||
|
// SeedFecResistance(data);
|
||||||
|
// //{
|
||||||
|
// // recorderData.SlopeGrade = data;
|
||||||
|
// // TrackResistance(data);
|
||||||
|
// //}
|
||||||
|
// break;
|
||||||
|
// case "3":
|
||||||
|
// recorderData.SendDataMode = SendDataMode.Track;
|
||||||
|
// int index = Route.GetStepIndex(recorderData.EndDistance);
|
||||||
|
// double grade = Route.GetPatchByIndex(index, false, recorderData.EndDistance);
|
||||||
|
// recorderData.SlopeGrade = grade;
|
||||||
|
|
||||||
|
// var grade1 = this._sensitivity / 100D * grade;
|
||||||
|
// //Trace.WriteLine("给设备发的坡度:"+grade, nameof(MapboxController));
|
||||||
|
// TrackResistance(grade1);
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 01f7e6fad7369e84ea67ee09f8b8b481
|
guid: f513d183d5ffc8642a79905a41b074fb
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d6647077ef503dc4e9f198f003415569
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts.Interface
|
|
||||||
{
|
|
||||||
public interface ICadenceDevice
|
|
||||||
{
|
|
||||||
int Cadence { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts.Interface
|
|
||||||
{
|
|
||||||
public interface IHeartRateDevice
|
|
||||||
{
|
|
||||||
int HeartRate { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 60c3eedce4d4b2a42be902c0b1dc1e1c
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts.Interface
|
|
||||||
{
|
|
||||||
public interface IPowerDevice
|
|
||||||
{
|
|
||||||
int Power { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ba4e3c819d613a740b008ce6fb95188e
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts.Interface
|
|
||||||
{
|
|
||||||
public interface ISpeedDevice
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 公里/小时
|
|
||||||
/// </summary>
|
|
||||||
double Speed { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 673cb46d6a3861444a00fed7d4c2abda
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -16,14 +16,14 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
/// <param name="manufacturerId"></param>
|
/// <param name="manufacturerId"></param>
|
||||||
/// <param name="deviceNumber"></param>
|
/// <param name="deviceNumber"></param>
|
||||||
/// <param name="antModelId"></param>
|
/// <param name="antModelId"></param>
|
||||||
public SingleModel(Route route1, SelectParamModel param)
|
public SingleModel(Route route1) //SelectParamModel param)
|
||||||
: base(route1, CyclingModel.Single)
|
: base(route1, CyclingModel.Single)
|
||||||
{
|
{
|
||||||
//recorderData = recorderData1;
|
//recorderData = recorderData1;
|
||||||
this.IsRecord = true;
|
this.IsRecord = true;
|
||||||
recorderData = new RecorderDataModel()
|
recorderData = new RecorderDataModel()
|
||||||
{
|
{
|
||||||
CurrentUser = PubCommData.CurrentUser,
|
CurrentUser = null,//TODO:PubCommData.CurrentUser,
|
||||||
//BelongUserId = PubCommData.CurrentUser.Id,
|
//BelongUserId = PubCommData.CurrentUser.Id,
|
||||||
Competitionid = 0,
|
Competitionid = 0,
|
||||||
ContinueIndex = 0,
|
ContinueIndex = 0,
|
||||||
@ -39,63 +39,57 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
|||||||
//AntModelId = antModelId,
|
//AntModelId = antModelId,
|
||||||
StartTime = DateTime.Now
|
StartTime = DateTime.Now
|
||||||
};
|
};
|
||||||
if (param != null)
|
#region TODO 线路上的人
|
||||||
{
|
//if (param != null)
|
||||||
recorderData.EndDistance = param.EndDistance;
|
//{
|
||||||
recorderData.CurrentRouteStartDistance = param.EndDistance;
|
// recorderData.EndDistance = param.EndDistance;
|
||||||
if (!string.IsNullOrWhiteSpace(param.ContinueMark))
|
// recorderData.CurrentRouteStartDistance = param.EndDistance;
|
||||||
{
|
// if (!string.IsNullOrWhiteSpace(param.ContinueMark))
|
||||||
recorderData.ContinueMark = param.ContinueMark;
|
// {
|
||||||
}
|
// recorderData.ContinueMark = param.ContinueMark;
|
||||||
recorderData.ContinueIndex = param.ContinueIndex.GetValueOrDefault(0);
|
// }
|
||||||
}
|
// recorderData.ContinueIndex = param.ContinueIndex.GetValueOrDefault(0);
|
||||||
recorderData.PreDistance = recorderData.EndDistance;
|
//}
|
||||||
|
//recorderData.PreDistance = recorderData.EndDistance;
|
||||||
//Rhino.PowerFun.Services.MapUDPService.Send(route.RouteInstance.Id, riders.First().UserId, route.Point.First());
|
//Rhino.PowerFun.Services.MapUDPService.Send(route.RouteInstance.Id, riders.First().UserId, route.Point.First());
|
||||||
|
|
||||||
|
|
||||||
riders = new List<BaseRider>();
|
//riders = new List<BaseRider>();
|
||||||
var rider = new OnlineRiderModel()
|
//TODO 附件的人列表加上自己
|
||||||
{
|
//var rider = new OnlineRiderModel()
|
||||||
NickName = PubCommData.CurrentUser.Nickname,
|
//{
|
||||||
UserId = PubCommData.CurrentUser.Id,
|
// NickName = PubCommData.CurrentUser.Nickname,
|
||||||
WxHeadImg = PubCommData.CurrentUser.WxHeadImg + "?t=1",
|
// UserId = PubCommData.CurrentUser.Id,
|
||||||
//Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1]),
|
// WxHeadImg = PubCommData.CurrentUser.WxHeadImg + "?t=1",
|
||||||
EndDistance = recorderData.EndDistance
|
// //Point = new GeoJSON.Net.Geometry.GeographicPosition(this.route.RouteInstance.Point[0], this.route.RouteInstance.Point[1]),
|
||||||
};
|
// EndDistance = recorderData.EndDistance
|
||||||
rider.Point = _turfHelper.Along(rider.EndDistance);
|
//};
|
||||||
|
//rider.Point = _turfHelper.Along(rider.EndDistance);
|
||||||
|
|
||||||
riders.Add(rider);
|
//riders.Add(rider);
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Run(TargetData targetData)
|
protected override void Run(TargetData targetData)
|
||||||
{
|
{
|
||||||
//base.BeforeRun(targetData);
|
#region TODO 获取在线用户
|
||||||
var dis1 = SpeedToDistance(targetData._Speed);
|
//riders.RemoveAll(r => r.IsSelf == false);
|
||||||
currentDistance = recorderData.EndDistance + dis1;//实时计算距离
|
//var onlineUsers = MapUDPService.GetOnlineUsers(recorderData.CurrentRoute.RouteInstance.Id).Where(d => d.IsSelf == false)
|
||||||
if (recorderData.CyclingState == CyclingStateEnum.Prepare || recorderData.CyclingState == CyclingStateEnum.Stop)
|
// .ToList();
|
||||||
{
|
|
||||||
currentDistance = recorderData.EndDistance;
|
|
||||||
}
|
|
||||||
if (recorderData.CyclingState == CyclingStateEnum.Cycling)
|
|
||||||
{
|
|
||||||
//Console.WriteLine($"{Ticks + 1}, 总距离:{currentDistance},速度:{ targetData._Speed },移动距离:{ dis1 }");
|
|
||||||
}
|
|
||||||
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)
|
//foreach (var item in onlineUsers)
|
||||||
{
|
//{
|
||||||
riders.Add(new OnlineRiderModel()
|
// riders.Add(new OnlineRiderModel()
|
||||||
{
|
// {
|
||||||
NickName = item.Name,
|
// NickName = item.Name,
|
||||||
UserId = item.Id,
|
// UserId = item.Id,
|
||||||
WxHeadImg = item.HeadImage,
|
// WxHeadImg = item.HeadImage,
|
||||||
Point = new GeoJSON.Net.Geometry.GeographicPosition(item.Point[0], item.Point[1]),
|
// Point = new GeoJSON.Net.Geometry.GeographicPosition(item.Point[0], item.Point[1]),
|
||||||
EndDistance = item.EndDistance,
|
// EndDistance = item.EndDistance,
|
||||||
PreDistance = item.PreDistance,
|
// PreDistance = item.PreDistance,
|
||||||
});
|
// });
|
||||||
}
|
//}
|
||||||
|
#endregion
|
||||||
base.Run(targetData);
|
base.Run(targetData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return CurrentUser.Id;
|
return 10688;//CurrentUser.Id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -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, DateTime createTime, string base64Image = "")
|
public JsonResult<AddMapRecordResultModel> SaveData(CyclingModel cyclingModel, SelectParamModel selectParam, string base64Image = "")
|
||||||
{
|
{
|
||||||
if (RiderDatas.Count <= 0)
|
if (RiderDatas.Count <= 0)
|
||||||
{
|
{
|
||||||
@ -126,13 +126,14 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
MapInterruptRecordApi service = new MapInterruptRecordApi();
|
MapInterruptRecordApi service = new MapInterruptRecordApi();
|
||||||
//AntManufacturer manufacturer = service.GetAntManufacturer(ManufacturerId);
|
//AntManufacturer manufacturer = service.GetAntManufacturer(ManufacturerId);
|
||||||
var recordId = Guid.NewGuid().ToString();
|
var recordId = Guid.NewGuid().ToString();
|
||||||
|
var ticks = RiderDatas.Last().Ticks;
|
||||||
var interruptRecord = new MapInterruptRecord
|
var interruptRecord = new MapInterruptRecord
|
||||||
{
|
{
|
||||||
Id = recordId,
|
Id = recordId,
|
||||||
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 = BelongUserId,
|
UserId = 10688,//BelongUserId,
|
||||||
RecordFileName = newFileName + ".txt",
|
RecordFileName = newFileName + ".txt",
|
||||||
Ftp = FTP,//FTP设置
|
Ftp = FTP,//FTP设置
|
||||||
IF = Math.Round(IF, 2),
|
IF = Math.Round(IF, 2),
|
||||||
@ -145,9 +146,9 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
NormalizedPower = Math.Floor(NP),//标准化功率
|
NormalizedPower = Math.Floor(NP),//标准化功率
|
||||||
AveragePower = averagePower,//平均功率
|
AveragePower = averagePower,//平均功率
|
||||||
MaxPower = RiderDatas.Max(a => a._Power),//最大功率
|
MaxPower = RiderDatas.Max(a => a._Power),//最大功率
|
||||||
WeightKg = Math.Round(averagePower / PubCommData.CurrentUser.Weight, 2),
|
WeightKg = Math.Round(averagePower / 65, 2),
|
||||||
Weight = PubCommData.CurrentUser.Weight,
|
Weight = 65, //PubCommData.CurrentUser.Weight,
|
||||||
BicycleWeight = PubCommData.CurrentUser.BicycleWeight,
|
BicycleWeight =7, //PubCommData.CurrentUser.BicycleWeight,
|
||||||
ContinueMark = ContinueMark,
|
ContinueMark = ContinueMark,
|
||||||
ContinueIndex = ContinueIndex,
|
ContinueIndex = ContinueIndex,
|
||||||
IsDelete = false,
|
IsDelete = false,
|
||||||
@ -159,11 +160,11 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
ManufacturerId = ManufacturerId,
|
ManufacturerId = ManufacturerId,
|
||||||
AntModelId = AntModelId,
|
AntModelId = AntModelId,
|
||||||
StartTime = StartTime,
|
StartTime = StartTime,
|
||||||
CreateTime = createTime,
|
CreateTime = StartTime.AddSeconds(ticks),
|
||||||
Ticks = RiderDatas.Last().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 = selectParam.GlobalCyclingId
|
||||||
};
|
};
|
||||||
//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);
|
||||||
@ -195,7 +196,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
stream.Close();
|
stream.Close();
|
||||||
files.Add(fname);
|
files.Add(fname);
|
||||||
}
|
}
|
||||||
//TODO 截图
|
#region TODO 截图
|
||||||
if (!string.IsNullOrEmpty(base64Image))
|
if (!string.IsNullOrEmpty(base64Image))
|
||||||
{
|
{
|
||||||
//var imageName = path + "/" + Guid.NewGuid().ToString() + ".png";
|
//var imageName = path + "/" + Guid.NewGuid().ToString() + ".png";
|
||||||
@ -209,6 +210,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
//}
|
//}
|
||||||
//files.Add(imageName);
|
//files.Add(imageName);
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
var result = service.Add(interruptRecord, files);
|
var result = service.Add(interruptRecord, files);
|
||||||
return new JsonResult<AddMapRecordResultModel> { result = result.result, errMsg = result.errMsg, data = result.data };
|
return new JsonResult<AddMapRecordResultModel> { result = result.result, errMsg = result.errMsg, data = result.data };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,138 +12,55 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
public class PlayerController : AbstractPlayer
|
public class PlayerController : AbstractPlayer
|
||||||
{
|
{
|
||||||
|
|
||||||
#region 骑行逻辑
|
#region 骑行逻辑
|
||||||
|
|
||||||
public List<TargetData> RiderDatas = new List<TargetData>();
|
|
||||||
protected override void Init()
|
protected override void Init()
|
||||||
{
|
{
|
||||||
base.Init();
|
base.Init();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 计算数据,父类会在此方法后处理动画
|
||||||
|
/// </summary>
|
||||||
protected override void Compute()
|
protected override void Compute()
|
||||||
{
|
{
|
||||||
//计算数据
|
//计算数据
|
||||||
power = 2000;//功率
|
//speed = mainController.UpDateSpeed();
|
||||||
|
heartRate = mainController.UpDateHeart()??0;
|
||||||
|
power = mainController.UpdatePower();
|
||||||
|
cadance = mainController.UpdateCadence();
|
||||||
|
|
||||||
|
power = 2000;//测试功率
|
||||||
|
|
||||||
speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight);
|
speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight);
|
||||||
distance = Math.Round(speed / 3600, 6);
|
distance = mainController.UpdateDistance(speed);
|
||||||
totalDistance += distance;
|
totalDistance += distance;
|
||||||
//记录骑行数据
|
//记录骑行数据
|
||||||
var recordText = string.Format($"{ ticks },{ power.ToString(CultureInfo.InvariantCulture) },{ speed.ToString(CultureInfo.InvariantCulture) },{ Math.Round(totalDistance, 6).ToString(CultureInfo.InvariantCulture) },{ cadance.ToString(CultureInfo.InvariantCulture) },{ heartRate.ToString(CultureInfo.InvariantCulture) },{ Math.Round(nextlatlong.x, 6).ToString(CultureInfo.InvariantCulture) },{ Math.Round(nextlatlong.y, 6).ToString(CultureInfo.InvariantCulture) }");
|
var recordText = string.Format($"{ ticks },{ power.ToString(CultureInfo.InvariantCulture) },{ speed.ToString(CultureInfo.InvariantCulture) },{ Math.Round(totalDistance, 6).ToString(CultureInfo.InvariantCulture) },{ cadance.ToString(CultureInfo.InvariantCulture) },{ heartRate.ToString(CultureInfo.InvariantCulture) },{ Math.Round(nextlatlong.x, 6).ToString(CultureInfo.InvariantCulture) },{ Math.Round(nextlatlong.y, 6).ToString(CultureInfo.InvariantCulture) }");
|
||||||
Debug.Log(recordText);
|
Debug.Log(recordText);
|
||||||
RiderDatas.Add(new TargetData
|
#if !UNITY_EDITOR
|
||||||
{
|
var recorderData = cyclingExcutor.recorderData;
|
||||||
Ticks = ticks,
|
recorderData.RiderDatas.Add(new TargetData
|
||||||
_Power = power,
|
{
|
||||||
_Speed = speed,
|
Ticks = ticks,
|
||||||
_Distance = totalDistance,
|
_Power = power,
|
||||||
_Cadence = cadance,
|
_Speed = speed,
|
||||||
_HeartRate = heartRate,
|
_Distance = totalDistance> mapData.TotalDistance? mapData.TotalDistance: totalDistance,
|
||||||
_Lat = nextlatlong.x,
|
_Cadence = cadance,
|
||||||
_Lon = nextlatlong.y
|
_HeartRate = heartRate,
|
||||||
});
|
_Lat = nextlatlong.x,
|
||||||
}
|
_Lon = nextlatlong.y
|
||||||
|
});
|
||||||
|
#endif
|
||||||
|
}
|
||||||
//上传数据
|
//上传数据
|
||||||
protected override void Upload()
|
protected override void Upload()
|
||||||
{
|
{
|
||||||
|
#if !UNITY_EDITOR
|
||||||
}
|
cyclingExcutor.recorderData.IsCompleted = totalDistance == mapData.TotalDistance;
|
||||||
|
cyclingExcutor.recorderData.EndDistance = totalDistance;
|
||||||
#region 保存骑行数据 准备迁移
|
cyclingExcutor.recorderData.SaveData(cyclingExcutor.Mode,null,string.Empty);
|
||||||
|
#endif
|
||||||
|
|
||||||
private string ContinueMark = "TODO";
|
|
||||||
private int ContinueIndex=0;
|
|
||||||
private int Competitionid =0;
|
|
||||||
private bool IsNeedRanking = true;
|
|
||||||
private double CurrentRouteStartDistance = 0;
|
|
||||||
private int ManufacturerId=0;
|
|
||||||
private int AntModelId =0 ;
|
|
||||||
private CyclingModel cyclingModel = CyclingModel.Single;
|
|
||||||
private DateTime EndTime;
|
|
||||||
void Complete()
|
|
||||||
{
|
|
||||||
EndTime = startTime.AddSeconds(ticks);
|
|
||||||
MapInterruptRecordApi api = new MapInterruptRecordApi();
|
|
||||||
string newFileName = Guid.NewGuid().ToString();
|
|
||||||
int FTP = Helper.GetFtp();
|
|
||||||
double NP = Helper.GetNP(RiderDatas);
|
|
||||||
//强度
|
|
||||||
double IF = NP / FTP;
|
|
||||||
//训练量
|
|
||||||
double TSS = (RiderDatas.Count * NP * IF) / (FTP * 3600) * 100;
|
|
||||||
var recordId = Guid.NewGuid().ToString();
|
|
||||||
var averagePower = Helper.AveragePower(RiderDatas);
|
|
||||||
var interruptRecord = new MapInterruptRecord
|
|
||||||
{
|
|
||||||
Id = recordId,
|
|
||||||
RouteId = 1,
|
|
||||||
RouteName = "",
|
|
||||||
TotalDistance = mapData.TotalDistance,
|
|
||||||
UserId = userId,
|
|
||||||
RecordFileName = newFileName + ".txt",
|
|
||||||
Ftp = FTP,//FTP设置
|
|
||||||
IF = Math.Round(IF, 2),
|
|
||||||
Kj = RiderDatas.Sum(a => a._Power) / 1000,//消耗
|
|
||||||
Tss = Math.Round(TSS, 2),
|
|
||||||
EndDistance = totalDistance,
|
|
||||||
IsCompleted = totalDistance >= mapData.TotalDistance,
|
|
||||||
NormalizedPower = Math.Floor(NP),//标准化功率
|
|
||||||
AveragePower = averagePower,//平均功率
|
|
||||||
MaxPower = RiderDatas.Max(a => a._Power),//最大功率
|
|
||||||
WeightKg = Math.Round(averagePower / weight, 2),
|
|
||||||
Weight = weight,
|
|
||||||
BicycleWeight = bicycleWeight,
|
|
||||||
ContinueMark = ContinueMark,
|
|
||||||
ContinueIndex = ContinueIndex,
|
|
||||||
IsDelete = false,
|
|
||||||
MapCompetitionId = Competitionid,
|
|
||||||
ManufacturerName = "TODO",
|
|
||||||
DeviceNumber = "TODO",
|
|
||||||
IsRanking = IsNeedRanking,
|
|
||||||
CurrentRouteStartDistance = CurrentRouteStartDistance,
|
|
||||||
ManufacturerId = ManufacturerId,
|
|
||||||
AntModelId = AntModelId,
|
|
||||||
StartTime = startTime,
|
|
||||||
CreateTime = EndTime,
|
|
||||||
Ticks = RiderDatas.Last().Ticks,
|
|
||||||
Mode = cyclingModel.ToString(),
|
|
||||||
//Param = Newtonsoft.Json.JsonConvert.SerializeObject(selectParam),
|
|
||||||
//GlobalCyclingId = selectParam.GlobalCyclingId
|
|
||||||
};
|
|
||||||
interruptRecord.SpeedRange = null;
|
|
||||||
double process = Math.Round((totalDistance - interruptRecord.CurrentRouteStartDistance) /mapData.TotalDistance, 2);
|
|
||||||
interruptRecord.Progress = process > 1 ? 1 : process;
|
|
||||||
|
|
||||||
var cadences = RiderDatas.Where(a => a._Cadence.HasValue && a._Cadence.Value > 0);
|
|
||||||
if (cadences.Any())
|
|
||||||
{
|
|
||||||
interruptRecord.AverageCadence = Math.Round(cadences.Average(a => a._Cadence.GetValueOrDefault(0)));
|
|
||||||
}
|
|
||||||
interruptRecord.MaxCadence = Math.Round(RiderDatas.Max(a => a._Cadence.GetValueOrDefault(0)));
|
|
||||||
interruptRecord.AverageHeartRate = Math.Round(RiderDatas.Average(a => a._HeartRate.GetValueOrDefault(0)));
|
|
||||||
interruptRecord.MaxHeartRate = RiderDatas.Max(a => a._HeartRate.GetValueOrDefault(0));
|
|
||||||
|
|
||||||
var path = Helper.GetDataDire("MapWorkoutRecords");
|
|
||||||
var fname = path + "/" + newFileName + ".txt";
|
|
||||||
var files = new List<string>();
|
|
||||||
using (var fs = new FileInfo(fname).OpenWrite())
|
|
||||||
{
|
|
||||||
var stream = new StreamWriter(fs);
|
|
||||||
stream.BaseStream.Seek(0, SeekOrigin.End);
|
|
||||||
foreach (var item in RiderDatas)
|
|
||||||
{
|
|
||||||
stream.Write(item.Write() + "\r\n");
|
|
||||||
}
|
|
||||||
stream.Flush();
|
|
||||||
stream.Close();
|
|
||||||
files.Add(fname);
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = api.Add(interruptRecord, files);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
}
|
||||||
#endregion
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
GameObject _directionsGO;
|
GameObject _directionsGO;
|
||||||
GameObject _mipMapRoute;
|
GameObject _mipMapRoute;
|
||||||
CyclingController cyclingCotroller;
|
CyclingController cyclingCotroller;
|
||||||
|
private bool initComplete = false;
|
||||||
|
|
||||||
protected virtual void Awake()
|
protected virtual void Awake()
|
||||||
{
|
{
|
||||||
@ -35,14 +36,41 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
_map = FindObjectOfType<AbstractMap>();
|
_map = FindObjectOfType<AbstractMap>();
|
||||||
}
|
}
|
||||||
_map.OnInitialized += CreateRoute;
|
// _map.OnInitialized += _map_OnInitialized; ;
|
||||||
_map.OnUpdated += CreateRoute;
|
//_map.OnUpdated += _map_OnUpdated; ;
|
||||||
|
//_map.OnTileFinished += _map_OnTileFinished; ;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void _map_OnUpdated()
|
||||||
|
{
|
||||||
|
Debug.Log("_map_OnUpdated");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _map_OnInitialized()
|
||||||
|
{
|
||||||
|
Debug.Log("_map_OnInitialized");
|
||||||
|
CreateRoute();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _map_OnTileFinished(UnityTile obj)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!initComplete)
|
||||||
|
{
|
||||||
|
Debug.Log(47);
|
||||||
|
CreateRoute(obj);
|
||||||
|
initComplete = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PlayerController playerController;
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
cyclingCotroller = transform.parent.GetComponent<CyclingController>();
|
cyclingCotroller = transform.parent.GetComponent<CyclingController>();
|
||||||
|
playerController = FindObjectOfType<PlayerController>();
|
||||||
StartCoroutine(QueryTimer());
|
StartCoroutine(QueryTimer());
|
||||||
//CreateRoute();
|
//CreateRoute();
|
||||||
}
|
}
|
||||||
@ -57,10 +85,54 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
Debug.Log(88);
|
||||||
yield return new WaitForSeconds(UpdateFrequency);
|
yield return new WaitForSeconds(UpdateFrequency);
|
||||||
CreateRoute();
|
CreateRoute(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateRoute(UnityTile tile)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
var meshData = new MeshData();
|
||||||
|
var dat = new List<Vector3>();
|
||||||
|
|
||||||
|
var mapData = cyclingCotroller.GetMapData();
|
||||||
|
if (mapData != null)
|
||||||
|
{
|
||||||
|
foreach (var mapDataItem in mapData.List)
|
||||||
|
{
|
||||||
|
var point = mapDataItem.Point;
|
||||||
|
|
||||||
|
Vector3 item = _map.GeoToWorldPosition(new Vector2d(point[0], point[1]));
|
||||||
|
var distance = TurfCS.Turf.Distance(TurfCS.Turf.Point(new double[] { playerController.Nextlatlong.x, playerController.Nextlatlong.y }), TurfCS.Turf.Point(new double[] { point[0], point[1]}));
|
||||||
|
if (distance<10)
|
||||||
|
{
|
||||||
|
item.y += 0.3f;
|
||||||
|
dat.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var feat = new VectorFeatureUnity();
|
||||||
|
feat.Points.Add(dat);
|
||||||
|
//处理海拔高度的问题
|
||||||
|
//SnapModifier.Run(feat, meshData, tile);
|
||||||
|
CreatMapRoute(feat);//创建路线
|
||||||
|
CreateMiniMapRoute(feat);//创建小地图路线
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool posInScreen(Vector3 position)
|
||||||
|
{
|
||||||
|
Transform camreatra = Camera.main.transform;
|
||||||
|
Vector3 viewPos = Camera.main.WorldToViewportPoint(position);
|
||||||
|
Vector3 dir = (position - camreatra.position).normalized;
|
||||||
|
float dot = Vector3.Dot(camreatra.forward, dir);
|
||||||
|
if (dot > 0 && viewPos.x > 0 && viewPos.x < 1 && viewPos.y > 0 && viewPos.y < 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
void CreateRoute()
|
void CreateRoute()
|
||||||
{
|
{
|
||||||
UnityTile tile;
|
UnityTile tile;
|
||||||
@ -96,6 +168,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
_directionsGO.Destroy();
|
_directionsGO.Destroy();
|
||||||
}
|
}
|
||||||
_directionsGO = new GameObject("MapRoute");
|
_directionsGO = new GameObject("MapRoute");
|
||||||
|
_directionsGO.transform.parent = transform;
|
||||||
var lineRender = _directionsGO.AddComponent<LineRenderer>();
|
var lineRender = _directionsGO.AddComponent<LineRenderer>();
|
||||||
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];
|
||||||
@ -124,6 +197,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
_mipMapRoute.Destroy();
|
_mipMapRoute.Destroy();
|
||||||
}
|
}
|
||||||
_mipMapRoute = new GameObject("MiniMapRoute");
|
_mipMapRoute = new GameObject("MiniMapRoute");
|
||||||
|
_mipMapRoute.transform.parent = transform;
|
||||||
var lineRender = _mipMapRoute.AddComponent<LineRenderer>();
|
var lineRender = _mipMapRoute.AddComponent<LineRenderer>();
|
||||||
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];
|
||||||
|
|||||||
@ -8,14 +8,17 @@ using Mapbox.Unity.Map;
|
|||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using System;
|
using System;
|
||||||
using Assets.Scenes.Ride.Scripts.Model;
|
using Assets.Scenes.Ride.Scripts.Model;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
namespace Assets.Scenes.Ride.Scripts
|
namespace Assets.Scenes.Ride.Scripts
|
||||||
{
|
{
|
||||||
|
|
||||||
public class UIManager : MonoBehaviour
|
public class SingleUIManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
#region UI control
|
#region UI control
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
|
Text Fps;//开始按钮
|
||||||
|
[SerializeField]
|
||||||
Button startBtn;//开始按钮
|
Button startBtn;//开始按钮
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
Button simpleBtn;//进入简约模式按钮
|
Button simpleBtn;//进入简约模式按钮
|
||||||
@ -51,6 +54,8 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
Text timerTxt;//计时器
|
Text timerTxt;//计时器
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
Text countDownTxt;//倒计时5s
|
Text countDownTxt;//倒计时5s
|
||||||
|
[SerializeField]
|
||||||
|
Text mapName;//路书名称
|
||||||
[SerializeField] LineChart elevationChart;//海拔图
|
[SerializeField] LineChart elevationChart;//海拔图
|
||||||
[SerializeField] Image img;//当前用户头像
|
[SerializeField] Image img;//当前用户头像
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
@ -82,18 +87,26 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
DeviceButton.onClick.AddListener(ShowDevicePanel);
|
DeviceButton.onClick.AddListener(ShowDevicePanel);
|
||||||
ExitButton.onClick.AddListener(StopRide);
|
ExitButton.onClick.AddListener(StopRide);
|
||||||
|
|
||||||
playerController = FindObjectOfType<PlayerController>();
|
|
||||||
mainController = FindObjectOfType<CyclingController>();
|
|
||||||
|
|
||||||
totalDistance.text = "/"+Math.Round(mainController.GetMapData().TotalDistance,2).ToString() + "KM";
|
|
||||||
}
|
}
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
playerController = FindObjectOfType<PlayerController>();
|
||||||
|
mainController = FindObjectOfType<CyclingController>();
|
||||||
|
var route = mainController.GetRoute();
|
||||||
|
mapName.text = route.RouteInstance.Name;
|
||||||
|
totalDistance.text = "/" + Math.Round(mainController.GetMapData().TotalDistance, 2).ToString() + "KM";
|
||||||
RenderChart();
|
RenderChart();
|
||||||
}
|
}
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
float tt = 1f;
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
tt -= Time.deltaTime;
|
||||||
|
while (tt < 0) {
|
||||||
|
Fps.text = (1 / Time.deltaTime).ToString();
|
||||||
|
tt = 1;
|
||||||
|
}
|
||||||
//获取当前选中玩家绑定当前UI
|
//获取当前选中玩家绑定当前UI
|
||||||
if (playerController != null)
|
if (playerController != null)
|
||||||
{
|
{
|
||||||
@ -152,7 +165,10 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
//结束游戏
|
//结束游戏
|
||||||
private void StopRide()
|
private void StopRide()
|
||||||
{
|
{
|
||||||
|
//TODO:主动保存或者舍弃保存
|
||||||
|
//切换到路数列表
|
||||||
|
SceneManager.LoadScene("MainScene");
|
||||||
|
|
||||||
}
|
}
|
||||||
//显示设备连接
|
//显示设备连接
|
||||||
private void ShowDevicePanel()
|
private void ShowDevicePanel()
|
||||||
@ -1,18 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class StartGame : MonoBehaviour
|
|
||||||
{
|
|
||||||
// Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1fb28883cdccb754f96b10ee3509d5ef
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
using Assets.Scripts.Apis.Models;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -9,4 +10,6 @@ public static class App
|
|||||||
public static string AppVersion = "1.0.0";
|
public static string AppVersion = "1.0.0";
|
||||||
|
|
||||||
public static int RouteIdParam = 0;
|
public static int RouteIdParam = 0;
|
||||||
|
|
||||||
|
public static UserResultModel CurrentUser { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -192,7 +192,7 @@ public class LoginController : MonoBehaviour
|
|||||||
//var res = await NoAuthApi.Login(phone.text, pwd.text);
|
//var res = await NoAuthApi.Login(phone.text, pwd.text);
|
||||||
if (res.result)
|
if (res.result)
|
||||||
{
|
{
|
||||||
ConfigHelper.CurrentUser = res.data;
|
App.CurrentUser = res.data;
|
||||||
SceneManager.LoadScene("MainScene");
|
SceneManager.LoadScene("MainScene");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -70,7 +70,7 @@ public class HomeController : PFUIPanel
|
|||||||
|
|
||||||
void SetCurrentUser()
|
void SetCurrentUser()
|
||||||
{
|
{
|
||||||
var user = ConfigHelper.CurrentUser;
|
var user = App.CurrentUser;
|
||||||
Ftp.text = user.FTP.ToString();
|
Ftp.text = user.FTP.ToString();
|
||||||
Weight.text = user.Weight.ToString();
|
Weight.text = user.Weight.ToString();
|
||||||
WKG.text = $"{user.Weight}KG/{user.BicycleWeight}KG";
|
WKG.text = $"{user.Weight}KG/{user.BicycleWeight}KG";
|
||||||
|
|||||||
@ -64,6 +64,15 @@ public class UIManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CyclingController mCyclingController;
|
||||||
|
public CyclingController CyclingController
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.GetPanelInstance("CyclingController", ref this.mCyclingController);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private EditUserController mEditUserController;
|
private EditUserController mEditUserController;
|
||||||
public EditUserController EditUserPanel
|
public EditUserController EditUserPanel
|
||||||
{
|
{
|
||||||
@ -176,6 +185,10 @@ public class UIManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
UIManager.Show(UIManager.Instance.HomePanel, UIManager.Instance.MainPanel);
|
UIManager.Show(UIManager.Instance.HomePanel, UIManager.Instance.MainPanel);
|
||||||
}
|
}
|
||||||
|
public static void ShowCyclingController()
|
||||||
|
{
|
||||||
|
UIManager.Show(UIManager.Instance.CyclingController, UIManager.Instance.MainPanel);
|
||||||
|
}
|
||||||
|
|
||||||
public static void ShowDevicePanel()
|
public static void ShowDevicePanel()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,10 +5,10 @@ EditorBuildSettings:
|
|||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Scenes:
|
m_Scenes:
|
||||||
- enabled: 0
|
- enabled: 1
|
||||||
path: Assets/Scenes/1-Login.unity
|
path: Assets/Scenes/1-Login.unity
|
||||||
guid: 6dce3e17997730b4492f91dd8fede429
|
guid: 6dce3e17997730b4492f91dd8fede429
|
||||||
- enabled: 0
|
- enabled: 1
|
||||||
path: Assets/Scenes/MainScene.unity
|
path: Assets/Scenes/MainScene.unity
|
||||||
guid: ab586a3c1bacd4a48a55178eb06fe0cc
|
guid: ab586a3c1bacd4a48a55178eb06fe0cc
|
||||||
- enabled: 1
|
- enabled: 1
|
||||||
|
|||||||
@ -166,7 +166,7 @@ PlayerSettings:
|
|||||||
v2Signing: 1
|
v2Signing: 1
|
||||||
enable360StereoCapture: 0
|
enable360StereoCapture: 0
|
||||||
isWsaHolographicRemotingEnabled: 0
|
isWsaHolographicRemotingEnabled: 0
|
||||||
enableFrameTimingStats: 0
|
enableFrameTimingStats: 1
|
||||||
useHDRDisplay: 0
|
useHDRDisplay: 0
|
||||||
D3DHDRBitDepth: 0
|
D3DHDRBitDepth: 0
|
||||||
m_ColorGamuts: 00000000
|
m_ColorGamuts: 00000000
|
||||||
@ -350,7 +350,7 @@ PlayerSettings:
|
|||||||
tvOS: 1
|
tvOS: 1
|
||||||
m_BuildTargetGroupLightmapEncodingQuality:
|
m_BuildTargetGroupLightmapEncodingQuality:
|
||||||
- m_BuildTarget: Standalone
|
- m_BuildTarget: Standalone
|
||||||
m_EncodingQuality: 1
|
m_EncodingQuality: 2
|
||||||
m_BuildTargetGroupLightmapSettings: []
|
m_BuildTargetGroupLightmapSettings: []
|
||||||
playModeTestRunnerEnabled: 0
|
playModeTestRunnerEnabled: 0
|
||||||
runPlayModeTestAsEditModeTest: 0
|
runPlayModeTestAsEditModeTest: 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user