处理合并冲突
This commit is contained in:
1 parent
8638cd97de
commit
b0f6c39118
49 files changed
+119
-5434
No files matched your search
@@ -104,5 +104,11 @@ namespace Assets.Scenes.Ride.Scripts.Model.CyclingModels
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected double SpeedToDistance(double speed)
|
||||
{
|
||||
return Math.Round(speed / 3600, 5, MidpointRounding.AwayFromZero);
|
||||
//return 0.08;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using Assets.Scenes.Ride.Scripts.Model.RiderModels;
|
||||
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 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)
|
||||
{
|
||||
//recorderData = recorderData1;
|
||||
this.IsRecord = true;
|
||||
recorderData = new RecorderDataModel()
|
||||
{
|
||||
CurrentUser = PubCommData.CurrentUser,
|
||||
//BelongUserId = PubCommData.CurrentUser.Id,
|
||||
Competitionid = 0,
|
||||
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
|
||||
};
|
||||
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;
|
||||
//Rhino.PowerFun.Services.MapUDPService.Send(route.RouteInstance.Id, riders.First().UserId, route.Point.First());
|
||||
|
||||
|
||||
riders = new List<BaseRider>();
|
||||
var rider = new OnlineRiderModel()
|
||||
{
|
||||
NickName = PubCommData.CurrentUser.Nickname,
|
||||
UserId = PubCommData.CurrentUser.Id,
|
||||
WxHeadImg = PubCommData.CurrentUser.WxHeadImg + "?t=1",
|
||||
//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);
|
||||
|
||||
riders.Add(rider);
|
||||
}
|
||||
|
||||
protected override void Run(TargetData targetData)
|
||||
{
|
||||
//base.BeforeRun(targetData);
|
||||
var dis1 = SpeedToDistance(targetData._Speed);
|
||||
currentDistance = recorderData.EndDistance + dis1;//实时计算距离
|
||||
if (recorderData.CyclingState == CyclingStateEnum.Prepare || recorderData.CyclingState == CyclingStateEnum.Stop)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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: 1057f786065eded488dd73a935cc1b93
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user