继骑&重骑骑行结果页细节调整
This commit is contained in:
parent
018699c944
commit
afba150d91
@ -4,8 +4,9 @@
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: MapboxBlue
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _EMISSION
|
||||
@ -72,5 +73,5 @@ Material:
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 0.25882354, g: 0.39215687, b: 0.9843137, a: 1}
|
||||
- _EmissionColor: {r: 0.1551394, g: 0.23505972, b: 0.59, a: 1}
|
||||
- _Color: {r: 0.9764706, g: 0.1882353, b: 0.5254902, a: 0.6509804}
|
||||
- _EmissionColor: {r: 0.00024361434, g: 0.00029474328, b: 0.00019549299, a: 1}
|
||||
|
||||
@ -4,8 +4,9 @@
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: MapboxWhite
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _EMISSION
|
||||
@ -73,4 +74,4 @@ Material:
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _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
|
||||
var point = mainController.GetCenterCoordinate();
|
||||
_map.Initialize(new Utils.Vector2d(point[0], point[1]), _map.AbsoluteZoom);
|
||||
_map.Initialize(point, _map.AbsoluteZoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
8
Assets/Mapbox/User/Modifiers.meta
Normal file
8
Assets/Mapbox/User/Modifiers.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9281e8bf86b8d70459ba6c65898fee31
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/NuGet/Apis/Models.meta
Normal file
8
Assets/NuGet/Apis/Models.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6dd204d295b8fd5418483cecb462bd25
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Images/编组 3.png
Normal file
BIN
Assets/Resources/Images/编组 3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
104
Assets/Resources/Images/编组 3.png.meta
Normal file
104
Assets/Resources/Images/编组 3.png.meta
Normal file
@ -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_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
@ -61,7 +61,7 @@ MeshRenderer:
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 9c84f71e98b0047259dedc9428260078, type: 2}
|
||||
- {fileID: 2100000, guid: bdad3ccf6401a414188827874d8999aa, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
|
||||
@ -29,7 +29,7 @@ Transform:
|
||||
m_GameObject: {fileID: 1056360222971152080}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
@ -108,4 +108,9 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
character: {fileID: 1056360222971152080}
|
||||
characterAnimator: {fileID: 0}
|
||||
isQuit: 0
|
||||
CurrentIndex: 0
|
||||
record: []
|
||||
_reviewItemScript: {fileID: 0}
|
||||
_playerController: {fileID: 0}
|
||||
LastTicks: 0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -33,6 +33,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
#region 选手骑行数据
|
||||
protected Vector2d nextlatlong; //下一个点的坐标
|
||||
protected Vector2d currentlatlong; //当前坐标
|
||||
//protected bool isStart;//开始或者暂停
|
||||
public bool isQuit;//true 中途退出 或者到达终点
|
||||
protected bool isMajor;//是否是主人公
|
||||
@ -71,7 +72,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public double CurrentSlopeDistance { get => currentSlopeDistance; }
|
||||
public double Elevation { get => elevation; }
|
||||
public double LastEndDistance { get => lastEndDistance; }
|
||||
public Vector2d Nextlatlong { get => nextlatlong; }
|
||||
public Vector2d Currentlatlong { get => currentlatlong; }
|
||||
#endregion
|
||||
|
||||
#region 游戏状态控制
|
||||
@ -116,12 +117,10 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
protected BaseCycling cyclingExcutor;
|
||||
protected virtual void Init()
|
||||
{
|
||||
characterAnimator = GetComponentInChildren<Animator>();
|
||||
//characterAnimator = GetComponentInChildren<Animator>();
|
||||
mainController = transform.parent.GetComponent<CyclingController>();
|
||||
map = transform.parent.Find("Map").GetComponent<AbstractMap>();
|
||||
mapData = mainController.GetMapData();//获取路书信息
|
||||
nextlatlong = new Vector2d(mapData.List[0].Point[0], mapData.List[0].Point[1]);//初始化人物位置 TODO加上之前骑行距离
|
||||
cyclingExcutor = mainController.cyclingController;
|
||||
}
|
||||
|
||||
protected virtual void Excute()
|
||||
@ -163,14 +162,14 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
distance = totalDistance - mapData.TotalDistance;
|
||||
totalDistance = mapData.TotalDistance;
|
||||
//characterAnimator.SetBool("ReachEnd", true);//到达终点
|
||||
Upload();
|
||||
StartCoroutine("LateUpload");
|
||||
isQuit = true;
|
||||
}
|
||||
|
||||
//数据处理
|
||||
nextlatlong = Along(totalDistance);//下一个坐标
|
||||
nextPos = map.GeoToWorldPosition(nextlatlong);//下一个点
|
||||
nextPos.y += 0.5f;//提高y轴让人物站在地图上面
|
||||
currentlatlong = Along(totalDistance);//下一个坐标
|
||||
nextPos = map.GeoToWorldPosition(currentlatlong);//下一个点
|
||||
nextPos.y += 0.6f;//提高y轴让人物站在地图上面
|
||||
prePos = transform.localPosition;//当前点
|
||||
thisRotation = transform.localRotation;
|
||||
//动画控制
|
||||
@ -201,6 +200,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
#region 工具类
|
||||
|
||||
IEnumerator LateUpload()
|
||||
{
|
||||
yield return new WaitForSeconds(1);
|
||||
Upload();
|
||||
StopCoroutine("LateUpload");
|
||||
}
|
||||
|
||||
protected string CaptureCamera(Camera camera, Rect rect)
|
||||
{
|
||||
// 创建一个RenderTexture对象
|
||||
@ -225,8 +231,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
RenderTexture.active = null; // JC: added to avoid errors
|
||||
GameObject.Destroy(rt);
|
||||
// 最后将这些纹理数据,成一个图片文件
|
||||
byte[] bytes = screenShot.EncodeToJPG();
|
||||
string filename = Application.dataPath + "/"+Guid.NewGuid().ToString() +".jpg";
|
||||
byte[] bytes = screenShot.EncodeToPNG();
|
||||
string filename = Application.dataPath + "/"+Guid.NewGuid().ToString() +".png";
|
||||
System.IO.File.WriteAllBytes(filename, bytes);
|
||||
//Debug.Log(string.Format("截屏了一张照片: {0}", filename));
|
||||
return filename;
|
||||
@ -259,6 +265,10 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
nextSlope = pointList[nextIndex].Grade;
|
||||
nextSlopeDistance = sumDistance - totalDistance * 1000;
|
||||
currentSlopeDistance = totalDistance * 1000 - (sumDistance - pointList[index].Distance);
|
||||
////bearing
|
||||
//var nextpoint = Turf.Point(new double[] { pointList[nextIndex].Point[1], pointList[nextIndex].Point[0] });
|
||||
//var point = Turf.Point(new double[] { currentlatlong.y, currentlatlong.x });
|
||||
//bearing = TurfCS.Turf.Bearing(point, nextpoint);
|
||||
}
|
||||
//根据距离计算坐标
|
||||
Vector2d Along(double endDistance)
|
||||
@ -271,7 +281,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var ll = ((GeographicPosition)((GeoJSON.Net.Geometry.Point)pt1.Geometry).Coordinates);
|
||||
return new Vector2d(ll.Latitude, ll.Longitude);
|
||||
}
|
||||
return nextlatlong;
|
||||
return currentlatlong;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -11,10 +11,15 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
public void TrackResistance(double grade)
|
||||
{
|
||||
//if (!ConfigHelper.IsNeedContectedToDevice)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
if (grade > 10)
|
||||
{
|
||||
grade = 10;
|
||||
}
|
||||
if (grade <-10 )
|
||||
{
|
||||
grade = -10;
|
||||
}
|
||||
|
||||
var device = (_device as FitDevice);
|
||||
if (device != null)
|
||||
{
|
||||
|
||||
@ -29,7 +29,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
var mapdata = cyclingCotroller.GetMapData();
|
||||
//初始化map
|
||||
var point = cyclingCotroller.GetCenterCoordinate();
|
||||
//var point = cyclingCotroller.GetCenterCoordinate();
|
||||
if (_map != null && mapdata !=null)
|
||||
{
|
||||
_map.OnInitialized += _map_OnInitialized;
|
||||
@ -46,7 +46,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
if (playerController != null)
|
||||
{
|
||||
_player.transform.localPosition = _map.GeoToWorldPosition(playerController.Nextlatlong);
|
||||
_player.transform.localPosition = _map.GeoToWorldPosition(playerController.Currentlatlong);
|
||||
}
|
||||
}
|
||||
private bool init = false;
|
||||
|
||||
@ -23,7 +23,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
if (_player != null)
|
||||
{
|
||||
transform.localPosition = _map.GeoToWorldPosition(_player.Nextlatlong);
|
||||
transform.localPosition = _map.GeoToWorldPosition(_player.Currentlatlong);
|
||||
}
|
||||
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.Scripts.Apis.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -9,50 +10,43 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
{
|
||||
public class SingleModel : BaseCycling
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <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)
|
||||
|
||||
public SingleModel(Route route,RouteResultParam param)
|
||||
: base(route, CyclingModel.Single)
|
||||
{
|
||||
//recorderData = recorderData1;
|
||||
this.IsRecord = true;
|
||||
recorderData = new RecorderDataModel()
|
||||
{
|
||||
CurrentUser = App.CurrentUser,
|
||||
//BelongUserId = App.CurrentUser.Id,
|
||||
Competitionid = 0,
|
||||
ContinueIndex = 0,
|
||||
ContinueMark = Guid.NewGuid().ToString(),
|
||||
ContinueIndex = 0,
|
||||
ContinueMark = Guid.NewGuid().ToString(),
|
||||
EndDistance = 0,
|
||||
IsCompleted = false,
|
||||
IsNeedRanking = true,
|
||||
CyclingState = CyclingStateEnum.Prepare,
|
||||
//ManufacturerId = manufacturerId, //ManufacturerId,
|
||||
CurrentRoute = route,
|
||||
CurrentRouteStartDistance = 0,
|
||||
//DeviceNumber = deviceNumber,//DeviceNumber
|
||||
//AntModelId = antModelId,
|
||||
StartTime = DateTime.Now
|
||||
};
|
||||
#region TODO 线路上的人
|
||||
//if (param != null)
|
||||
//{
|
||||
// recorderData.EndDistance = param.EndDistance;
|
||||
// recorderData.CurrentRouteStartDistance = param.EndDistance;
|
||||
// if (!string.IsNullOrWhiteSpace(param.ContinueMark))
|
||||
// {
|
||||
// recorderData.ContinueMark = param.ContinueMark;
|
||||
// }
|
||||
// recorderData.ContinueIndex = param.ContinueIndex.GetValueOrDefault(0);
|
||||
//}
|
||||
//recorderData.PreDistance = recorderData.EndDistance;
|
||||
|
||||
if (param != null)
|
||||
{
|
||||
recorderData.EndDistance = param.EndDistance;
|
||||
recorderData.CurrentRouteStartDistance = param.EndDistance;
|
||||
if (!string.IsNullOrWhiteSpace(param.ContinueMark))
|
||||
{
|
||||
recorderData.ContinueMark = param.ContinueMark;
|
||||
}
|
||||
else
|
||||
{
|
||||
param.ContinueMark = recorderData.ContinueMark;
|
||||
}
|
||||
recorderData.ContinueIndex = param.ContinueIndex.GetValueOrDefault(0);
|
||||
}
|
||||
|
||||
recorderData.PreDistance = recorderData.EndDistance;
|
||||
|
||||
//TODO 附件的人列表加上自己
|
||||
riders = new List<BaseRider>();
|
||||
var rider = new OnlineRiderModel()
|
||||
{
|
||||
@ -65,7 +59,7 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
rider.Point = _turfHelper.Along(rider.EndDistance);
|
||||
|
||||
riders.Add(rider);
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public override void Run(TargetData targetData)
|
||||
|
||||
@ -109,7 +109,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
/// </summary>
|
||||
/// <param name="base64Image"></param>
|
||||
/// <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)
|
||||
{
|
||||
@ -124,7 +124,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
double TSS = (RiderDatas.Count * NP * IF) / (FTP * 3600) * 100;
|
||||
var averagePower = Helper.AveragePower(RiderDatas);
|
||||
MapInterruptRecordApi service = new MapInterruptRecordApi();
|
||||
//AntManufacturer manufacturer = service.GetAntManufacturer(ManufacturerId);
|
||||
// AntManufacturer manufacturer = service.GetAntManufacturer(ManufacturerId).data;
|
||||
var recordId = Guid.NewGuid().ToString();
|
||||
var ticks = RiderDatas.Last().Ticks;
|
||||
var interruptRecord = new MapInterruptRecord
|
||||
@ -133,7 +133,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
RouteId = CurrentRoute.RouteInstance.Id,
|
||||
RouteName = CurrentRoute.RouteInstance.Name,
|
||||
TotalDistance = CurrentRoute.RouteInstance.Distance,
|
||||
UserId = 10688,//BelongUserId,
|
||||
UserId = BelongUserId,
|
||||
RecordFileName = newFileName + ".txt",
|
||||
Ftp = FTP,//FTP设置
|
||||
IF = Math.Round(IF, 2),
|
||||
@ -147,13 +147,13 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
AveragePower = averagePower,//平均功率
|
||||
MaxPower = RiderDatas.Max(a => a._Power),//最大功率
|
||||
WeightKg = Math.Round(averagePower / 65, 2),
|
||||
Weight = 65, //App.CurrentUser.Weight,
|
||||
BicycleWeight =7, //App.CurrentUser.BicycleWeight,
|
||||
Weight = App.CurrentUser.Weight,
|
||||
BicycleWeight = App.CurrentUser.BicycleWeight,
|
||||
ContinueMark = ContinueMark,
|
||||
ContinueIndex = ContinueIndex,
|
||||
IsDelete = false,
|
||||
MapCompetitionId = Competitionid,
|
||||
ManufacturerName = "TODO",//manufacturer == null ? "" : manufacturer.Name,
|
||||
ManufacturerName = "",//manufacturer == null ? "" : manufacturer.Name,
|
||||
DeviceNumber = DeviceNumber,
|
||||
IsRanking = IsNeedRanking,
|
||||
CurrentRouteStartDistance = CurrentRouteStartDistance,
|
||||
@ -163,8 +163,8 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
CreateTime = StartTime.AddSeconds(ticks),
|
||||
Ticks = ticks,
|
||||
Mode = cyclingModel.ToString(),
|
||||
//Param = Newtonsoft.Json.JsonConvert.SerializeObject(selectParam),
|
||||
//GlobalCyclingId = selectParam.GlobalCyclingId
|
||||
Param = Newtonsoft.Json.JsonConvert.SerializeObject(selectParam),
|
||||
GlobalCyclingId = 0
|
||||
};
|
||||
//var range = new MapSpeedRange().GetSpeedRange(RiderDatas, CurrentRoute.RouteInstance.Distance);
|
||||
interruptRecord.SpeedRange = null; //JsonConvert.SerializeObject(range);
|
||||
|
||||
@ -41,7 +41,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
while (t < 0)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
@ -70,7 +70,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
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++)
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using Assets.Scenes.Ride.Scripts.Model;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
@ -8,16 +9,20 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public string[] record;
|
||||
public ReviewItemScript _reviewItemScript;
|
||||
public PlayerController _playerController;
|
||||
|
||||
public int tickOffset = 0;
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
_playerController = FindObjectOfType<PlayerController>();
|
||||
tickOffset = mainController.preticks;
|
||||
}
|
||||
|
||||
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;
|
||||
totalDistance = data._Distance;
|
||||
}
|
||||
@ -30,10 +35,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var diff = Math.Round(totalDistance - _playerController.TotalDistance, 3) * 1000;
|
||||
_reviewItemScript.SetDistance(diff);
|
||||
}
|
||||
public void SetController(ReviewItemScript reviewItemScript, PlayerController playerController)
|
||||
public void SetController(ReviewItemScript reviewItemScript)
|
||||
{
|
||||
_reviewItemScript = reviewItemScript;
|
||||
_playerController = playerController;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Assets.Scenes.Ride.Scripts.Model;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
@ -17,6 +18,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
protected override void 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;
|
||||
/// <summary>
|
||||
@ -31,17 +39,17 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
cadance = mainController.UpdateCadence();
|
||||
weight = App.CurrentUser.Weight;
|
||||
bicycleWeight = App.CurrentUser.BicycleWeight;
|
||||
Debug.Log(power);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
power = 2000;//测试功率
|
||||
#endif
|
||||
mainController.TrackResistance(currentSlope);
|
||||
mainController.TrackResistance(currentSlope);//TODO
|
||||
speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight);
|
||||
distance = mainController.UpdateDistance(speed);
|
||||
totalDistance += distance;
|
||||
//记录骑行数据
|
||||
|
||||
var recorderData = cyclingExcutor.recorderData;
|
||||
var recorderData = mainController.cyclingController.recorderData;
|
||||
targetData = new TargetData
|
||||
{
|
||||
Ticks = ticks,
|
||||
@ -50,24 +58,31 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
_Distance = totalDistance > mapData.TotalDistance ? mapData.TotalDistance : totalDistance,
|
||||
_Cadence = cadance,
|
||||
_HeartRate = heartRate,
|
||||
_Lat = nextlatlong.x,
|
||||
_Lon = nextlatlong.y
|
||||
_Lat = currentlatlong.x,
|
||||
_Lon = currentlatlong.y
|
||||
};
|
||||
recorderData.RiderDatas.Add(targetData);
|
||||
|
||||
}
|
||||
protected override void SendTcp()
|
||||
{
|
||||
mainController.cyclingController.Run(null);
|
||||
if (mainController.cyclingController != null)
|
||||
{
|
||||
mainController.cyclingController.Run(null);
|
||||
}
|
||||
}
|
||||
//上传数据
|
||||
public override void Upload()
|
||||
{
|
||||
mainController.isStart = false;
|
||||
string imageFileName = base.CaptureCamera(Camera.main, new Rect(Screen.width * 0f, Screen.height * 0f, Screen.width * 0.5f, Screen.height * 0.5f));
|
||||
cyclingExcutor.recorderData.IsCompleted = totalDistance == mapData.TotalDistance;
|
||||
cyclingExcutor.recorderData.EndDistance = totalDistance;
|
||||
cyclingExcutor.recorderData.SaveData(cyclingExcutor.Mode,null, imageFileName);
|
||||
mainController.cyclingController.recorderData.StartTime = startTime;
|
||||
mainController.cyclingController.recorderData.IsCompleted = totalDistance == mapData.TotalDistance;
|
||||
mainController.cyclingController.recorderData.EndDistance = totalDistance;
|
||||
mainController.cyclingController.recorderData.AntModelId = mainController.AntModelId;
|
||||
mainController.cyclingController.recorderData.ManufacturerId = mainController.ManufacturerId;
|
||||
mainController.cyclingController.recorderData.DeviceNumber = mainController.DeviceNumber;
|
||||
mainController.cyclingController.recorderData.SaveData(mainController.cyclingModel, mainController.selectParamModel, imageFileName);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -49,18 +49,12 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
case Model.CyclingModel.Single:
|
||||
singleArea.SetActive(true);
|
||||
break;
|
||||
case Model.CyclingModel.Online:
|
||||
reviewScrollView.SetActive(false);
|
||||
break;
|
||||
case Model.CyclingModel.Review:
|
||||
singleArea.SetActive(false);
|
||||
InitReview();
|
||||
break;
|
||||
case Model.CyclingModel.Competition:
|
||||
break;
|
||||
case Model.CyclingModel.GlobalCycling:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
float t = 1;
|
||||
@ -100,7 +94,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var otherPlayerController = otherPlayerObj.GetComponent<OtherPlayerController>();
|
||||
otherList.Add(otherPlayerController);
|
||||
otherPlayerController.record = item.record;
|
||||
otherPlayerController.SetController(reviewItemScript, playerController);
|
||||
otherPlayerController.SetController(reviewItemScript);
|
||||
GameObject miniPlayer = (GameObject)Instantiate(miniMapPlayer, transform.parent.parent.parent);
|
||||
var miniController = miniPlayer.GetComponent<MiniMapPlayerController>();
|
||||
miniController.SetController(otherPlayerController);
|
||||
|
||||
@ -27,6 +27,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
GameObject _directionsGO;
|
||||
GameObject _mipMapRoute;
|
||||
GameObject _pathRoute;
|
||||
CyclingController cyclingCotroller;
|
||||
private bool initComplete = false;
|
||||
|
||||
@ -95,6 +96,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
var meshData = new MeshData();
|
||||
var dat = new List<Vector3>();
|
||||
var path = new List<Vector3>();
|
||||
|
||||
var mapData = cyclingCotroller.GetMapData();
|
||||
if (mapData != null)
|
||||
@ -105,21 +107,33 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var point = mapData.List[i].Point;
|
||||
Vector3 item = _map.GeoToWorldPosition(new Vector2d(point[0], point[1]));
|
||||
item.y += 0.3f;
|
||||
if (!posInScreen(item) && i > playerController.CurrentIndex)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (posInScreen(item))
|
||||
//if (!posInScreen(item) && i > playerController.CurrentIndex)
|
||||
//{
|
||||
// break;
|
||||
//}
|
||||
//else if (posInScreen(item))
|
||||
//{
|
||||
// dat.Add(item);
|
||||
//}
|
||||
//前后取50个点
|
||||
decimal diff = i - playerController.CurrentIndex;
|
||||
decimal diffAbs = Math.Abs(diff);
|
||||
if (diffAbs <= 50)
|
||||
{
|
||||
dat.Add(item);
|
||||
}
|
||||
if (diff < 0 && diff > -100)
|
||||
{
|
||||
item.y += 0.30001f;
|
||||
path.Add(item);
|
||||
}
|
||||
}
|
||||
var feat = new VectorFeatureUnity();
|
||||
feat.Points.Add(dat);
|
||||
//处理海拔高度的问题
|
||||
//SnapModifier.Run(feat, meshData, tile);
|
||||
CreatMapRoute(feat);//创建路线
|
||||
//CreateMiniMapRoute(feat);//创建小地图路线
|
||||
CreatPathRoute(path);//创建骑行过的线路
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -129,7 +143,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Vector3 viewPos = Camera.main.WorldToViewportPoint(position);
|
||||
Vector3 dir = (position - camreatra.localPosition).normalized;
|
||||
float dot = Vector3.Dot(camreatra.forward, dir);
|
||||
if (dot > -0.1 && viewPos.x >= -0.1 && viewPos.x <= 1.1 && viewPos.y >= -0.1 && viewPos.y <= 1.1)
|
||||
if (dot > 0 && viewPos.x >= 0 && viewPos.x <= 1.5 && viewPos.y >= 0 && viewPos.y <= 1.5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -176,23 +190,44 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
||||
var dat = feat.Points[0];
|
||||
ColorUtility.TryParseHtmlString("#FF2742", out Color c);
|
||||
lineRender.endColor = c;
|
||||
lineRender.startColor = c;
|
||||
lineRender.endColor = new Color(1,1,1,0.65f);
|
||||
lineRender.startColor = new Color(1, 1, 1, 0.65f);
|
||||
|
||||
//设置宽度
|
||||
lineRender.SetWidth(0.5f, 0.5f);
|
||||
lineRender.SetVertexCount(dat.Count);
|
||||
lineRender.startWidth = 0.6f;
|
||||
lineRender.endWidth = 0.6f;
|
||||
lineRender.positionCount = dat.Count;
|
||||
lineRender.SetPositions(feat.Points[0].ToArray());
|
||||
lineRender.loop = false;
|
||||
lineRender.numCapVertices = 90;
|
||||
float alpha = 1.0f;
|
||||
//Gradient gradient = new Gradient();
|
||||
//gradient.SetKeys(
|
||||
// new GradientColorKey[] { new GradientColorKey(Color.green, 0.0f), new GradientColorKey(Color.red, 1.0f) },
|
||||
// new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) }
|
||||
//);
|
||||
//lineRender.colorGradient = gradient;
|
||||
lineRender.numCornerVertices = 90;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CreatPathRoute(List<Vector3> feat)
|
||||
{
|
||||
if (_pathRoute != null)
|
||||
{
|
||||
_pathRoute.Destroy();
|
||||
}
|
||||
_pathRoute = new GameObject("MapPathRoute");
|
||||
_pathRoute.transform.parent = transform;
|
||||
var lineRender = _pathRoute.AddComponent<LineRenderer>();
|
||||
lineRender.material = new Material(Shader.Find("Sprites/Default"));
|
||||
|
||||
lineRender.endColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 0.65f);
|
||||
lineRender.startColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 0.65f);
|
||||
|
||||
//设置宽度
|
||||
lineRender.startWidth = 0.61f;
|
||||
lineRender.endWidth = 0.61f;
|
||||
lineRender.positionCount = feat.Count;
|
||||
lineRender.SetPositions(feat.ToArray());
|
||||
lineRender.loop = false;
|
||||
lineRender.numCapVertices = 90;
|
||||
lineRender.numCornerVertices = 90;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ using UnityEngine.SceneManagement;
|
||||
using System.Collections.Generic;
|
||||
using Assets.Cyp.Common;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
@ -74,11 +75,14 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
private float timeRemaining = 1f;
|
||||
private int count = 0;
|
||||
|
||||
Image arrow;
|
||||
AbstractMap map;
|
||||
void Awake()
|
||||
{
|
||||
#region 控件获取与事件绑定
|
||||
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;
|
||||
rightPanel = transform.Find("Panel/NearPanel").gameObject;
|
||||
startBtn = transform.Find("Panel/StartButton").GetComponent<Button>();
|
||||
@ -121,18 +125,31 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
target = transform.parent.Find("Target").gameObject;
|
||||
|
||||
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);
|
||||
UIManager.AddEvent(startBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, StartRide);
|
||||
UIManager.AddEvent(simpleBtn.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ClearPanel);
|
||||
UIManager.AddEvent(pauseButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, PauseRide);
|
||||
UIManager.AddEvent(settingButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowSettingPanel);
|
||||
UIManager.AddEvent(deviceButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowDevicePanel);
|
||||
UIManager.AddEvent(exitButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, StopRide);
|
||||
UIManager.AddEvent(singleButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, SingleRide);
|
||||
UIManager.AddEvent(shadowButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShadowRide);
|
||||
UIManager.AddEvent(addButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, ShowSelectPlayer);
|
||||
UIManager.AddEvent(saveButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, SaveRide);
|
||||
UIManager.AddEvent(cancelQuitButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, CancelQuit);
|
||||
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
|
||||
}
|
||||
|
||||
@ -145,6 +162,22 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 2).ToString() + "KM";//总里程
|
||||
RenderChart();
|
||||
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
|
||||
float tt = 1f;
|
||||
@ -153,6 +186,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
tt -= Time.deltaTime;
|
||||
while (tt < 0) {
|
||||
fps.text = (1 / Time.deltaTime).ToString();
|
||||
MoveChartMarkPoint();
|
||||
tt = 1;
|
||||
}
|
||||
//获取当前选中玩家绑定当前UI
|
||||
@ -188,40 +222,45 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
currentSlopeDistanceText.text = Math.Round(playerController.CurrentSlopeDistance, 0).ToString() + "M";
|
||||
totalClimb.text = Math.Round(playerController.TotalClimb, 0).ToString();
|
||||
//移动海拔图头像 TODO:移动所有人的头像
|
||||
UpdateRealTimeChart();
|
||||
|
||||
//MoveChartMarkPoint();
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
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.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);
|
||||
//控制照片移动
|
||||
((RectTransform)arrow.transform).position = Camera.main.WorldToScreenPoint(target.transform.position);
|
||||
}
|
||||
}
|
||||
private void SingleRide()
|
||||
|
||||
private void SingleRide(BaseEventData baseEventData)
|
||||
{
|
||||
selectPanel.SetActive(false);
|
||||
mainController.cyclingModel = CyclingModel.Single;
|
||||
mainController.SetCyclingModel(CyclingModel.Single);
|
||||
//显示单人骑行列表
|
||||
reviewPanel.SetActive(true);
|
||||
}
|
||||
private void ShadowRide()
|
||||
private void ShadowRide(BaseEventData baseEventData)
|
||||
{
|
||||
mainController.cyclingModel = CyclingModel.Review;
|
||||
mainController.SetCyclingModel(CyclingModel.Review);
|
||||
selectPanel.SetActive(false);
|
||||
//显示影子选手骑行列表
|
||||
selectPlayer.SetActive(true);
|
||||
}
|
||||
private void ShowSelectPlayer()
|
||||
private void ShowSelectPlayer(BaseEventData baseEventData)
|
||||
{
|
||||
selectPlayer.SetActive(true);
|
||||
}
|
||||
private void StartRide()
|
||||
private void StartRide(BaseEventData baseEventData)
|
||||
{
|
||||
var antConnected = mainController.CheckAnt();//初始化ant+设备
|
||||
//if (!antConnected)
|
||||
//{
|
||||
// throw new Exception("请先连接设备");
|
||||
//}
|
||||
//加个5秒钟倒计时
|
||||
count = 5;
|
||||
startBtn.gameObject.SetActive(false);
|
||||
@ -229,12 +268,12 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
countDownTxt.text = count.ToString();
|
||||
}
|
||||
//暂停游戏
|
||||
private void PauseRide()
|
||||
private void PauseRide(BaseEventData baseEventData)
|
||||
{
|
||||
playerController.SetPause();
|
||||
startBtn.gameObject.SetActive(true);
|
||||
}
|
||||
private void SaveRide()
|
||||
private void SaveRide(BaseEventData baseEventData)
|
||||
{
|
||||
playerController.SetPause();
|
||||
if (playerController.TotalTicks > 0 && !playerController.isQuit )
|
||||
@ -244,18 +283,18 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
private void CancelQuit()
|
||||
private void CancelQuit(BaseEventData baseEventData)
|
||||
{
|
||||
quitPanel.SetActive(false);
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
|
||||
private void CloseQuit()
|
||||
private void CloseQuit(BaseEventData baseEventData)
|
||||
{
|
||||
quitPanel.SetActive(false);
|
||||
}
|
||||
//结束游戏
|
||||
private void StopRide()
|
||||
private void StopRide(BaseEventData baseEventData)
|
||||
{
|
||||
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>());
|
||||
}
|
||||
//显示设置
|
||||
private void ShowSettingPanel()
|
||||
private void ShowSettingPanel(BaseEventData baseEventData)
|
||||
{
|
||||
}
|
||||
int isSimple = 1;
|
||||
|
||||
private bool clearLock = true;
|
||||
private void ClearPanel()
|
||||
private void ClearPanel(BaseEventData baseEventData)
|
||||
{
|
||||
if (clearLock)
|
||||
{
|
||||
@ -311,7 +350,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
// elevationChart.AddData(0, elevationList[i]);
|
||||
//}
|
||||
//elevationChart.RefreshChart();
|
||||
|
||||
ElevationToScreenPoint();
|
||||
var endIndex = playerController.CurrentIndex;
|
||||
var s = endIndex / maxCacheDataNumber;
|
||||
var v = endIndex % maxCacheDataNumber;
|
||||
@ -324,7 +363,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
if (initCount > maxCacheDataNumber) break;
|
||||
AddOneData(s * maxCacheDataNumber + v + i);
|
||||
}
|
||||
|
||||
|
||||
elevationChart.RefreshChart();
|
||||
if (App.CurrentUser != null)
|
||||
{
|
||||
@ -352,28 +391,59 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
chartAddNum++;
|
||||
}
|
||||
var v = (endIndex - chartAddNum) % maxCacheDataNumber;
|
||||
MoveChartMarkPoint(v);
|
||||
//MoveChartMarkPoint(v);
|
||||
App.CurrentUserHeadTexture = img.texture;
|
||||
}
|
||||
}
|
||||
void AddOneData(int index)
|
||||
{
|
||||
string category = index.ToString();
|
||||
|
||||
elevationChart.AddData(0, elevationList[index]);
|
||||
//elevationChart.AddXAxisData(category);
|
||||
//elevationChart.AddXAxisData(index.ToString(), index);
|
||||
|
||||
}
|
||||
|
||||
void MoveChartMarkPoint(int index)
|
||||
private Dictionary<int, Vector2> pointMap = new Dictionary<int, Vector2>();
|
||||
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];
|
||||
pinLoction.y = img.transform.localPosition.y;
|
||||
img.transform.localPosition = pinLoction;
|
||||
var c = new Vector2(i*xUnit+ xoffset, elevationList[i]*yUnit + yoffset);
|
||||
pointMap.Add(i, c);
|
||||
}
|
||||
}
|
||||
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);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Assets/Scenes/Ride/icons/output27.png
Normal file
BIN
Assets/Scenes/Ride/icons/output27.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
104
Assets/Scenes/Ride/icons/output27.png.meta
Normal file
104
Assets/Scenes/Ride/icons/output27.png.meta
Normal file
@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
17
Assets/Scripts/Apis/Models/AntManufacturer.cs
Normal file
17
Assets/Scripts/Apis/Models/AntManufacturer.cs
Normal file
@ -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; }
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Apis/Models/AntManufacturer.cs.meta
Normal file
11
Assets/Scripts/Apis/Models/AntManufacturer.cs.meta
Normal file
@ -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>
|
||||
public string RankingsId { get; set; }
|
||||
public List<string> RankingsId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string GlobalContinue { get; set; }
|
||||
public bool GlobalContinue { get; set; }
|
||||
}
|
||||
public class RouteResult
|
||||
{
|
||||
|
||||
@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
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";
|
||||
|
||||
@ -25,5 +25,5 @@ public static class App
|
||||
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 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)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code))
|
||||
return countryDefaultValue;
|
||||
var c = countryList.FindIndex(x => x.abbreviation.ToLower() == code.ToLower());
|
||||
if (c == -1) return countryDefaultValue;
|
||||
return c;
|
||||
|
||||
@ -5,10 +5,12 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
{
|
||||
RouteResult routeResult;
|
||||
// Start is called before the first frame update
|
||||
Transform left,row1,row2,right;
|
||||
Transform btnReRide, btnContinue, btnDelete;
|
||||
@ -25,6 +27,7 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
||||
string titleColor = "#5c5c6e";
|
||||
public void Initial(RouteResult result)
|
||||
{
|
||||
routeResult = result;
|
||||
left = transform.Find("Left");
|
||||
row1 = left.Find("Main").Find("Row1");
|
||||
row2 = left.Find("Main").Find("Row2");
|
||||
@ -66,12 +69,20 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
||||
|
||||
private void GoReRide()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
App.RouteIdParam = routeResult.RouteId;
|
||||
App.routeResult = routeResult;
|
||||
App.routeResult.ContinueCyclingParam = null;
|
||||
SceneManager.LoadScene("Ride");
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user