2021-03-30 20:00:11 +08:00
|
|
|
|
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>
|
2021-04-02 19:17:23 +08:00
|
|
|
|
public SingleModel(Route route1) //SelectParamModel param)
|
2021-03-30 20:00:11 +08:00
|
|
|
|
: base(route1, CyclingModel.Single)
|
|
|
|
|
|
{
|
|
|
|
|
|
//recorderData = recorderData1;
|
|
|
|
|
|
this.IsRecord = true;
|
|
|
|
|
|
recorderData = new RecorderDataModel()
|
|
|
|
|
|
{
|
2021-04-02 19:17:23 +08:00
|
|
|
|
CurrentUser = null,//TODO:PubCommData.CurrentUser,
|
2021-03-30 20:00:11 +08:00
|
|
|
|
//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
|
|
|
|
|
|
};
|
2021-04-02 19:17:23 +08:00
|
|
|
|
#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;
|
2021-03-30 20:00:11 +08:00
|
|
|
|
//Rhino.PowerFun.Services.MapUDPService.Send(route.RouteInstance.Id, riders.First().UserId, route.Point.First());
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-02 19:17:23 +08:00
|
|
|
|
//riders = new List<BaseRider>();
|
|
|
|
|
|
//TODO 附件的人列表加上自己
|
|
|
|
|
|
//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);
|
2021-03-30 20:00:11 +08:00
|
|
|
|
|
2021-04-02 19:17:23 +08:00
|
|
|
|
//riders.Add(rider);
|
|
|
|
|
|
#endregion
|
2021-03-30 20:00:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Run(TargetData targetData)
|
|
|
|
|
|
{
|
2021-04-02 19:17:23 +08:00
|
|
|
|
#region TODO 获取在线用户
|
|
|
|
|
|
//riders.RemoveAll(r => r.IsSelf == false);
|
|
|
|
|
|
//var onlineUsers = MapUDPService.GetOnlineUsers(recorderData.CurrentRoute.RouteInstance.Id).Where(d => d.IsSelf == false)
|
|
|
|
|
|
// .ToList();
|
2021-03-30 20:00:11 +08:00
|
|
|
|
|
2021-04-02 19:17:23 +08:00
|
|
|
|
//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,
|
|
|
|
|
|
// });
|
|
|
|
|
|
//}
|
|
|
|
|
|
#endregion
|
2021-03-30 20:00:11 +08:00
|
|
|
|
base.Run(targetData);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|